Search in sources :

Example 6 with XmlSchemaType

use of org.apache.ws.commons.schema.XmlSchemaType in project ddf by codice.

the class FeatureMetacardType method processXmlSchemaParticle.

private void processXmlSchemaParticle(XmlSchemaParticle particle) {
    XmlSchemaSequence schemaSequence;
    if (particle instanceof XmlSchemaSequence) {
        schemaSequence = (XmlSchemaSequence) particle;
        List<XmlSchemaSequenceMember> schemaObjectCollection = schemaSequence.getItems();
        Iterator<XmlSchemaSequenceMember> iterator = schemaObjectCollection.iterator();
        while (iterator.hasNext()) {
            Object element = iterator.next();
            if (element instanceof XmlSchemaElement) {
                XmlSchemaElement innerElement = ((XmlSchemaElement) element);
                XmlSchemaType innerEleType = innerElement.getSchemaType();
                if (innerEleType instanceof XmlSchemaComplexType) {
                    processComplexType(innerElement);
                } else if (innerEleType instanceof XmlSchemaSimpleType) {
                    processSimpleType(innerElement);
                } else if (innerEleType == null) {
                    // Check if this is the GML location Property
                    processGmlType(innerElement);
                }
            }
        }
    }
}
Also used : XmlSchemaSequence(org.apache.ws.commons.schema.XmlSchemaSequence) XmlSchemaElement(org.apache.ws.commons.schema.XmlSchemaElement) XmlSchemaSimpleType(org.apache.ws.commons.schema.XmlSchemaSimpleType) XmlSchemaSequenceMember(org.apache.ws.commons.schema.XmlSchemaSequenceMember) XmlSchemaComplexType(org.apache.ws.commons.schema.XmlSchemaComplexType) XmlSchemaType(org.apache.ws.commons.schema.XmlSchemaType)

Example 7 with XmlSchemaType

use of org.apache.ws.commons.schema.XmlSchemaType in project tdi-studio-se by Talend.

the class AllTypeDialog method initComplexType.

private void initComplexType() {
    for (XmlSchemaType xmlSchemaType : allXmlSchemaType) {
        if (xmlSchemaType instanceof XmlSchemaComplexType) {
            XmlSchemaComplexType complexType = (XmlSchemaComplexType) xmlSchemaType;
            String label = COMPLEXTYPE + complexType.getName();
            labelAndNameSpaceMap.put(label, complexType.getQName().toString());
        }
    }
}
Also used : XmlSchemaComplexType(org.apache.ws.commons.schema.XmlSchemaComplexType) XmlSchemaType(org.apache.ws.commons.schema.XmlSchemaType)

Example 8 with XmlSchemaType

use of org.apache.ws.commons.schema.XmlSchemaType in project tdi-studio-se by Talend.

the class AllTypeDialog method initSimpleType.

