Examples of XmlSchemaType


Examples of org.apache.ws.commons.schema.XmlSchemaType

        // TEMPORARILY
        // using TypesVisitor to visit <const_type>
        // it should be visited by a ConstTypeVisitor
        TypesVisitor visitor = new TypesVisitor(getScope(), schemas, schema, typeMap, constNameNode);
        visitor.visit(constTypeNode);
        XmlSchemaType constSchemaType = visitor.getSchemaType();
        CorbaTypeImpl constCorbaType = visitor.getCorbaType();
        QName constCorbaTypeName = constCorbaType.getQName();
       
        // corba:const
        Const corbaConst = new Const();
        corbaConst.setQName(constQName);
        corbaConst.setValue(constValue);
        corbaConst.setType(constSchemaType.getQName());
        corbaConst.setIdltype(constCorbaTypeName);
       
        typeMap.getStructOrExceptionOrUnion().add(corbaConst);
    }
View Full Code Here

Examples of org.apache.ws.commons.schema.XmlSchemaType

        // struct members
        AST memberTypeNode = identifierNode.getNextSibling();
        while (memberTypeNode != null) {
            AST memberNode = TypesUtils.getCorbaTypeNameNode(memberTypeNode);
           
            XmlSchemaType schemaType = null;
            CorbaTypeImpl corbaType = null;
            try {
                TypesVisitor visitor = new TypesVisitor(structScope,
                                                        schemas,
                                                        schema,
                                                        typeMap,
                                                        null);
                visitor.visit(memberTypeNode);
               
                schemaType = visitor.getSchemaType();
                corbaType = visitor.getCorbaType();
               
            } catch (Exception ex) {
                System.out.println(ex.getMessage());
                System.exit(1);
            }

            // needed for anonymous arrays in structs
            if (ArrayVisitor.accept(memberNode)) {
                Scope anonScope = new Scope(structScope,
                                            TypesUtils.getCorbaTypeNameNode(memberTypeNode));
                ArrayVisitor arrayVisitor = new ArrayVisitor(anonScope,
                                                             schemas,
                                                             schema,
                                                             typeMap,
                                                             schemaType,
                                                             corbaType,
                                                             null);
                arrayVisitor.visit(memberNode);
                schemaType = arrayVisitor.getSchemaType();
                corbaType = arrayVisitor.getCorbaType();
            }
           
            // xmlschema:member
            XmlSchemaElement member = new XmlSchemaElement();
            String memberName = memberNode.toString();
            member.setName(memberName);
            member.setSchemaType(schemaType);
            member.setSchemaTypeName(schemaType.getQName());

            sequence.getItems().add(member);

           
            // corba:member
View Full Code Here

Examples of org.apache.ws.commons.schema.XmlSchemaType

    public void visit(AST node) {
        // <scoped_name> ::= <identifier>
        //                 | :: <identifier>
        //                 | <scoped_name> "::" <identifier>

        XmlSchemaType stype = null;
        CorbaTypeImpl ctype = null;
       
        if (PrimitiveTypesVisitor.accept(node)) {
            // primitive type
           
            PrimitiveTypesVisitor primitiveVisitor = new PrimitiveTypesVisitor(null, schemas);
            primitiveVisitor.visit(node);
           
            stype = primitiveVisitor.getSchemaType();
            ctype = primitiveVisitor.getCorbaType();
        } else {
            // declared type
            Scope currentScope = getScope();
            while (stype == null
                && currentScope != currentScope.getParent()) {
                // A name can be used in an unqualified form within a particular scope;
                // it will be resolved by successvely searching farther out in enclosing
                // scopes, while taking into consideration inheritance relationships
                // among interfaces.
                // INHERITANCE NOT IMPLEMENTED YET
                Scope scopedName = new Scope(currentScope, node);
                QName schemaQName = new QName(schema.getTargetNamespace(), scopedName.toString());

                stype = schema.getTypeByName(schemaQName);

                currentScope = currentScope.getParent();
            }
            if (stype == null) {
                // Global scope is our last chance to resolve the node
                QName schemaQName = new QName(schema.getTargetNamespace(), node.toString());
                stype = schema.getTypeByName(schemaQName);
            }
               
            // handle special case of simple string alias
            // a plain xsd:string has no corresponding XmlSchemaType in the XmlSchema
            // so the previous findType() method would return null.
            // As a temporary workaround, we query the typeMap for a corba:string with
            // same name. If the string is there, then it had been previously properly
            // declared and we can use it here.
            if (stype == null) {
                QName corbaQName = null;
                currentScope = getScope();
                while (ctype == null
                    && currentScope != currentScope.getParent()) {
                    Scope scopedName = new Scope(currentScope, node);
                    corbaQName = new QName(typeMap.getTargetNamespace(), scopedName.toString());
                    ctype = findCorbaType(typeMap, corbaQName);
                   
                    currentScope = currentScope.getParent();
                }
                if (ctype == null) {
                    corbaQName = new QName(typeMap.getTargetNamespace(), node.toString());
                    ctype = findCorbaType(typeMap, corbaQName);                   
                }
                if (ctype != null && ctype.getType() == Constants.XSD_STRING) {
                    stype = schemas.getTypeByQName(Constants.XSD_STRING);
                    ctype = new CorbaTypeImpl();
                    ctype.setName(CorbaConstants.NT_CORBA_STRING.getLocalPart());
                    ctype.setQName(CorbaConstants.NT_CORBA_STRING);
                    ctype.setType(Constants.XSD_STRING);
                } else {
                    throw new RuntimeException("[ScopedNameVisitor: Corba type "
                                               + corbaQName.toString()
                                               + " not found in typeMap]");
                }
            } else {
                ctype = findCorbaType(typeMap, stype.getQName());
            }
        }

        setSchemaType(stype);
        setCorbaType(ctype);
View Full Code Here

Examples of org.apache.ws.commons.schema.XmlSchemaType

    private static XmlSchemaType findSchemaType(Scope scope,
                                                XmlSchemaCollection schemas,
                                                XmlSchema schema,
                                                TypeMappingType typeMap,
                                                AST node) {
        XmlSchemaType result = null;
        Scope currentScope = scope;
        while (result == null
            && currentScope != currentScope.getParent()) {
            // A name can be used in an unqualified form within a particular scope;
            // it will be resolved by successvely searching farther out in enclosing
View Full Code Here

Examples of org.apache.ws.commons.schema.XmlSchemaType

                                                    schemas,
                                                    schema,
                                                    typeMap,
                                                    null);
            visitor.visit(memberTypeNode);
            XmlSchemaType stype = visitor.getSchemaType();
            CorbaTypeImpl ctype = visitor.getCorbaType();
           
            // needed for anonymous arrays in exceptions
            if (ArrayVisitor.accept(memberNode)) {
                Scope anonScope = new Scope(exceptionScope,
                                            TypesUtils.getCorbaTypeNameNode(memberTypeNode));
                ArrayVisitor arrayVisitor = new ArrayVisitor(anonScope,
                                                             schemas,
                                                             schema,
                                                             typeMap,
                                                             stype,
                                                             ctype,
                                                             null);
                arrayVisitor.visit(memberNode);
                stype = arrayVisitor.getSchemaType();
                ctype = arrayVisitor.getCorbaType();
            }

            // xmlschema:member
            XmlSchemaElement member = new XmlSchemaElement();
            String memberName = memberNode.toString();
            member.setName(memberName);
            member.setSchemaType(stype);
            member.setSchemaTypeName(stype.getQName());

            sequence.getItems().add(member);

           
            // corba:member
View Full Code Here

Examples of org.apache.ws.commons.schema.XmlSchemaType

        // Even though we don't need to add a schema definition for a default endpoint
        // type, we still need to create a schema type so that the visitor knows what
        // kind of parameter this is.  For a default endpoint, we'll just provide a
        // reference to a WS addressing EndpointReferenceType.
        XmlSchema wsaSchema = new XmlSchema(ReferenceConstants.WSADDRESSING_NAMESPACE, schemas);
        XmlSchemaType objectType = new XmlSchemaType(wsaSchema);
        objectType.setName(ReferenceConstants.WSADDRESSING_LOCAL_NAME);
        setSchemaType(objectType);
       
        // Build and assign the corba:object to the visitor
        Object corbaObject = new Object();
        corbaObject.setBinding(new QName(""));
        corbaObject.setQName(new QName(typeMap.getTargetNamespace(), "CORBA.Object"));
        corbaObject.setRepositoryID("IDL:omg.org/CORBA/Object/1.0");
        corbaObject.setType(objectType.getQName());
        setCorbaType(corbaObject);
       
        // Add the object definition to the typemap.  We only need to add the default
        // type once.
        if (!isReferenceCORBATypeDefined(corbaObject.getQName())) {
View Full Code Here

Examples of org.apache.ws.commons.schema.XmlSchemaType

        }

        // Create a schema namespace for WS addressing and use it to create an endpoint
        // reference type.  This will be used as the type for our endpoint reference.
        XmlSchema wsaSchema = new XmlSchema(ReferenceConstants.WSADDRESSING_NAMESPACE, schemas);
        XmlSchemaType wsaType = new XmlSchemaType(wsaSchema);
        wsaType.setName(ReferenceConstants.WSADDRESSING_LOCAL_NAME);

        // Check to see if we have already defined an element for this reference type.  If
        // we have, then there is no need to add it to the schema again.
        if (!isReferenceSchemaTypeDefined(referenceName)) {
            // We need to add a new element definition to the schema section of our WSDL.
            // For custom endpoint types, this should contain an annotation which points
            // to the binding which will be used for this endpoint type.
            XmlSchemaElement refElement = new XmlSchemaElement();
            refElement.setQName(referenceName);
            refElement.setName(referenceName.getLocalPart());
            refElement.setSchemaType(wsaType);
            refElement.setSchemaTypeName(wsaType.getQName());
     
            // Create an annotation which contains the CORBA binding for the element
            XmlSchemaAnnotation annotation = new XmlSchemaAnnotation();
            XmlSchemaAppInfo appInfo = new XmlSchemaAppInfo();
            try {
                DocumentBuilder db = DocumentBuilderFactory.newInstance().newDocumentBuilder();
                Document doc = db.newDocument();
                Element el = doc.createElement("appinfo");
                el.setTextContent("corba:binding=" + bindingName.getLocalPart());
                // TODO: This is correct but the appinfo markup is never added to the
                // schema.  Investigate.
                appInfo.setMarkup(el.getChildNodes());
            } catch (ParserConfigurationException ex) {
                throw new RuntimeException("[ObjectReferenceVisitor: error creating endpoint schema]");
            }
           
            annotation.getItems().add(appInfo);
           
            refElement.setAnnotation(annotation);

            schema.getElements().add(referenceName, refElement);
            schema.getItems().add(refElement);
        }

        // A schema type is required for visitors.  Create one based on the element we just added.
        XmlSchemaType endpointType = new XmlSchemaType(schema);
        endpointType.setName(referenceName.getLocalPart());
        setSchemaType(endpointType);
       
        // Build and assign the corba:object to the visitor
        Object corbaObject = new Object();
        corbaObject.setBinding(bindingName);
View Full Code Here

Examples of org.apache.ws.commons.schema.XmlSchemaType

            result.setCorbaType(corbaType);
        }
       
        // process first array
        Long size = new Long(firstSizeNode.toString());
        XmlSchemaType stype = null;
        CorbaTypeImpl ctype = null;
        if (identifierNode != null) {
            Scope scopedName = getScope();
            stype = generateSchemaArray(scopedName.toString(), size, result.getSchemaType().getQName());
            ctype = generateCorbaArray(scopedName, size, result.getCorbaType().getQName());
View Full Code Here

Examples of org.apache.ws.commons.schema.XmlSchemaType

                                                                schemas,
                                                                schema,
                                                                typeMap,
                                                                wsdlDefinition);
        visitor.visit(typeNode);
        XmlSchemaType schemaType = visitor.getSchemaType();
        CorbaTypeImpl corbaType = visitor.getCorbaType();
       
        boolean isObjectReference = false;
        if (corbaType instanceof org.apache.schemas.yoko.bindings.corba.Object) {
            isObjectReference = true;
View Full Code Here

Examples of org.apache.ws.commons.schema.XmlSchemaType

                                                                  schema,
                                                                  typeMap,
                                                                  null);
        visitor.visit(simpleTypeSpecNode);
       
        XmlSchemaType stype = visitor.getSchemaType();
        CorbaTypeImpl ctype = visitor.getCorbaType();
       

        long bound = -1;
        if (boundNode != null) {
            bound = Long.parseLong(boundNode.toString());
        }

        Scope scopedName = null;
        if (identifierNode == null) {
            // anonymous type
            scopedName = TypesUtils.generateAnonymousScopedName(getScope(), schema);
        } else {
            scopedName = new Scope(getScope(), identifierNode);
        }

        XmlSchemaType schemaType = null;
        if (stype != schemas.getTypeByQName(Constants.XSD_UNSIGNEDBYTE)) {
            schemaType = generateSchemaType(stype, scopedName, bound);
        } else {
            // According to CORBA Binding for WSDL specification,
            // idl:sequence<octet> maps to xs:base64Binary by default.
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.