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

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


    public void testArrayHandler() {
        objName = new QName("object");
        objIdlType = new QName(CorbaConstants.NU_WSDL_CORBA, "arrayType", CorbaConstants.NP_WSDL_CORBA);
        objTypeCode = orb.create_array_tc(5, orb.get_primitive_tc(TCKind.tk_long));
        Array arrayType = new Array();
        arrayType.setName("arrayType");
        arrayType.setElemtype(CorbaConstants.NT_CORBA_LONG);
        arrayType.setBound(5);
        arrayType.setRepositoryID("IDL:ArrayType:1.0");
        obj = new CorbaArrayHandler(objName, objIdlType, objTypeCode, arrayType);
        assertNotNull(obj);

        int arrayData[] = { 2, 4, 6, 8, 10 };
        for (int i = 0 ; i < arrayData.length; ++i) {
View Full Code Here


            WSDLToIDLAction idlgen = new WSDLToIDLAction();
            idlgen.setBindingName("XCORBABinding");
            idlgen.setOutputFile("atype.idl");
            idlgen.generateIDL(model);

            Array arr = (Array)mapType.getStructOrExceptionOrUnion().get(0);           
            assertEquals("ElementType is incorrect for Array Type", "X._5_A",
                         arr.getElemtype().getLocalPart());
           
            Anonarray arr2 = (Anonarray)mapType.getStructOrExceptionOrUnion().get(3);
            assertEquals("ElementType is incorrect for Anon Array Type", "X._4_A",
                         arr2.getElemtype().getLocalPart());
           
View Full Code Here

           
        //schematypeName = checkPrefix(schematypeName);

        if (!anonymous) {
            //Create an Array
            Array corbaArray = new Array();
            corbaArray.setName(name.getLocalPart());
            corbaArray.setType(schematypeName);
            corbaArray.setElemtype(arrayType);
            corbaArray.setBound(bound);
            corbaArray.setRepositoryID(repoString + name.getLocalPart().replace('.', '/') + idlversion);
            corbaArray.setQName(name);           
            corbatype = corbaArray;
        } else {
            //Create an Anonymous Array
            Anonarray corbaArray = new Anonarray();
            corbaArray.setName(name.getLocalPart());
            corbaArray.setType(schematypeName);           
            corbaArray.setElemtype(arrayType);
            corbaArray.setBound(bound);
            corbaArray.setQName(name);                       
            corbatype = corbaArray;
        }          
        return corbatype;
    }
View Full Code Here

        int data[] = { 1, 1, 2, 3, 5, 8, 13, 21 };
       
        // create an array of longs
        QName longIdlType = new QName(CorbaConstants.NU_WSDL_CORBA, "long", CorbaConstants.NP_WSDL_CORBA);
        QName arrayIdlType = new QName(CorbaConstants.NU_WSDL_CORBA, "array", CorbaConstants.NP_WSDL_CORBA);
        Array arrayType = new Array();
        arrayType.setBound(data.length);
        arrayType.setElemtype(longIdlType);
        // name and respoitory ID of the array are not needed for this test

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

        QName objIdlType = new QName(staxTestNamespaceURI, "TestArray", staxTestPrefix);
        TypeCode objTypeCode = CorbaUtils.getTypeCode(orb, objIdlType, staxBindingImpl.getCorbaTypeMaps());
        CorbaTypeImpl type = CorbaUtils.getCorbaType(objIdlType, staxBindingImpl.getCorbaTypeMaps());
        assertTrue(type instanceof Array);

        Array arrayType = (Array)type;
        CorbaArrayHandler obj = new CorbaArrayHandler(objName, objIdlType, objTypeCode, arrayType);
        assertNotNull(obj);

        List<CorbaObjectHandler> objElements = new ArrayList<CorbaObjectHandler>();
        int arrayData[] = { 2, 4, 6, 8, 10 };
View Full Code Here

                                              QName name, List<CorbaTypeMap> typeMaps) {
        QName arrayElementType = null;
        long arrayBound = 0;
        CorbaTypeImpl baseType = obj.getType();
        if (baseType instanceof Array) {
            Array arrayType = (Array)baseType;
            arrayElementType = arrayType.getElemtype();
            arrayBound = arrayType.getBound();
        } else {
            Anonarray anonArrayType = (Anonarray)baseType;
            arrayElementType = anonArrayType.getElemtype();
            arrayBound = anonArrayType.getBound();
        }
View Full Code Here

                mappingType.getStructOrExceptionOrUnion().add(unionType);
            } else if (currentNode.getNodeName().equals("corba:alias")) {
                Alias aliasType = getAliasDefinition(currentNode, def);
                mappingType.getStructOrExceptionOrUnion().add(aliasType);
            } else if (currentNode.getNodeName().equals("corba:array")) {
                Array arrayType = getArrayDefinition(currentNode, def);
                mappingType.getStructOrExceptionOrUnion().add(arrayType);
            } else if (currentNode.getNodeName().equals("corba:sequence")) {
                Sequence sequenceType = getSequenceDefinition(currentNode, def);
                mappingType.getStructOrExceptionOrUnion().add(sequenceType);
            } else if (currentNode.getNodeName().equals("corba:anonstring")) {
View Full Code Here

        }
        return aliasType;
    }

    public Array getArrayDefinition(Node node, Definition def) {
        Array arrayType = new Array();

        // Store information about the array
        NamedNodeMap arrayAttributes = node.getAttributes();
        for (int i = 0; i < arrayAttributes.getLength(); ++i) {
            if (arrayAttributes.item(i).getNodeName().equals("name")) {
                arrayType.setName(arrayAttributes.item(i).getNodeValue());
            } else if (arrayAttributes.item(i).getNodeName().equals("repositoryID")) {
                arrayType.setRepositoryID(arrayAttributes.item(i).getNodeValue());
            } else if (arrayAttributes.item(i).getNodeName().equals("elemtype")) {
                String elemType = arrayAttributes.item(i).getNodeValue();
                int seperatorIndex = elemType.indexOf(':');
                String prefix = elemType.substring(0, seperatorIndex);
                String localPart = elemType.substring(seperatorIndex + 1, elemType.length());
                arrayType.setElemtype(new QName(def.getNamespace(prefix), localPart, prefix));
            } else if (arrayAttributes.item(i).getNodeName().equals("bound")) {
                arrayType.setBound(Long.parseLong(arrayAttributes.item(i).getNodeValue()));
            }
        }
        return arrayType;
    }
View Full Code Here

            if (typeDefinition instanceof Anonarray) {
                Anonarray anonArrayType = (Anonarray)typeDefinition;
                arrayElemType = anonArrayType.getElemtype();
                arrayBound = anonArrayType.getBound();
            } else {
                Array arrayType = (Array)typeDefinition;
                arrayElemType = arrayType.getElemtype();
                arrayBound = arrayType.getBound();
            }
            StartElement arrayStartEl = reader.nextEvent().asStartElement();
            obj = new CorbaArrayHandler(arrayStartEl.getName(), idlType, tc, typeDefinition);
            for (int i = 0; i < arrayBound; ++i) {
                CorbaObjectHandler element = readObjectFromStax(reader, arrayElemType, true);
View Full Code Here

        return idlType;
    }
   
    private IdlType createArray(CorbaTypeImpl ctype, IdlScopeBase scope, String local) {
        IdlType idlType = null;
        Array s = (Array)ctype;
        IdlType base = findType(s.getElemtype());       
        int bound = (int)s.getBound();
        idlType = IdlArray.create(scope, local, base, bound);
        scope.addToScope(idlType);
        return idlType;
    }
View Full Code Here

TOP

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

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.