Package org.apache.cxf.tools.common.model

Examples of org.apache.cxf.tools.common.model.JavaParameter


    public void annotate(JavaAnnotatable jn) {

        JAnnotation jaxbAnnotation = new JAnnotation(XmlJavaTypeAdapter.class);
        jaxbAnnotation.addElement(new JAnnotationElement("value", adapter));
        if (jn instanceof JavaParameter) {
            JavaParameter jp = (JavaParameter)jn;
            jp.addAnnotation("XmlJavaTypeAdapter", jaxbAnnotation);
        } else if (jn instanceof JavaMethod) {
            JavaMethod jm = (JavaMethod)jn;
            jm.addAnnotation("XmlJavaTypeAdapter", jaxbAnnotation);
        } else {
            throw new RuntimeException("Annotation of " + jn.getClass() + " not supported.");
View Full Code Here


                        // other than messages used in porttype operation
                        ParameterProcessor processor = new ParameterProcessor(context);
                        MessagePartInfo exPart = service.getMessage(soapHeader.getMessage())
                            .getMessagePart(new QName(soapHeader.getMessage().getNamespaceURI(),
                                                      soapHeader.getPart()));
                        JavaParameter jp = processor.addParameterFromBinding(jm, exPart, JavaType.Style.OUT);
                        setParameterAsHeader(jp);
                    }
                }
                if (ext instanceof MIMEMultipartRelated && jm.enableMime()) {
                    processMultipart(jm, operation, (MIMEMultipartRelated)ext, JavaType.Style.OUT);
View Full Code Here

                if (extElement instanceof MIMEContent) {
                    MIMEContent mimeContent = (MIMEContent)extElement;
                    String mimeJavaType = getJavaTypeForMimeType(mPart);
                    if (JavaType.Style.IN.equals(style)) {
                        String paramName = ProcessorUtil.mangleNameToVariableName(mimeContent.getPart());
                        JavaParameter jp = jm.getParameter(paramName);
                        if (jp == null) {
                            Message message = new Message("MIMEPART_CANNOT_MAP", LOG, mimeContent.getPart());
                            throw new ToolException(message);
                        }
                        if (!jp.getClassName().equals(mimeJavaType)) {
                            // jp.setType(mimeJavaType);
                            jp.setClassName(mimeJavaType);
                        }
                    } else if (JavaType.Style.OUT.equals(style)) {
                        JavaType jp = null;
                        if (!"void".equals(jm.getReturn().getType())
                            && mimeContent.getPart().equals(jm.getReturn().getName())) {
                            jp = jm.getReturn();
                            jp.setClassName(mimeJavaType);
                        }



                        if (jp == null) {
View Full Code Here

                                    JavaType.Style style, ToolContext context) {
        String name = ProcessorUtil.mangleNameToVariableName(part.getName().getLocalPart());
        String namespace = ProcessorUtil.resolvePartNamespace(part);
        String type = ProcessorUtil.resolvePartType(part, context);
       
        JavaParameter parameter = new JavaParameter(name, type, namespace);
        parameter.setPartName(part.getName().getLocalPart());
        if (part.getXmlSchema() instanceof XmlSchemaSimpleType) {
            processXmlSchemaSimpleType((XmlSchemaSimpleType)part.getXmlSchema(), jm, parameter, part);
        } else if (part.getXmlSchema() instanceof XmlSchemaElement) {
            XmlSchemaElement element = (XmlSchemaElement)part.getXmlSchema();
            if (element.getSchemaType() instanceof XmlSchemaSimpleType) {
                processXmlSchemaSimpleType((XmlSchemaSimpleType)element.getSchemaType(), jm, parameter, part);
            }
        }
        parameter.setQName(ProcessorUtil.getElementName(part));
        parameter.setDefaultValueWriter(ProcessorUtil.getDefaultValueWriter(part, context));
        String fullJavaName = ProcessorUtil.getFullClzName(part, context, false);
       
        parameter.setClassName(fullJavaName);

        if (style == JavaType.Style.INOUT || style == JavaType.Style.OUT) {
            parameter.setHolder(true);
            parameter.setHolderName(javax.xml.ws.Holder.class.getName());
            String holderClass = fullJavaName;
            if (JAXBUtils.holderClass(fullJavaName) != null) {
                holderClass = JAXBUtils.holderClass(fullJavaName).getName();
           
            parameter.setClassName(holderClass);
        }
        parameter.setStyle(style);
       
        return parameter;
    }
View Full Code Here

            && countOutOfBandHeader(inputMessage) == 0) {
            return;
        }
        boolean isSchemaQualified = ProcessorUtil.isSchemaFormQualified(context, part.getElementQName());
        for (QName item : wrappedElements) {
            JavaParameter jp = getParameterFromQName(part.getElementQName(),
                                  item, JavaType.Style.IN, part);
            if (!isSchemaQualified) {
                jp.setTargetNamespace("");
            }

            addParameter(method, jp);
        }
View Full Code Here

        if (outputWrapElement.size() == 1 && inputWrapElement != null) {
            QName outElement = outputWrapElement.iterator().next();
            boolean sameWrapperChild = false;
            for (QName inElement : inputWrapElement) {
                if (isSameWrapperChild(inElement, outElement)) {
                    JavaParameter  jp = getParameterFromQName(outputPart.getElementQName(), outElement,
                                                              JavaType.Style.INOUT, outputPart);
                    if (!qualified) {
                        jp.setTargetNamespace("");
                    }
                    addParameter(method, jp);
                    sameWrapperChild = true;
                    if (method.getReturn() == null) {
                        addVoidReturn(method);
                    }
                    break;
                }
            }
            if (!sameWrapperChild) {
                JavaReturn jreturn = getReturnFromQName(outElement, outputPart);
                if (!qualified) {
                    jreturn.setTargetNamespace("");
                }
                method.setReturn(jreturn);
                return;
            }

        }

        for (QName outElement : outputWrapElement) {
            if ("return".equals(outElement.getLocalPart())) {
                if (method.getReturn() != null) {
                    org.apache.cxf.common.i18n.Message msg =
                        new org.apache.cxf.common.i18n.Message("WRAPPER_STYLE_TWO_RETURN_TYPES", LOG);
                    throw new ToolException(msg);
                }
                JavaReturn jreturn = getReturnFromQName(outElement, outputPart);
                if (!qualified) {
                    jreturn.setTargetNamespace("");
                }
                method.setReturn(jreturn);
                continue;
            }
            boolean sameWrapperChild = false;
            if (inputWrapElement != null) {
                for (QName inElement : inputWrapElement) {
                    if (isSameWrapperChild(inElement, outElement)) {
                        JavaParameter  jp = getParameterFromQName(outputPart.getElementQName(), outElement,
                                                                  JavaType.Style.INOUT, outputPart);
                        if (!qualified) {
                            jp.setTargetNamespace("");
                        }
                        addParameter(method, jp);
                        sameWrapperChild = true;
                        break;
                    }
                }
            }
            if (!sameWrapperChild) {
                JavaParameter  jp = getParameterFromQName(outputPart.getElementQName(), outElement,
                                                          JavaType.Style.OUT, outputPart);
                if (!qualified) {
                    jp.setTargetNamespace("");
                }
                addParameter(method, jp);
            }
        }
        if (method.getReturn() == null) {
View Full Code Here

        fullJavaName = this.dataBinding.getWrappedElementType(wrapperElement, item);

        String targetNamespace = item.getNamespaceURI();

        String jpname = ProcessorUtil.mangleNameToVariableName(item.getLocalPart());
        JavaParameter parameter = new JavaParameter(jpname, fullJavaName, targetNamespace);
        parameter.setStyle(style);
        parameter.setQName(item);

        parameter.setDefaultValueWriter(ProcessorUtil.getDefaultValueWriterForWrappedElement(part,
                                                                                             context,
                                                                                             item));

        if (style == JavaType.Style.OUT || style == JavaType.Style.INOUT) {
            parameter.setHolder(true);
            parameter.setHolderName(javax.xml.ws.Holder.class.getName());
            String holderClass = fullJavaName;
            if (JAXBUtils.holderClass(fullJavaName) != null) {
                holderClass = JAXBUtils.holderClass(fullJavaName).getName();
            }
            parameter.setClassName(holderClass);
        }
        return parameter;

    }
View Full Code Here

        JAXWSBinding mBinding = inputMessage.getOperation().getExtensor(JAXWSBinding.class);
        for (MessagePartInfo part : inputMessage.getMessageParts()) {
            if (isOutOfBandHeader(part) && !requireOutOfBandHeader()) {
                continue;
            }
            JavaParameter param = getParameterFromPart(method, part, JavaType.Style.IN);
            if (mBinding != null && mBinding.getJaxwsParas() != null) {
                for (JAXWSParameter jwp : mBinding.getJaxwsParas()) {
                    if (part.getName().getLocalPart().equals(jwp.getPart())) {
                        param.setName(jwp.getName());
                    }
                }
            }
            addParameter(method, param);
        }
View Full Code Here

            && countOutOfBandHeader(inputMessage) == 0) {
            return;
        }
        JAXWSBinding mBinding = inputMessage.getOperation().getExtensor(JAXWSBinding.class);
        for (QName item : wrappedElements) {
            JavaParameter jp = getParameterFromQName(part.getElementQName(),
                                  item, JavaType.Style.IN, part);
            if (mBinding != null && mBinding.getJaxwsParas() != null) {
                for (JAXWSParameter jwsp : mBinding.getJaxwsParas()) {
                    if (item.equals(jwsp.getElementName())) {
                        jp.setName(jwsp.getName());
                    }
                }
            }
           
            if (StringUtils.isEmpty(part.getConcreteName().getNamespaceURI())) {
                jp.setTargetNamespace("");
            }

            addParameter(method, jp);
        }
View Full Code Here

                processReturn(method, null);
            }
            JAXWSBinding mBinding = outputMessage.getOperation().getExtensor(JAXWSBinding.class);
            for (MessagePartInfo part : outParts) {

                JavaParameter param = getParameterFromPart(method, part, JavaType.Style.OUT);
                if (mBinding != null && mBinding.getJaxwsParas() != null) {
                    for (JAXWSParameter jwp : mBinding.getJaxwsParas()) {
                        if (part.getName().getLocalPart().equals(jwp.getPart())) {
                            param.setName(jwp.getName());
                        }
                    }
                }

                addParameter(method, param);
View Full Code Here

TOP

Related Classes of org.apache.cxf.tools.common.model.JavaParameter

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.