private void initSimpleType() throws WSDLException, URISyntaxException {
    String url = URLValue;
    XmlSchemaCollection schemaCollection = new XmlSchemaCollection();
    WSDLFactory wsdlFactory = WSDLFactory.newInstance();
    WSDLReader newWSDLReader = wsdlFactory.newWSDLReader();
    newWSDLReader.setFeature(com.ibm.wsdl.Constants.FEATURE_VERBOSE, false);
    URI wsdlURI = new URI(url);
    Definition definition = newWSDLReader.readWSDL(url);
    java.util.List<ExtensibilityElement> extensibilityElements = definition.getTypes().getExtensibilityElements();
    String tmpTNName = "";
    int tmpCount = 0;
    for (ExtensibilityElement el : extensibilityElements) {
        if (el instanceof Schema) {
            Schema schema = (Schema) el;
            // for bug 8674
            // set base uri for relative path in schemaLocation.
            schemaCollection.setBaseUri(schema.getDocumentBaseURI());
            if (schema.getElement().getAttributeNode("targetNamespace") == null) {
                tmpTNName = schema.getDocumentBaseURI() + "#type" + tmpCount;
                schemaCollection.read(schema.getElement(), tmpTNName);
                tmpCount++;
            } else {
                schemaCollection.read(schema.getElement());
            }
        }
    }
    Map namespaces = definition.getNamespaces();
    // System.out.println(namespaces);
    XmlSchema[] schemas = schemaCollection.getXmlSchemas();
    java.util.List<String> labelList = new ArrayList<String>();
    for (int i = 0; i < schemas.length; i++) {
        XmlSchema schema = schemas[i];
        XmlSchemaObjectTable types = schema.getSchemaTypes();
        Iterator it = types.getValues();
        while (it.hasNext()) {
            XmlSchemaType type = (XmlSchemaType) it.next();
            if (type instanceof XmlSchemaSimpleType) {
                XmlSchemaSimpleType t = (XmlSchemaSimpleType) type;
                String label = "simpletype:" + t.getName();
                if (!labelList.contains(label)) {
                    labelList.add(label);
                    labelAndNameSpaceMap.put(label, t.getQName().toString());
                }
            }
        }
    }
    allXMLSimpleTypeName = new String[labelList.size()];
    for (int i = 0; i < labelList.size(); i++) {
        allXMLSimpleTypeName[i] = labelList.get(i);
    }
}
Also used : XmlSchemaObjectTable(org.apache.ws.commons.schema.XmlSchemaObjectTable) XmlSchema(org.apache.ws.commons.schema.XmlSchema) Schema(javax.wsdl.extensions.schema.Schema) Definition(javax.wsdl.Definition) ArrayList(java.util.ArrayList) XmlSchemaType(org.apache.ws.commons.schema.XmlSchemaType) XmlSchemaCollection(org.apache.ws.commons.schema.XmlSchemaCollection) URI(java.net.URI) ExtensibilityElement(javax.wsdl.extensions.ExtensibilityElement) WSDLFactory(javax.wsdl.factory.WSDLFactory) XmlSchema(org.apache.ws.commons.schema.XmlSchema) XmlSchemaSimpleType(org.apache.ws.commons.schema.XmlSchemaSimpleType) Iterator(java.util.Iterator) Map(java.util.Map) HashMap(java.util.HashMap) WSDLReader(javax.wsdl.xml.WSDLReader)

Example 9 with XmlSchemaType

use of org.apache.ws.commons.schema.XmlSchemaType in project tdi-studio-se by Talend.

the class ComponentBuilder method collectAllXmlSchemaType.

/**
     * DOC gcui Comment method "collectAllXmlSchemaType".
     */
private void collectAllXmlSchemaType() {
    for (int i = 0; i < wsdlTypes.size(); i++) {
        XmlSchema xmlSchema = (wsdlTypes.elementAt(i));
        if (xmlSchema == null) {
            continue;
        }
        XmlSchemaObjectTable xmlSchemaObjectTable = xmlSchema.getSchemaTypes();
        Iterator typesItr = xmlSchemaObjectTable.getValues();
        while (typesItr.hasNext()) {
            XmlSchemaType xmlSchemaType = (XmlSchemaType) typesItr.next();
            allXmlSchemaType.add(xmlSchemaType);
        }
    }
}
Also used : XmlSchemaObjectTable(org.apache.ws.commons.schema.XmlSchemaObjectTable) XmlSchema(org.apache.ws.commons.schema.XmlSchema) Iterator(java.util.Iterator) XmlSchemaType(org.apache.ws.commons.schema.XmlSchemaType)

Example 10 with XmlSchemaType

use of org.apache.ws.commons.schema.XmlSchemaType in project tdi-studio-se by Talend.

the class AllTypeDialog method buileParameterFromTypes.

