Search in sources :

Example 1 with FrontEnd

use of org.apache.cxf.tools.plugin.FrontEnd in project cxf by apache.

the class JAXWSProfileTest method testLoadPlugins.

@Test
public void testLoadPlugins() {
    PluginLoader loader = PluginLoader.getInstance();
    assertNotNull(loader);
    loader.loadPlugin("/org/apache/cxf/tools/wsdlto/frontend/jaxws/jaxws-plugin.xml");
    assertEquals(3, loader.getPlugins().size());
    Plugin plugin = null;
    for (Plugin p : loader.getPlugins().values()) {
        if (p.getName().contains("jaxws")) {
            plugin = p;
        }
    }
    assertNotNull(plugin);
    assertEquals("tools-jaxws-frontend", plugin.getName());
    assertEquals("2.0", plugin.getVersion());
    assertEquals("apache cxf", plugin.getProvider());
    Map<String, FrontEnd> frontends = loader.getFrontEnds();
    assertNotNull(frontends);
    assertEquals(3, frontends.size());
    FrontEnd frontend = getFrontEnd(frontends, 0);
    assertEquals("jaxws", frontend.getName());
    assertEquals("org.apache.cxf.tools.wsdlto.frontend.jaxws", frontend.getPackage());
    assertEquals("JAXWSProfile", frontend.getProfile());
    assertNotNull(frontend.getGenerators());
    assertNotNull(frontend.getGenerators().getGenerator());
    assertEquals(2, frontend.getGenerators().getGenerator().size());
    assertEquals("AntGenerator", getGenerator(frontend, 0).getName());
    assertEquals("ImplGenerator", getGenerator(frontend, 1).getName());
    FrontEndProfile profile = loader.getFrontEndProfile("jaxws");
    assertNotNull(profile);
    List<FrontEndGenerator> generators = profile.getGenerators();
    assertNotNull(generators);
    assertEquals(2, generators.size());
    assertTrue(generators.get(0) instanceof AntGenerator);
    assertTrue(generators.get(1) instanceof ImplGenerator);
    Processor processor = profile.getProcessor();
    assertNotNull(processor);
    assertTrue(processor instanceof WSDLToJavaProcessor);
    AbstractWSDLBuilder builder = profile.getWSDLBuilder();
    assertNotNull(builder);
    assertTrue(builder instanceof JAXWSDefinitionBuilder);
    Class<?> container = profile.getContainerClass();
    assertEquals(container, JAXWSContainer.class);
    assertEquals("/org/apache/cxf/tools/wsdlto/frontend/jaxws/jaxws-toolspec.xml", profile.getToolspec());
}
Also used : AbstractWSDLBuilder(org.apache.cxf.tools.wsdlto.core.AbstractWSDLBuilder) Processor(org.apache.cxf.tools.common.Processor) WSDLToJavaProcessor(org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.WSDLToJavaProcessor) ImplGenerator(org.apache.cxf.tools.wsdlto.frontend.jaxws.generators.ImplGenerator) FrontEndProfile(org.apache.cxf.tools.wsdlto.core.FrontEndProfile) FrontEnd(org.apache.cxf.tools.plugin.FrontEnd) FrontEndGenerator(org.apache.cxf.tools.common.FrontEndGenerator) WSDLToJavaProcessor(org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.WSDLToJavaProcessor) PluginLoader(org.apache.cxf.tools.wsdlto.core.PluginLoader) JAXWSDefinitionBuilder(org.apache.cxf.tools.wsdlto.frontend.jaxws.wsdl11.JAXWSDefinitionBuilder) Plugin(org.apache.cxf.tools.plugin.Plugin) AntGenerator(org.apache.cxf.tools.wsdlto.frontend.jaxws.generators.AntGenerator) Test(org.junit.Test)

Example 2 with FrontEnd

use of org.apache.cxf.tools.plugin.FrontEnd in project cxf by apache.

the class PluginLoader method getFrontEndProfile.

public FrontEndProfile getFrontEndProfile(String name) {
    FrontEndProfile profile = null;
    FrontEnd frontend = getFrontEnd(name);
    profile = loadFrontEndProfile(getFrontEndProfileClass(frontend));
    for (FrontEndGenerator generator : getFrontEndGenerators(frontend)) {
        profile.registerGenerator(generator);
    }
    if (frontend.getProcessor() != null) {
        profile.setProcessor(loadProcessor(getProcessorClass(frontend)));
    }
    if (frontend.getContainer() != null) {
        profile.setContainerClass(loadContainerClass(getContainerClass(frontend)));
        profile.setToolspec(getToolspec(frontend));
    }
    if (frontend.getBuilder() != null) {
        profile.setWSDLBuilder(loadBuilder(getBuilderClass(frontend)));
    }
    return profile;
}
Also used : FrontEnd(org.apache.cxf.tools.plugin.FrontEnd) FrontEndGenerator(org.apache.cxf.tools.common.FrontEndGenerator)

Example 3 with FrontEnd

use of org.apache.cxf.tools.plugin.FrontEnd in project cxf by apache.

the class PluginLoader method loadPlugin.

