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

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


                mappingType.getStructOrExceptionOrUnion().add(constType);
            } else if (currentNode.getNodeName().equals("corba:enum")) {
                Enum enumType = getEnumDefinition(currentNode, def);
                mappingType.getStructOrExceptionOrUnion().add(enumType);
            } else if (currentNode.getNodeName().equals("corba:struct")) {
                Struct structType = getStructDefinition(currentNode, def);
                mappingType.getStructOrExceptionOrUnion().add(structType);
            } else if (currentNode.getNodeName().equals("corba:exception")) {
                Exception exceptType = getExceptionDefinition(currentNode, def);
                mappingType.getStructOrExceptionOrUnion().add(exceptType);
            } else if (currentNode.getNodeName().equals("corba:fixed")) {
View Full Code Here


        return enumType;
    }

    public Struct getStructDefinition(Node node, Definition def) {
        Struct structType = new Struct();
        NamedNodeMap structAttributes = node.getAttributes();

        // Store information about the struct
        for (int i = 0; i < structAttributes.getLength(); ++i) {
            if (structAttributes.item(i).getNodeName().equals("name")) {
                structType.setName(structAttributes.item(i).getNodeValue());
            } else if (structAttributes.item(i).getNodeName().equals("repositoryID")) {
                structType.setRepositoryID(structAttributes.item(i).getNodeValue());
            }
        }

        // Store information about the structs members
        NodeList structChildNodes = node.getChildNodes();
        for (int i = 0; i < structChildNodes.getLength(); ++i) {
            Node currentNode = structChildNodes.item(i);

            if (currentNode.getNodeName().equals("corba:member")) {
                MemberType member = new MemberType();
                NamedNodeMap memberAttributes = currentNode.getAttributes();

                for (int j = 0; j < memberAttributes.getLength(); ++j) {
                    Node memberAttrNode = memberAttributes.item(j);
                    if (memberAttrNode.getNodeName().equals("name")) {
                        member.setName(memberAttrNode.getNodeValue());
                    } else if (memberAttrNode.getNodeName().equals("idltype")) {
                        String idlType = memberAttrNode.getNodeValue();
                        int seperatorIndex = idlType.indexOf(':');
                        String prefix = idlType.substring(0, seperatorIndex);
                        String localPart = idlType.substring(seperatorIndex + 1, idlType.length());
                        member.setIdltype(new QName(def.getNamespace(prefix), localPart, prefix));
                    }
                }
                structType.getMember().add(member);
            }
        }
        return structType;
    }
View Full Code Here

        throws CorbaBindingException {
        CorbaStructHandler obj = null;
        CorbaTypeImpl typeDefinition = CorbaUtils.getCorbaType(idlType, typeMaps);
       
        try {
            Struct structType = (Struct)typeDefinition;
            StartElement structStartEl = reader.nextEvent().asStartElement();
            obj = new CorbaStructHandler(structStartEl.getName(), idlType, tc, structType);
            List<MemberType> structMembers = structType.getMember();
            for (Iterator<MemberType> iter = structMembers.iterator(); iter.hasNext();) {
                MemberType m = iter.next();
                CorbaObjectHandler member = readObjectFromStax(reader, m.getIdltype(), true);
                obj.addMember(member);
            }
View Full Code Here

                                  schemaTypeName.getLocalPart() + "SequenceStruct",
                                  schemaTypeName.getPrefix());
        }
       
        schemaTypeName = checkPrefix(schemaTypeName);
        Struct struct = new Struct();      
        struct.setName(seqName.getLocalPart());
        struct.setQName(seqName);
        struct.setRepositoryID(repoString + seqName.getLocalPart().replace('.', '/') + idlversion);
        struct.setType(schemaTypeName);
       
        List members = processContainerAsMembers(seq, defaultName, schemaTypeName);
        for (Iterator iterator = members.iterator(); iterator.hasNext();) {
            MemberType memberType = (MemberType)iterator.next();
            struct.getMember().add(memberType);           
        }       
       
        type = struct;
                             
        if (!"1".equals(seq.getMaxOccurs()) || !"1".equals(seq.getMinOccurs())) {
            QName name = createQNameTargetNamespace(type.getQName().getLocalPart() + "Array");           
            CorbaTypeImpl atype = createArray(name, type.getQName(), type.getQName(),
                                           seq.getMaxOccurs(), seq.getMinOccurs(), false);
            if (atype != null) {
                atype.setQName(null);              
                if (!isDuplicate(atype)) {
                    typeMappingType.getStructOrExceptionOrUnion().add(atype);              
                }
            }
        }
       
        if ((type instanceof Struct) && (struct.getMember().size() == 0)) {
            String msgStr = "Cannot create CORBA Struct" + struct.getName()
                            + "from container with no members";
            org.objectweb.celtix.common.i18n.Message msg = new org.objectweb.celtix.common.i18n.Message(
                                      msgStr, LOG);
            throw new Exception(msg.toString());
        }       
