use of com.sun.tools.xjc.api.S2JJAXBModel in project Activiti by Activiti.
the class CxfWSDLImporter method importTypes.
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);
}
}
use of com.sun.tools.xjc.api.S2JJAXBModel in project Activiti by Activiti.
the class WSDLImporter method compileModel.
private 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;
}
use of com.sun.tools.xjc.api.S2JJAXBModel in project Activiti by Activiti.
the class WSDLImporter method importTypes.
/**
* Import the Types from the WSDL definition using the same strategy that
* Cxf uses taking advantage of JAXB
*/
private 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);
}
}
use of com.sun.tools.xjc.api.S2JJAXBModel in project Activiti by Activiti.
the class CxfWSDLImporter method compileModel.
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;
}
use of com.sun.tools.xjc.api.S2JJAXBModel in project cxf by apache.
the class JAXBDataBinding method generate.
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);
}
}
Aggregations