Search in sources :

Example 6 with Sequence

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

the class ScopedNameVisitor method findNonSchemaType.

protected static boolean findNonSchemaType(String name, WSDLASTVisitor wsdlVisitor, VisitorTypeHolder holder) {
    boolean result = false;
    TypeMappingType typeMap = wsdlVisitor.getTypeMap();
    XmlSchemaCollection schemas = wsdlVisitor.getSchemas();
    QName qname = new QName(typeMap.getTargetNamespace(), name);
    CorbaType corbaType = findCorbaType(typeMap, qname);
    if (corbaType != null) {
        if (corbaType instanceof Alias) {
            result = true;
            if (holder != null) {
                populateAliasSchemaType(corbaType, wsdlVisitor, holder);
            }
        } else if (((corbaType instanceof Sequence) || (corbaType instanceof Anonsequence)) && ((corbaType.getType().equals(Constants.XSD_BASE64)))) {
            // special case of sequence of octets
            result = true;
            if (holder != null) {
                holder.setCorbaType(corbaType);
                holder.setSchemaType(schemas.getTypeByQName(corbaType.getType()));
            }
        }
    }
    return result;
}
Also used : CorbaType(org.apache.cxf.binding.corba.wsdl.CorbaType) QName(javax.xml.namespace.QName) Alias(org.apache.cxf.binding.corba.wsdl.Alias) TypeMappingType(org.apache.cxf.binding.corba.wsdl.TypeMappingType) Sequence(org.apache.cxf.binding.corba.wsdl.Sequence) XmlSchemaCollection(org.apache.ws.commons.schema.XmlSchemaCollection) Anonsequence(org.apache.cxf.binding.corba.wsdl.Anonsequence)

Example 7 with Sequence

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

the class WSDLToIDLAction method createType.

