public static EDLController createEDLController(
     EDocLiteAssociation edlAssociation,
     EDLGlobalConfig edlGlobalConfig,
     DocumentRouteHeaderValue document) {
   EDLController edlController = createEDLController(edlAssociation, edlGlobalConfig);
   try {
     Document defaultDom = edlController.getDefaultDOM();
     Document documentDom = XmlHelper.readXml(document.getDocContent());
     // get the data node and import it into our default DOM
     Element documentData = (Element) documentDom.getElementsByTagName(EDLXmlUtils.DATA_E).item(0);
     if (documentData != null) {
       Element defaultDomEDL = EDLXmlUtils.getEDLContent(defaultDom, false);
       Element defaultDomData =
           (Element) defaultDomEDL.getElementsByTagName(EDLXmlUtils.DATA_E).item(0);
       defaultDomEDL.replaceChild(defaultDom.importNode(documentData, true), defaultDomData);
     }
     if (LOG.isDebugEnabled()) {
       LOG.debug(
           "Created default Node from document id "
               + document.getDocumentId()
               + " content "
               + XmlJotter.jotNode(defaultDom));
     }
   } catch (Exception e) {
     throw new WorkflowRuntimeException(
         "Problems creating controller for EDL "
             + edlAssociation.getEdlName()
             + " document "
             + document.getDocumentId(),
         e);
   }
   return edlController;
 }
  private void parse(String fileLoc, Map<String, Object> fileProperties, boolean baseFile)
      throws IOException {
    InputStream configStream = getConfigAsStream(fileLoc);
    if (configStream == null) {
      LOG.warn("###############################");
      LOG.warn("#");
      LOG.warn("# Configuration file " + fileLoc + " not found!");
      LOG.warn("#");
      LOG.warn("###############################");
      return;
    }

    LOG.info("Parsing config: " + fileLoc);

    if (!baseFile) {
      fileProperties.put(fileLoc, new Properties());
    }
    Properties props = (Properties) fileProperties.get(fileLoc);
    Document doc;
    try {
      doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(configStream);
      if (LOG.isDebugEnabled()) {
        LOG.debug("Contents of config " + fileLoc + ": \n" + XmlJotter.jotNode(doc, true));
      }
    } catch (SAXException se) {
      IOException ioe = new IOException("Error parsing config resource: " + fileLoc);
      ioe.initCause(se);
      throw ioe;
    } catch (ParserConfigurationException pce) {
      IOException ioe = new IOException("Unable to obtain document builder");
      ioe.initCause(pce);
      throw ioe;
    } finally {
      configStream.close();
    }

    Element root = doc.getDocumentElement();
    // ignore the actual type of the document element for now
    // so that plugin descriptors can be parsed
    NodeList list = root.getChildNodes();
    StringBuffer content = new StringBuffer();
    for (int i = 0; i < list.getLength(); i++) {
      Node node = list.item(i);
      if (node.getNodeType() != Node.ELEMENT_NODE) continue;
      if (!"param".equals(node.getNodeName())) {
        LOG.warn("Encountered non-param config node: " + node.getNodeName());
        continue;
      }
      Element param = (Element) node;
      String name = param.getAttribute("name");
      Boolean override = Boolean.TRUE;
      if (param.getAttribute("override") != null
          && param.getAttribute("override").trim().length() > 0) {
        override = new Boolean(param.getAttribute("override"));
      }
      if (name == null) {
        LOG.error(
            "Unnamed parameter in config resource '" + fileLoc + "': " + XmlJotter.jotNode(param));
        continue;
      }
      NodeList contents = param.getChildNodes();
      // accumulate all content (preserving any XML content)
      try {
        content.setLength(0);
        for (int j = 0; j < contents.getLength(); j++) {
          content.append(XmlJotter.jotNode(contents.item(j), true));
        }
        String contentValue;
        try {
          contentValue = resolvePropertyTokens(content.toString(), fileProperties);
        } catch (Exception e) {
          LOG.error("Exception caught parsing " + content, e);
          throw new RuntimeException(e);
        }
        if (name.equals("config.location")) {
          if (!contentValue.contains(ALTERNATE_BUILD_LOCATION_KEY)) {
            parse(contentValue, fileProperties, false);
          }
        } else {
          if (props == null) {
            updateProperties(fileProperties, override, name, contentValue, fileProperties);
          } else {
            updateProperties(props, override, name, contentValue, fileProperties);
          }
        }
      } catch (XmlException te) {
        IOException ioe =
            new IOException(
                "Error obtaining parameter '" + name + "' from config resource: " + fileLoc);
        ioe.initCause(te);
        throw ioe;
      }
    }
    LOG.info("Parsed config: " + fileLoc);
  }