Package org.apache.tuscany.sca.interfacedef.util

Examples of org.apache.tuscany.sca.interfacedef.util.WrapperInfo


            List<ElementInfo> outputElements = new ArrayList<ElementInfo>();
            WebResult result = method.getAnnotation(WebResult.class);
            outputElements.add(new ElementInfo(new QName(result.targetNamespace(), result.name()), null));

            WrapperInfo wrapperInfo =
                new WrapperInfo(JAXB_DATABINDING, new ElementInfo(inputWrapper, null), new ElementInfo(outputWrapper,
                                                                                                       null),
                                inputElements, outputElements);
            operation.setWrapper(wrapperInfo);
            // operation.setDataBinding(JAXB_DATABINDING); // could be JAXB or SDO
View Full Code Here


                if (out != null) {
                    for (XmlSchemaElement e : getOutputChildElements()) {
                        outChildren.add(getElementInfo(e));
                    }
                }
                wrapperInfo = new WrapperInfo(dataBinding, in, out, inChildren, outChildren);
            }
            return wrapperInfo;
        }
View Full Code Here

            operationModel.setInputType(getInputType());
            operationModel.setOutputType(getOutputType());

            operationModel.setWrapperStyle(isWrapperStyle());
            if (isWrapperStyle()) {
                WrapperInfo wrapperInfo = getWrapper().getWrapperInfo();
                operationModel.setWrapper(wrapperInfo);
            }
        }
        return operationModel;
    }
View Full Code Here

                        }

                    }
                }
                if (op.isWrapperStyle()) {
                    WrapperInfo wrapper = op.getWrapper();
                    if (wrapper != null) {
                        DataType<List<DataType>> unwrappedInputType = wrapper.getUnwrappedInputType();
                        if (unwrappedInputType != null) {
                            for (DataType d : unwrappedInputType.getLogical()) {
                                if (d.getDataBinding() == null) {
                                    d.setDataBinding(dataBinding);
                                }
                            }
                        }
                        DataType unwrappedOutputType = wrapper.getUnwrappedOutputType();
                        if (unwrappedOutputType != null && unwrappedOutputType.getDataBinding() == null) {
                            unwrappedOutputType.setDataBinding(dataBinding);
                        }
                    }
                }
View Full Code Here

                    setDataBinding(d, dataBinding);
                    setDataBinding((DataType) d.getLogical(), dataBinding);
                }
            }
            if (op.isWrapperStyle()) {
                WrapperInfo wrapper = op.getWrapper();
                if (wrapper != null) {
                    DataType<List<DataType>> unwrappedInputType = wrapper.getUnwrappedInputType();
                    if (unwrappedInputType != null) {
                        for (DataType d : unwrappedInputType.getLogical()) {
                            setDataBinding(d, dataBinding);
                        }
                    }
                    DataType unwrappedOutputType = wrapper.getUnwrappedOutputType();
                    if (unwrappedOutputType != null) {
                        setDataBinding(unwrappedOutputType, dataBinding);
                    }
                }
            }
