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

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


                return;
            }
            for (JavaServiceClass js : javaModel.getServiceClasses().values()) {
                for (JavaPort jp : js.getPorts()) {
                    String interfaceName = jp.getInterfaceClass();
                    JavaInterface intf = interfaces.get(interfaceName);
                    if (intf == null) {
                        interfaceName = jp.getPortType();
                        intf = interfaces.get(interfaceName);
                    }
                    address = StringUtils.isEmpty(jp.getBindingAdress()) ? address : jp.getBindingAdress();
                    String serverClassName = interfaceName + "_"
                                             + NameUtil.mangleNameToClassName(jp.getPortName()) + "_Server";
   
                    serverClassName = mapClassName(intf.getPackageName(), serverClassName, penv);
                    clearAttributes();
                    setAttributes("serverClassName", serverClassName);
                    setAttributes("intf", intf);
                   
                    String name = getImplName(jp.getPortName(), js.getServiceName(), intf, penv);
                    setAttributes("impl", name);
                   
                    setAttributes("address", address);
                    setCommonAttributes();
   
                    doWrite(SRV_TEMPLATE, parseOutputName(intf.getPackageName(), serverClassName));          
                }
            }
        }
    }
View Full Code Here


                port = jport.getPortName();
            }
        }
        for (Iterator iter = interfaces.keySet().iterator(); iter.hasNext();) {
            String interfaceName = (String)iter.next();
            JavaInterface intf = interfaces.get(interfaceName);

            clearAttributes();
            setAttributes("intf", intf);

            setAttributes("service", service);
 
            setAttributes("port", port);
           
            setCommonAttributes();

            doWrite(IMPL_TEMPLATE, parseOutputName(intf.getPackageName(), intf.getName() + "Impl"));
        }
    }
