Search in sources :

Example 6 with NavascriptTag

use of com.dexels.navajo.document.navascript.tags.NavascriptTag in project navajo by Dexels.

the class NS3ToNSXML method initialize.

public void initialize() throws UnsupportedEncodingException {
    myNavascript = new NavascriptTag();
    out = new OutputStreamWriter(System.out, "UTF-8");
}
Also used : OutputStreamWriter(java.io.OutputStreamWriter) NavascriptTag(com.dexels.navajo.document.navascript.tags.NavascriptTag)

Example 7 with NavascriptTag

use of com.dexels.navajo.document.navascript.tags.NavascriptTag in project navajo by Dexels.

the class NSXMLToNS3 method main.

public static void main(String[] args) throws Exception {
    MapDefinitionInterrogatorImpl mdii = new MapDefinitionInterrogatorImpl();
    mdii.addExtentionDefinition("com.dexels.navajo.adapter.StandardAdapterLibrary");
    mdii.addExtentionDefinition("com.dexels.navajo.adapter.core.NavajoEnterpriseCoreAdapterLibrary");
    mdii.addExtentionDefinition("com.dexels.navajo.mongo.adapter.MongoAdapterLibrary");
    mdii.addExtentionDefinition("com.dexels.sportlink.adapters.SportlinkAdapterDefinitions");
    mdii.addExtentionDefinition("com.dexels.navajo.resource.http.bundle.ResourceAdapterLibrary");
    String argstate = "";
    String inputFile = null;
    String outputFile = null;
    if (args.length == 0) {
        System.out.println("Usage: java xmltons [-d] -i input [-o output] [-c config]");
        System.out.println();
        System.out.println();
        System.out.println("  input : a navascript or tsl script file");
        System.out.println("  output: a navascript 3 file");
        System.out.println("  Option:");
        System.out.println("    -d     debug");
    }
    for (String arg : args) {
        if (arg.equals("-i")) {
            argstate = "readinput";
        } else if (arg.equals("-o")) {
            argstate = "writeoutput";
        } else if (argstate.equals("readinput")) {
            inputFile = arg;
        } else if (argstate.equals("writeoutput")) {
            outputFile = arg;
        }
    }
    if (inputFile == null) {
        System.out.println("No filename supplied");
        return;
    }
    try {
        FileInputStream fis = new FileInputStream(inputFile);
        NavascriptTag navascript = (NavascriptTag) NavajoFactory.getInstance().createNavaScript(fis, mdii);
        OutputStream os = System.out;
        if (outputFile != null) {
            os = new FileOutputStream(outputFile);
        }
        navascript.formatNS3(0, os);
        os.close();
    } catch (Exception e) {
        System.err.println("Error transpiling " + inputFile + ": " + e.getMessage());
        System.exit(-1);
    }
}
Also used : MapDefinitionInterrogatorImpl(com.dexels.navajo.mapping.compiler.meta.MapDefinitionInterrogatorImpl) OutputStream(java.io.OutputStream) FileOutputStream(java.io.FileOutputStream) FileOutputStream(java.io.FileOutputStream) FileInputStream(java.io.FileInputStream) NavascriptTag(com.dexels.navajo.document.navascript.tags.NavascriptTag)

Aggregations

NavascriptTag (com.dexels.navajo.document.navascript.tags.NavascriptTag)7 FileInputStream (java.io.FileInputStream)3 MapTag (com.dexels.navajo.document.navascript.tags.MapTag)2 MapDefinitionInterrogatorImpl (com.dexels.navajo.mapping.compiler.meta.MapDefinitionInterrogatorImpl)2 OutputStream (java.io.OutputStream)2 NavajoException (com.dexels.navajo.document.NavajoException)1 BaseNode (com.dexels.navajo.document.base.BaseNode)1 BlockTag (com.dexels.navajo.document.navascript.tags.BlockTag)1 BreakTag (com.dexels.navajo.document.navascript.tags.BreakTag)1 CheckTag (com.dexels.navajo.document.navascript.tags.CheckTag)1 DebugTag (com.dexels.navajo.document.navascript.tags.DebugTag)1 DefineTag (com.dexels.navajo.document.navascript.tags.DefineTag)1 DefinesTag (com.dexels.navajo.document.navascript.tags.DefinesTag)1 ExpressionTag (com.dexels.navajo.document.navascript.tags.ExpressionTag)1 FieldTag (com.dexels.navajo.document.navascript.tags.FieldTag)1 FinallyTag (com.dexels.navajo.document.navascript.tags.FinallyTag)1 IncludeTag (com.dexels.navajo.document.navascript.tags.IncludeTag)1 LogTag (com.dexels.navajo.document.navascript.tags.LogTag)1 MessageTag (com.dexels.navajo.document.navascript.tags.MessageTag)1 MethodTag (com.dexels.navajo.document.navascript.tags.MethodTag)1