protected void loadPlugin(Plugin plugin) {
    if (plugin.getFrontend().size() > 0) {
        LOG.log(Level.FINE, "FOUND_FRONTENDS", new Object[] { plugin.getName(), plugin.getFrontend().size() });
    }
    for (FrontEnd frontend : plugin.getFrontend()) {
        LOG.log(Level.FINE, "LOADING_FRONTEND", new Object[] { frontend.getName(), plugin.getName() });
        if (StringUtils.isEmpty(frontend.getName())) {
            LOG.log(Level.WARNING, "FRONTEND_MISSING_NAME", plugin.getName());
            continue;
        }
        if (frontends.containsKey(frontend.getName()) && DEFAULT_PROVIDER_NAME.equals(plugin.getProvider())) {
            Message msg = new Message("REPLACED_DEFAULT_FRONTEND", LOG, frontend.getName());
            LOG.log(Level.INFO, msg.toString());
            continue;
        }
        frontends.put(frontend.getName(), frontend);
    }
    if (plugin.getDatabinding().size() > 0) {
        LOG.log(Level.FINE, "FOUND_DATABINDINGS", new Object[] { plugin.getName(), plugin.getDatabinding().size() });
    }
    for (DataBinding databinding : plugin.getDatabinding()) {
        LOG.log(Level.FINE, "LOADING_DATABINDING", new Object[] { databinding.getName(), plugin.getName() });
        if (StringUtils.isEmpty(databinding.getName())) {
            LOG.log(Level.WARNING, "DATABINDING_MISSING_NAME", plugin.getName());
            continue;
        }
        if (databindings.containsKey(databinding.getName()) && DEFAULT_PROVIDER_NAME.equals(plugin.getProvider())) {
            Message msg = new Message("REPLACED_DEFAULT_DATABINDING", LOG, databinding.getName());
            LOG.log(Level.INFO, msg.toString());
            continue;
        }
        databindings.put(databinding.getName(), databinding);
    }
}
Also used : FrontEnd(org.apache.cxf.tools.plugin.FrontEnd) Message(org.apache.cxf.common.i18n.Message) DataBinding(org.apache.cxf.tools.plugin.DataBinding)

Example 4 with FrontEnd

use of org.apache.cxf.tools.plugin.FrontEnd in project cxf by apache.

the class PluginLoaderTest method testLoadPlugins.

@Test
public void testLoadPlugins() throws Exception {
    PluginLoader loader = PluginLoader.getInstance();
    assertEquals(3, loader.getPlugins().size());
    Plugin plugin = getPlugin(loader, 0);
    assertNotNull(plugin.getName());
    Map<String, FrontEnd> frontends = loader.getFrontEnds();
    assertNotNull(frontends);
    assertEquals(3, frontends.size());
    FrontEnd frontend = getFrontEnd(frontends, 0);
    assertEquals("jaxws", frontend.getName());
    assertEquals("org.apache.cxf.tools.wsdlto.frontend.jaxws", frontend.getPackage());
    assertEquals("JAXWSProfile", frontend.getProfile());
    assertNotNull(frontend.getGenerators());
    assertNotNull(frontend.getGenerators().getGenerator());
    assertEquals("AntGenerator", getGenerator(frontend, 0).getName());
    assertEquals("JAXWSContainer", frontend.getContainer().getName());
    assertEquals("jaxws-toolspec.xml", frontend.getContainer().getToolspec());
    loader.getFrontEndProfile("jaxws");
    Map<String, DataBinding> databindings = loader.getDataBindings();
    assertNotNull(databindings);
    assertEquals(5, databindings.size());
    DataBinding databinding = databindings.get("jaxb");
    assertNotNull(databinding);
    assertEquals("jaxb", databinding.getName());
    assertEquals("org.apache.cxf.tools.wsdlto.databinding.jaxb", databinding.getPackage());
    assertEquals("JAXBDataBinding", databinding.getProfile());
}
Also used : FrontEnd(org.apache.cxf.tools.plugin.FrontEnd) DataBinding(org.apache.cxf.tools.plugin.DataBinding) Plugin(org.apache.cxf.tools.plugin.Plugin) Test(org.junit.Test)

Aggregations

FrontEnd (org.apache.cxf.tools.plugin.FrontEnd)4 FrontEndGenerator (org.apache.cxf.tools.common.FrontEndGenerator)2 DataBinding (org.apache.cxf.tools.plugin.DataBinding)2 Plugin (org.apache.cxf.tools.plugin.Plugin)2 Test (org.junit.Test)2 Message (org.apache.cxf.common.i18n.Message)1 Processor (org.apache.cxf.tools.common.Processor)1 AbstractWSDLBuilder (org.apache.cxf.tools.wsdlto.core.AbstractWSDLBuilder)1 FrontEndProfile (org.apache.cxf.tools.wsdlto.core.FrontEndProfile)1 PluginLoader (org.apache.cxf.tools.wsdlto.core.PluginLoader)1 AntGenerator (org.apache.cxf.tools.wsdlto.frontend.jaxws.generators.AntGenerator)1 ImplGenerator (org.apache.cxf.tools.wsdlto.frontend.jaxws.generators.ImplGenerator)1 WSDLToJavaProcessor (org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.WSDLToJavaProcessor)1 JAXWSDefinitionBuilder (org.apache.cxf.tools.wsdlto.frontend.jaxws.wsdl11.JAXWSDefinitionBuilder)1