com.sun.tools.xjc.api.S2JJAXBModel Java Examples

The following examples show how to use com.sun.tools.xjc.api.S2JJAXBModel. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WSDLImporter.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
/**
 * Import the Types from the WSDL definition using the same strategy that Cxf uses taking advantage of JAXB
 */
protected void importTypes(Types types) {
  SchemaCompiler compiler = XJC.createSchemaCompiler();
  ErrorListener elForRun = new ConsoleErrorReporter();
  compiler.setErrorListener(elForRun);

  Element rootTypes = this.getRootTypes();
  this.createDefaultStructures(rootTypes);

  S2JJAXBModel intermediateModel = this.compileModel(types, compiler, rootTypes);
  Collection<? extends Mapping> mappings = intermediateModel.getMappings();

  for (Mapping mapping : mappings) {
    this.importStructure(mapping);
  }
}
 
Example #2
Source File: WSDLImporter.java    From flowable-engine with Apache License 2.0 6 votes vote down vote up
/**
 * Import the Types from the WSDL definition using the same strategy that Cxf uses taking advantage of JAXB
 */
protected void importTypes(Types types) {
    SchemaCompiler compiler = XJC.createSchemaCompiler();
    ErrorListener elForRun = new ConsoleErrorReporter();
    compiler.setErrorListener(elForRun);

    Element rootTypes = this.getRootTypes();
    this.createDefaultStructures(rootTypes);

    S2JJAXBModel intermediateModel = this.compileModel(types, compiler, rootTypes);
    Collection<? extends Mapping> mappings = intermediateModel.getMappings();

    for (Mapping mapping : mappings) {
        this.importStructure(mapping);
    }
}
 
Example #3
Source File: CxfWSDLImporter.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
protected void importTypes(Types types) {
  SchemaCompiler compiler = XJC.createSchemaCompiler();
  ErrorListener elForRun = new ConsoleErrorReporter();
  compiler.setErrorListener(elForRun);

  SchemaImpl impl = (SchemaImpl) types.getExtensibilityElements().get(0);
  
  S2JJAXBModel intermediateModel = this.compileModel(types, compiler, impl.getElement());
  Collection<? extends Mapping> mappings = intermediateModel.getMappings();

  for (Mapping mapping : mappings){
    this.importStructure(mapping);
  }
}
 
Example #4
Source File: CxfWSDLImporter.java    From flowable-engine with Apache License 2.0 5 votes vote down vote up
protected void importTypes(Types types) {
    SchemaCompiler compiler = XJC.createSchemaCompiler();
    ErrorListener elForRun = new ConsoleErrorReporter();
    compiler.setErrorListener(elForRun);

    SchemaImpl impl = (SchemaImpl) types.getExtensibilityElements().get(0);

    S2JJAXBModel intermediateModel = this.compileModel(types, compiler, impl.getElement());
    Collection<? extends Mapping> mappings = intermediateModel.getMappings();

    for (Mapping mapping : mappings) {
        this.importStructure(mapping);
    }
}
 
Example #5
Source File: CxfWSDLImporter.java    From activiti6-boot2 with Apache License 2.0 4 votes vote down vote up
protected S2JJAXBModel compileModel(Types types, SchemaCompiler compiler, org.w3c.dom.Element rootTypes) {
  Schema schema = (Schema) types.getExtensibilityElements().get(0);
  compiler.parseSchema(schema.getDocumentBaseURI() + "#types1", rootTypes);
  S2JJAXBModel intermediateModel = compiler.bind();
  return intermediateModel;
}
 
Example #6
Source File: WSDLImporter.java    From activiti6-boot2 with Apache License 2.0 4 votes vote down vote up
protected S2JJAXBModel compileModel(Types types, SchemaCompiler compiler, Element rootTypes) {
  Schema schema = (Schema) types.getExtensibilityElements().get(0);
  compiler.parseSchema(schema.getDocumentBaseURI() + "#types1", rootTypes);
  S2JJAXBModel intermediateModel = compiler.bind();
  return intermediateModel;
}
 
Example #7
Source File: CxfWSDLImporter.java    From flowable-engine with Apache License 2.0 4 votes vote down vote up
protected S2JJAXBModel compileModel(Types types, SchemaCompiler compiler, org.w3c.dom.Element rootTypes) {
    Schema schema = (Schema) types.getExtensibilityElements().get(0);
    compiler.parseSchema(schema.getDocumentBaseURI() + "#types1", rootTypes);
    S2JJAXBModel intermediateModel = compiler.bind();
    return intermediateModel;
}
 
Example #8
Source File: WSDLImporter.java    From flowable-engine with Apache License 2.0 4 votes vote down vote up
protected S2JJAXBModel compileModel(Types types, SchemaCompiler compiler, Element rootTypes) {
    Schema schema = (Schema) types.getExtensibilityElements().get(0);
    compiler.parseSchema(schema.getDocumentBaseURI() + "#types1", rootTypes);
    S2JJAXBModel intermediateModel = compiler.bind();
    return intermediateModel;
}
 
Example #9
Source File: JAXBDataBinding.java    From cxf with Apache License 2.0 4 votes vote down vote up
public void generate(ToolContext c) throws ToolException {
    if (!initialized) {
        initialize(c);
    }
    if (rawJaxbModelGenCode == null) {
        return;
    }
    if (c.getErrorListener().getErrorCount() > 0) {
        return;
    }


    try {
        String dir = (String)context.get(ToolConstants.CFG_OUTPUTDIR);

        TypesCodeWriter fileCodeWriter = new TypesCodeWriter(new File(dir),
                                                             context.getExcludePkgList(),
                                                             (String)context.get(ToolConstants.CFG_ENCODING),
                                                             context.get(OutputStreamCreator.class));

        S2JJAXBModel schem2JavaJaxbModel = rawJaxbModelGenCode;

        ClassCollector classCollector = context.get(ClassCollector.class);
        for (JClass cls : schem2JavaJaxbModel.getAllObjectFactories()) {
            classCollector.getTypesPackages().add(cls._package().name());
        }

        JCodeModel jcodeModel = schem2JavaJaxbModel.generateCode(null, null);

        if (!isSuppressCodeGen()) {
            jcodeModel.build(fileCodeWriter);
        }

        context.put(JCodeModel.class, jcodeModel);

        for (String str : fileCodeWriter.getExcludeFileList()) {
            context.getExcludeFileList().add(str);
        }

        return;
    } catch (IOException e) {
        Message msg = new Message("FAIL_TO_GENERATE_TYPES", LOG);
        throw new ToolException(msg, e);
    }
}