Search in sources :

Example 21 with CorbaType

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

the class WSDLTypes method mapToSequence.

public static CorbaType mapToSequence(QName name, QName schematypeName, QName arrayType, QName elName, int bound, boolean anonymous) {
    CorbaType corbaTypeImpl = null;
    // schematypeName = checkPrefix(schematypeName);
    if (!anonymous) {
        // Create a Sequence
        Sequence corbaSeq = new Sequence();
        corbaSeq.setName(name.getLocalPart());
        corbaSeq.setQName(name);
        corbaSeq.setType(schematypeName);
        corbaSeq.setElemtype(arrayType);
        corbaSeq.setElemname(elName);
        corbaSeq.setBound(bound);
        corbaSeq.setRepositoryID(WSDLToCorbaHelper.REPO_STRING + name.getLocalPart().replace('.', '/') + WSDLToCorbaHelper.IDL_VERSION);
        corbaTypeImpl = corbaSeq;
    } else {
        // Create a Anonymous Sequence
        Anonsequence corbaSeq = new Anonsequence();
        corbaSeq.setName(name.getLocalPart());
        corbaSeq.setQName(name);
        corbaSeq.setType(schematypeName);
        corbaSeq.setElemtype(arrayType);
        corbaSeq.setElemname(elName);
        corbaSeq.setBound(bound);
        corbaTypeImpl = corbaSeq;
    }
    return corbaTypeImpl;
}
Also used : CorbaType(org.apache.cxf.binding.corba.wsdl.CorbaType) XmlSchemaSequence(org.apache.ws.commons.schema.XmlSchemaSequence) Sequence(org.apache.cxf.binding.corba.wsdl.Sequence) Anonsequence(org.apache.cxf.binding.corba.wsdl.Anonsequence)

Example 22 with CorbaType

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

the class WSDLTypes method mapToArray.

public static CorbaType mapToArray(QName name, QName schematypeName, QName arrayType, QName elName, int bound, boolean anonymous) {
    CorbaType corbatype = null;
    if (!anonymous) {
        // Create an Array
        Array corbaArray = new Array();
        corbaArray.setName(name.getLocalPart());
        corbaArray.setType(schematypeName);
        corbaArray.setElemtype(arrayType);
        corbaArray.setElemname(elName);
        corbaArray.setBound(bound);
        corbaArray.setRepositoryID(WSDLToCorbaHelper.REPO_STRING + name.getLocalPart().replace('.', '/') + WSDLToCorbaHelper.IDL_VERSION);
        corbaArray.setQName(name);
        corbatype = corbaArray;
    } else {
        // Create an Anonymous Array
        Anonarray corbaArray = new Anonarray();
        corbaArray.setName(name.getLocalPart());
        corbaArray.setType(schematypeName);
        corbaArray.setElemtype(arrayType);
        corbaArray.setElemname(elName);
        corbaArray.setBound(bound);
        corbaArray.setQName(name);
        corbatype = corbaArray;
    }
    return corbatype;
}
Also used : Array(org.apache.cxf.binding.corba.wsdl.Array) CorbaType(org.apache.cxf.binding.corba.wsdl.CorbaType) Anonarray(org.apache.cxf.binding.corba.wsdl.Anonarray)

Example 23 with CorbaType

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

the class WSDLToCorbaBindingTest method testFixedBindingGeneration.

@Test
public void testFixedBindingGeneration() throws Exception {
    String fileName = getClass().getResource("/wsdl/fixed.wsdl").toString();
    generator.setWsdlFile(fileName);
    generator.addInterfaceName("Y");
    Definition model = generator.generateCORBABinding();
    Document document = writer.getDocument(model);
    Element typemap = getElementNode(document, "corba:typeMapping");
    assertEquals(1, typemap.getElementsByTagName("corba:sequence").getLength());
    assertEquals(5, typemap.getElementsByTagName("corba:fixed").getLength());
    Element bindingElement = getElementNode(document, "binding");
    assertEquals(5, bindingElement.getElementsByTagName("corba:operation").getLength());
    QName bName = new QName("http://schemas.apache.org/idl/fixed.idl", "YCORBABinding", "tns");
    Binding binding = model.getBinding(bName);
    TypeMappingType mapType = (TypeMappingType) model.getExtensibilityElements().get(0);
    Map<String, CorbaType> tmap = new HashMap<>();
    for (CorbaType type : mapType.getStructOrExceptionOrUnion()) {
        tmap.put(type.getName(), type);
    }
    Iterator<?> j = binding.getBindingOperations().iterator();
    while (j.hasNext()) {
        BindingOperation bindingOperation = (BindingOperation) j.next();
        assertEquals("YCORBABinding", binding.getQName().getLocalPart());
        assertEquals(1, bindingOperation.getExtensibilityElements().size());
        checkFixedTypeOne(bindingOperation, tmap);
        bindingOperation = (BindingOperation) j.next();
        checkSequenceType(bindingOperation, tmap);
        bindingOperation = (BindingOperation) j.next();
        checkFixedTypeTwo(bindingOperation, tmap);
        bindingOperation = (BindingOperation) j.next();
        checkFixedTypeThree(bindingOperation, tmap);
        bindingOperation = (BindingOperation) j.next();
        checkFixedTypeFour(bindingOperation, tmap);
    }
}
Also used : WSDLToCorbaBinding(org.apache.cxf.tools.corba.processors.wsdl.WSDLToCorbaBinding) Binding(javax.wsdl.Binding) BindingOperation(javax.wsdl.BindingOperation) CorbaType(org.apache.cxf.binding.corba.wsdl.CorbaType) HashMap(java.util.HashMap) QName(javax.xml.namespace.QName) ExtensibilityElement(javax.wsdl.extensions.ExtensibilityElement) Element(org.w3c.dom.Element) Definition(javax.wsdl.Definition) TypeMappingType(org.apache.cxf.binding.corba.wsdl.TypeMappingType) Document(org.w3c.dom.Document) Test(org.junit.Test)

