Search in sources :

Example 26 with CorbaType

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

the class ParamDclVisitor method visit.

public void visit(AST node) {
    // <param_dcl> ::= <param_attribute> <param_type_spec> <simple_declarator>
    // <param_attribute> ::= "in"
    // | "out"
    // | "inout"
    AST typeNode = node.getFirstChild();
    AST nameNode = TypesUtils.getCorbaTypeNameNode(typeNode);
    ParamTypeSpecVisitor visitor = new ParamTypeSpecVisitor(getScope(), definition, schema, wsdlVisitor);
    visitor.visit(typeNode);
    XmlSchemaType schemaType = visitor.getSchemaType();
    CorbaType corbaType = visitor.getCorbaType();
    Scope fullyQualifiedName = visitor.getFullyQualifiedName();
    switch(node.getType()) {
        case IDLTokenTypes.LITERAL_in:
            addElement(inWrappingSequence, schemaType, nameNode.toString(), fullyQualifiedName);
            addCorbaParam(corbaType, ModeType.IN, nameNode.toString(), fullyQualifiedName);
            break;
        case IDLTokenTypes.LITERAL_out:
            addElement(outWrappingSequence, schemaType, nameNode.toString(), fullyQualifiedName);
            addCorbaParam(corbaType, ModeType.OUT, nameNode.toString(), fullyQualifiedName);
            break;
        case IDLTokenTypes.LITERAL_inout:
            addElement(inWrappingSequence, schemaType, nameNode.toString(), fullyQualifiedName);
            addElement(outWrappingSequence, schemaType, nameNode.toString(), fullyQualifiedName);
            addCorbaParam(corbaType, ModeType.INOUT, nameNode.toString(), fullyQualifiedName);
            break;
        default:
            throw new RuntimeException("[ParamDclVisitor: illegal IDL!]");
    }
    setSchemaType(schemaType);
    setCorbaType(corbaType);
}
Also used : AST(antlr.collections.AST) CorbaType(org.apache.cxf.binding.corba.wsdl.CorbaType) XmlSchemaType(org.apache.ws.commons.schema.XmlSchemaType)

Example 27 with CorbaType

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

the class PrimitiveTypesVisitor method visit.

