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

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


        List<Element> elemList = DOMUtils.findAllElementsByTagNameNS(e,
                                                                     ToolConstants.HANDLER_CHAINS_URI,
                                                                     ToolConstants.HANDLER_CHAIN);
        if (elemList.size() > 0) {
            String fName = ProcessorUtil.getHandlerConfigFileName(this.intf.getName());
            handlerChainAnnotation = new JAnnotation(HandlerChain.class);
            handlerChainAnnotation.addElement(new JAnnotationElement("name",
                                                                     HANDLER_CHAIN_NAME));
            handlerChainAnnotation.addElement(new JAnnotationElement("file", fName + ".xml"));          
            generateHandlerChainFile(e, parseOutputName(this.intf.getPackageName(),
                                                        fName,
View Full Code Here


                    // REVISIT: find a better way to handle Handler gen, should not
                    // pass JavaInterface around.
                    handlerGen.setJavaInterface(intf);
                    handlerGen.generate(getEnvironment());
   
                    JAnnotation annot = handlerGen.getHandlerAnnotation();
                    if (handlerGen.getHandlerAnnotation() != null) {
                        boolean existHandlerAnno = false;
                        for (JAnnotation jann : intf.getAnnotations()) {
                            if (jann.getType() == HandlerChain.class) {
                                existHandlerAnno = true;
                            }
                        }
                        if (!existHandlerAnno) {
                            intf.addAnnotation(annot);
                            intf.addImport("javax.jws.HandlerChain");
                        }
                    }
                }
                if (penv.containsKey(ToolConstants.RUNTIME_DATABINDING_CLASS)) {
                    JAnnotation ann = new JAnnotation(DataBinding.class);
                    JAnnotationElement el
                        = new JAnnotationElement(null,
                                                 penv.get(ToolConstants.RUNTIME_DATABINDING_CLASS),
                                                 true);
                    ann.addElement(el);
                    intf.addAnnotation(ann);
                }
                clearAttributes();
                setAttributes("intf", intf);
                setCommonAttributes();
View Full Code Here

                if (js.getHandlerChains() != null) {
                    HandlerConfigGenerator handlerGen = new HandlerConfigGenerator();
                    handlerGen.setJavaInterface(js);
                    handlerGen.generate(getEnvironment());
   
                    JAnnotation annot = handlerGen.getHandlerAnnotation();
                                  
                    if (handlerGen.getHandlerAnnotation() != null) {
                        boolean existHandlerAnno = false;
                        for (JAnnotation jann : js.getAnnotations()) {
                            if (jann.getType() == HandlerChain.class) {
View Full Code Here

        JavaInterface intf = method.getInterface();
        MessageInfo inputMessage = operation.getInput();
        MessageInfo outputMessage = operation.getOutput();

        JAnnotation actionAnnotation = new JAnnotation(Action.class);
        if (inputMessage.getExtensionAttributes() != null) {
            QName inputAction = (QName)inputMessage.getExtensionAttribute(WSAW_ACTION_QNAME);
            if (inputAction != null) {
                actionAnnotation.addElement(new JAnnotationElement("input",
                                                                          inputAction.getLocalPart()));
                required = true;
            }
        }

        if (outputMessage != null && outputMessage.getExtensionAttributes() != null) {
            QName outputAction = (QName)outputMessage.getExtensionAttribute(WSAW_ACTION_QNAME);
            if (outputAction != null) {
                actionAnnotation.addElement(new JAnnotationElement("output",
                                                                          outputAction.getLocalPart()));
                required = true;
            }
        }
        if (operation.hasFaults()) {
            List<JAnnotation> faultAnnotations = new ArrayList<JAnnotation>();
            for (FaultInfo faultInfo : operation.getFaults()) {
                if (faultInfo.getExtensionAttributes() != null) {
                    QName faultAction = (QName)faultInfo.getExtensionAttribute(WSAW_ACTION_QNAME);

                    JavaException exceptionClass = getExceptionClass(method, faultInfo);                   
                    if (!StringUtils.isEmpty(exceptionClass.getPackageName())
                        && !exceptionClass.getPackageName().equals(intf.getPackageName())) {
                        intf.addImport(exceptionClass.getClassName());
                    }                   

                    JAnnotation faultAnnotation = new JAnnotation(FaultAction.class);
                    faultAnnotation.addElement(new JAnnotationElement("className", exceptionClass));
                    faultAnnotation.addElement(new JAnnotationElement("value",
                                                                             faultAction.getLocalPart()));
                    faultAnnotations.add(faultAnnotation);
                    required = true;
                }
            }
View Full Code Here

                        p2.setName(param.getName());
                        p2.setClassName(param.getHolderName());
                        p2.setStyle(JavaType.Style.IN);
                        callbackMethod.addParameter(p2);
                        for (String s : param.getAnnotationTags()) {
                            JAnnotation ann = param.getAnnotation(s);
                            p2.addAnnotation(s, ann);
                        }
                    } else if (!param.isHeader() && asyncCname == null) {
                        asyncCname = param.getClassName();
                    }
                } else {
                    callbackMethod.addParameter(param);
                }
            } else {
                callbackMethod.addParameter(param);
            }
        }
        JavaParameter asyncHandler = new JavaParameter();
       
        asyncHandler.setName("asyncHandler");
        asyncHandler.setCallback(true);
        asyncHandler.setClassName(getAsyncClassName(method,
                                                    "AsyncHandler",
                                                    asyncCname));
        asyncHandler.setStyle(JavaType.Style.IN);
       
        callbackMethod.addParameter(asyncHandler);
       
        JAnnotation asyncHandlerAnnotation = new JAnnotation(WebParam.class);
        asyncHandlerAnnotation.addElement(new JAnnotationElement("name", "asyncHandler"));
        asyncHandlerAnnotation.addElement(new JAnnotationElement("targetNamespace", ""));
        asyncHandler.addAnnotation("WebParam", asyncHandlerAnnotation);               

        method.getInterface().addImport("javax.jws.WebParam");
        method.getInterface().addMethod(callbackMethod);
    }
View Full Code Here

                        p2.setName(param.getName());
                        p2.setClassName(param.getHolderName());
                        p2.setStyle(JavaType.Style.IN);
                        pollingMethod.addParameter(p2);
                        for (String s : param.getAnnotationTags()) {
                            JAnnotation ann = param.getAnnotation(s);
                            p2.addAnnotation(s, ann);
                        }
                    } else if (!param.isHeader() && asyncCname == null) {
                        asyncCname = param.getClassName();
                    }
View Full Code Here

        clz.annotate(new WrapperBeanAnnotator());
        List<JAnnotation> annotations = clz.getAnnotations();
       
        String expectedNamespace = "http://doc.withannotation.fortest.tools.cxf.apache.org/";
               
        JAnnotation rootElementAnnotation = annotations.get(0);
        assertEquals("@XmlRootElement(name = \"sayHi\", "
                     + "namespace = \"" + expectedNamespace + "\")",
                     rootElementAnnotation.toString());
       
        JAnnotation xmlTypeAnnotation = annotations.get(2);
        assertEquals("@XmlType(name = \"sayHi\", "
                     + "namespace = \"" + expectedNamespace + "\")",
                     xmlTypeAnnotation.toString());
       
        JAnnotation accessorTypeAnnotation = annotations.get(1);
        assertEquals("@XmlAccessorType(XmlAccessType.FIELD)",
                     accessorTypeAnnotation.toString());
       
        WrapperBeanClass resWrapperClass = new WrapperBeanClass();
        resWrapperClass.setFullClassName(pkgName + ".SayHiResponse");
        resWrapperClass.setElementName(new QName(expectedNamespace,
                                     "sayHiResponse"));
       
        resWrapperClass.annotate(new WrapperBeanAnnotator());
        annotations = resWrapperClass.getAnnotations();
       
        rootElementAnnotation = annotations.get(0);
        assertEquals("@XmlRootElement(name = \"sayHiResponse\", "
                     + "namespace = \"" + expectedNamespace + "\")",
                     rootElementAnnotation.toString());
       
        accessorTypeAnnotation = annotations.get(1);
        assertEquals("@XmlAccessorType(XmlAccessType.FIELD)",
                     accessorTypeAnnotation.toString());
       
        xmlTypeAnnotation = annotations.get(2);
        assertEquals("@XmlType(name = \"sayHiResponse\", "
                     + "namespace = \"" + expectedNamespace + "\")",
                     xmlTypeAnnotation.toString());
View Full Code Here

            method = (JavaMethod) ja;
        } else {
            throw new RuntimeException("WebMethod can only annotate JavaMethod");
        }
        String operationName = method.getOperationName();
        JAnnotation methodAnnotation = new JAnnotation(WebMethod.class);
       
        if (!method.getName().equals(operationName)) {
            methodAnnotation.addElement(new JAnnotationElement("operationName", operationName));
        }
        if (!StringUtils.isEmpty(method.getSoapAction())) {
            methodAnnotation.addElement(new JAnnotationElement("action", method.getSoapAction()));
        }
        method.addAnnotation("WebMethod", methodAnnotation);
    }
