Search in sources :

Example 11 with JavaInterface

use of org.apache.cxf.tools.common.model.JavaInterface in project cxf by apache.

the class InterfaceMapperTest method testMap.

@Test
public void testMap() throws Exception {
    InterfaceInfo interfaceInfo = new InterfaceInfo(new ServiceInfo(), new QName("http://apache.org/hello_world_soap_http", "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());
}
Also used : ServiceInfo(org.apache.cxf.service.model.ServiceInfo) JavaInterface(org.apache.cxf.tools.common.model.JavaInterface) QName(javax.xml.namespace.QName) ToolContext(org.apache.cxf.tools.common.ToolContext) InterfaceInfo(org.apache.cxf.service.model.InterfaceInfo) Test(org.junit.Test)

Example 12 with JavaInterface

use of org.apache.cxf.tools.common.model.JavaInterface in project cxf by apache.

the class JAXWSFrontEndProcessor method process.

@SuppressWarnings("unchecked")
public void process() throws ToolException {
    checkJaxwsClass();
    List<ServiceInfo> services = (List<ServiceInfo>) context.get(ToolConstants.SERVICE_LIST);
    ServiceInfo serviceInfo = services.get(0);
    JavaInterface jinf = JavaFirstUtil.serviceInfo2JavaInf(serviceInfo);
    String className = (String) context.get(ToolConstants.IMPL_CLASS);
    if (className != null && className.equals(jinf.getFullClassName())) {
        jinf.setName(jinf.getName() + SEI_SUFFIX);
    }
    JavaModel jm = new JavaModel();
    jm.addInterface("inf", jinf);
    jinf.setJavaModel(jm);
    context.put(JavaModel.class, jm);
    context.put(ToolConstants.SERVICE_NAME, serviceInfo.getName());
    EndpointInfo endpointInfo = serviceInfo.getEndpoints().iterator().next();
    context.put(ToolConstants.PORT_NAME, endpointInfo.getName());
    generators.add(new JaxwsSEIGenerator());
    generators.add(new JaxwsImplGenerator());
    generators.add(new JaxwsServerGenerator());
    generators.add(new JaxwsClientGenerator());
    generators.add(new AntGenerator());
    for (AbstractGenerator generator : generators) {
        generator.generate(context);
    }
}
Also used : JavaInterface(org.apache.cxf.tools.common.model.JavaInterface) JaxwsServerGenerator(org.apache.cxf.tools.java2wsdl.processor.internal.jaxws.generator.JaxwsServerGenerator) AbstractGenerator(org.apache.cxf.tools.wsdlto.core.AbstractGenerator) JaxwsImplGenerator(org.apache.cxf.tools.java2wsdl.processor.internal.jaxws.generator.JaxwsImplGenerator) JaxwsClientGenerator(org.apache.cxf.tools.java2wsdl.processor.internal.jaxws.generator.JaxwsClientGenerator) ServiceInfo(org.apache.cxf.service.model.ServiceInfo) EndpointInfo(org.apache.cxf.service.model.EndpointInfo) JaxwsSEIGenerator(org.apache.cxf.tools.java2wsdl.processor.internal.jaxws.generator.JaxwsSEIGenerator) JavaModel(org.apache.cxf.tools.common.model.JavaModel) ArrayList(java.util.ArrayList) List(java.util.List) AntGenerator(org.apache.cxf.tools.java2wsdl.processor.internal.AntGenerator)

Example 13 with JavaInterface

use of org.apache.cxf.tools.common.model.JavaInterface in project cxf by apache.

the class JaxwsClientGenerator method generate.

public void generate(ToolContext penv) throws ToolException {
    this.env = penv;
    JavaModel javaModel = env.get(JavaModel.class);
    if (passthrough()) {
        return;
    }
    Map<String, JavaInterface> interfaces = javaModel.getInterfaces();
    QName service = (QName) env.get(ToolConstants.SERVICE_NAME);
    QName port = (QName) env.get(ToolConstants.PORT_NAME);
    for (JavaInterface intf : interfaces.values()) {
        clearAttributes();
        setAttributes("intf", intf);
        setAttributes("service", service);
        setAttributes("port", port);
        setAttributes("address", penv.get(ToolConstants.CFG_ADDRESS));
        setAttributes("seiClass", env.get(ToolConstants.SEI_CLASS));
        setCommonAttributes();
        doWrite(CLIENT_TEMPLATE, parseOutputName(intf.getPackageName(), intf.getName() + "Client"));
    }
}
Also used : JavaInterface(org.apache.cxf.tools.common.model.JavaInterface) QName(javax.xml.namespace.QName) JavaModel(org.apache.cxf.tools.common.model.JavaModel)

Example 14 with JavaInterface

use of org.apache.cxf.tools.common.model.JavaInterface in project cxf by apache.

the class JaxwsServerGenerator method generate.

public void generate(ToolContext penv) throws ToolException {
    this.env = penv;
    JavaModel javaModel = env.get(JavaModel.class);
    if (passthrough()) {
        return;
    }
    Map<String, JavaInterface> interfaces = javaModel.getInterfaces();
    for (JavaInterface intf : interfaces.values()) {
        clearAttributes();
        setAttributes("intf", intf);
        setAttributes("address", penv.get(ToolConstants.CFG_ADDRESS));
        setAttributes("implClass", env.get(ToolConstants.IMPL_CLASS));
        setCommonAttributes();
        doWrite(SERVER_TEMPLATE, parseOutputName(intf.getPackageName(), intf.getName() + "Server"));
    }
}
Also used : JavaInterface(org.apache.cxf.tools.common.model.JavaInterface) JavaModel(org.apache.cxf.tools.common.model.JavaModel)

Example 15 with JavaInterface

use of org.apache.cxf.tools.common.model.JavaInterface in project cxf by apache.

the class SimpleFrontEndProcessor method process.

@SuppressWarnings("unchecked")
public void process() throws ToolException {
    List<ServiceInfo> services = (List<ServiceInfo>) context.get(ToolConstants.SERVICE_LIST);
    ServiceInfo serviceInfo = services.get(0);
    JavaInterface jinf = JavaFirstUtil.serviceInfo2JavaInf(serviceInfo);
    JavaModel jm = new JavaModel();
    jm.addInterface("inf", jinf);
    jinf.setJavaModel(jm);
    context.put(JavaModel.class, jm);
    generators.add(new SimpleSEIGenerator());
    generators.add(new SimpleImplGenerator());
    generators.add(new SimpleServerGenerator());
    generators.add(new SimpleClientGenerator());
    generators.add(new AntGenerator());
    for (AbstractGenerator generator : generators) {
        generator.generate(context);
    }
}
Also used : ServiceInfo(org.apache.cxf.service.model.ServiceInfo) SimpleSEIGenerator(org.apache.cxf.tools.java2wsdl.processor.internal.simple.generator.SimpleSEIGenerator) SimpleImplGenerator(org.apache.cxf.tools.java2wsdl.processor.internal.simple.generator.SimpleImplGenerator) SimpleClientGenerator(org.apache.cxf.tools.java2wsdl.processor.internal.simple.generator.SimpleClientGenerator) JavaInterface(org.apache.cxf.tools.common.model.JavaInterface) SimpleServerGenerator(org.apache.cxf.tools.java2wsdl.processor.internal.simple.generator.SimpleServerGenerator) JavaModel(org.apache.cxf.tools.common.model.JavaModel) AbstractGenerator(org.apache.cxf.tools.wsdlto.core.AbstractGenerator) ArrayList(java.util.ArrayList) List(java.util.List) AntGenerator(org.apache.cxf.tools.java2wsdl.processor.internal.AntGenerator)

Aggregations

JavaInterface (org.apache.cxf.tools.common.model.JavaInterface)33 JavaModel (org.apache.cxf.tools.common.model.JavaModel)20 QName (javax.xml.namespace.QName)11 ServiceInfo (org.apache.cxf.service.model.ServiceInfo)8 JavaMethod (org.apache.cxf.tools.common.model.JavaMethod)7 ArrayList (java.util.ArrayList)6 Message (org.apache.cxf.common.i18n.Message)6 JAnnotation (org.apache.cxf.tools.common.model.JAnnotation)6 JAnnotationElement (org.apache.cxf.tools.common.model.JAnnotationElement)6 JavaPort (org.apache.cxf.tools.common.model.JavaPort)6 InterfaceInfo (org.apache.cxf.service.model.InterfaceInfo)5 JavaException (org.apache.cxf.tools.common.model.JavaException)5 JavaServiceClass (org.apache.cxf.tools.common.model.JavaServiceClass)5 OperationInfo (org.apache.cxf.service.model.OperationInfo)4 ToolContext (org.apache.cxf.tools.common.ToolContext)4 Test (org.junit.Test)4 HashMap (java.util.HashMap)3 ToolException (org.apache.cxf.tools.common.ToolException)3 JAXWSBinding (org.apache.cxf.tools.wsdlto.frontend.jaxws.customization.JAXWSBinding)3 GenericArrayType (java.lang.reflect.GenericArrayType)2