Search in sources :

Example 51 with CorbaType

use of org.apache.cxf.binding.corba.wsdl.CorbaType in project cxf by apache.

the class WSDLToCorbaHelper method processElementType.

private CorbaType processElementType(XmlSchemaElement stype, QName defaultName, String uri) throws Exception {
    String name = null;
    QName schemaTypeName = null;
    XmlSchemaType schemaType = stype.getSchemaType();
    if (stype.getQName() == null) {
        if (stype.getRef().getTargetQName() == null) {
            schemaTypeName = defaultName;
        } else {
            name = stype.getRef().getTargetQName().getLocalPart();
            schemaType = findSchemaType(stype.getRef().getTargetQName());
        }
    } else {
        name = stype.getQName().getLocalPart();
    }
    if (schemaTypeName == null) {
        schemaTypeName = createQNameTargetNamespace(name);
    }
    CorbaType result = convertSchemaToCorbaType(schemaType, schemaTypeName, schemaType, null, false);
    result.setQualified(getElementQualification(stype, uri));
    return result;
}
Also used : CorbaType(org.apache.cxf.binding.corba.wsdl.CorbaType) QName(javax.xml.namespace.QName) XmlSchemaType(org.apache.ws.commons.schema.XmlSchemaType)

Example 52 with CorbaType

use of org.apache.cxf.binding.corba.wsdl.CorbaType in project cxf by apache.

the class WSDLToCorbaHelper method processComplexContentStructSchemaAll.

private Struct processComplexContentStructSchemaAll(Struct corbaStruct, XmlSchemaAll all, QName defaultName, QName schematypeName) throws Exception {
    CorbaType alltype = processAllType(all, defaultName, schematypeName);
    MemberType allmem = new MemberType();
    allmem.setName(alltype.getQName().getLocalPart() + "_f");
    allmem.setIdltype(alltype.getQName());
    allmem.setAnonschematype(true);
    if (alltype.isSetQualified() && alltype.isQualified()) {
        allmem.setQualified(true);
    }
    corbaStruct.getMember().add(allmem);
    if (!isDuplicate(alltype)) {
        typeMappingType.getStructOrExceptionOrUnion().add(alltype);
    }
    return corbaStruct;
}
Also used : CorbaType(org.apache.cxf.binding.corba.wsdl.CorbaType) MemberType(org.apache.cxf.binding.corba.wsdl.MemberType)

Example 53 with CorbaType

use of org.apache.cxf.binding.corba.wsdl.CorbaType in project cxf by apache.

the class WSDLToCorbaHelper method convertSchemaToCorbaType.

public CorbaType convertSchemaToCorbaType(XmlSchemaType stype, QName defaultName, XmlSchemaType parent, XmlSchemaAnnotation annotation, boolean anonymous) throws Exception {
    CorbaType corbaTypeImpl = null;
    if (!isAddressingNamespace(stype.getQName())) {
        // need to determine if its a primitive type.
        if (stype instanceof XmlSchemaComplexType) {
            corbaTypeImpl = processComplexType((XmlSchemaComplexType) stype, defaultName, annotation, anonymous);
        } else if (stype instanceof XmlSchemaSimpleType) {
            corbaTypeImpl = processSimpleType((XmlSchemaSimpleType) stype, defaultName, anonymous);
        } else if (xmlSchemaList.getElementByQName(stype.getQName()) != null) {
            XmlSchemaElement el = xmlSchemaList.getElementByQName(stype.getQName());
            // REVISIT, passing ns uri because of a bug in XmlSchema (Bug: WSCOMMONS-69)
            corbaTypeImpl = processElementType(el, defaultName, stype.getQName().getNamespaceURI());
        } else {
            throw new Exception("Couldn't convert schema " + stype.getQName() + " to corba type");
        }
    }
    if (corbaTypeImpl != null && !isDuplicate(corbaTypeImpl)) {
        typeMappingType.getStructOrExceptionOrUnion().add(corbaTypeImpl);
    }
    return corbaTypeImpl;
}
Also used : CorbaType(org.apache.cxf.binding.corba.wsdl.CorbaType) XmlSchemaSimpleType(org.apache.ws.commons.schema.XmlSchemaSimpleType) XmlSchemaElement(org.apache.ws.commons.schema.XmlSchemaElement) XmlSchemaComplexType(org.apache.ws.commons.schema.XmlSchemaComplexType)