View Full Code Here

    @Test
    public void testAnnotateDOCWrapped() throws Exception {
        init(method, parameter, SOAPBinding.Style.DOCUMENT, true);
        parameter.annotate(new WebParamAnnotator());

        JAnnotation annotation = parameter.getAnnotation();
        assertEquals("@WebParam(name = \"x\", targetNamespace = \"http://apache.org/cxf\")",
                         annotation.toString());
        List<JAnnotationElement> elements = annotation.getElements();
        assertEquals(2, elements.size());
        assertEquals("http://apache.org/cxf", elements.get(1).getValue());
        assertEquals("x", elements.get(0).getValue());
        // XXX - order that attributes are appended to the string
        //       differs with the ibmjdk...
View Full Code Here

    public void testAnnotateDOCBare() throws Exception {
        init(method, parameter, SOAPBinding.Style.DOCUMENT, false);

        parameter.annotate(new WebParamAnnotator());

        JAnnotation annotation = parameter.getAnnotation();
        assertEquals("@WebParam(partName = \"y\", name = \"x\", "
                     + "targetNamespace = \"http://apache.org/cxf\")",
                         annotation.toString());
        List<JAnnotationElement> elements = annotation.getElements();
        assertEquals(3, elements.size());
        // XXX - order that attributes are appended to the string
        //       differs with the ibmjdk...
        //assertEquals(
        //"@WebParam(targetNamespace = \"http://apache.org/cxf\", partName = \"y\", name = \"x\")",
View Full Code Here

TOP

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

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.