private void buileParameterFromTypes(String paraType, ParameterInfo parameter) {
    for (int i = 0; i < allXmlSchemaType.size(); i++) {
        XmlSchemaType type = allXmlSchemaType.get(i);
        String typeName = type.getName();
        if (paraType.equals(typeName)) {
            if (type instanceof XmlSchemaComplexType) {
                XmlSchemaComplexType xmlSchemaComplexType = (XmlSchemaComplexType) type;
                XmlSchemaParticle xmlSchemaParticle = xmlSchemaComplexType.getParticle();
                XmlSchemaObjectCollection xmlSchemaObjectCollection = null;
                if (xmlSchemaParticle == null && xmlSchemaComplexType.getContentModel() != null) {
                    Object obj = xmlSchemaComplexType.getContentModel().getContent();
                    if (obj instanceof XmlSchemaComplexContentExtension) {
                        XmlSchemaComplexContentExtension xscce = (XmlSchemaComplexContentExtension) obj;
                        if (xscce.getBaseTypeName() != null) {
                            buileParameterFromTypes(xscce.getBaseTypeName().getLocalPart(), parameter);
                        }
                        if (xscce != null) {
                            xmlSchemaParticle = xscce.getParticle();
                        }
                        if (xmlSchemaParticle instanceof XmlSchemaGroupBase) {
                            XmlSchemaGroupBase xmlSchemaGroupBase = (XmlSchemaGroupBase) xmlSchemaParticle;
                            xmlSchemaObjectCollection = xmlSchemaGroupBase.getItems();
                        }
                    } else if (obj instanceof XmlSchemaComplexContentRestriction) {
                        XmlSchemaComplexContentRestriction xsccr = (XmlSchemaComplexContentRestriction) obj;
                        xmlSchemaObjectCollection = xsccr.getAttributes();
                    }
                } else if (xmlSchemaParticle instanceof XmlSchemaGroupBase) {
                    XmlSchemaGroupBase xmlSchemaGroupBase = (XmlSchemaGroupBase) xmlSchemaParticle;
                    xmlSchemaObjectCollection = xmlSchemaGroupBase.getItems();
                }
                if (xmlSchemaObjectCollection != null && xmlSchemaObjectCollection.getCount() > 0) {
                    buildParameterFromCollection(xmlSchemaObjectCollection, parameter);
                }
            } else if (type instanceof XmlSchemaSimpleType) {
            }
            break;
        }
    }
}
Also used : XmlSchemaComplexContentExtension(org.apache.ws.commons.schema.XmlSchemaComplexContentExtension) XmlSchemaSimpleType(org.apache.ws.commons.schema.XmlSchemaSimpleType) XmlSchemaComplexContentRestriction(org.apache.ws.commons.schema.XmlSchemaComplexContentRestriction) XmlSchemaComplexType(org.apache.ws.commons.schema.XmlSchemaComplexType) XmlSchemaParticle(org.apache.ws.commons.schema.XmlSchemaParticle) XmlSchemaObject(org.apache.ws.commons.schema.XmlSchemaObject) XmlSchemaType(org.apache.ws.commons.schema.XmlSchemaType) XmlSchemaGroupBase(org.apache.ws.commons.schema.XmlSchemaGroupBase) XmlSchemaObjectCollection(org.apache.ws.commons.schema.XmlSchemaObjectCollection)

Aggregations

XmlSchemaType (org.apache.ws.commons.schema.XmlSchemaType)13 XmlSchemaComplexType (org.apache.ws.commons.schema.XmlSchemaComplexType)10 XmlSchemaSimpleType (org.apache.ws.commons.schema.XmlSchemaSimpleType)7 XmlSchemaComplexContentExtension (org.apache.ws.commons.schema.XmlSchemaComplexContentExtension)6 XmlSchema (org.apache.ws.commons.schema.XmlSchema)4 XmlSchemaElement (org.apache.ws.commons.schema.XmlSchemaElement)4 XmlSchemaGroupBase (org.apache.ws.commons.schema.XmlSchemaGroupBase)4 XmlSchemaObject (org.apache.ws.commons.schema.XmlSchemaObject)4 XmlSchemaObjectCollection (org.apache.ws.commons.schema.XmlSchemaObjectCollection)4 XmlSchemaParticle (org.apache.ws.commons.schema.XmlSchemaParticle)4 Iterator (java.util.Iterator)3 XmlSchemaComplexContentRestriction (org.apache.ws.commons.schema.XmlSchemaComplexContentRestriction)3 ParameterInfo (org.talend.designer.webservice.ws.wsdlinfo.ParameterInfo)3 ArrayList (java.util.ArrayList)2 QName (javax.xml.namespace.QName)2 XmlSchemaComplexContent (org.apache.ws.commons.schema.XmlSchemaComplexContent)2 XmlSchemaObjectTable (org.apache.ws.commons.schema.XmlSchemaObjectTable)2 XmlSchemaSequence (org.apache.ws.commons.schema.XmlSchemaSequence)2 Field (java.lang.reflect.Field)1 Method (java.lang.reflect.Method)1