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

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


                         fx.getName());
                    assertEquals("Type is incorrect for AnonFixed Type", "decimal",
                         fx.getType().getLocalPart());
           
                } else if (type instanceof Struct) {
                    Struct struct = (Struct)type;
                    String[] testResult;
                    if ("X.op_a".equals(struct.getName())) {
                        testResult = new String[]{"X.op_a", "X.op_a", "p1",
                            "X.S", "p2", "X.S"};
                    } else if ("X.op_aResult".equals(struct.getName())) {
                        testResult = new String[]{"X.op_aResult",
                            "X.op_aResult", "return", "X.S", "p2", "X.S"};
                    } else {
                        testResult = new String[]{"X.S", "X.S", "str",
                            "X._1_S", "fx", "X._2_S"};
                    }
                    assertEquals("Name is incorrect for Anon Array Type",
                        testResult[0],
                        struct.getName());           
                    assertEquals("Type is incorrect for Struct Type",
                        testResult[1],
                        struct.getType().getLocalPart());
                    assertEquals("Name for first Struct Member Type is incorrect",
                        testResult[2],
                        struct.getMember().get(0).getName());
                    assertEquals("Idltype for first Struct Member Type is incorrect",
                        testResult[3],
                        struct.getMember().get(0).getIdltype().getLocalPart());           
                    assertEquals("Name for second Struct Member Type is incorrect",
                        testResult[4],
                        struct.getMember().get(1).getName());
                    assertEquals("Idltype for second Struct Member Type is incorrect",
                        testResult[5],
                        struct.getMember().get(1).getIdltype().getLocalPart());
                } else {
                    //System.err.println("Type: " + i + " " + type.getClass().getName());
                }
            }   
            File f = new File("atype.idl");
View Full Code Here


        } else {
            seqName = createQNameCorbaNamespace(schemaTypeName.getLocalPart() + "SequenceStruct");
        }

        schemaTypeName = checkPrefix(schemaTypeName);
        Struct struct = new Struct();
        struct.setName(seqName.getLocalPart());
        struct.setQName(seqName);
        struct.setRepositoryID(REPO_STRING + seqName.getLocalPart().replace('.', '/') + IDL_VERSION);
        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 (seq.getMaxOccurs() != 1 || seq.getMinOccurs() != 1) {
            QName name = createQNameTargetNamespace(type.getQName().getLocalPart() + "Array");
            CorbaTypeImpl atype = createArray(name, type.getQName(), type.getQName(),
                                              seq.getMaxOccurs(), seq.getMinOccurs(), false);

            if (atype != null
                && !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.apache.cxf.common.i18n.Message msg = new org.apache.cxf.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 = REPO_STRING + type.getQName().getLocalPart().replace('.', '/') + IDL_VERSION;
        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 = createQNameTargetNamespace(defaultName.getLocalPart());
            if (defaultName.getNamespaceURI().equals("")) {
                schematypeName = checkPrefix(schematypeName);
            } else {
                schematypeName = checkPrefix(defaultName);
            }
            name = checkPrefix(createQNameCorbaNamespace(defaultName.getLocalPart()));
        } else {
            name = checkPrefix(createQNameCorbaNamespace(schematypeName.getLocalPart()));
        }

        corbaStruct = (Struct)recursionMap.get(name);
        if (corbaStruct != null) {
            return corbaStruct;
        }

        corbaStruct = new Struct();
        corbaStruct.setName(name.getLocalPart());
        corbaStruct.setQName(name);
        String repoId = REPO_STRING + name.getLocalPart().replace('.', '/') + IDL_VERSION;
        corbaStruct.setRepositoryID(repoId);
        corbaStruct.setType(schematypeName);


        recursionMap.put(name, corbaStruct);

        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().isEmpty()) {
            String uri;
            if (schematypeName != null) {
                uri = schematypeName.getNamespaceURI();
            } else {
                uri = defaultName.getNamespaceURI();
            }
            List attlist2 = processAttributesAsMembers(complex.getAttributes(), uri);
            for (int i = 0; i < attlist2.size(); i++) {
                MemberType 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);
            }
        }

        recursionMap.remove(name);
View Full Code Here

        complexType.setName(mapper.mapToQName(structScope));
        XmlSchemaSequence sequence = new XmlSchemaSequence();
        complexType.setParticle(sequence);

        // corba:struct
        Struct struct = new Struct();
        struct.setQName(new QName(typeMap.getTargetNamespace(), structScope.toString()));
        struct.setType(complexType.getQName());
        struct.setRepositoryID(structScope.toIDLRepositoryID());

        boolean recursiveAdd = addRecursiveScopedName(identifierNode);

        // struct members
        visitStructMembers(identifierNode, struct, sequence, structScope);