View Full Code Here

            enableOpMime = true;
            if (bopBinding.getJaxwsPara() != null) {
                jaxwsBinding.setJaxwsPara(bopBinding.getJaxwsPara());
            }
        }
        JavaInterface jf = null;
        for (JavaInterface jf2 : model.getInterfaces().values()) {
            if (binding.getInterface().getName().getLocalPart()
                    .equals(jf2.getWebServiceName())) {
                jf = jf2;
            }
        }
        if (isSoapBinding()) {
            SoapBinding soapBinding = (SoapBinding)bindingObj;
            if (SOAPBindingUtil.getSoapStyle(soapBinding.getStyle()) == null) {
                jf.setSOAPStyle(javax.jws.soap.SOAPBinding.Style.DOCUMENT);
            } else {
                jf.setSOAPStyle(SOAPBindingUtil.getSoapStyle(soapBinding.getStyle()));
            }
        } else {
            // REVISIT: fix for xml binding
            jf.setSOAPStyle(javax.jws.soap.SOAPBinding.Style.DOCUMENT);
        }

        Object[] methods = jf.getMethods().toArray();
        for (int i = 0; i < methods.length; i++) {
            JavaMethod jm = (JavaMethod)methods[i];
            if (jm.getOperationName() != null && jm.getOperationName().equals(bop.getName().getLocalPart())) {
                if (isSoapBinding()) {
                    // TODO: add customize here
                    //doCustomizeOperation(jf, jm, bop);
                    Map prop = getSoapOperationProp(bop);
                    String soapAction = prop.get(soapOPAction) == null ? "" : (String)prop.get(soapOPAction);
                    String soapStyle = prop.get(soapOPStyle) == null ? "" : (String)prop.get(soapOPStyle);
                    jm.setSoapAction(soapAction);
                    if (SOAPBindingUtil.getSoapStyle(soapStyle) == null && this.bindingObj == null) {
                        org.apache.cxf.common.i18n.Message msg =
                            new  org.apache.cxf.common.i18n.Message("BINDING_STYLE_NOT_DEFINED",
                                                                         LOG);
                        throw new ToolException(msg);
                    }
                    if (SOAPBindingUtil.getSoapStyle(soapStyle) == null) {
                        jm.setSoapStyle(jf.getSOAPStyle());
                    } else {
                        jm.setSoapStyle(SOAPBindingUtil.getSoapStyle(soapStyle));
                    }
                } else {
                    // REVISIT: fix for xml binding
                    jm.setSoapStyle(jf.getSOAPStyle());
                }

                if (jm.getSoapStyle().equals(javax.jws.soap.SOAPBinding.Style.RPC)) {
                    jm.getAnnotationMap().remove("SOAPBinding");
                }
View Full Code Here

            JavaModel javaModel = context.get(JavaModel.class);

            Map<String, JavaInterface> interfaces = javaModel.getInterfaces();
            assertEquals(1, interfaces.size());

            JavaInterface intf = interfaces.values().iterator().next();
            assertEquals("http://cxf.apache.org/w2j/hello_world_soap_http", intf.getNamespace());
            assertEquals("Greeter", intf.getName());
            assertEquals("org.apache.cxf.w2j.hello_world_soap_http", intf.getPackageName());

            List<JavaMethod> methods = intf.getMethods();
            assertEquals(6, methods.size());
            Boolean methodSame = false;
            for (JavaMethod m1 : methods) {
                if (m1.getName().equals("testDocLitFault")) {
                    methodSame = true;
View Full Code Here

            assertNotNull(javaModel);

            Map<String, JavaInterface> interfaces = javaModel.getInterfaces();
            assertEquals(1, interfaces.size());

            JavaInterface intf = interfaces.values().iterator().next();
            String interfaceName = intf.getName();
            assertEquals("Greeter", interfaceName);
            assertEquals("http://cxf.apache.org/w2j/hello_world_soap_http", intf.getNamespace());
            assertEquals("org.apache.cxf.w2j.hello_world_soap_http", intf.getPackageName());

            List<JavaMethod> methods = intf.getMethods();
            assertEquals(6, methods.size());

            Boolean methodSame = false;
            JavaMethod m1 = null;
            for (JavaMethod m2 : methods) {
View Full Code Here

import org.apache.cxf.tools.util.SOAPBindingUtil;

public final class BindingAnnotator implements Annotator {
   
    public void annotate(JavaAnnotatable ja) {
        JavaInterface intf;
        if (ja instanceof JavaInterface) {
            intf = (JavaInterface) ja;
        } else {
            throw new RuntimeException("BindingAnnotator can only annotate JavaInterface");
        }
       
        if (processBinding(intf)) {
            JavaAnnotation bindingAnnotation = new JavaAnnotation("SOAPBinding");
            if (!SOAPBinding.Style.DOCUMENT.equals(intf.getSOAPStyle())) {
                String style = SOAPBindingUtil.getBindingAnnotation(intf.getSOAPStyle().toString());
                bindingAnnotation.addArgument("style", style, "");               
            }
            if (!SOAPBinding.Use.LITERAL.equals(intf.getSOAPUse())) {
                String use = SOAPBindingUtil.getBindingAnnotation(intf.getSOAPUse().toString());
                bindingAnnotation.addArgument("use", use, "");
            }           
            if (intf.getSOAPStyle() == SOAPBinding.Style.DOCUMENT) {
                String parameterStyle = SOAPBindingUtil.getBindingAnnotation(intf.
                                                                             getSOAPParameterStyle().
                                                                             toString());
                bindingAnnotation.addArgument("parameterStyle", parameterStyle, "");
            }
            intf.addAnnotation(bindingAnnotation.toString());
        }
    }
View Full Code Here

        JavaServiceClass js = null;
        JavaPort jp = null;

        for (Iterator iter = interfaces.keySet().iterator(); iter.hasNext();) {
            String interfaceName = (String)iter.next();
            JavaInterface intf = interfaces.get(interfaceName);

            Iterator it = javaModel.getServiceClasses().values().iterator();
            while (it.hasNext()) {
                String serviceName = "";
                js = (JavaServiceClass)it.next();
                Iterator i = js.getPorts().iterator();
                while (i.hasNext()) {
                    jp = (JavaPort)i.next();
                    if (jp.getPortType().equals(interfaceName)) {
                        serviceName = js.getName();

                        break;
                    }
                }
                if (!"".equals(serviceName)) {
                    break;
                }
            }


            String clientClassName = interfaceName + "Client";
            while (isCollision(intf.getPackageName(), clientClassName)) {
                clientClassName = clientClassName + "_Client";
            }

            clearAttributes();
            setAttributes("clientClassName", clientClassName);
            setAttributes("intf", intf);
            setAttributes("service", js);
            setAttributes("port", jp);

            setCommonAttributes();

            doWrite(CLT_TEMPLATE, parseOutputName(intf.getPackageName(),
                    clientClassName));
        }
    }
View Full Code Here

            return;
        }
       
        for (Iterator iter = interfaces.keySet().iterator(); iter.hasNext();) {
            String interfaceName = (String)iter.next();
            JavaInterface intf = interfaces.get(interfaceName);
            Iterator it = javaModel.getServiceClasses().values().iterator();
            while (it.hasNext()) {
                JavaServiceClass js = (JavaServiceClass)it.next();
                Iterator i = js.getPorts().iterator();
                while (i.hasNext()) {
                    JavaPort jp = (JavaPort)i.next();
                    if (interfaceName.equals(jp.getPortType())) {
                        address = jp.getBindingAdress();
                        break;
                    }
                }
                if (!"".equals(address)) {
                    break;
                }
            }


            String serverClassName = interfaceName + "Server";

            while (isCollision(intf.getPackageName(), serverClassName)) {
                serverClassName = serverClassName + "_Server";
            }

            clearAttributes();
            setAttributes("serverClassName", serverClassName);
            setAttributes("intf", intf);
            if (penv.optionSet(ToolConstants.CFG_IMPL_CLASS)) {
                setAttributes("impl",
                              (String)penv.get(ToolConstants.CFG_IMPL_CLASS));
            } else {
                setAttributes("impl", intf.getName() + "Impl");
            }
            setAttributes("address", address);
            setCommonAttributes();

            doWrite(SRV_TEMPLATE, parseOutputName(intf.getPackageName(), serverClassName));
        }
    }
View Full Code Here

import org.apache.cxf.tools.common.model.JavaInterface;

public final class WebServiceAnnotator implements Annotator {
   
    public void annotate(JavaAnnotatable  ja) {
        JavaInterface intf = null;
        if (ja instanceof JavaInterface) {
            intf = (JavaInterface) ja;
        } else {
            throw new RuntimeException("WebService can only annotate JavaInterface");
        }
        JavaAnnotation serviceAnnotation = new JavaAnnotation("WebService");
        serviceAnnotation.addArgument("targetNamespace", intf.getNamespace());
        //serviceAnnotation.addArgument("wsdlLocation", intf.getLocation());
        serviceAnnotation.addArgument("name", intf.getWebServiceName());
       
        intf.addAnnotation(serviceAnnotation.toString());
    }
View Full Code Here

                port = jport.getPortName();
            }
        }
        for (Iterator iter = interfaces.keySet().iterator(); iter.hasNext();) {
            String interfaceName = (String)iter.next();
            JavaInterface intf = interfaces.get(interfaceName);

            clearAttributes();
            setAttributes("intf", intf);

            setAttributes("service", service);
 
            setAttributes("port", port);
           
            setCommonAttributes();

            doWrite(IMPL_TEMPLATE, parseOutputName(intf.getPackageName(), intf.getName() + "Impl"));
        }
    }
View Full Code Here

TOP

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

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.