use of org.apache.cxf.common.i18n.Message in project cxf by apache.
the class CustomizationParser method internalizeBinding.
protected void internalizeBinding(Element bindings, Element targetNode, String expression) {
if (bindings.getAttributeNode("wsdlLocation") != null) {
expression = "/";
}
if (isGlobaleBindings(bindings)) {
nodeSelector.addNamespaces(wsdlNode);
if (targetNode != wsdlNode) {
nodeSelector.addNamespaces(targetNode);
}
copyBindingsToWsdl(targetNode, bindings, nodeSelector.getNamespaceContext());
}
if (isJAXWSBindings(bindings) && bindings.getAttributeNode("node") != null) {
expression = expression + "/" + bindings.getAttribute("node");
nodeSelector.addNamespaces(bindings);
NodeList nodeList = nodeSelector.queryNodes(targetNode, expression);
if (nodeList == null || nodeList.getLength() == 0) {
throw new ToolException(new Message("NODE_NOT_EXISTS", LOG, new Object[] { expression }));
}
for (int i = 0; i < nodeList.getLength(); i++) {
Node node = nodeList.item(i);
if (hasJaxbBindingDeclaration(bindings)) {
copyAllJaxbDeclarations(node, bindings);
} else {
copyBindingsToWsdl(node, bindings, nodeSelector.getNamespaceContext());
}
}
}
Element[] children = getChildElements(bindings, ToolConstants.NS_JAXWS_BINDINGS);
for (Element child : children) {
internalizeBinding(child, targetNode, expression);
}
}
use of org.apache.cxf.common.i18n.Message in project cxf by apache.
the class CustomizationParser method getAbsoluteURI.
private String getAbsoluteURI(String uri, String bindingFile) {
URI locURI;
try {
locURI = new URI(uri);
} catch (URISyntaxException e) {
Message msg = new Message("BINDING_LOC_ERROR", LOG, new Object[] { uri });
throw new ToolException(msg);
}
if (!locURI.isAbsolute()) {
try {
String base = URIParserUtil.getAbsoluteURI(bindingFile);
URI baseURI = new URI(base);
locURI = baseURI.resolve(locURI);
} catch (URISyntaxException e) {
Message msg = new Message("NOT_URI", LOG, new Object[] { bindingFile });
throw new ToolException(msg, e);
}
}
return locURI.toString();
}
use of org.apache.cxf.common.i18n.Message in project cxf by apache.
the class PluginLoader method loadPlugin.
public void loadPlugin(String resource) {
try {
LOG.log(Level.FINE, "PLUGIN_LOADING", resource);
loadPlugin(getPlugin(resource));
} catch (FileNotFoundException fe) {
Message msg = new Message("PLUGIN_FILE_NOT_FOUND", LOG, resource);
LOG.log(Level.SEVERE, msg.toString());
throw new ToolException(msg, fe);
} catch (JAXBException | IOException e) {
Message msg = new Message("PLUGIN_LOAD_FAIL", LOG, resource);
LOG.log(Level.SEVERE, msg.toString());
throw new ToolException(msg, e);
}
}
use of org.apache.cxf.common.i18n.Message in project cxf by apache.
the class PluginLoader method loadFrontEndProfile.
private FrontEndProfile loadFrontEndProfile(String fullClzName) {
final FrontEndProfile profile;
try {
Class<?> clz = ClassLoaderUtils.loadClass(fullClzName, this.getClass());
profile = (FrontEndProfile) clz.newInstance();
} catch (Exception e) {
Message msg = new Message("FRONTEND_PROFILE_LOAD_FAIL", LOG, fullClzName);
LOG.log(Level.SEVERE, msg.toString());
throw new ToolException(msg, e);
}
return profile;
}
use of org.apache.cxf.common.i18n.Message in project cxf by apache.
the class WSDLDefinitionBuilder method parseWSDL.
@SuppressWarnings("unchecked")
protected void parseWSDL(String wsdlURL) {
try {
WSDLManager mgr = bus.getExtension(WSDLManager.class);
registerWSDLExtensibilityPlugins(mgr.getExtensionRegistry());
wsdlDefinition = mgr.getDefinition(wsdlURL);
parseImports(wsdlDefinition);
if (wsdlDefinition.getServices().isEmpty()) {
for (Definition def : importedDefinitions) {
Set<QName> services = def.getServices().keySet();
for (QName sName : services) {
if (!wsdlDefinition.getServices().keySet().contains(sName)) {
wsdlDefinition.getServices().put(sName, def.getService(sName));
}
}
}
}
} catch (Exception we) {
Message msg = new Message("FAIL_TO_CREATE_WSDL_DEFINITION", LOG, wsdlURL, we.getMessage());
throw new WSDLRuntimeException(msg, we);
}
}
Aggregations