Package org.apache.cxf.binding.corba.types

Examples of org.apache.cxf.binding.corba.types.CorbaObjectHandler


    public void readUnion(CorbaObjectHandler obj) throws CorbaBindingException {
        CorbaUnionHandler unionHandler = (CorbaUnionHandler)obj;
        Union unionType = (Union)unionHandler.getType();
        List<Unionbranch> branches = unionType.getUnionbranch();
        CorbaObjectHandler discriminator = unionHandler.getDiscriminator();
        if (branches.size() > 0) {
            String discLabel = null;
            if (discriminator.getTypeCodeKind().value() == TCKind._tk_enum) {
                CorbaEnumHandler disc = (CorbaEnumHandler) discriminator;
                readEnumDiscriminator(unionHandler, disc);
                discLabel = disc.getValue();
            } 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) {
                    break;
                }
            }
           
            // If we never find a case that matches the value of the discriminiator, then we must have
            // found the default case.
            if (!caseFound && defaultBranch != null) {
                CorbaObjectHandler branchObj = unionHandler.getBranchByName(defaultBranch.getName());
                this.read(branchObj);
                unionHandler.setValue(defaultBranch.getName(), branchObj);
            }
        }
    }
View Full Code Here


            // existance of template, which will be present for all unbounded sequences and for bound
            // sequences with recursive type elements.  Use the template element to construct each
            // object that is in the input stream.
            if (sequenceObj.getTemplateElement() != null) {
                sequenceObj.clear();
                CorbaObjectHandler template = sequenceObj.getTemplateElement();
                for (int i = 0; i < length; ++i) {
                    CorbaObjectHandler seqElement;
                    if (i < seqElements.size()) {
                        seqElement = seqElements.get(i);
                    } else {
                        seqElement = initializeCorbaObjectHandler(template);
                    }
View Full Code Here

        }
        params[1] = template.getIdlType();
        params[2] = template.getTypeCode();
        params[3] = template.getType();
       
        CorbaObjectHandler handler = null;
        try {
            handler = (CorbaObjectHandler) templateConstructor.newInstance(params);
            // To construct an any, we also need to set a typemap.  This should be available through
            // the template object.
            if (template instanceof CorbaAnyHandler) {
                ((CorbaAnyHandler)handler).setTypeMap(((CorbaAnyHandler)template).getTypeMap());
            }
        } catch (java.lang.Exception ex) {
            throw new CorbaBindingException("Unable to instantiate sequence element", ex);
        }


        if (template instanceof CorbaSequenceHandler) {
            CorbaSequenceHandler templateSeq = (CorbaSequenceHandler) template;
            ((CorbaSequenceHandler)handler).
                setTemplateElement(templateSeq.getTemplateElement());
        } else if (template instanceof CorbaStructHandler) {
            CorbaStructHandler templateStruct = (CorbaStructHandler) template;
            CorbaStructHandler struct = (CorbaStructHandler) handler;
            struct.setRecursive(template.isRecursive());
            List<CorbaObjectHandler> members = templateStruct.getMembers();
            for (int i = 0; i < members.size(); i++) {
                CorbaObjectHandler member = initializeCorbaObjectHandler(members.get(i));
                struct.addMember(member);
            }          
        } else if (template instanceof CorbaArrayHandler) {
            CorbaArrayHandler templateArray = (CorbaArrayHandler) template;
            CorbaArrayHandler array = (CorbaArrayHandler) handler;
            List<CorbaObjectHandler> elements = templateArray.getElements();
            for (int i = 0; i < elements.size(); i++) {
                CorbaObjectHandler element = initializeCorbaObjectHandler(elements.get(i));
                array.addElement(element);
            }
        } else if (template instanceof CorbaUnionHandler) {
            CorbaUnionHandler templateUnion = (CorbaUnionHandler) template;
            CorbaUnionHandler union = (CorbaUnionHandler) handler;
View Full Code Here

        // build the object holder for an array.
        TypeCode arrayTC = orb.create_array_tc(data.length, orb.get_primitive_tc(TCKind.tk_long));
        CorbaArrayHandler obj = new CorbaArrayHandler(new QName("Array"), arrayIdlType, arrayTC, arrayType);
        for (int i = 0; i < data.length; ++i) {
            CorbaObjectHandler nestedObj =
                new CorbaPrimitiveHandler(new QName("item"), longIdlType,
                                      orb.get_primitive_tc(TCKind.tk_long), null);
            obj.addElement(nestedObj);
        }
       
View Full Code Here

                RaisesType raises = exceptions.get(except.type());
                if (raises == null) {
                    throw new CorbaBindingException("Couldn't find the exception type code to unmarshall");
                }
                QName elName = new QName("", raises.getException().getLocalPart());
                CorbaObjectHandler handler =
                    CorbaHandlerUtils.initializeObjectHandler(orb,
                                                              elName,
                                                              raises.getException(),
                                                              typeMap,
                                                              service);
View Full Code Here

                RaisesType raises = exceptions.get(except.type());
                if (raises == null) {
                    throw new CorbaBindingException("Couldn't find the exception type code to unmarshall");
                }
                QName elName = new QName("", raises.getException().getLocalPart());
                CorbaObjectHandler handler =
                    CorbaHandlerUtils.initializeObjectHandler(orb,
                                                              elName,
                                                              raises.getException(),
                                                              typeMap,
                                                              service);
View Full Code Here

                    } else {
                        paramName = getMessageParamQName(output, param.getName(), outMsgIndex);
                        outMsgIndex++;
                    }
                }
                CorbaObjectHandler obj =
                    CorbaHandlerUtils.initializeObjectHandler(orb, paramName, paramIdlType, map, service);
                streamables[i] = corbaMsg.createStreamableObject(obj, paramName);

                Any value = CorbaAnyHelper.createAny(orb);
                if (paramMode.value().equals("in")) {
View Full Code Here

                RaisesType raises = exceptions.get(except.type());
                if (raises == null) {
                    throw new CorbaBindingException("Couldn't find the exception type code to unmarshall");
                }
                QName elName = new QName("", raises.getException().getLocalPart());
                CorbaObjectHandler handler =
                    CorbaHandlerUtils.initializeObjectHandler(orb,
                                                              elName,
                                                              raises.getException(),
                                                              typeMap,
                                                              service);
View Full Code Here

                    } else {
                        paramName = getMessageParamQName(output, param.getName(), outMsgIndex);
                        outMsgIndex++;
                    }
                }
                CorbaObjectHandler obj =
                    CorbaHandlerUtils.initializeObjectHandler(orb, paramName, paramIdlType, map, service);
                streamables[i] = corbaMsg.createStreamableObject(obj, paramName);

                Any value = CorbaAnyHelper.createAny(orb);
                if (paramMode.value().equals("in")) {
View Full Code Here

                    } else {
                        paramName = getMessageParamQName(output, param.getName(), outMsgIndex);
                        outMsgIndex++;
                    }
                }
                CorbaObjectHandler obj =
                    CorbaHandlerUtils.initializeObjectHandler(orb, paramName, paramIdlType, map, service);
                streamables[i] = corbaMsg.createStreamableObject(obj, paramName);

                Any value = CorbaAnyHelper.createAny(orb);
                if (paramMode.value().equals("in")) {
View Full Code Here

TOP

Related Classes of org.apache.cxf.binding.corba.types.CorbaObjectHandler

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.