use of com.webcohesion.enunciate.util.StaticInterfaceDescriptionFile in project enunciate by stoicflame.
the class IDLModule method call.
@Override
public void call(EnunciateContext context) {
Map<String, SchemaInfo> ns2schema = Collections.emptyMap();
Map<String, String> ns2prefix = Collections.emptyMap();
if (this.jaxbModule != null) {
ns2schema = this.jaxbModule.getJaxbContext().getSchemas();
ns2prefix = this.jaxbModule.getJaxbContext().getNamespacePrefixes();
}
Map<String, WsdlInfo> ns2wsdl = Collections.emptyMap();
if (this.jaxwsModule != null) {
ns2wsdl = this.jaxwsModule.getJaxwsContext().getWsdls();
}
Set<String> facetIncludes = new TreeSet<String>(this.enunciate.getConfiguration().getFacetIncludes());
facetIncludes.addAll(getFacetIncludes());
Set<String> facetExcludes = new TreeSet<String>(this.enunciate.getConfiguration().getFacetExcludes());
facetExcludes.addAll(getFacetExcludes());
FacetFilter facetFilter = new FacetFilter(facetIncludes, facetExcludes);
Map<String, SchemaConfig> schemaConfigs = getSchemaConfigs();
for (SchemaInfo schemaInfo : ns2schema.values()) {
String defaultFilename = ns2prefix.get(schemaInfo.getNamespace()) + ".xsd";
SchemaConfig explicitConfig = schemaConfigs.get(schemaInfo.getNamespace());
if (explicitConfig != null && explicitConfig.getUseFile() != null) {
schemaInfo.setFilename(explicitConfig.getUseFile().getName());
schemaInfo.setSchemaFile(new StaticInterfaceDescriptionFile(explicitConfig.getUseFile(), this.enunciate));
} else if (explicitConfig != null) {
schemaInfo.setAppinfo(explicitConfig.getAppinfo());
schemaInfo.setFilename(explicitConfig.getFilename() != null ? explicitConfig.getFilename() : defaultFilename);
schemaInfo.setExplicitLocation(explicitConfig.getLocation());
schemaInfo.setJaxbBindingVersion(explicitConfig.getJaxbBindingVersion());
schemaInfo.setSchemaFile(new JaxbSchemaFile(this.enunciate, defaultFilename, this.jaxbModule.getJaxbContext(), schemaInfo, facetFilter, ns2prefix));
} else {
schemaInfo.setFilename(defaultFilename);
schemaInfo.setSchemaFile(new JaxbSchemaFile(this.enunciate, defaultFilename, this.jaxbModule.getJaxbContext(), schemaInfo, facetFilter, ns2prefix));
}
}
String baseUri = this.enunciate.getConfiguration().getApplicationRoot();
Map<String, WsdlConfig> wsdlConfigs = getWsdlConfigs();
for (WsdlInfo wsdlInfo : ns2wsdl.values()) {
String defaultFilename = ns2prefix.get(wsdlInfo.getTargetNamespace()) + ".wsdl";
WsdlConfig explicitConfig = wsdlConfigs.get(wsdlInfo.getTargetNamespace());
if (explicitConfig != null && explicitConfig.getUseFile() != null) {
wsdlInfo.setFilename(explicitConfig.getUseFile().getName());
wsdlInfo.setWsdlFile(new StaticInterfaceDescriptionFile(explicitConfig.getUseFile(), this.enunciate));
} else if (explicitConfig != null) {
wsdlInfo.setFilename(explicitConfig.getFilename() != null ? explicitConfig.getFilename() : defaultFilename);
wsdlInfo.setInlineSchema(explicitConfig.isInlineSchema());
wsdlInfo.setWsdlFile(new JaxwsWsdlFile(this.enunciate, defaultFilename, wsdlInfo, this.jaxbModule.getJaxbContext(), baseUri, ns2prefix, facetFilter));
} else {
wsdlInfo.setFilename(defaultFilename);
wsdlInfo.setWsdlFile(new JaxwsWsdlFile(this.enunciate, defaultFilename, wsdlInfo, this.jaxbModule.getJaxbContext(), baseUri, ns2prefix, facetFilter));
}
}
if (this.jaxrsModule != null && this.jaxbModule != null && !isDisableWadl()) {
this.jaxrsModule.getJaxrsContext().setWadlFile(new JaxrsWadlFile(this.enunciate, "application.wadl", this.jaxrsModule.getJaxrsContext(), this.jaxbModule.getJaxbContext(), new ArrayList<SchemaInfo>(ns2schema.values()), getWadlStylesheetUri(), baseUri, ns2prefix, facetFilter, isLinkJsonToXml()));
}
}
Aggregations