Search in sources :

Example 1 with TJavaGeneratorExtension

use of com.sun.tools.ws.api.TJavaGeneratorExtension in project metro-jax-ws by eclipse-ee4j.

the class SeiGenerator method init.

public void init(Model model, WsimportOptions options, ErrorReceiver receiver, TJavaGeneratorExtension... extensions) {
    init(model, options, receiver);
    extensionHandlers = new ArrayList<>();
    // 2.2 Spec requires generation of @Action when wsam:Action is explicitly stated in wsdl
    if (options.target.isLaterThan(Options.Target.V2_2)) {
        register(new W3CAddressingJavaGeneratorExtension());
    }
    for (TJavaGeneratorExtension j : extensions) {
        register(j);
    }
    this.extension = new JavaGeneratorExtensionFacade(extensionHandlers.toArray(new TJavaGeneratorExtension[0]));
}
Also used : TJavaGeneratorExtension(com.sun.tools.ws.api.TJavaGeneratorExtension)

Example 2 with TJavaGeneratorExtension

use of com.sun.tools.ws.api.TJavaGeneratorExtension in project metro-jax-ws by eclipse-ee4j.

the class WsimportTool method generateCode.

protected boolean generateCode(Listener listener, Receiver receiver, Model wsdlModel, boolean generateService) throws IOException {
    // generated code
    if (!options.quiet)
        listener.message(WscompileMessages.WSIMPORT_GENERATING_CODE());
    TJavaGeneratorExtension[] genExtn = ServiceFinder.find(TJavaGeneratorExtension.class, ServiceLoader.load(TJavaGeneratorExtension.class)).toArray();
    CustomExceptionGenerator.generate(wsdlModel, options, receiver);
    SeiGenerator.generate(wsdlModel, options, receiver, genExtn);
    if (receiver.hadError()) {
        throw new AbortException();
    }
    if (generateService) {
        ServiceGenerator.generate(wsdlModel, options, receiver);
    }
    for (GeneratorBase g : ServiceFinder.find(GeneratorBase.class, ServiceLoader.load(GeneratorBase.class))) {
        g.init(wsdlModel, options, receiver);
        g.doGeneration();
    }
    List<String> implFiles = null;
    if (options.isGenerateJWS) {
        implFiles = JwsImplGenerator.generate(wsdlModel, options, receiver);
    }
    for (Plugin plugin : options.activePlugins) {
        try {
            plugin.run(wsdlModel, options, receiver);
        } catch (SAXException sex) {
            // fatal error. error should have been reported
            return false;
        }
    }
    if (options.getModuleName() != null) {
        options.getCodeModel()._prepareModuleInfo(options.getModuleName(), JAXWS_MODULE);
    }
    CodeWriter cw;
    if (options.filer != null) {
        cw = new FilerCodeWriter(options);
    } else {
        cw = new WSCodeWriter(options.sourceDir, options);
    }
    if (options.verbose)
        cw = new ProgressCodeWriter(cw, out);
    options.getCodeModel().build(cw);
    if (options.isGenerateJWS) {
        // move Impl files to implDestDir
        return JwsImplGenerator.moveToImplDestDir(implFiles, options, receiver);
    }
    return true;
}
Also used : ProgressCodeWriter(com.sun.codemodel.writer.ProgressCodeWriter) TJavaGeneratorExtension(com.sun.tools.ws.api.TJavaGeneratorExtension) GeneratorBase(com.sun.tools.ws.processor.generator.GeneratorBase) CodeWriter(com.sun.codemodel.CodeWriter) ProgressCodeWriter(com.sun.codemodel.writer.ProgressCodeWriter) SAXException(org.xml.sax.SAXException)

Aggregations

TJavaGeneratorExtension (com.sun.tools.ws.api.TJavaGeneratorExtension)2 CodeWriter (com.sun.codemodel.CodeWriter)1 ProgressCodeWriter (com.sun.codemodel.writer.ProgressCodeWriter)1 GeneratorBase (com.sun.tools.ws.processor.generator.GeneratorBase)1 SAXException (org.xml.sax.SAXException)1