Package org.apache.ws.commons.schema

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


        boolean isUnion = false;

        if (type.getParticle() instanceof XmlSchemaSequence
            && type.getAttributes().getCount() == 0) {
       
            XmlSchemaSequence stype = (XmlSchemaSequence)type.getParticle();               

            if (stype.getItems().getCount() == 2) {
                Iterator it = stype.getItems().getIterator();
                XmlSchemaParticle st1 = (XmlSchemaParticle)it.next();
                XmlSchemaParticle st2 = (XmlSchemaParticle)it.next();
                XmlSchemaElement discEl = null;

                if (st1 instanceof XmlSchemaChoice && st2 instanceof XmlSchemaElement) {
View Full Code Here


            XmlSchemaParticle particle = null;
            if (cpt.getParticle() != null) {
                particle = (XmlSchemaParticle) cpt.getParticle();

                if (particle instanceof XmlSchemaSequence) {
                    XmlSchemaSequence seq = (XmlSchemaSequence) particle;
                    return seq.getItems().getIterator();
                } else if (particle instanceof XmlSchemaChoice) {
                    XmlSchemaChoice choice = (XmlSchemaChoice) particle;
                    return choice.getItems().getIterator();
                }
            }
            if (cpt.getContentModel() != null) {
                XmlSchemaContentModel xscm = (XmlSchemaContentModel) cpt
                        .getContentModel();
                if (xscm instanceof XmlSchemaComplexContent) {
                    XmlSchemaComplexContent xscc = (XmlSchemaComplexContent) xscm;

                    XmlSchemaComplexContentExtension ext = null;
                    if (xscc.getContent() instanceof XmlSchemaComplexContentExtension) {
                        ext = (XmlSchemaComplexContentExtension) xscc
                                .getContent();
                    }
                    if (ext.getParticle() instanceof XmlSchemaSequence) {
                        XmlSchemaSequence seq = (XmlSchemaSequence) ext
                                .getParticle();
                        return seq.getItems().getIterator();
                    } else if (ext.getParticle() instanceof XmlSchemaChoice) {
                        XmlSchemaChoice choice = (XmlSchemaChoice) ext
                                .getParticle();
                        return choice.getItems().getIterator();
                    }
View Full Code Here

        if (cpt.getAttributes().getCount() != 0) {
            return true;
        }

        if (particle instanceof XmlSchemaSequence) {
            XmlSchemaSequence seq = (XmlSchemaSequence) particle;
            Iterator it = seq.getItems().getIterator();
            while (it.hasNext()) {
                if (!(it.next() instanceof XmlSchemaElement)) {
                    return true;
                }
            }
View Full Code Here

        AST discriminatorNode = identifierNode.getNextSibling();
        AST caseNode = discriminatorNode.getNextSibling();

        // xmlschema:union
        XmlSchemaComplexType unionSchemaComplexType = new XmlSchemaComplexType(schema);
        XmlSchemaSequence sequence = new XmlSchemaSequence();
        unionSchemaComplexType.setName(unionScope.toString());
        unionSchemaComplexType.setParticle(sequence);
       
        // REVISIT
        // TEMPORARILY
        // using TypesVisitor to visit <const_type>
        // it should be visited by a SwitchTypeSpecVisitor
        TypesVisitor visitor = new TypesVisitor(getScope(), schemas, schema, typeMap, null);
        visitor.visit(discriminatorNode);
        XmlSchemaType stype = visitor.getSchemaType();
        CorbaTypeImpl ctype = visitor.getCorbaType();
       
        XmlSchemaElement discriminatorElement = new XmlSchemaElement();
        discriminatorElement.setName(discriminator);
        discriminatorElement.setSchemaTypeName(stype.getQName());
        discriminatorElement.setMinOccurs(1);
        discriminatorElement.setMaxOccurs(1);
        sequence.getItems().add(discriminatorElement);
       
        XmlSchemaChoice choice = new XmlSchemaChoice();
        choice.setMinOccurs(1);
        choice.setMaxOccurs(1);
        sequence.getItems().add(choice);
       
       
        // corba:union
        Union corbaUnion = new Union();
        corbaUnion.setQName(new QName(typeMap.getTargetNamespace(), unionScope.toString()));
View Full Code Here

           
            element.setSchemaTypeName(stype.getQName());
            element.setName(paramName);
        }
       
        XmlSchemaSequence sequence = new XmlSchemaSequence();
        if (typeNode != null) {
            sequence.getItems().add(element);
        }
       
        XmlSchemaComplexType complex = new XmlSchemaComplexType(schema);
        complex.setParticle(sequence);
       
View Full Code Here

       
        Operation operation = generateOperation(node.toString());

        BindingOperation bindingOperation = generateBindingOperation(binding, operation);
       
        XmlSchemaSequence inputWrappingSequence = new XmlSchemaSequence();
        XmlSchemaElement inputElement = generateWrapper(new QName(schema.getTargetNamespace(),
                                                                  operation.getName()),
                                                        inputWrappingSequence);
        inputMsg = generateInputMessage(operation, bindingOperation);
        inputPart = generateInputPart(inputMsg, inputElement);

        // <op_attribute>
        node = node.getFirstChild();
        XmlSchemaSequence outputWrappingSequence = null;
        XmlSchemaElement outputElement = null;
        if (node != null && (node.getType() == IDLTokenTypes.LITERAL_oneway)) {
            // oneway operations map to operations with only input message
            // no outputMsg nor outputPart need be created
            node = node.getNextSibling();
        } else {
            // normal operations map to request-response operations
            // with input and output messages
            outputWrappingSequence = new XmlSchemaSequence();
            outputElement = generateWrapper(new QName(schema.getTargetNamespace(),
                                                      operation.getName() + RESPONSE_SUFFIX),
                                            outputWrappingSequence);
            outputMsg = generateOutputMessage(operation, bindingOperation);
            outputPart = generateOutputPart(outputMsg, outputElement);          
View Full Code Here

        Scope structScope = new Scope(getScope(), identifierNode);       

        // xmlschema:struct
        XmlSchemaComplexType complexType = new XmlSchemaComplexType(schema);
        complexType.setName(structScope.toString());
        XmlSchemaSequence sequence = new XmlSchemaSequence();
        complexType.setParticle(sequence);

       
        // corba:struct
        Struct struct = new Struct();
        struct.setQName(new QName(typeMap.getTargetNamespace(), structScope.toString()));
        struct.setType(complexType.getQName());
        struct.setRepositoryID(structScope.toIDLRepositoryID());

       
        // 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
            MemberType memberType = new MemberType();
            memberType.setName(memberName);
View Full Code Here

        String exceptionTypeName = exceptionName + TYPE_SUFFIX;

        XmlSchemaComplexType complexType = new XmlSchemaComplexType(schema);
        complexType.setName(exceptionTypeName);
        //complexType.setQName(new QName(schema.getTargetNamespace(), exceptionTypeName));
        XmlSchemaSequence sequence = new XmlSchemaSequence();
        complexType.setParticle(sequence);

        element.setSchemaTypeName(complexType.getQName());
       
        // corba:exception
        Exception exception = new Exception();
        exception.setQName(new QName(typeMap.getTargetNamespace(), exceptionName));
        exception.setType(complexType.getQName());
        exception.setRepositoryID(scopedName.toIDLRepositoryID());

       
        // exception members
        AST memberTypeNode = identifierNode.getNextSibling();
        while (memberTypeNode != null) {
            AST memberNode = memberTypeNode.getNextSibling();

            TypesVisitor visitor = new TypesVisitor(exceptionScope,
                                                    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
            MemberType memberType = new MemberType();
            memberType.setName(memberName);
View Full Code Here

   
    private XmlSchemaComplexType generateSchemaArray(String name, Long size, QName type) {
        XmlSchemaComplexType complexType = new XmlSchemaComplexType(schema);
        complexType.setName(name);

        XmlSchemaSequence sequence = new XmlSchemaSequence();

        XmlSchemaElement element = new XmlSchemaElement();
        element.setMinOccurs(size);
        element.setMaxOccurs(size);
        element.setName("item");
        element.setSchemaTypeName(type);
       
        sequence.getItems().add(element);

        complexType.setParticle(sequence);

        return complexType;
    }
View Full Code Here

    }

    private XmlSchemaType generateSchemaType(XmlSchemaType stype, Scope scopedName, long bound) {
        XmlSchemaComplexType ct = new XmlSchemaComplexType(schema);
        ct.setName(scopedName.toString());
        XmlSchemaSequence sequence = new XmlSchemaSequence();
        XmlSchemaElement el = new XmlSchemaElement();
        el.setName("item");
        el.setMinOccurs(0);
        if (bound != -1) {
            el.setMaxOccurs(bound);
        } else {
            el.setMaxOccurs(Long.MAX_VALUE);
        }
        el.setSchemaTypeName(stype.getQName());
        sequence.getItems().add(el);
        ct.setParticle(sequence);
        return ct;
    }
View Full Code Here

TOP

Related Classes of org.apache.ws.commons.schema.XmlSchemaSequence

Copyright © 2018 www.massapicom. 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.