Example 24 with CorbaType

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

the class DeclaratorVisitor method visitNewTypes.

private void visitNewTypes(Scope newScope) {
    CorbaType nextCorbaType = null;
    XmlSchemaType nextSchemaType = null;
    CorbaType oldCorbaType = getCorbaType();
    QName newQname = new QName(getCorbaType().getQName().getNamespaceURI(), newScope.toString());
    if (oldCorbaType instanceof Alias) {
        // Alias
        // 
        Alias oldAlias = (Alias) oldCorbaType;
        Alias alias = new Alias();
        alias.setQName(newQname);
        alias.setBasetype(oldAlias.getBasetype());
        alias.setType(oldAlias.getType());
        alias.setRepositoryID(newScope.toIDLRepositoryID());
        nextCorbaType = alias;
    } else if (oldCorbaType instanceof Sequence) {
        // Sequence
        // 
        nextSchemaType = duplicateXmlSchemaComplexType(newScope);
        Sequence oldSequence = (Sequence) oldCorbaType;
        Sequence newSequence = new Sequence();
        newSequence.setQName(newQname);
        newSequence.setType(nextSchemaType.getQName());
        newSequence.setElemtype(oldSequence.getElemtype());
        newSequence.setElemname(oldSequence.getElemname());
        newSequence.setBound(oldSequence.getBound());
        newSequence.setRepositoryID(newScope.toIDLRepositoryID());
        nextCorbaType = newSequence;
    } else if (oldCorbaType instanceof Fixed) {
        // Fixed
        // 
        nextSchemaType = duplicateXmlSchemaSimpleType(newScope);
        Fixed oldFixed = (Fixed) getCorbaType();
        Fixed newFixed = new Fixed();
        newFixed.setQName(newQname);
        newFixed.setDigits(oldFixed.getDigits());
        newFixed.setScale(oldFixed.getScale());
        newFixed.setType(oldFixed.getType());
        newFixed.setRepositoryID(newScope.toIDLRepositoryID());
        nextCorbaType = newFixed;
    } else {
        System.err.println("[DeclaratorVisitor: Unexpected CORBA type error!]");
        System.exit(1);
    }
    if (nextCorbaType != null) {
        typeMap.getStructOrExceptionOrUnion().add(nextCorbaType);
    }
}
Also used : CorbaType(org.apache.cxf.binding.corba.wsdl.CorbaType) QName(javax.xml.namespace.QName) Alias(org.apache.cxf.binding.corba.wsdl.Alias) Sequence(org.apache.cxf.binding.corba.wsdl.Sequence) XmlSchemaType(org.apache.ws.commons.schema.XmlSchemaType) Fixed(org.apache.cxf.binding.corba.wsdl.Fixed)

Example 25 with CorbaType

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

the class FixedPtConstVisitor method visit.

public void visit(AST fixedNode) {
    // <fixed_pt_const_type> ::= "fixed"
    XmlSchemaType stype = null;
    CorbaType ctype = null;
    QName corbaTypeQName = CorbaConstants.NE_CORBA_FIXED;
    if (corbaTypeQName != null) {
        QName schemaTypeQName = Constants.XSD_DECIMAL;
        if (schemaTypeQName != null) {
            stype = schemas.getTypeByQName(schemaTypeQName);
            if (stype != null) {
                ctype = new CorbaType();
                ctype.setQName(corbaTypeQName);
                ctype.setType(stype.getQName());
                ctype.setName(stype.getQName().getLocalPart());
            }
        }
    }
    schemaType = stype;
    corbaType = ctype;
}
Also used : CorbaType(org.apache.cxf.binding.corba.wsdl.CorbaType) QName(javax.xml.namespace.QName) XmlSchemaType(org.apache.ws.commons.schema.XmlSchemaType)

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