protected IdlType createType(QName idlType, String[] name, CorbaType corbaType) throws Exception {
    if (idlType.getLocalPart().equals("CORBA.Object")) {
        return IdlInterface.create(null, "Object");
    }
    CorbaType corbaTypeImpl = corbaType;
    if (corbaTypeImpl == null) {
        corbaTypeImpl = getCorbaType(idlType);
    }
    if (corbaTypeImpl == null) {
        String msgStr = "Type " + idlType.getLocalPart() + " not found.";
        org.apache.cxf.common.i18n.Message msg = new org.apache.cxf.common.i18n.Message(msgStr, LOG);
        throw new Exception(msg.toString());
    }
    IdlScopeBase scope = root;
    StringBuilder dotScopedName = new StringBuilder("");
    for (int i = 0; i < name.length - 1; ++i) {
        dotScopedName.append(name[i]);
        // name array.
        if ("CORBA".equals(dotScopedName.toString()) && name.length == 2 && i == 0 && name[1].equals("Object")) {
            break;
        }
        IdlDefn idlDef = scope.lookup(name[i]);
        if (idlDef == null) {
            // Before creating module, check to see if a Corba type
            // represent this name aleady exists.
            // For example if type is a.b.c and we are about to create
            // module b, look to see if a.b
            // is an interface that needs to be processed
            QName qname = new QName(corbaTypeImpl.getType().getNamespaceURI(), dotScopedName.toString());
            // Check to see if CORBAType exists. If so, create type for it
            // otherwise
            // create module for this scope
            CorbaType possibleCorbaType = getCorbaType(qname);
            if (possibleCorbaType != null) {
                idlDef = findType(qname);
            }
            if (idlDef == null) {
                idlDef = IdlModule.create(scope, name[i]);
                scope.addToScope(idlDef);
            }
        }
        dotScopedName.append(".");
        scope = (IdlScopeBase) idlDef;
    }
    IdlType result = null;
    String local = name[name.length - 1];
    if (corbaTypeImpl instanceof Enum) {
        result = createEnum((Enum) corbaTypeImpl, scope, local);
    } else if (corbaTypeImpl instanceof Sequence) {
        result = createSequence((Sequence) corbaTypeImpl, scope, local);
    } else if (corbaTypeImpl instanceof Anonsequence) {
        result = createAnonSequence((Anonsequence) corbaTypeImpl, scope, local);
    } else if (corbaTypeImpl instanceof org.apache.cxf.binding.corba.wsdl.Exception) {
        result = createIdlException((org.apache.cxf.binding.corba.wsdl.Exception) corbaTypeImpl, scope, local);
    } else if (corbaTypeImpl instanceof Struct) {
        result = createStruct((Struct) corbaTypeImpl, scope, local);
    } else if (corbaTypeImpl instanceof Union) {
        result = createUnion((Union) corbaTypeImpl, scope, local);
    } else if (corbaTypeImpl instanceof Alias) {
        result = createTypedef((Alias) corbaTypeImpl, scope, local);
    } else if (corbaTypeImpl instanceof Array) {
        result = createArray((Array) corbaTypeImpl, scope, local);
    } else if (corbaTypeImpl instanceof Anonarray) {
        result = createAnonArray((Anonarray) corbaTypeImpl, scope, local);
    } else if (corbaTypeImpl instanceof Fixed) {
        result = createFixed((Fixed) corbaTypeImpl, scope, local);
    } else if (corbaTypeImpl instanceof Anonfixed) {
        result = createAnonFixed((Anonfixed) corbaTypeImpl, scope, local);
    } else if (corbaTypeImpl instanceof Const) {
        result = createConst((Const) corbaTypeImpl, scope, local);
    } else {
        result = checkAnon(corbaTypeImpl, scope, local);
    }
    if (result == null && corbaTypeImpl instanceof org.apache.cxf.binding.corba.wsdl.Object) {
        result = createInterface((org.apache.cxf.binding.corba.wsdl.Object) corbaTypeImpl, scope, local);
    }
    return result;
}
Also used : IdlEnum(org.apache.cxf.tools.corba.common.idltypes.IdlEnum) Enum(org.apache.cxf.binding.corba.wsdl.Enum) IdlString(org.apache.cxf.tools.corba.common.idltypes.IdlString) IdlType(org.apache.cxf.tools.corba.common.idltypes.IdlType) Union(org.apache.cxf.binding.corba.wsdl.Union) IdlUnion(org.apache.cxf.tools.corba.common.idltypes.IdlUnion) IdlStruct(org.apache.cxf.tools.corba.common.idltypes.IdlStruct) Struct(org.apache.cxf.binding.corba.wsdl.Struct) Anonarray(org.apache.cxf.binding.corba.wsdl.Anonarray) IdlFixed(org.apache.cxf.tools.corba.common.idltypes.IdlFixed) IdlAnonFixed(org.apache.cxf.tools.corba.common.idltypes.IdlAnonFixed) Fixed(org.apache.cxf.binding.corba.wsdl.Fixed) QName(javax.xml.namespace.QName) IdlDefn(org.apache.cxf.tools.corba.common.idltypes.IdlDefn) Const(org.apache.cxf.binding.corba.wsdl.Const) IdlConst(org.apache.cxf.tools.corba.common.idltypes.IdlConst) IdlScopeBase(org.apache.cxf.tools.corba.common.idltypes.IdlScopeBase) IdlAnonSequence(org.apache.cxf.tools.corba.common.idltypes.IdlAnonSequence) Sequence(org.apache.cxf.binding.corba.wsdl.Sequence) IdlSequence(org.apache.cxf.tools.corba.common.idltypes.IdlSequence) IdlException(org.apache.cxf.tools.corba.common.idltypes.IdlException) IdlAnonArray(org.apache.cxf.tools.corba.common.idltypes.IdlAnonArray) Array(org.apache.cxf.binding.corba.wsdl.Array) IdlArray(org.apache.cxf.tools.corba.common.idltypes.IdlArray) Anonfixed(org.apache.cxf.binding.corba.wsdl.Anonfixed) CorbaType(org.apache.cxf.binding.corba.wsdl.CorbaType) Alias(org.apache.cxf.binding.corba.wsdl.Alias) Anonsequence(org.apache.cxf.binding.corba.wsdl.Anonsequence)

Example 8 with Sequence

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

the class WSDLTypes method getOctetCorbaType.