View Full Code Here

        String targetDataBinding = getDataBinding(targetOp);
        targetWrapperHandler = getWrapperHandler(targetDataBinding, targetWrapped);

        if ((!sourceWrapped && !sourceBare) && targetWrapped) {
            // Unwrapped --> Wrapped
            WrapperInfo wrapper = targetOp.getInputWrapper();
            // ElementInfo wrapperElement = wrapper.getInputWrapperElement();

            // Class<?> targetWrapperClass = wrapper != null ? wrapper.getInputWrapperClass() : null;

            if (source == null) {
                // Empty child elements
                Object targetWrapper = targetWrapperHandler.create(targetOp, true);
                return new Object[] {targetWrapper};
            }

            // If the source can be wrapped, wrapped it first
            if (sourceWrapperHandler != null) {
                WrapperInfo sourceWrapperInfo = sourceOp.getInputWrapper();
                DataType sourceWrapperType = sourceWrapperInfo != null ? sourceWrapperInfo.getWrapperType() : null;

                // We only do wrapper to wrapper transformation if the source has a wrapper and both sides
                // match by XML structure
                if (sourceWrapperType != null && matches(sourceOp.getInputWrapper(), targetOp.getInputWrapper())) {
                    Class<?> sourceWrapperClass = sourceWrapperType.getPhysical();

                    // Create the source wrapper
                    Object sourceWrapper = sourceWrapperHandler.create(sourceOp, true);

                    // Populate the source wrapper
                    if (sourceWrapper != null) {
                        sourceWrapperHandler.setChildren(sourceWrapper,
                                                         source,
                                                         sourceOp,
                                                         true);

                        // Transform the data from source wrapper to target wrapper
                        Object targetWrapper =
                            mediator.mediate(sourceWrapper, sourceWrapperType, targetType.getLogical().get(0), context
                                .getMetadata());
                        return new Object[] {targetWrapper};
                    }
                }
            }
            // Fall back to child by child transformation
            Object targetWrapper = targetWrapperHandler.create(targetOp, true);
            List<DataType> argTypes = wrapper.getUnwrappedInputType().getLogical();
            Object[] targetChildren = new Object[source.length];
            for (int i = 0; i < source.length; i++) {
                // ElementInfo argElement = wrapper.getInputChildElements().get(i);
                DataType<XMLType> argType = argTypes.get(i);
                targetChildren[i] =
                    mediator.mediate(source[i], sourceType.getLogical().get(i), argType, context.getMetadata());
            }
            targetWrapperHandler.setChildren(targetWrapper,
                                             targetChildren,
                                             targetOp,
                                             true);
            return new Object[] {targetWrapper};

        } else if (sourceWrapped && (!targetWrapped && !targetBare)) {
            // Wrapped to Unwrapped
            Object sourceWrapper = source[0];
            Object[] target = null;

            // List<ElementInfo> childElements = sourceOp.getWrapper().getInputChildElements();
            if (targetWrapperHandler != null) {
                // ElementInfo wrapperElement = sourceOp.getWrapper().getInputWrapperElement();
                // FIXME: This is a workaround for the wsdless support as it passes in child elements
                // under the wrapper that only matches by position
                if (sourceWrapperHandler.isInstance(sourceWrapper, sourceOp, true)) {

                    WrapperInfo targetWrapperInfo = targetOp.getInputWrapper();
                    DataType targetWrapperType =
                        targetWrapperInfo != null ? targetWrapperInfo.getWrapperType() : null;
                    if (targetWrapperType != null && matches(sourceOp.getInputWrapper(), targetOp.getInputWrapper())) {
                        Object targetWrapper =
                            mediator.mediate(sourceWrapper, sourceType.getLogical().get(0), targetWrapperType, context
                                .getMetadata());
                        target = targetWrapperHandler.getChildren(targetWrapper, targetOp, true).toArray();
View Full Code Here

        }
        return wrapperHandler;
    }

    private String getDataBinding(Operation operation) {
        WrapperInfo wrapper = operation.getInputWrapper();
        if (wrapper != null) {
            return wrapper.getDataBinding();
        } else {
            return null;
        }
    }
View Full Code Here

                    }
                }

                if (op.isInputWrapperStyle()) {
                    WrapperInfo inputWrapperInfo = op.getInputWrapper();
                    if (inputWrapperInfo != null) {
                        DataType<List<DataType>> unwrappedInputType = inputWrapperInfo.getUnwrappedInputType();
                        if (unwrappedInputType != null) {
                            for (DataType d : unwrappedInputType.getLogical()) {
                                if (d.getDataBinding() == null) {
                                    d.setDataBinding(dataBinding);
                                }
                            }
                        }
                    }
                }

                if (op.isOutputWrapperStyle()) {
                    WrapperInfo outputWrapperInfo = op.getOutputWrapper();
                    if (outputWrapperInfo != null){
                        DataType unwrappedOutputType = outputWrapperInfo.getUnwrappedOutputType();
                        if (unwrappedOutputType != null && unwrappedOutputType.getDataBinding() == null) {
                            unwrappedOutputType.setDataBinding(dataBinding);
                        }
                    }
                }
View Full Code Here

                    setDataBinding((DataType) d.getLogical(), dataBinding);
                }
            }

            if (op.isInputWrapperStyle()) {
                WrapperInfo inputWrapperInfo = op.getInputWrapper();
                if (inputWrapperInfo != null) {
                    DataType<List<DataType>> unwrappedInputType = inputWrapperInfo.getUnwrappedInputType();
                    if (unwrappedInputType != null) {
                        for (DataType d : unwrappedInputType.getLogical()) {
                            setDataBinding(d, dataBinding);
                        }
                    }
                }
            }

            if (op.isOutputWrapperStyle()) {
                WrapperInfo outputWrapperInfo = op.getOutputWrapper();
                if (outputWrapperInfo != null){
                    DataType unwrappedOutputType = outputWrapperInfo.getUnwrappedOutputType();
                    if (unwrappedOutputType != null) {
                        setDataBinding(unwrappedOutputType, dataBinding);
                    }
                }
            }
View Full Code Here

        return dataTypes;
    }

    @SuppressWarnings("unchecked")
    private static void getDataTypes(List<DataType> dataTypes, Operation op, boolean useWrapper) {
        WrapperInfo inputWrapperInfo = op.getInputWrapper();
        WrapperInfo outputWrapperInfo = op.getOutputWrapper();
       
        if (useWrapper && (inputWrapperInfo != null)) {
            DataType dt1 = inputWrapperInfo.getWrapperType();
            if (dt1 != null) {
                dataTypes.add(dt1);
            }
        }
        if (useWrapper && (outputWrapperInfo != null)) {
            DataType dt2 = outputWrapperInfo.getWrapperType();
            if (dt2 != null) {
                dataTypes.add(dt2);
            }
        }
        // FIXME: [rfeng] We may need to find the referenced classes in the child types
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.interfacedef.util.WrapperInfo

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.