Search in sources :

Example 1 with WSDLExtensibilityPlugin

use of org.apache.cxf.wsdl.WSDLExtensibilityPlugin in project cxf by apache.

the class WSDLToServiceProcessor method setAddrElement.

private void setAddrElement() throws ToolException {
    String transport = (String) env.get(ToolConstants.CFG_TRANSPORT);
    Address address = AddressFactory.getInstance().getAddresser(transport);
    Map<String, String> ns = address.getNamespaces(env);
    for (Map.Entry<String, String> entry : ns.entrySet()) {
        wsdlDefinition.addNamespace(entry.getKey(), entry.getValue());
    }
    WSDLExtensibilityPlugin plugin = getWSDLPlugin(transport, Port.class);
    try {
        ExtensibilityElement extElement = plugin.createExtension(address.buildAddressArguments(env));
        port.addExtensibilityElement(extElement);
    } catch (WSDLException wse) {
        Message msg = new Message("FAIL_TO_CREATE_SOAP_ADDRESS", LOG);
        throw new ToolException(msg, wse);
    }
}
Also used : Address(org.apache.cxf.tools.misc.processor.address.Address) Message(org.apache.cxf.common.i18n.Message) WSDLException(javax.wsdl.WSDLException) WSDLExtensibilityPlugin(org.apache.cxf.wsdl.WSDLExtensibilityPlugin) ToolException(org.apache.cxf.tools.common.ToolException) Map(java.util.Map) ExtensibilityElement(javax.wsdl.extensions.ExtensibilityElement)

Example 2 with WSDLExtensibilityPlugin

use of org.apache.cxf.wsdl.WSDLExtensibilityPlugin in project cxf by apache.

the class WSDLToXMLProcessor method setAddrElement.

private void setAddrElement() throws ToolException {
    Address address = AddressFactory.getInstance().getAddresser("xml");
    for (Map.Entry<String, String> entry : address.getNamespaces(env).entrySet()) {
        wsdlDefinition.addNamespace(entry.getKey(), entry.getValue());
    }
    WSDLExtensibilityPlugin generator = getWSDLPlugin("xml", Port.class);
    try {
        ExtensibilityElement extElement = generator.createExtension(address.buildAddressArguments(env));
        port.addExtensibilityElement(extElement);
    } catch (WSDLException wse) {
        Message msg = new Message("FAIL_TO_CREATE_SOAPADDRESS", LOG);
        throw new ToolException(msg);
    }
}
Also used : Address(org.apache.cxf.tools.misc.processor.address.Address) Message(org.apache.cxf.common.i18n.Message) WSDLException(javax.wsdl.WSDLException) WSDLExtensibilityPlugin(org.apache.cxf.wsdl.WSDLExtensibilityPlugin) ToolException(org.apache.cxf.tools.common.ToolException) HashMap(java.util.HashMap) Map(java.util.Map) ExtensibilityElement(javax.wsdl.extensions.ExtensibilityElement)

Example 3 with WSDLExtensibilityPlugin

use of org.apache.cxf.wsdl.WSDLExtensibilityPlugin in project cxf by apache.

the class AbstractWSDLToProcessor method getWSDLPlugin.

public WSDLExtensibilityPlugin getWSDLPlugin(final String key, final Class<?> clz) {
    StringBuilder sb = new StringBuilder();
    sb.append(key);
    sb.append('-');
    sb.append(clz.getName());
    WSDLExtensibilityPlugin plugin = wsdlPlugins.get(sb.toString());
    if (plugin == null) {
        throw new ToolException(new Message("FOUND_NO_WSDL_PLUGIN", LOG, sb.toString(), clz));
    }
    return plugin;
}
Also used : Message(org.apache.cxf.common.i18n.Message) WSDLExtensibilityPlugin(org.apache.cxf.wsdl.WSDLExtensibilityPlugin) ToolException(org.apache.cxf.tools.common.ToolException)

Example 4 with WSDLExtensibilityPlugin

use of org.apache.cxf.wsdl.WSDLExtensibilityPlugin in project cxf by apache.

the class WSDLDefinitionBuilder method registerWSDLExtensibilityPlugins.

private void registerWSDLExtensibilityPlugins(ExtensionRegistry registry) {
    final Properties initialExtensions;
    try {
        initialExtensions = PropertiesLoaderUtils.loadAllProperties(WSDL_PLUGIN_RESOURCE, Thread.currentThread().getContextClassLoader());
    } catch (IOException ex) {
        throw new RuntimeException(ex);
    }
    for (Iterator<?> it = initialExtensions.keySet().iterator(); it.hasNext(); ) {
        String key = (String) it.next();
        String pluginClz = initialExtensions.getProperty(key);
        try {
            if (LOG.isLoggable(Level.FINE)) {
                LOG.fine("Registering : " + pluginClz + " for type: " + key);
            }
            WSDLExtensibilityPlugin plugin = (WSDLExtensibilityPlugin) ClassLoaderUtils.loadClass(pluginClz, getClass()).newInstance();
            plugin.setExtensionRegistry(registry);
            wsdlPlugins.put(key, plugin);
        } catch (Exception ex) {
            LOG.log(Level.WARNING, "EXTENSION_ADD_FAILED_MSG", ex);
        }
    }
}
Also used : WSDLRuntimeException(org.apache.cxf.wsdl11.WSDLRuntimeException) WSDLExtensibilityPlugin(org.apache.cxf.wsdl.WSDLExtensibilityPlugin) IOException(java.io.IOException) Properties(java.util.Properties) WSDLRuntimeException(org.apache.cxf.wsdl11.WSDLRuntimeException) IOException(java.io.IOException)

Aggregations

WSDLExtensibilityPlugin (org.apache.cxf.wsdl.WSDLExtensibilityPlugin)4 Message (org.apache.cxf.common.i18n.Message)3 ToolException (org.apache.cxf.tools.common.ToolException)3 Map (java.util.Map)2 WSDLException (javax.wsdl.WSDLException)2 ExtensibilityElement (javax.wsdl.extensions.ExtensibilityElement)2 Address (org.apache.cxf.tools.misc.processor.address.Address)2 IOException (java.io.IOException)1 HashMap (java.util.HashMap)1 Properties (java.util.Properties)1 WSDLRuntimeException (org.apache.cxf.wsdl11.WSDLRuntimeException)1