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

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


            jaxwsBinding.setEnableMime(false);
            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


        InterfaceInfo interfaceInfo = serviceInfo.getInterface();
        if (interfaceInfo == null) {
            return;
        }
       
        JavaInterface intf = new InterfaceMapper(context).map(interfaceInfo);

        JAXWSBinding jaxwsBinding = serviceInfo.getDescription().getExtensor(JAXWSBinding.class);
        JAXWSBinding infBinding = interfaceInfo.getExtensor(JAXWSBinding.class);
        if (infBinding != null && infBinding.getPackage() != null) {
            intf.setPackageName(infBinding.getPackage());
        } else if (jaxwsBinding != null && jaxwsBinding.getPackage() != null) {
            intf.setPackageName(jaxwsBinding.getPackage());           
        }
       
        String name = intf.getName();
        if (infBinding != null
            && infBinding.getJaxwsClass() != null
            && infBinding.getJaxwsClass().getClassName() != null) {
            name = infBinding.getJaxwsClass().getClassName();
        }
        intf.setName(name);

        ClassCollector collector = context.get(ClassCollector.class);
        collector.addSeiClassName(intf.getPackageName(),
                                  intf.getName(),
                                  intf.getPackageName() + "." + intf.getName());
    }
View Full Code Here

       
        if (interfaceInfo == null) {
            return;
        }
        JavaInterface intf = new InterfaceMapper(context).map(interfaceInfo);
        intf.setJavaModel(jmodel);

        JAXWSBinding jaxwsBinding = serviceInfo.getDescription().getExtensor(JAXWSBinding.class);
        JAXWSBinding infBinding = interfaceInfo.getExtensor(JAXWSBinding.class);
        if (infBinding != null && infBinding.getPackage() != null) {
            intf.setPackageName(infBinding.getPackage());
        } else if (jaxwsBinding != null && jaxwsBinding.getPackage() != null) {
            intf.setPackageName(jaxwsBinding.getPackage());           
        }
       
        String name = intf.getName();
        if (infBinding != null
            && infBinding.getJaxwsClass() != null
            && infBinding.getJaxwsClass().getClassName() != null) {
            name = infBinding.getJaxwsClass().getClassName();
        }
        intf.setName(name);
       
        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

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

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

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

            List<JavaMethod> methods = intf.getMethods();
            assertEquals(6, methods.size());
            JavaMethod m1 = methods.get(0);
            assertEquals("testDocLitFault", m1.getName());
        } catch (Exception e) {
            e.printStackTrace();
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://apache.org/hello_world_soap_http", intf.getNamespace());
            assertEquals("Greeter", intf.getName());
            assertEquals("org.apache.hello_world_soap_http", intf.getPackageName());

            List<JavaMethod> methods = intf.getMethods();
            assertEquals(6, methods.size());
            JavaMethod m1 = methods.get(0);
            assertEquals("testDocLitFault", m1.getName());

            assertEquals(2, m1.getExceptions().size());
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

            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

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

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)) {
            JAnnotation bindingAnnotation = new JAnnotation(SOAPBinding.class);
            if (!SOAPBinding.Style.DOCUMENT.equals(intf.getSOAPStyle())) {
                bindingAnnotation.addElement(new JAnnotationElement("style", intf.getSOAPStyle()));
            }
            if (!SOAPBinding.Use.LITERAL.equals(intf.getSOAPUse())) {
                bindingAnnotation.addElement(new JAnnotationElement("use", intf.getSOAPUse()));
            }           
            if (intf.getSOAPStyle() == SOAPBinding.Style.DOCUMENT) {
                bindingAnnotation.addElement(new JAnnotationElement("parameterStyle",
                                                                           intf.getSOAPParameterStyle()));
            }
            intf.addAnnotation(bindingAnnotation);
        }
    }
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.