Search in sources :

Example 41 with XMLElement

use of com.dexels.navajo.document.nanoimpl.XMLElement in project navajo by Dexels.

the class TslMetaDataHandler method createTotalXML.

public XMLElement createTotalXML() {
    XMLElement x = new CaseSensitiveXMLElement();
    x.setName("metadata");
    for (Iterator<String> iter = scriptList.iterator(); iter.hasNext(); ) {
        String element = iter.next();
        addScriptElement(x, element);
    }
    return x;
}
Also used : CaseSensitiveXMLElement(com.dexels.navajo.document.nanoimpl.CaseSensitiveXMLElement) CaseSensitiveXMLElement(com.dexels.navajo.document.nanoimpl.CaseSensitiveXMLElement) XMLElement(com.dexels.navajo.document.nanoimpl.XMLElement)

Example 42 with XMLElement

use of com.dexels.navajo.document.nanoimpl.XMLElement in project navajo by Dexels.

the class TslMetaDataHandler method toXml.

private XMLElement toXml(Map<String, TreeSet<String>> m, String topTagName, String tagname, String elementName, String attribute) {
    XMLElement x = new CaseSensitiveXMLElement();
    x.setName(topTagName);
    Set<Entry<String, TreeSet<String>>> s = m.entrySet();
    for (Iterator<Entry<String, TreeSet<String>>> iter = s.iterator(); iter.hasNext(); ) {
        Entry<String, TreeSet<String>> e = iter.next();
        String element = e.getKey();
        TreeSet<String> value = e.getValue();
        XMLElement xc = new CaseSensitiveXMLElement();
        xc.setName(tagname);
        xc.setAttribute("name", element);
        x.addChild(xc);
        for (Iterator<String> iterator = value.iterator(); iterator.hasNext(); ) {
            String ee = iterator.next();
            XMLElement xce = new CaseSensitiveXMLElement();
            xce.setName(elementName);
            xce.setAttribute(attribute, ee);
            xc.addChild(xce);
        }
    }
    return x;
}
Also used : Entry(java.util.Map.Entry) CaseSensitiveXMLElement(com.dexels.navajo.document.nanoimpl.CaseSensitiveXMLElement) TreeSet(java.util.TreeSet) CaseSensitiveXMLElement(com.dexels.navajo.document.nanoimpl.CaseSensitiveXMLElement) XMLElement(com.dexels.navajo.document.nanoimpl.XMLElement)

Example 43 with XMLElement

use of com.dexels.navajo.document.nanoimpl.XMLElement in project navajo by Dexels.

the class TslMetaDataHandler method parseScriptData.

/**
 * @param element
 */
private void parseScriptData(String scriptName, XMLElement e) {
    Vector<XMLElement> v = e.getChildren();
    for (Iterator<XMLElement> iter = v.iterator(); iter.hasNext(); ) {
        XMLElement element = iter.next();
        if ("adapters".equals(element.getName())) {
            String adapterValue = element.getStringAttribute("name");
            addToMap(usesAdapter, scriptName, adapterValue);
            continue;
        }
        if ("calledby".equals(element.getName())) {
            String adapterValue = element.getStringAttribute("name");
            addToMap(calledByScriptMap, scriptName, adapterValue);
            continue;
        }
        if ("calls".equals(element.getName())) {
            String adapterValue = element.getStringAttribute("name");
            addToMap(callsScriptMap, scriptName, adapterValue);
            continue;
        }
        if ("includes".equals(element.getName())) {
            String adapterValue = element.getStringAttribute("name");
            addToMap(includesScriptMap, scriptName, adapterValue);
            continue;
        }
        if ("includedby".equals(element.getName())) {
            String adapterValue = element.getStringAttribute("name");
            addToMap(includedByScriptMap, scriptName, adapterValue);
            continue;
        }
    }
}
Also used : CaseSensitiveXMLElement(com.dexels.navajo.document.nanoimpl.CaseSensitiveXMLElement) XMLElement(com.dexels.navajo.document.nanoimpl.XMLElement)

Example 44 with XMLElement

use of com.dexels.navajo.document.nanoimpl.XMLElement in project navajo by Dexels.

the class TslMetaDataHandler method loadScriptData.

public void loadScriptData(InputStream in) {
    Reader fr = null;
    try {
        fr = new InputStreamReader(in, "UTF-8");
        XMLElement e = new CaseSensitiveXMLElement();
        e.parseFromReader(fr);
        parseMetaData(e);
    } catch (IOException e) {
        logger.error("Error: ", e);
    } finally {
        if (fr != null) {
            try {
                fr.close();
            } catch (IOException e1) {
                logger.error("Error: ", e1);
            }
        }
    }
}
Also used : CaseSensitiveXMLElement(com.dexels.navajo.document.nanoimpl.CaseSensitiveXMLElement) InputStreamReader(java.io.InputStreamReader) Reader(java.io.Reader) InputStreamReader(java.io.InputStreamReader) FileReader(java.io.FileReader) IOException(java.io.IOException) CaseSensitiveXMLElement(com.dexels.navajo.document.nanoimpl.CaseSensitiveXMLElement) XMLElement(com.dexels.navajo.document.nanoimpl.XMLElement)

Example 45 with XMLElement

use of com.dexels.navajo.document.nanoimpl.XMLElement in project navajo by Dexels.

the class TslMetaDataHandler method addAdapters.

/**
 * @param xn
 * @param element
 */
private void addAdapters(XMLElement xn, String element) {
    Set<String> s = usesAdapter.get(element);
    if (s == null) {
        return;
    }
    for (Iterator<String> iter = s.iterator(); iter.hasNext(); ) {
        String adapter = iter.next();
        XMLElement xnincl = new CaseSensitiveXMLElement();
        xnincl.setName("adapters");
        xnincl.setAttribute("name", adapter);
        xn.addChild(xnincl);
    }
}
Also used : CaseSensitiveXMLElement(com.dexels.navajo.document.nanoimpl.CaseSensitiveXMLElement) CaseSensitiveXMLElement(com.dexels.navajo.document.nanoimpl.CaseSensitiveXMLElement) XMLElement(com.dexels.navajo.document.nanoimpl.XMLElement)

Aggregations

XMLElement (com.dexels.navajo.document.nanoimpl.XMLElement)120 CaseSensitiveXMLElement (com.dexels.navajo.document.nanoimpl.CaseSensitiveXMLElement)109 MapTag (com.dexels.navajo.document.navascript.tags.MapTag)12 IOException (java.io.IOException)12 NS3Compatible (com.dexels.navajo.document.navascript.tags.NS3Compatible)10 ArrayList (java.util.ArrayList)8 ParamTag (com.dexels.navajo.document.navascript.tags.ParamTag)7 InputStreamReader (java.io.InputStreamReader)7 HashMap (java.util.HashMap)7 APIException (com.dexels.navajo.article.APIException)6 ExpressionTag (com.dexels.navajo.document.navascript.tags.ExpressionTag)5 FieldTag (com.dexels.navajo.document.navascript.tags.FieldTag)5 FileInputStream (java.io.FileInputStream)5 FileReader (java.io.FileReader)5 Property (com.dexels.navajo.document.Property)4 IncludeTag (com.dexels.navajo.document.navascript.tags.IncludeTag)4 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)4 File (java.io.File)4 Message (com.dexels.navajo.document.Message)3 BlockTag (com.dexels.navajo.document.navascript.tags.BlockTag)3