Package org.apache.cxf.binding.corba.wsdl

Examples of org.apache.cxf.binding.corba.wsdl.Unionbranch


            TypeCode discTC = getTypeCode(orb, unionType.getDiscriminator(), typeMap, seenTypes);
            Map<String, UnionMember> members = new LinkedHashMap<String, UnionMember>();
            List<Unionbranch> branches = unionType.getUnionbranch();
            for (Iterator<Unionbranch> branchIter = branches.iterator(); branchIter.hasNext();) {
                Unionbranch branch = branchIter.next();
                List<CaseType> cases = branch.getCase();
                for (Iterator<CaseType> caseIter = cases.iterator(); caseIter.hasNext();) {
                    CaseType cs = caseIter.next();
                    if (!members.containsKey(cs.getLabel())) {
                        UnionMember member = new UnionMember();
                        member.name = branch.getName();
                        member.type = getTypeCode(orb, branch.getIdltype(), typeMap, seenTypes);
                        member.label = orb.create_any();
                        // We need to insert the labels in a way that depends on the type of the
                        // discriminator.  According to the CORBA specification, the following types
                        // are permissable as discriminator types:
                        //    * signed & unsigned short
View Full Code Here


            } else {
                read(discriminator);
                discLabel = ((CorbaPrimitiveHandler)discriminator).getDataFromValue();
            }
            // Now find the label in the union to get the right case
            Unionbranch defaultBranch = null;
            boolean caseFound = false;
            for (Iterator<Unionbranch> branchIter = branches.iterator(); branchIter.hasNext();) {
                Unionbranch branch = branchIter.next();
                if (branch.isSetDefault() && branch.isDefault()) {
                    defaultBranch = branch;
                }
                List<CaseType> cases = branch.getCase();
                for (Iterator<CaseType> caseIter = cases.iterator(); caseIter.hasNext();) {
                    CaseType c = caseIter.next();
                    if (c.getLabel().equalsIgnoreCase(discLabel)) {
                        CorbaObjectHandler branchObj = unionHandler.getBranchByName(branch.getName());
                        this.read(branchObj);
                        unionHandler.setValue(branch.getName(), branchObj);
                        caseFound = true;
                        break;
                    }
                }
                if (caseFound) {
View Full Code Here

       
            TypeCode discTC = getTypeCode(orb, unionType.getDiscriminator(), typeMap, seenTypes);
            Map<String, UnionMember> members = new LinkedHashMap<String, UnionMember>();
            List<Unionbranch> branches = unionType.getUnionbranch();
            for (Iterator<Unionbranch> branchIter = branches.iterator(); branchIter.hasNext();) {
                Unionbranch branch = branchIter.next();
                List<CaseType> cases = branch.getCase();
                for (Iterator<CaseType> caseIter = cases.iterator(); caseIter.hasNext();) {
                    CaseType cs = caseIter.next();
                    if (!members.containsKey(cs.getLabel())) {
                        UnionMember member = new UnionMember();
                        member.name = branch.getName();
                        member.type = getTypeCode(orb, branch.getIdltype(), typeMap, seenTypes);
                        member.label = orb.create_any();
                        // We need to insert the labels in a way that depends on the type of the
                        // discriminator.  According to the CORBA specification, the following types
                        // are permissable as discriminator types:
                        //    * signed & unsigned short
View Full Code Here

        seenTypes.put(obj.getIdlType(), obj);

        // Now handle all of the branches
        List<Unionbranch> unionBranches = unionType.getUnionbranch();
        for (int i = 0; i < unionBranches.size(); i++) {
            Unionbranch branch = unionBranches.get(i);
            QName branchName;
            if (branch.isSetQualified() && branch.isQualified() && (typeName != null)) {
                branchName = new QName(typeName.getNamespaceURI(), branch.getName());
            } else {
                branchName = new QName("", branch.getName());
            }
            QName branchIdlType = branch.getIdltype();
            CorbaObjectHandler branchObj =
                initializeObjectHandler(orb, branchName, branchIdlType, typeMap, serviceInfo,
                                        seenTypes);
            ((CorbaUnionHandler)obj).addCase(branchObj);
        }
View Full Code Here

            } else {
                read(discriminator);
                discLabel = ((CorbaPrimitiveHandler)discriminator).getDataFromValue();
            }
            // Now find the label in the union to get the right case
            Unionbranch defaultBranch = null;
            boolean caseFound = false;
            for (Iterator<Unionbranch> branchIter = branches.iterator(); branchIter.hasNext();) {
                Unionbranch branch = branchIter.next();
                if (branch.isSetDefault() && branch.isDefault()) {
                    defaultBranch = branch;
                }
                List<CaseType> cases = branch.getCase();
                for (Iterator<CaseType> caseIter = cases.iterator(); caseIter.hasNext();) {
                    CaseType c = caseIter.next();
                    if (c.getLabel().equalsIgnoreCase(discLabel)) {
                        CorbaObjectHandler branchObj = unionHandler.getBranchByName(branch.getName());
                        this.read(branchObj);
                        unionHandler.setValue(branch.getName(), branchObj);
                        caseFound = true;
                        break;
                    }
                }
                if (caseFound) {
View Full Code Here

            Union un = (Union)mapType.getStructOrExceptionOrUnion().get(2);
            assertEquals("Name is incorrect for Union Type", "long_nil",
                         un.getName());
            assertEquals("Type is incorrect for Union Type", "PEl",
                         un.getType().getLocalPart());
            Unionbranch unbranch = un.getUnionbranch().get(0);
            assertEquals("Name is incorrect for UnionBranch Type", "value",
                         unbranch.getName());
            assertEquals("Type is incorrect for UnionBranch Type", "long",
                         unbranch.getIdltype().getLocalPart());

            File f = new File("nillable.idl");
            assertTrue("nillable.idl should be generated", f.exists());
        } finally {
            new File("nillable.idl").deleteOnExit();
View Full Code Here

                                             List<String> caselist) {
        int caseIndex = 0;

        for (int i = 0; i < fields.size(); i++) {
            MemberType field = fields.get(i);
            Unionbranch branch = new Unionbranch();
            branch.setName(field.getName());
            branch.setIdltype(field.getIdltype());
            if (field.isSetQualified() && field.isQualified()) {
                branch.setQualified(true);
            }
            branch.setDefault(false);

            CaseType c = new CaseType();
            c.setLabel(caselist.get(caseIndex));
            caseIndex++;
            branch.getCase().add(c);
            corbaUnion.getUnionbranch().add(branch);
        }
        return corbaUnion;
    }
View Full Code Here

            // xmlschema:element
            XmlSchemaElement element = new XmlSchemaElement(schema, false);

            // corba:unionbranch
            Unionbranch unionBranch = new Unionbranch();

            if (caseNode.getType() == IDLTokenTypes.LITERAL_default) {
                // default:
                unionBranch.setDefault(true);

                typeNode = caseNode.getFirstChild();
                nameNode = typeNode.getNextSibling();
            } else {
                // case:
                createCase(caseNode, unionBranch);

                labelNode = caseNode.getFirstChild();
                if (labelNode.getType() == IDLTokenTypes.LITERAL_case) {
                    labelNode = labelNode.getNextSibling();
                }

                typeNode = labelNode.getNextSibling();
                nameNode = typeNode.getNextSibling();
            }


            TypesVisitor visitor = new TypesVisitor(scope,
                                                    definition,
                                                    schema,
                                                    wsdlVisitor,
                                                    null);
            visitor.visit(typeNode);
            XmlSchemaType stype = visitor.getSchemaType();
            CorbaType ctype = visitor.getCorbaType();
            Scope fullyQualifiedName = visitor.getFullyQualifiedName();


            // needed for anonymous arrays in unions
            if (ArrayVisitor.accept(nameNode)) {
                Scope anonScope = new Scope(scope, TypesUtils.getCorbaTypeNameNode(nameNode));
                ArrayVisitor arrayVisitor = new ArrayVisitor(anonScope,
                                                             definition,
                                                             schema,
                                                             wsdlVisitor,
                                                             null,
                                                             fullyQualifiedName);
                arrayVisitor.setSchemaType(stype);
                arrayVisitor.setCorbaType(ctype);
                arrayVisitor.visit(nameNode);
                stype = arrayVisitor.getSchemaType();
                ctype = arrayVisitor.getCorbaType();
                fullyQualifiedName = visitor.getFullyQualifiedName();
            }


            // xmlschema:element
            element.setName(nameNode.toString());
            if (stype != null) {
                element.setSchemaTypeName(stype.getQName());
                if (stype.getQName().equals(ReferenceConstants.WSADDRESSING_TYPE)) {
                    element.setNillable(true);
                }
            } else {
                UnionDeferredAction elementAction =
                    new UnionDeferredAction(element);
                wsdlVisitor.getDeferredActions().add(fullyQualifiedName, elementAction);
            }
            choice.getItems().add(element);


            // corba:unionbranch
            unionBranch.setName(nameNode.toString());
            if (ctype != null) {
                unionBranch.setIdltype(ctype.getQName());
            } else {
                // its type is forward declared.
                UnionDeferredAction unionBranchAction =
                    new UnionDeferredAction(unionBranch);
                wsdlVisitor.getDeferredActions().add(fullyQualifiedName, unionBranchAction);
View Full Code Here

            // xmlschema:element
            XmlSchemaElement element = new XmlSchemaElement(schema, false);

            // corba:unionbranch
            Unionbranch unionBranch = new Unionbranch();

            if (caseNode.getType() == IDLTokenTypes.LITERAL_default) {
                // default:
                unionBranch.setDefault(true);

                typeNode = caseNode.getFirstChild();
                nameNode = typeNode.getNextSibling();
            } else {
                // case:
                createCase(caseNode, unionBranch);

                labelNode = caseNode.getFirstChild();
                if (labelNode.getType() == IDLTokenTypes.LITERAL_case) {
                    labelNode = labelNode.getNextSibling();
                }

                typeNode = labelNode.getNextSibling();
                nameNode = typeNode.getNextSibling();
            }


            TypesVisitor visitor = new TypesVisitor(scope,
                                                    definition,
                                                    schema,
                                                    wsdlVisitor,
                                                    null);
            visitor.visit(typeNode);
            XmlSchemaType stype = visitor.getSchemaType();
            CorbaTypeImpl ctype = visitor.getCorbaType();
            Scope fullyQualifiedName = visitor.getFullyQualifiedName();


            // needed for anonymous arrays in unions
            if (ArrayVisitor.accept(nameNode)) {
                Scope anonScope = new Scope(scope, TypesUtils.getCorbaTypeNameNode(nameNode));
                ArrayVisitor arrayVisitor = new ArrayVisitor(anonScope,
                                                             definition,
                                                             schema,
                                                             wsdlVisitor,
                                                             null,
                                                             fullyQualifiedName);
                arrayVisitor.setSchemaType(stype);
                arrayVisitor.setCorbaType(ctype);
                arrayVisitor.visit(nameNode);
                stype = arrayVisitor.getSchemaType();
                ctype = arrayVisitor.getCorbaType();
                fullyQualifiedName = visitor.getFullyQualifiedName();
            }


            // xmlschema:element
            element.setName(nameNode.toString());
            if (stype != null) {
                element.setSchemaTypeName(stype.getQName());
                if (stype.getQName().equals(ReferenceConstants.WSADDRESSING_TYPE)) {
                    element.setNillable(true);
                }
            } else {
                UnionDeferredAction elementAction =
                    new UnionDeferredAction(element);
                wsdlVisitor.getDeferredActions().add(fullyQualifiedName, elementAction);
            }
            choice.getItems().add(element);


            // corba:unionbranch
            unionBranch.setName(nameNode.toString());
            if (ctype != null) {
                unionBranch.setIdltype(ctype.getQName());
            } else {
                // its type is forward declared.
                UnionDeferredAction unionBranchAction =
                    new UnionDeferredAction(unionBranch);
                wsdlVisitor.getDeferredActions().add(fullyQualifiedName, unionBranchAction);
View Full Code Here

        nilUnion.setQName(name);
        nilUnion.setDiscriminator(CorbaConstants.NT_CORBA_BOOLEAN);
        String id = REPO_STRING + nilUnion.getQName().getLocalPart().replace('.', '/') + IDL_VERSION;
        nilUnion.setRepositoryID(id);

        Unionbranch branch = new Unionbranch();
        branch.setName("value");
        branch.setIdltype(membertype);
        branch.setDefault(false);
        if (isQualified) {
            branch.setQualified(true);
        }
        CaseType caseType = new CaseType();
        caseType.setLabel("TRUE");
        branch.getCase().add(caseType);
        nilUnion.getUnionbranch().add(branch);
        nilUnion.setNillable(true);
        return nilUnion;
    }
View Full Code Here

TOP

Related Classes of org.apache.cxf.binding.corba.wsdl.Unionbranch

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.