Package org.apache.schemas.yoko.bindings.corba

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


            Unionbranch branch = new Unionbranch();
            branch.setName(field.getName());
            branch.setIdltype(field.getIdltype());
            branch.setDefault(false);                        

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


            List<CaseType> branchCases = branch.getCase();
            if (branchCases.size() == 0) {
                defaultIndex = index;
            } else {
                for (Iterator<CaseType> casesIter = branchCases.iterator(); casesIter.hasNext();) {
                    CaseType ct = casesIter.next();
                    labels.add(ct.getLabel());
                }
            }
           
            index++;
        }
View Full Code Here

    private void createCase(AST caseNode, Unionbranch unionBranch) {
        AST node = caseNode.getFirstChild();
        if (node != null) {
            if (node.getType() == IDLTokenTypes.LITERAL_case) {
                // corba:case
                CaseType caseType = new CaseType();
                caseType.setLabel(node.getNextSibling().toString());
                unionBranch.getCase().add(caseType);
               
                // recursive call
                createCase(node, unionBranch);
            } else {
                // corba:case
                CaseType caseType = new CaseType();
                caseType.setLabel(node.toString());
                unionBranch.getCase().add(caseType);
            }
        }
    }
View Full Code Here

        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:
                //    * signed & unsigned short
                //    * signed & unsigned long
                //    * signed & unsigned long long
                //    * char
                //    * boolean
                switch (discTC.kind().value()) {
                case TCKind._tk_short:
                    member.label.insert_short(Short.parseShort(cs.getLabel()));
                    break;
                case TCKind._tk_ushort:
                    member.label.insert_ushort(Short.parseShort(cs.getLabel()));
                    break;
                case TCKind._tk_long:
                    member.label.insert_long(Integer.parseInt(cs.getLabel()));
                    break;
                case TCKind._tk_ulong:
                    member.label.insert_ulong(Integer.parseInt(cs.getLabel()));
                    break;
                case TCKind._tk_longlong:
                    member.label.insert_longlong(Long.parseLong(cs.getLabel()));
                    break;
                case TCKind._tk_ulonglong:
                    member.label.insert_ulonglong(Long.parseLong(cs.getLabel()));
                    break;
                case TCKind._tk_char:
                    member.label.insert_char(cs.getLabel().charAt(0));
                    break;
                case TCKind._tk_boolean:
                    member.label.insert_boolean(Boolean.parseBoolean(cs.getLabel()));
                    break;
                default:
                    // TODO: Throw exception since this is an unsupported discriminator type
                }
                // Yoko orb is strict on how the case labels are stored for each member.  So we can't
                // simply insert the labels as strings
                members.put(cs.getLabel(), member);
            }
        }
        return orb.create_union_tc(unionType.getRepositoryID(),
                                   unionType.getName(),
                                   discTC,
View Full Code Here

                    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);
View Full Code Here

                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;
View Full Code Here

        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

    private void createCase(AST caseNode, Unionbranch unionBranch) {
        AST node = caseNode.getFirstChild();
        if (node != null) {
            if (node.getType() == IDLTokenTypes.LITERAL_case) {
                // corba:case
                CaseType caseType = new CaseType();
                caseType.setLabel(node.getNextSibling().toString());
                unionBranch.getCase().add(caseType);
               
                // recursive call
                createCase(node, unionBranch);
            } else {
                // corba:case
                CaseType caseType = new CaseType();
                caseType.setLabel(node.toString());
                unionBranch.getCase().add(caseType);
            }
        }
    }
View Full Code Here

            Unionbranch branch = new Unionbranch();
            branch.setName(field.getName());
            branch.setIdltype(field.getIdltype());
            branch.setDefault(false);                        

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

            List<CaseType> branchCases = branch.getCase();
            if (branchCases.size() == 0) {
                defaultIndex = index;
            } else {
                for (Iterator<CaseType> casesIter = branchCases.iterator(); casesIter.hasNext();) {
                    CaseType ct = casesIter.next();
                    labels.add(ct.getLabel());
                }
            }
           
            index++;
        }
View Full Code Here

TOP

Related Classes of org.apache.schemas.yoko.bindings.corba.CaseType

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.