Search in sources :

Example 1 with GeneratorBase

use of com.sun.tools.ws.processor.generator.GeneratorBase 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

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