Search in sources :

Example 41 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)

Example 42 with CorbaType

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

the class WSDLToCorbaHelper method processSequenceType.

protected CorbaType processSequenceType(XmlSchemaSequence seq, QName defaultName, QName schemaTypeName) throws Exception {
    CorbaType type = null;
    QName seqName = null;
    if (schemaTypeName == null) {
        seqName = createQNameCorbaNamespace(defaultName.getLocalPart() + "SequenceStruct");
    } else {
        seqName = createQNameCorbaNamespace(schemaTypeName.getLocalPart() + "SequenceStruct");
    }
    schemaTypeName = checkPrefix(schemaTypeName);
    Struct struct = new Struct();
    struct.setName(seqName.getLocalPart());
    struct.setQName(seqName);
    struct.setRepositoryID(REPO_STRING + seqName.getLocalPart().replace('.', '/') + IDL_VERSION);
    struct.setType(schemaTypeName);
    List<MemberType> members = processContainerAsMembers(seq, defaultName, schemaTypeName);
    for (MemberType memberType : members) {
        struct.getMember().add(memberType);
    }
    type = struct;
    if (seq.getMaxOccurs() != 1 || seq.getMinOccurs() != 1) {
        QName name = createQNameTargetNamespace(type.getQName().getLocalPart() + "Array");
        CorbaType atype = createArray(name, type.getQName(), type.getQName(), seq.getMaxOccurs(), seq.getMinOccurs(), false);
        if (atype != null && !isDuplicate(atype)) {
            typeMappingType.getStructOrExceptionOrUnion().add(atype);
        }
    }
    if ((struct != null) && (struct.getMember().isEmpty())) {
        String msgStr = "Cannot create CORBA Struct" + struct.getName() + "from container with no members";
        org.apache.cxf.common.i18n.Message msg = new org.apache.cxf.common.i18n.Message(msgStr, LOG);
        throw new Exception(msg.toString());
    }
    return type;
}
Also used : QName(javax.xml.namespace.QName) Struct(org.apache.cxf.binding.corba.wsdl.Struct) CorbaType(org.apache.cxf.binding.corba.wsdl.CorbaType) MemberType(org.apache.cxf.binding.corba.wsdl.MemberType)

Example 43 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 44 with CorbaType

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

the class WSDLToCorbaHelper method processAllMember.

private MemberType processAllMember(XmlSchemaAll all, QName defaultName, QName schemaTypeName) throws Exception {
    CorbaType corbatype = processAllType(all, defaultName, schemaTypeName);
    MemberType member = new MemberType();
    member.setName(corbatype.getQName().getLocalPart());
    member.setIdltype(corbatype.getQName());
    if (corbatype.isSetQualified() && corbatype.isQualified()) {
        member.setQualified(true);
    }
    return member;
}
Also used : CorbaType(org.apache.cxf.binding.corba.wsdl.CorbaType) MemberType(org.apache.cxf.binding.corba.wsdl.MemberType)

Example 45 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)

Aggregations

CorbaType (org.apache.cxf.binding.corba.wsdl.CorbaType)71 QName (javax.xml.namespace.QName)44 XmlSchemaType (org.apache.ws.commons.schema.XmlSchemaType)22 MemberType (org.apache.cxf.binding.corba.wsdl.MemberType)13 AST (antlr.collections.AST)9 TypeMappingType (org.apache.cxf.binding.corba.wsdl.TypeMappingType)8 XmlSchemaElement (org.apache.ws.commons.schema.XmlSchemaElement)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