Search in sources :

Example 61 with CorbaType

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

the class SequenceVisitor method visit.

public void visit(AST seq) {
    // <sequence_type> ::= "sequence" "<" <simple_type_spec> "," <positive_int_const> ">"
    // | "sequence" "<" <simple_type_spec> ">"
    AST simpleTypeSpecNode = seq.getFirstChild();
    // REVISIT: TypesUtils.getPrimitiveCorbaTypeNameNode should be renamed
    // to something more suitable and should be made more general.
    AST boundNode = TypesUtils.getCorbaTypeNameNode(simpleTypeSpecNode);
    // if so, replace the symbol name with defined const
    if (boundNode != null) {
        String constValue = TypesUtils.getConstValueByName(boundNode, typeMap);
        if (constValue != null) {
            boundNode.setText(constValue);
        }
    }
    SimpleTypeSpecVisitor visitor = new SimpleTypeSpecVisitor(new Scope(getScope(), identifierNode), definition, schema, wsdlVisitor, null);
    visitor.visit(simpleTypeSpecNode);
    XmlSchemaType stype = visitor.getSchemaType();
    CorbaType ctype = visitor.getCorbaType();
    Scope fullyQualifiedName = visitor.getFullyQualifiedName();
    long bound = -1;
    if (boundNode != null) {
        bound = Long.parseLong(boundNode.toString());
    }
    final Scope scopedName;
    if (identifierNode == null) {
        // anonymous type
        scopedName = TypesUtils.generateAnonymousScopedName(getScope(), schema);
    } else {
        scopedName = new Scope(getScope(), identifierNode);
    }
    final XmlSchemaType schemaType;
    // 
    if (stype != null) {
        if (!stype.getQName().equals(Constants.XSD_UNSIGNEDBYTE)) {
            schemaType = generateSchemaType(stype, scopedName, bound, fullyQualifiedName);
        } else {
            schemaType = wsdlVisitor.getSequenceOctetType();
        }
    } else {
        schemaType = generateSchemaType(null, scopedName, bound, fullyQualifiedName);
    }
    final CorbaType corbaType;
    if (identifierNode == null) {
        corbaType = generateCorbaAnonsequence(ctype, schemaType, scopedName, bound, fullyQualifiedName);
    } else {
        corbaType = generateCorbaSequence(ctype, schemaType, scopedName, bound, fullyQualifiedName);
    }
    setSchemaType(schemaType);
    setCorbaType(corbaType);
    setFullyQualifiedName(fullyQualifiedName);
}
Also used : AST(antlr.collections.AST) CorbaType(org.apache.cxf.binding.corba.wsdl.CorbaType) XmlSchemaType(org.apache.ws.commons.schema.XmlSchemaType)

Example 62 with CorbaType

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

the class StringVisitor method visitUnboundedString.

private void visitUnboundedString() {
    // schema type
    setSchemaType(schemas.getTypeByQName(Constants.XSD_STRING));
    // corba type
    CorbaType corbaString = new CorbaType();
    if (stringNode.getType() == IDLTokenTypes.LITERAL_string) {
        corbaString.setQName(CorbaConstants.NT_CORBA_STRING);
        corbaString.setName(CorbaConstants.NT_CORBA_STRING.getLocalPart());
    } else if (stringNode.getType() == IDLTokenTypes.LITERAL_wstring) {
        corbaString.setQName(CorbaConstants.NT_CORBA_WSTRING);
        corbaString.setName(CorbaConstants.NT_CORBA_WSTRING.getLocalPart());
    } else {
        // should never get here
        throw new RuntimeException("StringVisitor attempted to visit an invalid node");
    }
    corbaString.setType(Constants.XSD_STRING);
    setCorbaType(corbaString);
}
Also used : CorbaType(org.apache.cxf.binding.corba.wsdl.CorbaType)

Example 63 with CorbaType

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

the class StructVisitor method processForwardStructActions.

// Process any actions that were defered for a forward declared struct
private void processForwardStructActions(Scope structScope) {
    if (wsdlVisitor.getDeferredActions() != null) {
        DeferredActionCollection deferredActions = wsdlVisitor.getDeferredActions();
        List<DeferredAction> list = deferredActions.getActions(structScope);
        if ((list != null) && !list.isEmpty()) {
            XmlSchemaType stype = getSchemaType();
            CorbaType ctype = getCorbaType();
            Iterator<DeferredAction> iterator = list.iterator();
            while (iterator.hasNext()) {
                SchemaDeferredAction action = (SchemaDeferredAction) iterator.next();
                action.execute(stype, ctype);
            }
            iterator = list.iterator();
            while (iterator.hasNext()) {
                iterator.next();
                iterator.remove();
            }
        }
    }
}
Also used : CorbaType(org.apache.cxf.binding.corba.wsdl.CorbaType) XmlSchemaType(org.apache.ws.commons.schema.XmlSchemaType)

Example 64 with CorbaType

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

the class CorbaPrimitiveMapTest method testMap.

@Test
public void testMap() {
    Map<QName, CorbaType> map = new HashMap<>();
    QName corbaName = new QName("http://cxf.apache.org/bindings/corba", "string", "corba");
    QName typeName = new QName("http://www.w3.org/2001/XMLSchema", "string");
    CorbaType corbaTypeImpl = new CorbaType();
    corbaTypeImpl.setQName(corbaName);
    corbaTypeImpl.setType(typeName);
    corbaTypeImpl.setName(corbaName.getLocalPart());
    map.put(typeName, corbaTypeImpl);
    Object value = map.get(typeName);
    Assert.assertEquals(corbaTypeImpl.getName(), corbaName.getLocalPart());
    Assert.assertEquals(corbaTypeImpl.getQName(), corbaName);
    Assert.assertEquals(corbaTypeImpl.getType(), typeName);
    Assert.assertEquals(corbaTypeImpl, value);
}
Also used : CorbaType(org.apache.cxf.binding.corba.wsdl.CorbaType) QName(javax.xml.namespace.QName) Test(org.junit.Test)

Example 65 with CorbaType

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

the class ScopedNameVisitor method getCorbaSchemaType.

private static CorbaType getCorbaSchemaType(XmlSchema xmlSchema, TypeMappingType typeMap, XmlSchemaType stype, Scope scopedName) {
    final CorbaType ctype;
    if (stype.getQName().equals(Constants.XSD_STRING)) {
        ctype = new CorbaType();
        ctype.setName(CorbaConstants.NT_CORBA_STRING.getLocalPart());
        ctype.setQName(CorbaConstants.NT_CORBA_STRING);
        ctype.setType(Constants.XSD_STRING);
    } else {
        QName qname = stype.getQName();
        ctype = findCorbaTypeForSchemaType(typeMap, qname, scopedName);
    }
    return ctype;
}
Also used : CorbaType(org.apache.cxf.binding.corba.wsdl.CorbaType) QName(javax.xml.namespace.QName)

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