Package org.apache.tuscany.sca.interfacedef

Examples of org.apache.tuscany.sca.interfacedef.DataType


                OperationTypes operationTypes = new OperationTypes();
                List<TypeTree> inputInstances = new ArrayList<TypeTree>();
                // cache output type tree
                if (operation.getOutputType() != null) {
                    // Should only be one output, since this was created when we only supported one output.
                    DataType returnType = operation.getOutputType().getLogical().get(0);
                    Class<?> returnClass = returnType.getPhysical();
                    if (returnClass != null && !returnClass.equals(void.class)) {
                        Annotation[] notes = operationMethodMapping.get(operation).getAnnotations();                   
                        TypeTree outputType =
                            TypeTreeCreator.createTypeTree(returnClass, notes);
                        operationTypes.setOutputType(outputType);
View Full Code Here


     */
    public DataType<List<DataType>> getUnwrappedInputType() {
        if (unwrappedInputType == null) {
            List<DataType> childTypes = new ArrayList<DataType>();
            for (ElementInfo element : getInputChildElements()) {
                DataType type = getDataType(element);
                childTypes.add(type);
            }
            unwrappedInputType = new DataTypeImpl<List<DataType>>("idl:unwrapped.input", Object[].class, childTypes);
        }
        return unwrappedInputType;
View Full Code Here

        }
        return unwrappedInputType;
    }

    private DataType getDataType(ElementInfo element) {
        DataType type = null;
        if (element.isMany()) {
            DataType logical = new DataTypeImpl<XMLType>(dataBinding, Object.class, new XMLType(element));
            type = new DataTypeImpl<DataType>("java:array", Object[].class, logical);
        } else {
            type = new DataTypeImpl<XMLType>(dataBinding, Object.class, new XMLType(element));
        }
        return type;
View Full Code Here

     */
    public DataType<List<DataType>> getUnwrappedOutputType() {
        if (unwrappedOutputType == null) {
            List<DataType> childTypes = new ArrayList<DataType>();
            for (ElementInfo element : getOutputChildElements()) {
                DataType type = getDataType(element);
                childTypes.add(type);
            }
            unwrappedOutputType = new DataTypeImpl<List<DataType>>("idl:unwrapped.input", Object[].class, childTypes);
        }
        return unwrappedOutputType;    }
View Full Code Here

            copy.outputWrapperType = (DataType<XMLType>)outputWrapperType.clone();
        }
        if (unwrappedInputType != null) {
            List<DataType> clonedLogicalTypes = new ArrayList<DataType>();
            for (DataType t : unwrappedInputType.getLogical()) {
                DataType type = (DataType) t.clone();
                clonedLogicalTypes.add(type);
            }
            DataType<List<DataType>> clonedUnwrappedInputType =
                new DataTypeImpl<List<DataType>>(unwrappedInputType.getPhysical(), clonedLogicalTypes);
            clonedUnwrappedInputType.setDataBinding(unwrappedInputType.getDataBinding());
            copy.unwrappedInputType = clonedUnwrappedInputType;
        }
        if (unwrappedOutputType != null) {
            List<DataType> clonedLogicalTypes = new ArrayList<DataType>();
            for (DataType t : unwrappedOutputType.getLogical()) {
                DataType type = (DataType) t.clone();
                clonedLogicalTypes.add(type);
            }
            DataType<List<DataType>> clonedUnwrappedOutputType =
                new DataTypeImpl<List<DataType>>(unwrappedOutputType.getPhysical(), clonedLogicalTypes);
            clonedUnwrappedOutputType.setDataBinding(unwrappedOutputType.getDataBinding());
View Full Code Here

    }

    @Test
    public void testOutputTypes() throws Exception {
        InterfaceContract source = new MockContract("FooContract");
        DataType sourceStringType =  new DataTypeImpl<Type>(String.class, String.class);
        ArrayList sourceTypes = new ArrayList();
        sourceTypes.add(sourceStringType);
        DataType sourceOutputType = new DataTypeImpl(Object[].class, sourceTypes);
        Operation opSource1 = newOperation("op1");
        opSource1.setOutputType(sourceOutputType);
        Map<String, Operation> sourceOperations = new HashMap<String, Operation>();
        sourceOperations.put("op1", opSource1);
        source.getInterface().getOperations().addAll(sourceOperations.values());

        InterfaceContract target = new MockContract("FooContract");
        DataType stringType = new DataTypeImpl<Type>(String.class, String.class);
        ArrayList types = new ArrayList();
        types.add(stringType);
        DataType targetOutputType = new DataTypeImpl(Object[].class, types);
        Operation opTarget = newOperation("op1");
        opTarget.setOutputType(targetOutputType);
        Map<String, Operation> targetOperations = new HashMap<String, Operation>();
        targetOperations.put("op1", opTarget);
        target.getInterface().getOperations().addAll(targetOperations.values());
View Full Code Here

    }

    @Test
    public void testIncompatibleOutputTypes() throws Exception {
        InterfaceContract source = new MockContract("FooContract");
        DataType sourceType = new DataTypeImpl<Type>(String.class, String.class);
        ArrayList sourceTypes = new ArrayList();
        sourceTypes.add(sourceType);
        DataType sourceOutputType = new DataTypeImpl(Object[].class, sourceTypes);
        Operation opSource1 = newOperation("op1");
        opSource1.setOutputType(sourceOutputType);
        Map<String, Operation> sourceOperations = new HashMap<String, Operation>();
        sourceOperations.put("op1", opSource1);
        source.getInterface().getOperations().addAll(sourceOperations.values());

        InterfaceContract target = new MockContract("FooContract");
        DataType targetType = new DataTypeImpl<Type>(Integer.class, Integer.class);
        ArrayList targetTypes = new ArrayList();
        targetTypes.add(targetType);
        DataType targetOutputType = new DataTypeImpl(Object[].class, targetTypes);
        Operation opTarget = newOperation("op1");
        opTarget.setOutputType(targetOutputType);
        Map<String, Operation> targetOperations = new HashMap<String, Operation>();
        targetOperations.put("op1", opTarget);
        target.getInterface().getOperations().addAll(targetOperations.values());
View Full Code Here

    }

    @Test
    public void testFaultTypes() throws Exception {
        InterfaceContract source = new MockContract("FooContract");
        DataType sourceFaultType = new DataTypeImpl<Type>(String.class, String.class);
        List<DataType> sourceFaultTypes = new ArrayList<DataType>();
        sourceFaultTypes.add(0, sourceFaultType);
        Operation opSource1 = newOperation("op1");
        opSource1.setFaultTypes(sourceFaultTypes);
        Map<String, Operation> sourceOperations = new HashMap<String, Operation>();
        sourceOperations.put("op1", opSource1);
        source.getInterface().getOperations().addAll(sourceOperations.values());

        InterfaceContract target = new MockContract("FooContract");
        DataType targetFaultType = new DataTypeImpl<Type>(String.class, String.class);
        List<DataType> targetFaultTypes = new ArrayList<DataType>();
        targetFaultTypes.add(0, targetFaultType);

        Operation opTarget = newOperation("op1");
        opTarget.setFaultTypes(targetFaultTypes);
View Full Code Here

    }

    @Test
    public void testSourceFaultTargetNoFaultCompatibility() throws Exception {
        InterfaceContract source = new MockContract("FooContract");
        DataType sourceFaultType = new DataTypeImpl<Type>(String.class, String.class);
        List<DataType> sourceFaultTypes = new ArrayList<DataType>();
        sourceFaultTypes.add(0, sourceFaultType);
        Operation opSource1 = newOperation("op1");
        opSource1.setFaultTypes(sourceFaultTypes);
        Map<String, Operation> sourceOperations = new HashMap<String, Operation>();
View Full Code Here

        }
        copy.faultTypes = clonedFaultTypes;

        List<DataType> clonedLogicalTypes = new ArrayList<DataType>();
        for (DataType t : inputType.getLogical()) {
            DataType type = (DataType) t.clone();
            clonedLogicalTypes.add(type);
        }
        DataType<List<DataType>> clonedInputType =
            new DataTypeImpl<List<DataType>>(inputType.getPhysical(), clonedLogicalTypes);
        clonedInputType.setDataBinding(inputType.getDataBinding());
        copy.inputType = clonedInputType;

        if ( outputType != null ) {
            List<DataType> clonedLogicalOutputTypes = new ArrayList<DataType>();
            for ( DataType t : outputType.getLogical()) {
                if ( t == null ) {
                    clonedLogicalOutputTypes.add(null);
                } else {
                    DataType type = (DataType) t.clone();
                    clonedLogicalOutputTypes.add(type);
                }
            }
            DataType<List<DataType>> clonedOutputType =
                new DataTypeImpl<List<DataType>>(outputType.getPhysical(), clonedLogicalOutputTypes);
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.interfacedef.DataType

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.