Examples of Unionbranch


Examples of org.apache.schemas.yoko.bindings.corba.Unionbranch

            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

Examples of org.apache.schemas.yoko.bindings.corba.Unionbranch

            Union un = (Union)mapType.getStructOrExceptionOrUnion().get(7);
            assertEquals("Name is incorrect for Union Type", "attrib2Type_nil",
                         un.getName());
            assertEquals("Type is incorrect for Union Type", "attrib2",
                         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", "attrib2Type",
                         unbranch.getIdltype().getLocalPart());

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

Examples of org.apache.schemas.yoko.bindings.corba.Unionbranch

        // default case (since we are not provided with one from the Stax stream of the Celtix object)
        Union union = (Union)unionType;
        List<Unionbranch> branches = union.getUnionbranch();
        int index = 0;
        for (Iterator<Unionbranch> branchesIter = branches.iterator(); branchesIter.hasNext();) {
            Unionbranch branch = branchesIter.next();
            List<CaseType> branchCases = branch.getCase();
            if (branchCases.size() == 0) {
                defaultIndex = index;
            } else {
                for (Iterator<CaseType> casesIter = branchCases.iterator(); casesIter.hasNext();) {
                    CaseType ct = casesIter.next();
View Full Code Here

Examples of org.apache.schemas.yoko.bindings.corba.Unionbranch

        }
        String nsURI = getNamespaceURI(serviceInfo, qname);
        // Now handle all of the branches
        List<Unionbranch> unionBranches = unionType.getUnionbranch();
        for (Iterator<Unionbranch> iter = unionBranches.iterator(); iter.hasNext();) {
            Unionbranch branch = iter.next();
            QName branchName = new QName(nsURI, branch.getName());
            QName branchIdlType = branch.getIdltype();
            CorbaObjectHandler branchObj =
                initializeObjectHandler(orb, branchName, branchIdlType, stype, typeMaps, serviceInfo);
            ((CorbaUnionHandler)obj).addCase(branchObj);
        }
    }
View Full Code Here

Examples of org.apache.schemas.yoko.bindings.corba.Unionbranch

           
            // xmlschema:element
            XmlSchemaElement element = new XmlSchemaElement();

            // 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,
                                                    schemas,
                                                    schema,
                                                    typeMap,
                                                    null);
            visitor.visit(typeNode);
            XmlSchemaType stype = visitor.getSchemaType();
            CorbaTypeImpl ctype = visitor.getCorbaType();
           
           
            // needed for anonymous arrays in unions
            if (ArrayVisitor.accept(nameNode)) {
                Scope anonScope = new Scope(scope, TypesUtils.getCorbaTypeNameNode(nameNode));
                ArrayVisitor arrayVisitor = new ArrayVisitor(anonScope,
                                                             schemas,
                                                             schema,
                                                             typeMap,
                                                             stype,
                                                             ctype,
                                                             null);
                arrayVisitor.visit(nameNode);
                stype = arrayVisitor.getSchemaType();
                ctype = arrayVisitor.getCorbaType();
            }
           
           
            // xmlschema:element
            element.setName(nameNode.toString());
            element.setSchemaTypeName(stype.getQName());
            choice.getItems().add(element);
           
           
            // corba:unionbranch
            unionBranch.setName(nameNode.toString());
            unionBranch.setIdltype(ctype.getQName());
            corbaUnion.getUnionbranch().add(unionBranch);
           
           
            caseNode = caseNode.getNextSibling();
        }
View Full Code Here

Examples of org.apache.schemas.yoko.bindings.corba.Unionbranch

                branchName = branchElement.getName().getLocalPart();
            }
            List<Unionbranch> branches = unionType.getUnionbranch();
            XmlSchemaObjectCollection items = choiceType.getItems();               
            for (int i = 0; i < branches.size(); i++) {
                Unionbranch branch = branches.get(i);
                CorbaObjectHandler branchObj = null;
                if (branch.getName().equals(branchName)) {
                    branchObj = readObjectFromStax(reader, branch.getIdltype(), items.getItem(i), true);
                    // We also need to set the discriminator since this is the branch with the actual
                    // union value
                    CorbaObjectHandler discObj =
                        CorbaHandlerUtils.createTypeHandler(orb,
                                                            new QName("discriminator"),
                                                            unionType.getDiscriminator(),
                                                            typeMaps,
                                                            serviceInfo);
                    obj.setDiscriminator(discObj);
                   
                    // Determine the value of the discriminator. 
                    List<CaseType> branchCases = branch.getCase();
                    String discValue = null;
                    if (branchCases.size() != 0) {
                        // This represents a union case.  Set the discriminator based on the first
                        // label value associated with the branch (since we don't have this information)
                        // from the Stax representation of the Celtix object).
                        CaseType caseLabel = branchCases.get(0);
                        discValue = caseLabel.getLabel();
                    } else {
                        // This represents the default case.
                        discValue = obj.createDefaultDiscriminatorLabel();
                    }
                    obj.setDiscriminatorValueFromData(discValue);
                    obj.setValue(branchName, branchObj);
                } else {
                    XmlSchemaElement el = (XmlSchemaElement) items.getItem(i);
                    QName qname = new QName("", branch.getName());
                    if (CorbaUtils.isElementFormQualified(serviceInfo, el.getQName().getNamespaceURI())) {
                        qname = el.getQName();
                    }
                    // Create an object holder with no value
                    branchObj = CorbaHandlerUtils.createTypeHandler(orb,
                                                                    qname,
                                                                    branch.getIdltype(),
                                                                    typeMaps,
                                                                    serviceInfo);
                }
                obj.addCase(branchObj);
            }
View Full Code Here

Examples of org.apache.schemas.yoko.bindings.corba.Unionbranch

            } else {
                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

Examples of org.apache.schemas.yoko.bindings.corba.Unionbranch

       
        TypeCode discTC = getTypeCode(orb, unionType.getDiscriminator(), typeMaps);
        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();
                UnionMember member = new UnionMember();
                member.name = branch.getName();
                member.type = getTypeCode(orb, branch.getIdltype(), typeMaps);
                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:
View Full Code Here

Examples of org.apache.schemas.yoko.bindings.corba.Unionbranch

        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);
        CaseType caseType = new CaseType();
        caseType.setLabel("TRUE");
        branch.getCase().add(caseType);
        nilUnion.getUnionbranch().add(branch);      
       
        return nilUnion;
    }
View Full Code Here

Examples of org.apache.schemas.yoko.bindings.corba.Unionbranch

            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
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.