public void visit(AST node) {
    // <base_type_spec> ::= <floating_pt_type>
    // | <integer_type>
    // | <char_type>
    // | <wide_char_type>
    // | <boolean_type>
    // | <octet_type>
    // | <any_type>
    // | <object_type>      <= NOT SUPPORTED
    // | <value_base_type>  <= NOT SUPPORTED
    // <floating_pt_type> ::= "float"
    // | "double"
    // | "long" double"
    // <integer_type> ::= <signed_int>
    // | <unsigned_int>
    // <signed_int> ::= <signed_short_int>
    // | <signed_long_int>
    // | <signed_longlong_int>
    // <signed_short_int> ::= "short"
    // <signed_long_int> ::= "long"
    // <signed_longlong_int> ::= "long" "long"
    // <unsigned_int> ::= <unsigned_short_int>
    // | <unsigned_long_int>
    // | <unsigned_longlong_int>
    // <unsigned_short_int> ::= "unsigned" "short"
    // <unsigned_long_int> ::= "unsigned" "long"
    // <unsigned_longlong_int> ::= "unsigned" "long" "long"
    // <char_type> ::= "char"
    // <wide_char_type> ::= "wchar"
    // <boolean_type> ::= "boolean"
    // <octet_type> ::= "octet"
    // <any_type> ::= "any"
    XmlSchemaType stype = null;
    CorbaType ctype = null;
    QName corbaTypeQName = PrimitiveTypesVisitor.getPrimitiveType(node);
    if (corbaTypeQName != null) {
        QName schemaTypeQName = xmlSchemaPrimitiveMap.get(corbaTypeQName);
        if (schemaTypeQName != null) {
            // XmlSchemaCollection schemas = new XmlSchemaCollection();
            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)

Example 28 with CorbaType

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

the class ScopedNameVisitor method visit.

public void visit(AST node) {
    // <scoped_name> ::= <identifier>
    // | :: <identifier>
    // | <scoped_name> "::" <identifier>
    XmlSchemaType stype = null;
    CorbaType ctype = null;
    if (PrimitiveTypesVisitor.accept(node)) {
        // primitive type
        PrimitiveTypesVisitor primitiveVisitor = new PrimitiveTypesVisitor(null, definition, schema, schemas);
        primitiveVisitor.visit(node);
        stype = primitiveVisitor.getSchemaType();
        ctype = primitiveVisitor.getCorbaType();
    } else if (isforwardDeclared(getScope(), node, wsdlVisitor)) {
        // forward declaration
        Scope scope = forwardDeclared(getScope(), definition, schema, node, wsdlVisitor);
        setFullyQualifiedName(scope);
    // how will we create the corbatype ????
    } else if (ObjectReferenceVisitor.accept(getScope(), schema, definition, node, wsdlVisitor)) {
        ObjectReferenceVisitor objRefVisitor = new ObjectReferenceVisitor(getScope(), definition, schema, wsdlVisitor);
        objRefVisitor.visit(node);
        stype = objRefVisitor.getSchemaType();
        ctype = objRefVisitor.getCorbaType();
    } else {
        VisitorTypeHolder holder = new VisitorTypeHolder();
        boolean found = findSchemaType(getScope(), definition, schema, node, wsdlVisitor, holder);
        if (found) {
            ctype = holder.getCorbaType();
            stype = holder.getSchemaType();
        } else {
            Scope scopedName = new Scope(getScope(), node);
            QName qname = new QName(schema.getTargetNamespace(), scopedName.toString());
            throw new RuntimeException("[ScopedNameVisitor:  Corba type " + qname + " not found in typeMap]");
        }
    }
    setSchemaType(stype);
    setCorbaType(ctype);
}
Also used : CorbaType(org.apache.cxf.binding.corba.wsdl.CorbaType) QName(javax.xml.namespace.QName) XmlSchemaType(org.apache.ws.commons.schema.XmlSchemaType)

Example 29 with CorbaType

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

the class ScopedNameVisitor method populateAliasSchemaType.

protected static void populateAliasSchemaType(CorbaType corbaType, WSDLASTVisitor wsdlVisitor, VisitorTypeHolder holder) {
    XmlSchemaCollection schemas = wsdlVisitor.getSchemas();
    TypeMappingType typeMap = wsdlVisitor.getTypeMap();
    holder.setCorbaType(corbaType);
    Alias alias = (Alias) corbaType;
    // loop through alias base types, till you get a non-alias corba type
    CorbaType type = findCorbaType(typeMap, alias.getBasetype());
    while ((type != null) && (type instanceof Alias)) {
        alias = (Alias) type;
        type = findCorbaType(typeMap, alias.getBasetype());
    }
    QName tname;
    if (type == null) {
        // it must be a primitive type
        tname = xmlSchemaPrimitiveMap.get(alias.getBasetype());
    } else {
        tname = type.getType();
    }
    XmlSchemaType stype = schemas.getTypeByQName(tname);
    if (stype == null) {
        XmlSchema xmlSchema = wsdlVisitor.getManager().getXmlSchema(tname.getNamespaceURI());
        if (xmlSchema != null) {
            stype = xmlSchema.getTypeByName(tname);
        } else {
            stype = wsdlVisitor.getSchema().getTypeByName(tname);
        }
    }
    holder.setSchemaType(stype);
}
Also used : CorbaType(org.apache.cxf.binding.corba.wsdl.CorbaType) XmlSchema(org.apache.ws.commons.schema.XmlSchema) Alias(org.apache.cxf.binding.corba.wsdl.Alias) QName(javax.xml.namespace.QName) TypeMappingType(org.apache.cxf.binding.corba.wsdl.TypeMappingType) XmlSchemaType(org.apache.ws.commons.schema.XmlSchemaType) XmlSchemaCollection(org.apache.ws.commons.schema.XmlSchemaCollection)

Example 30 with CorbaType

use of org.apache.cxf.binding.corba.wsdl.CorbaType 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)

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