Search in sources :

Example 1 with ServiceSchemaInfo

use of org.apache.cxf.service.model.ServiceSchemaInfo in project cxf by apache.

the class WSDLServiceBuilder method getSchemas.

private void getSchemas(Definition def, ServiceInfo serviceInfo) {
    ServiceSchemaInfo serviceSchemaInfo = null;
    WSDLManager wsdlManager = bus.getExtension(WSDLManager.class);
    if (wsdlManager != null) {
        serviceSchemaInfo = wsdlManager.getSchemasForDefinition(def);
    }
    if (serviceSchemaInfo == null) {
        SchemaUtil schemaUtil = new SchemaUtil(bus, this.schemaList);
        schemaUtil.getSchemas(def, serviceInfo);
        serviceSchemaInfo = new ServiceSchemaInfo();
        serviceSchemaInfo.setSchemaElementList(this.schemaList);
        serviceSchemaInfo.setSchemaCollection(serviceInfo.getXmlSchemaCollection());
        serviceSchemaInfo.setSchemaInfoList(serviceInfo.getSchemas());
        if (wsdlManager != null) {
            wsdlManager.putSchemasForDefinition(def, serviceSchemaInfo);
        }
    } else {
        serviceInfo.setServiceSchemaInfo(serviceSchemaInfo);
        schemaList.putAll(serviceSchemaInfo.getSchemaElementList());
    }
}
Also used : WSDLManager(org.apache.cxf.wsdl.WSDLManager) ServiceSchemaInfo(org.apache.cxf.service.model.ServiceSchemaInfo)

Example 2 with ServiceSchemaInfo

use of org.apache.cxf.service.model.ServiceSchemaInfo in project cxf by apache.

the class WSDLRefValidator method processSchemas.

private void processSchemas(Bus bus) {
    try {
        ServiceSchemaInfo info = bus.getExtension(WSDLManager.class).getSchemasForDefinition(definition);
        if (info == null) {
            getSchemas(bus);
        } else {
            schemaCollection = info.getSchemaCollection();
        }
        checkTargetNamespace(this.definition.getTargetNamespace());
    } catch (Exception ex) {
        throw new ToolException(ex);
    }
}
Also used : WSDLManager(org.apache.cxf.wsdl.WSDLManager) ToolException(org.apache.cxf.tools.common.ToolException) URISyntaxException(java.net.URISyntaxException) ToolException(org.apache.cxf.tools.common.ToolException) ServiceSchemaInfo(org.apache.cxf.service.model.ServiceSchemaInfo)

Example 3 with ServiceSchemaInfo

use of org.apache.cxf.service.model.ServiceSchemaInfo in project cxf by apache.

the class WSDLRefValidator method getSchemas.

private void getSchemas(Bus bus) {
    Map<String, Element> schemaList = new HashMap<>();
    SchemaUtil schemaUtil = new SchemaUtil(bus, schemaList);
    List<SchemaInfo> si = new ArrayList<>();
    schemaUtil.getSchemas(definition, schemaCollection, si);
    ServiceSchemaInfo ssi = new ServiceSchemaInfo();
    ssi.setSchemaCollection(schemaCollection);
    ssi.setSchemaInfoList(si);
    ssi.setSchemaElementList(schemaList);
    bus.getExtension(WSDLManager.class).putSchemasForDefinition(definition, ssi);
}
Also used : HashMap(java.util.HashMap) SchemaUtil(org.apache.cxf.wsdl11.SchemaUtil) XmlSchemaElement(org.apache.ws.commons.schema.XmlSchemaElement) Element(org.w3c.dom.Element) ArrayList(java.util.ArrayList) WSDLManager(org.apache.cxf.wsdl.WSDLManager) ServiceSchemaInfo(org.apache.cxf.service.model.ServiceSchemaInfo) SchemaInfo(org.apache.cxf.service.model.SchemaInfo) ServiceSchemaInfo(org.apache.cxf.service.model.ServiceSchemaInfo)

Aggregations

ServiceSchemaInfo (org.apache.cxf.service.model.ServiceSchemaInfo)3 WSDLManager (org.apache.cxf.wsdl.WSDLManager)3 URISyntaxException (java.net.URISyntaxException)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 SchemaInfo (org.apache.cxf.service.model.SchemaInfo)1 ToolException (org.apache.cxf.tools.common.ToolException)1 SchemaUtil (org.apache.cxf.wsdl11.SchemaUtil)1 XmlSchemaElement (org.apache.ws.commons.schema.XmlSchemaElement)1 Element (org.w3c.dom.Element)1