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);
}
}
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);
}
}
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;
}
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);
}
}
}
Aggregations