Search in sources :

Example 46 with Message

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);
    }
}
Also used : Message(org.apache.cxf.common.i18n.Message) NodeList(org.w3c.dom.NodeList) Node(org.w3c.dom.Node) Element(org.w3c.dom.Element) ToolException(org.apache.cxf.tools.common.ToolException)

Example 47 with Message

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();
}
Also used : Message(org.apache.cxf.common.i18n.Message) URISyntaxException(java.net.URISyntaxException) ToolException(org.apache.cxf.tools.common.ToolException) URI(java.net.URI)

Example 48 with Message

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);
    }
}
Also used : Message(org.apache.cxf.common.i18n.Message) JAXBException(javax.xml.bind.JAXBException) FileNotFoundException(java.io.FileNotFoundException) ToolException(org.apache.cxf.tools.common.ToolException) IOException(java.io.IOException)

Example 49 with Message

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;
}
Also used : Message(org.apache.cxf.common.i18n.Message) ToolException(org.apache.cxf.tools.common.ToolException) XMLStreamException(javax.xml.stream.XMLStreamException) IOException(java.io.IOException) JAXBException(javax.xml.bind.JAXBException) FileNotFoundException(java.io.FileNotFoundException) ToolException(org.apache.cxf.tools.common.ToolException)

Example 50 with Message

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);
    }
}
Also used : Message(org.apache.cxf.common.i18n.Message) QName(javax.xml.namespace.QName) Definition(javax.wsdl.Definition) WSDLManager(org.apache.cxf.wsdl.WSDLManager) WSDLRuntimeException(org.apache.cxf.wsdl11.WSDLRuntimeException) WSDLRuntimeException(org.apache.cxf.wsdl11.WSDLRuntimeException) IOException(java.io.IOException)

Aggregations

Message (org.apache.cxf.common.i18n.Message)201 ToolException (org.apache.cxf.tools.common.ToolException)69 IOException (java.io.IOException)45 QName (javax.xml.namespace.QName)42 Fault (org.apache.cxf.interceptor.Fault)34 XMLStreamException (javax.xml.stream.XMLStreamException)27 JAXBException (javax.xml.bind.JAXBException)23 ArrayList (java.util.ArrayList)19 XmlSchemaElement (org.apache.ws.commons.schema.XmlSchemaElement)17 Element (org.w3c.dom.Element)17 File (java.io.File)16 WSDLException (javax.wsdl.WSDLException)15 Method (java.lang.reflect.Method)14 SoapMessage (org.apache.cxf.binding.soap.SoapMessage)13 ServiceInfo (org.apache.cxf.service.model.ServiceInfo)12 InputStream (java.io.InputStream)11 HashMap (java.util.HashMap)11 List (java.util.List)11 Map (java.util.Map)11 ServiceConstructionException (org.apache.cxf.service.factory.ServiceConstructionException)11