public static CorbaType getOctetCorbaType(QName name, QName stype, int bound) {
    Sequence seq = new Sequence();
    seq.setName(name.getLocalPart());
    seq.setQName(name);
    seq.setType(stype);
    seq.setElemtype(CorbaConstants.NT_CORBA_OCTET);
    seq.setBound(bound);
    seq.setRepositoryID(WSDLToCorbaHelper.REPO_STRING + name.getLocalPart().replace('.', '/') + WSDLToCorbaHelper.IDL_VERSION);
    return seq;
}
Also used : XmlSchemaSequence(org.apache.ws.commons.schema.XmlSchemaSequence) Sequence(org.apache.cxf.binding.corba.wsdl.Sequence)

Example 9 with Sequence

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

the class SequenceVisitor method generateCorbaSequence.

private CorbaType generateCorbaSequence(CorbaType ctype, XmlSchemaType schemaType, Scope scopedName, long bound, Scope fullyQualifiedName) {
    // create the corba sequence
    Sequence corbaSeq = new Sequence();
    if (bound == -1) {
        bound = 0;
    }
    corbaSeq.setBound(bound);
    corbaSeq.setQName(new QName(typeMap.getTargetNamespace(), scopedName.toString()));
    corbaSeq.setType(schemaType.getQName());
    // REVISIT, if we add qualification then change the below.
    corbaSeq.setElemname(new QName("", ELEMENT_NAME));
    if (ctype != null) {
        corbaSeq.setElemtype(ctype.getQName());
    } else {
        SequenceDeferredAction seqAction = new SequenceDeferredAction(corbaSeq);
        wsdlVisitor.getDeferredActions().add(fullyQualifiedName, seqAction);
    }
    corbaSeq.setRepositoryID(scopedName.toIDLRepositoryID());
    return corbaSeq;
}
Also used : QName(javax.xml.namespace.QName) XmlSchemaSequence(org.apache.ws.commons.schema.XmlSchemaSequence) Sequence(org.apache.cxf.binding.corba.wsdl.Sequence)

Example 10 with Sequence

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

the class CorbaHandlerUtils method isPrimitiveIDLTypeSequence.

public static boolean isPrimitiveIDLTypeSequence(CorbaObjectHandler handler) {
    CorbaType seqType = handler.getType();
    QName seqElementType;
    if (seqType instanceof Anonsequence) {
        Anonsequence anonSeqType = (Anonsequence) seqType;
        seqElementType = anonSeqType.getElemtype();
    } else {
        Sequence type = (Sequence) seqType;
        seqElementType = type.getElemtype();
    }
    return CorbaUtils.isPrimitiveIdlType(seqElementType);
}
Also used : CorbaType(org.apache.cxf.binding.corba.wsdl.CorbaType) QName(javax.xml.namespace.QName) XmlSchemaSequence(org.apache.ws.commons.schema.XmlSchemaSequence) Sequence(org.apache.cxf.binding.corba.wsdl.Sequence) Anonsequence(org.apache.cxf.binding.corba.wsdl.Anonsequence)

Aggregations

Sequence (org.apache.cxf.binding.corba.wsdl.Sequence)15 QName (javax.xml.namespace.QName)12 Anonsequence (org.apache.cxf.binding.corba.wsdl.Anonsequence)7 CorbaType (org.apache.cxf.binding.corba.wsdl.CorbaType)6 XmlSchemaSequence (org.apache.ws.commons.schema.XmlSchemaSequence)5 Alias (org.apache.cxf.binding.corba.wsdl.Alias)4 TypeCode (org.omg.CORBA.TypeCode)4 Array (org.apache.cxf.binding.corba.wsdl.Array)3 Fixed (org.apache.cxf.binding.corba.wsdl.Fixed)3 Struct (org.apache.cxf.binding.corba.wsdl.Struct)3 Test (org.junit.Test)3 CorbaPrimitiveHandler (org.apache.cxf.binding.corba.types.CorbaPrimitiveHandler)2 CorbaSequenceHandler (org.apache.cxf.binding.corba.types.CorbaSequenceHandler)2 Anonarray (org.apache.cxf.binding.corba.wsdl.Anonarray)2 Enum (org.apache.cxf.binding.corba.wsdl.Enum)2 Union (org.apache.cxf.binding.corba.wsdl.Union)2 List (java.util.List)1 ExtensibilityElement (javax.wsdl.extensions.ExtensibilityElement)1 CorbaBindingException (org.apache.cxf.binding.corba.CorbaBindingException)1 Anonfixed (org.apache.cxf.binding.corba.wsdl.Anonfixed)1