Examples of ElementInfo


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

        }
        */

        public WrapperInfo getWrapperInfo() throws InvalidWSDLException {
            if (wrapperInfo == null) {
                ElementInfo in = getElementInfo(getInputWrapperElement());
                ElementInfo out = getElementInfo(getOutputWrapperElement());
                List<ElementInfo> inChildren = new ArrayList<ElementInfo>();
                if (in != null) {
                    for (XmlSchemaElement e : getInputChildElements()) {
                        inChildren.add(getElementInfo(e));
                    }
View Full Code Here

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

            // Bare style
            int i = 0;
            for (DataType d : op.getInputType().getLogical()) {
                inputMsg.addPart(generatePart(definition, d, "arg" + i));
                elements = new ArrayList<ElementInfo>();
                ElementInfo element = getElementInfo(d.getPhysical(), d, null, helpers);
                elements.add(element);
                QName elementName = ((XMLType)d.getLogical()).getElementName();
                wrappers.put(elementName, elements);
                i++;
            }
        }
        input.setMessage(inputMsg);
        operation.setInput(input);

        if (!op.isNonBlocking()) {
            Output output = definition.createOutput();
            Message outputMsg = definition.createMessage();
            QName outputMsgName = new QName(namespaceURI, op.getName() + "Response");
            outputMsg.setQName(outputMsgName);
            outputMsg.setUndefined(false);
            definition.addMessage(outputMsg);

            if (op.getWrapper() != null) {
                outputMsg.addPart(generateWrapperPart(definition, op, helpers, wrappers, false));
            } else {
               
                if ((op.getOutputType() != null) && ( op.getOutputType().getLogical().size() != 0)) {
                  DataType outputType = op.getOutputType().getLogical().get(0);
                    outputMsg.addPart(generatePart(definition, outputType, "return"));
                    elements = new ArrayList<ElementInfo>();
                    ElementInfo element = getElementInfo(outputType.getPhysical(), outputType, null, helpers);
                    elements.add(element);
                    QName elementName = ((XMLType)outputType.getLogical()).getElementName();
                    wrappers.put(elementName, elements);
                }
            }
View Full Code Here

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

        Part part = definition.createPart();
        String partName = input ? operation.getName() : (operation.getName() + "Response");
        part.setName(partName);
        WrapperInfo opWrapper = operation.getWrapper();
        if (opWrapper != null) {
            ElementInfo elementInfo =
                input ? opWrapper.getInputWrapperElement() : opWrapper.getOutputWrapperElement();
            List<ElementInfo> elements =
                input ? opWrapper.getInputChildElements() : opWrapper.getOutputChildElements();
            QName wrapperName = elementInfo.getQName();
            part.setElementName(wrapperName);
            addNamespace(definition, wrapperName);
            wrappers.put(wrapperName, elements);

            // FIXME: [rfeng] Ideally, we should try to register the wrappers only. But we are
View Full Code Here

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

                    XMLType xmlType = (XMLType)dataType.getLogical();
                    if (xmlType.getElementName() != null) {
                        element = xmlType.getElementName();
                    }
                }
                return new ElementInfo(element, new TypeInfo(ANYTYPE_QNAME, false, null));
                // throw new ServiceRuntimeException("No data binding for " + db);
            }

            helper = dataBinding.getXMLTypeHelper();
            if (helper == null) {
                // Default to JAXB
                helper = helpers.get(JAXBDataBinding.NAME);
                if (helper == null) {
                    helper = dataBindings.getDataBinding(JAXBDataBinding.NAME).getXMLTypeHelper();
                    helpers.put(JAXBDataBinding.NAME, helper);
                }
            }
            helpers.put(db, helper);
        }
        // TUSCANY-3616 - don't revert a byte[] to a byte type but retain the mapping to base64Binary
        //                which is carried in the dataType and the original javaType
        TypeInfo typeInfo = null;
        ElementInfo element = null;
        if (byte[].class == javaType){
            typeInfo = helper.getTypeInfo(javaType, dataType.getLogical());
            element = new ElementInfo(name, typeInfo);
            element.setMany(false);
        } else {
            typeInfo = helper.getTypeInfo(javaType.isArray() ? javaType.getComponentType() : javaType, dataType.getLogical());
            element = new ElementInfo(name, typeInfo);
            element.setMany(javaType.isArray());
        }

        element.setNillable(!javaType.isPrimitive());
        return element;
    }
