Search in sources :

Example 1 with JavaToJSProcessor

use of org.apache.cxf.tools.java2js.processor.JavaToJSProcessor in project cxf by apache.

the class JavaToJS method execute.

public void execute(boolean exitOnFinish) {
    Processor processor = new JavaToJSProcessor();
    try {
        super.execute(exitOnFinish);
        if (!hasInfoOption()) {
            ToolContext env = new ToolContext();
            env.setParameters(getParametersMap(new HashSet<>()));
            if (env.get(ToolConstants.CFG_OUTPUTDIR) == null) {
                env.put(ToolConstants.CFG_OUTPUTDIR, ".");
            }
            if (isVerboseOn()) {
                env.put(ToolConstants.CFG_VERBOSE, Boolean.TRUE);
            }
            env.put(ToolConstants.CFG_CMD_ARG, getArgument());
            validate(env);
            processor.setEnvironment(env);
            processor.process();
        }
    } catch (ToolException ex) {
        if (ex.getCause() instanceof BadUsageException) {
            printUsageException(TOOL_NAME, (BadUsageException) ex.getCause());
        }
        err.println();
        err.println("JavaToJS Error : " + ex.getMessage());
        if (isVerboseOn()) {
            ex.printStackTrace(err);
        }
    } catch (Exception ex) {
        err.println();
        err.println("JavaToJS Error : " + ex.getMessage());
        if (isVerboseOn()) {
            ex.printStackTrace(err);
        }
    } finally {
        tearDown();
    }
}
Also used : JavaToJSProcessor(org.apache.cxf.tools.java2js.processor.JavaToJSProcessor) JavaToJSProcessor(org.apache.cxf.tools.java2js.processor.JavaToJSProcessor) Processor(org.apache.cxf.tools.common.Processor) BadUsageException(org.apache.cxf.tools.common.toolspec.parser.BadUsageException) ToolContext(org.apache.cxf.tools.common.ToolContext) ToolException(org.apache.cxf.tools.common.ToolException) ToolException(org.apache.cxf.tools.common.ToolException) BadUsageException(org.apache.cxf.tools.common.toolspec.parser.BadUsageException) HashSet(java.util.HashSet)

Aggregations

HashSet (java.util.HashSet)1 Processor (org.apache.cxf.tools.common.Processor)1 ToolContext (org.apache.cxf.tools.common.ToolContext)1 ToolException (org.apache.cxf.tools.common.ToolException)1 BadUsageException (org.apache.cxf.tools.common.toolspec.parser.BadUsageException)1 JavaToJSProcessor (org.apache.cxf.tools.java2js.processor.JavaToJSProcessor)1