View Full Code Here

   
   
    protected CorbaTypeImpl processAllType(XmlSchemaAll seq, QName defaultName,
                                           QName schematypeName) throws Exception {
        QName allName = null;
        Struct type = null;

        if (schematypeName == null) {
            allName = createQNameCorbaNamespace(defaultName.getLocalPart() + "AllStruct");
        } else {
            allName = createQNameCorbaNamespace(schematypeName.getLocalPart() + "AllStruct");
        }

        type = new Struct();
        type.setName(allName.getLocalPart());
        type.setQName(allName);
        type.setType(schematypeName);
       
        List members = processContainerAsMembers(seq, defaultName, schematypeName);
        for (Iterator iterator = members.iterator(); iterator.hasNext();) {
            MemberType memberType = (MemberType)iterator.next();
            type.getMember().add(memberType);
        }
               
        String repoId = repoString + type.getQName().getLocalPart().replace('.', '/') + idlversion;
        type.setRepositoryID(repoId);
        return type;
    }
View Full Code Here

     

    private CorbaTypeImpl processStruct(XmlSchemaComplexType complex, QName defaultName)
        throws Exception {
        QName name;
        Struct corbaStruct = null;
        QName schematypeName = checkPrefix(complex.getQName());              

        if (schematypeName == null) {
            schematypeName = checkPrefix(defaultName);
            name = checkPrefix(createQNameCorbaNamespace(defaultName.getLocalPart()));           
        } else {
            name = checkPrefix(createQNameCorbaNamespace(schematypeName.getLocalPart()));           
        }

        corbaStruct = new Struct();
        corbaStruct.setName(name.getLocalPart());
        corbaStruct.setQName(name);
        String repoId = repoString + name.getLocalPart().replace('.', '/') + idlversion;
        corbaStruct.setRepositoryID(repoId);       
        corbaStruct.setType(schematypeName);
         
        if (complex.getContentModel() instanceof XmlSchemaSimpleContent) {
            corbaStruct = processSimpleContentStruct((XmlSchemaSimpleContent)complex.getContentModel(),
                                                     defaultName, corbaStruct, schematypeName);
        } else if (complex.getContentModel() instanceof XmlSchemaComplexContent) {
            corbaStruct = processComplexContentStruct((XmlSchemaComplexContent)complex.getContentModel(),
                                                      defaultName, corbaStruct, schematypeName);       
        }
       
        // Process attributes at ComplexType level
        if (complex.getAttributes().getIterator() != null) {
            Iterator iterator = complex.getAttributes().getIterator();
            List attlist2 = processAttributesAsMembers(iterator);
            MemberType member = new MemberType();
            for (int i = 0; i < attlist2.size(); i++) {
                member = (MemberType)attlist2.get(i);
                corbaStruct.getMember().add(member);
            }
        }

        if (complex.getParticle() != null) {
            List members = processContainerAsMembers(complex.getParticle(), defaultName, schematypeName);

            for (Iterator it = members.iterator(); it.hasNext();) {
                MemberType memberType = (MemberType)it.next();
                corbaStruct.getMember().add(memberType);
            }
        }

        return corbaStruct;
    }
View Full Code Here

        }
        return union;
    }
   
    private IdlType createStruct(CorbaTypeImpl ctype, IdlScopeBase scope, String local) {
        Struct s = (Struct)ctype;
        boolean undefinedCircular = false;
        IdlStruct struct = IdlStruct.create(scope, local);
        scope.holdForScope(struct);

        Iterator it = s.getMember().iterator();
        while (it.hasNext()) {
            MemberType m = (MemberType)it.next();
            QName qname = m.getIdltype();
            IdlType type = findType(qname);           
           
View Full Code Here

        } else if (obj instanceof Sequence) {
            Sequence seqType = (Sequence)obj;
            tc = orb.create_sequence_tc((int) seqType.getBound(),
                                        getTypeCode(orb, seqType.getElemtype(), typeMaps));
        } else if (obj instanceof Struct) {
            Struct structType = (Struct)obj;

            // TODO: check to see if this is a recursive type.
            List list = structType.getMember();
            StructMember[] members = new StructMember[list.size()];
            for (int i = 0; i < members.length; ++i) {
                MemberType member = (MemberType) list.get(i);
                members[i] = new StructMember(member.getName(),
                                              getTypeCode(orb, member.getIdltype(), typeMaps), null);
            }
            String name = structType.getName();
            tc = orb.create_struct_tc(structType.getRepositoryID(), name, members);
        } else if (obj instanceof Union) {
            tc = getUnionTypeCode(orb, obj, typeMaps);
        }
        return tc;
    }
View Full Code Here

TOP

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

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.