View Full Code Here

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

    }

    public Node create(Operation operation, boolean input) {

        WrapperInfo wrapperInfo = operation.getWrapper();
        ElementInfo element = input ? wrapperInfo.getInputWrapperElement() : wrapperInfo.getOutputWrapperElement();
        // Class<?> wrapperClass = input ? wrapperInfo.getInputWrapperClass() : wrapperInfo.getOutputWrapperClass();
        Document document = domHelper.newDocument();
        QName name = element.getQName();
        return DOMHelper.createElement(document, name);
    }
View Full Code Here

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

    /**
     * @see org.apache.tuscany.sca.databinding.WrapperHandler#getWrapperType(Operation, boolean)
     */
    public DataType getWrapperType(Operation operation, boolean input) {
        WrapperInfo wrapper = operation.getWrapper();
        ElementInfo element = input? wrapper.getInputWrapperElement(): wrapper.getOutputWrapperElement();
        DataType<XMLType> wrapperType =
            new DataTypeImpl<XMLType>(DOMDataBinding.NAME, Node.class, new XMLType(element));
        return wrapperType;
    }
View Full Code Here

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

    public boolean isInstance(Object wrapperObj,
                              Operation operation,
                              boolean input) {
        WrapperInfo wrapperInfo = operation.getWrapper();
        ElementInfo element = input ? wrapperInfo.getInputWrapperElement() : wrapperInfo.getOutputWrapperElement();
        List<ElementInfo> childElements =
            input ? wrapperInfo.getInputChildElements() : wrapperInfo.getOutputChildElements();
        Node wrapper = (Node)wrapperObj;
        if (wrapper.getNodeType() == Node.DOCUMENT_NODE) {
            wrapper = ((Document)wrapper).getDocumentElement();
        }
        QName elementName = new QName(wrapper.getNamespaceURI(), wrapper.getLocalName());
        if (!element.getQName().equals(elementName)) {
            return false;
        }
        Set<QName> names = new HashSet<QName>();
        for (ElementInfo e : childElements) {
            names.add(e.getQName());
View Full Code Here

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

      this.domHelper = DOMHelper.getInstance(registry);
        this.handler = new DOMWrapperHandler(domHelper);

        List<ElementInfo> elements = new ArrayList<ElementInfo>();
        for (QName inQName : new QName[] { INPUT1, INPUT2, INPUT3, INPUT4 }) {
            ElementInfo e = new ElementInfo(inQName, null);
            e.setNillable(true);
            elements.add(e);
        }
        // INPUT1,4 are like maxOccurs="unbounded"
        elements.get(0).setMany(true);
        elements.get(3).setMany(true);
View Full Code Here

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

        this.factory = OMAbstractFactory.getOMFactory();
    }

    public OMElement create(Operation operation, boolean input) {
        WrapperInfo wrapperInfo = operation.getWrapper();
        ElementInfo element = input ? wrapperInfo.getInputWrapperElement() : wrapperInfo.getOutputWrapperElement();
        // Class<?> wrapperClass = input ? wrapperInfo.getInputWrapperClass() : wrapperInfo.getOutputWrapperClass();
        OMElement wrapper = AxiomHelper.createOMElement(factory, element.getQName());
        return wrapper;
    }
View Full Code Here

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

       
        // Since not all the ElementInfo(s) will be represented, (if some elements don't appear as children
        // of the wrapper payload, we need to loop through the schema
        for (int index=0; index < groupedElementList.size(); index++) {         
            List<OMElement> elements = groupedElementList.get(index);
            ElementInfo childElement = childElements.get(index)
            if (!childElement.isMany()) {
                Object next = elements.isEmpty() ? null : attachXSIType(childElement, elements.get(0));
                retVal.add(next);
            } else {
                Object[] array = elements.toArray();
                for (Object item : array) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.