Example 54 with CorbaType

use of org.apache.cxf.binding.corba.wsdl.CorbaType in project cxf by apache.

the class WSDLToCorbaHelper method processChoice.

private CorbaType processChoice(XmlSchemaChoice choice, QName defaultName, QName schemaTypeName) throws Exception {
    QName choicename;
    if (schemaTypeName == null) {
        choicename = createQNameCorbaNamespace(defaultName.getLocalPart());
    } else {
        choicename = createQNameCorbaNamespace(schemaTypeName.getLocalPart());
    }
    choicename = checkPrefix(choicename);
    CorbaType corbatype = createUnion(choicename, choice, defaultName, schemaTypeName);
    String repoId = REPO_STRING + corbatype.getQName().getLocalPart().replace('.', '/') + IDL_VERSION;
    ((Union) corbatype).setRepositoryID(repoId);
    if (choice.getMaxOccurs() != 1 || choice.getMinOccurs() != 1) {
        QName name = createQNameTargetNamespace(corbatype.getQName().getLocalPart() + "Array");
        CorbaType arrayType = createArray(name, corbatype.getQName(), corbatype.getQName(), choice.getMaxOccurs(), choice.getMinOccurs(), false);
        if (arrayType != null && !isDuplicate(arrayType)) {
            typeMappingType.getStructOrExceptionOrUnion().add(arrayType);
        }
    }
    return corbatype;
}
Also used : CorbaType(org.apache.cxf.binding.corba.wsdl.CorbaType) QName(javax.xml.namespace.QName) Union(org.apache.cxf.binding.corba.wsdl.Union)

Example 55 with CorbaType

use of org.apache.cxf.binding.corba.wsdl.CorbaType in project cxf by apache.

the class WSDLToCorbaHelper method isDuplicateException.

protected CorbaType isDuplicateException(CorbaType corbaTypeImpl) {
    CorbaType duplicate = null;
    String corbaName = corbaTypeImpl.getName();
    String corbaType = corbaTypeImpl.getType().getLocalPart();
    if (!typeMappingType.getStructOrExceptionOrUnion().isEmpty()) {
        Iterator<CorbaType> i = typeMappingType.getStructOrExceptionOrUnion().iterator();
        while (i.hasNext()) {
            CorbaType type = i.next();
            if (corbaName.equals(type.getName()) && corbaType.equals(type.getType().getLocalPart()) && type instanceof Struct) {
                return type;
            }
        }
    }
    return duplicate;
}
Also used : CorbaType(org.apache.cxf.binding.corba.wsdl.CorbaType) Struct(org.apache.cxf.binding.corba.wsdl.Struct)

Aggregations

CorbaType (org.apache.cxf.binding.corba.wsdl.CorbaType)72 QName (javax.xml.namespace.QName)45 XmlSchemaType (org.apache.ws.commons.schema.XmlSchemaType)23 MemberType (org.apache.cxf.binding.corba.wsdl.MemberType)13 AST (antlr.collections.AST)9 XmlSchemaElement (org.apache.ws.commons.schema.XmlSchemaElement)9 TypeMappingType (org.apache.cxf.binding.corba.wsdl.TypeMappingType)8 Test (org.junit.Test)8 XmlSchemaSequence (org.apache.ws.commons.schema.XmlSchemaSequence)7 Alias (org.apache.cxf.binding.corba.wsdl.Alias)6 Anonsequence (org.apache.cxf.binding.corba.wsdl.Anonsequence)6 Sequence (org.apache.cxf.binding.corba.wsdl.Sequence)6 Struct (org.apache.cxf.binding.corba.wsdl.Struct)6 Union (org.apache.cxf.binding.corba.wsdl.Union)6 File (java.io.File)5 Definition (javax.wsdl.Definition)5 ArrayList (java.util.ArrayList)4 Anonarray (org.apache.cxf.binding.corba.wsdl.Anonarray)4 Anonstring (org.apache.cxf.binding.corba.wsdl.Anonstring)4 Array (org.apache.cxf.binding.corba.wsdl.Array)4