View Full Code Here

                         fx.getName());
                    assertEquals("Type is incorrect for AnonFixed Type", "decimal",
                         fx.getType().getLocalPart());
           
                } else if (type instanceof Struct) {
                    Struct struct = (Struct)type;
                    String[] testResult;
                    if ("X.op_a".equals(struct.getName())) {
                        testResult = new String[]{"X.op_a", "X.op_a", "p1",
                            "X.S", "p2", "X.S"};
                    } else if ("X.op_aResult".equals(struct.getName())) {
                        testResult = new String[]{"X.op_aResult",
                            "X.op_aResult", "return", "X.S", "p2", "X.S"};
                    } else {
                        testResult = new String[]{"X.S", "X.S", "str",
                            "X._1_S", "fx", "X._2_S"};
                    }
                    assertEquals("Name is incorrect for Anon Array Type",
                        testResult[0],
                        struct.getName());           
                    assertEquals("Type is incorrect for Struct Type",
                        testResult[1],
                        struct.getType().getLocalPart());
                    assertEquals("Name for first Struct Member Type is incorrect",
                        testResult[2],
                        struct.getMember().get(0).getName());
                    assertEquals("Idltype for first Struct Member Type is incorrect",
                        testResult[3],
                        struct.getMember().get(0).getIdltype().getLocalPart());           
                    assertEquals("Name for second Struct Member Type is incorrect",
                        testResult[4],
                        struct.getMember().get(1).getName());
                    assertEquals("Idltype for second Struct Member Type is incorrect",
                        testResult[5],
                        struct.getMember().get(1).getIdltype().getLocalPart());
                } else {
                    //System.err.println("Type: " + i + " " + type.getClass().getName());
                }
            }   
            File f = new File("atype.idl");
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(), typeMap, seenTypes));
            } else if (obj instanceof Struct) {
                Struct structType = (Struct)obj;

                // TODO: check to see if this is a recursive type.
                if (seenTypes.contains(new QName(structType.getName()))) {
                    tc = orb.create_recursive_tc(structType.getRepositoryID());
                } else {
                    seenTypes.push(new QName(structType.getName()));
                    List<MemberType> 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(), typeMap, seenTypes),
                                                 null);
                    }
                    String name = getTypeCodeName(structType.getName());
                    tc = orb.create_struct_tc(structType.getRepositoryID(), name, members);
                    seenTypes.pop();
                }
            } else if (obj instanceof Union) {
                tc = getUnionTypeCode(orb, obj, typeMap, seenTypes);
            }
View Full Code Here

        } else {
            seqName = createQNameCorbaNamespace(schemaTypeName.getLocalPart() + "SequenceStruct");
        }

        schemaTypeName = checkPrefix(schemaTypeName);
        Struct struct = new Struct();
        struct.setName(seqName.getLocalPart());
        struct.setQName(seqName);
        struct.setRepositoryID(REPO_STRING + seqName.getLocalPart().replace('.', '/') + IDL_VERSION);
        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 (seq.getMaxOccurs() != 1 || seq.getMinOccurs() != 1) {
            QName name = createQNameTargetNamespace(type.getQName().getLocalPart() + "Array");
            CorbaTypeImpl atype = createArray(name, type.getQName(), type.getQName(),
                                              seq.getMaxOccurs(), seq.getMinOccurs(), false);

            if (atype != null
                && !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.apache.cxf.common.i18n.Message msg = new org.apache.cxf.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 = REPO_STRING + type.getQName().getLocalPart().replace('.', '/') + IDL_VERSION;
        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 = createQNameTargetNamespace(defaultName.getLocalPart());
            if (defaultName.getNamespaceURI().equals("")) {
                schematypeName = checkPrefix(schematypeName);
            } else {
                schematypeName = checkPrefix(defaultName);
            }
            name = checkPrefix(createQNameCorbaNamespace(defaultName.getLocalPart()));
        } else {
            name = checkPrefix(createQNameCorbaNamespace(schematypeName.getLocalPart()));
        }

        corbaStruct = (Struct)recursionMap.get(name);
        if (corbaStruct != null) {
            return corbaStruct;
        }

        corbaStruct = new Struct();
        corbaStruct.setName(name.getLocalPart());
        corbaStruct.setQName(name);
        String repoId = REPO_STRING + name.getLocalPart().replace('.', '/') + IDL_VERSION;
        corbaStruct.setRepositoryID(repoId);
        corbaStruct.setType(schematypeName);


        recursionMap.put(name, corbaStruct);

        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().isEmpty()) {
            String uri;
            if (schematypeName != null) {
                uri = schematypeName.getNamespaceURI();
            } else {
                uri = defaultName.getNamespaceURI();
            }
            List attlist2 = processAttributesAsMembers(complex.getAttributes(), uri);
            for (int i = 0; i < attlist2.size(); i++) {
                MemberType 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);
            }
        }

        recursionMap.remove(name);
View Full Code Here

TOP

Related Classes of org.apache.cxf.binding.corba.wsdl.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.