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

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


        if (interfaceInfo == null) {
            return;
        }

        JavaInterface intf = getInterface(context, serviceInfo, interfaceInfo);
        intf.setJavaModel(jmodel);

        Element handler = (Element)context.get(ToolConstants.HANDLER_CHAIN);
        intf.setHandlerChains(handler);


        Collection<OperationInfo> operations = interfaceInfo.getOperations();

        for (OperationInfo operation : operations) {
            if (isOverloading(operation.getName())) {
                LOG.log(Level.WARNING, "SKIP_OVERLOADED_OPERATION", operation.getName());
                continue;
            }
            OperationProcessor operationProcessor = new OperationProcessor(context);
            operationProcessor.process(intf, operation);
        }

        jmodel.setLocation(intf.getLocation());
        jmodel.addInterface(intf.getName(), intf);
    }
View Full Code Here


        }

        boolean required = false;


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

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

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

                    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",
View Full Code Here

                JavaServiceClass js = (JavaServiceClass)it.next();
                Iterator i = js.getPorts().iterator();
                while (i.hasNext()) {
                    JavaPort jp = (JavaPort)i.next();
                    String interfaceName = jp.getInterfaceClass();
                    JavaInterface intf = interfaces.get(interfaceName);
                    if (intf == null) {
                        interfaceName = jp.getPortType();
                        intf = interfaces.get(interfaceName);
                    }
                   
                    String clientClassName = interfaceName + "_"
                                             + NameUtil.mangleNameToClassName(jp.getPortName()) + "_Client";
   
                    clientClassName = mapClassName(intf.getPackageName(), clientClassName, penv);
                    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

                JavaServiceClass js = (JavaServiceClass)it.next();
                Iterator i = js.getPorts().iterator();
                while (i.hasNext()) {
                    JavaPort jp = (JavaPort)i.next();
                    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);
                    if (penv.optionSet(ToolConstants.CFG_IMPL_CLASS)) {
                        setAttributes("impl", (String)penv.get(ToolConstants.CFG_IMPL_CLASS));
                        penv.remove(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

public class XmlSeeAlsoAnnotatorTest extends Assert {

    @Test
    public void testAddXmlSeeAlsoAnnotation() throws Exception {
        JavaInterface intf = new JavaInterface();
        assertFalse(intf.getImports().hasNext());

        ClassCollector collector = new ClassCollector();
        collector.getTypesPackages().add(ObjectFactory.class.getPackage().getName());
        intf.annotate(new XmlSeeAlsoAnnotator(collector));

        Iterator iter = intf.getImports();
        assertEquals("javax.xml.bind.annotation.XmlSeeAlso", iter.next());
    
        assertEquals("@XmlSeeAlso({" + ObjectFactory.class.getName() + ".class})",
                     intf.getAnnotations().iterator().next().toString());
    }
View Full Code Here

    }

    private JavaPort processPort(JavaModel model, ServiceInfo si, EndpointInfo port) throws ToolException {
        BindingInfo binding = port.getBinding();
        String portType = binding.getInterface().getName().getLocalPart();
        JavaInterface intf = PortTypeProcessor.getInterface(context, si, binding.getInterface());
        JavaPort jport = new JavaPort(NameUtil.mangleNameToClassName(port.getName().getLocalPart()));
        jport.setPackageName(intf.getPackageName());
       
        jport.setPortName(port.getName().getLocalPart());
        jport.setBindingAdress(port.getAddress());
        jport.setBindingName(binding.getName().getLocalPart());


        jport.setPortType(portType);


        jport.setInterfaceClass(intf.getName());
        bindingType = getBindingType(binding);

        if (bindingType == null) {
            org.apache.cxf.common.i18n.Message msg =
                new org.apache.cxf.common.i18n.Message("BINDING_SPECIFY_ONE_PROTOCOL",
View Full Code Here

            enableOpMime = true;
            if (bopBinding.getJaxwsParas() != null) {
                jaxwsBinding.setJaxwsParas(bopBinding.getJaxwsParas());
            }
        }
        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

                                                                  "interfaceTest"));

        ToolContext context = new ToolContext();
        context.put(ToolConstants.CFG_WSDLURL, "http://localhost/?wsdl");
       
        JavaInterface intf = new InterfaceMapper(context).map(interfaceInfo);
        assertNotNull(intf);

        assertEquals("interfaceTest", intf.getWebServiceName());
        assertEquals("InterfaceTest", intf.getName());
        assertEquals("http://apache.org/hello_world_soap_http", intf.getNamespace());
        assertEquals("org.apache.hello_world_soap_http", intf.getPackageName());
        assertEquals("http://localhost/?wsdl", intf.getLocation());
    }
View Full Code Here

        ToolContext context = new ToolContext();
        context.put(ToolConstants.CFG_WSDLURL, "http://localhost/?wsdl");
        context.put(ToolConstants.CFG_WSDLLOCATION, "/foo/blah.wsdl");
       
        JavaInterface intf = new InterfaceMapper(context).map(interfaceInfo);
        assertNotNull(intf);

        assertEquals("interfaceTest", intf.getWebServiceName());
        assertEquals("InterfaceTest", intf.getName());
        assertEquals("http://apache.org/hello_world_soap_http", intf.getNamespace());
        assertEquals("org.apache.hello_world_soap_http", intf.getPackageName());
        assertEquals("/foo/blah.wsdl", intf.getLocation());
    }
View Full Code Here

                JavaServiceClass js = (JavaServiceClass)it.next();
                Iterator i = js.getPorts().iterator();
                while (i.hasNext()) {
                    JavaPort jp = (JavaPort)i.next();
                    String interfaceName = jp.getInterfaceClass();
                    JavaInterface intf = interfaces.get(interfaceName);
                    if (intf == null) {
                        interfaceName = jp.getPortType();
                        intf = interfaces.get(interfaceName);
                    }
                   
                    String clientClassName = intf.getPackageName() + "." + interfaceName + "_"
                                             + NameUtil.mangleNameToClassName(jp.getPortName()) + "_Client";
   
                    String serverClassName = intf.getPackageName() + "." + interfaceName + "_"
                                             + NameUtil.mangleNameToClassName(jp.getPortName()) + "_Server";
                    String clientTargetName = interfaceName + "Client";
                    boolean collison = false;
                    if (clientClassNamesMap.keySet().contains(clientTargetName)) {
                        clientTargetName = clientTargetName + index;
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.