Search in sources :

Example 1 with OASISCatalogManagerHelper

use of org.apache.cxf.catalog.OASISCatalogManagerHelper in project cxf by apache.

the class CustomizedWSDLLocator method resolve.

private InputSource resolve(final String target, final String base) {
    try {
        String resolvedLocation = new OASISCatalogManagerHelper().resolve(catalogResolver, target, base);
        if (resolvedLocation == null) {
            return this.resolver.resolve(target, base);
        }
        resolvedMap.put(target, resolvedLocation);
        return this.resolver.resolve(resolvedLocation, base);
    } catch (Exception e) {
        throw new RuntimeException("Catalog resolve failed: ", e);
    }
}
Also used : OASISCatalogManagerHelper(org.apache.cxf.catalog.OASISCatalogManagerHelper) URISyntaxException(java.net.URISyntaxException)

Example 2 with OASISCatalogManagerHelper

use of org.apache.cxf.catalog.OASISCatalogManagerHelper in project cxf by apache.

the class CustomizationParser method resolveByCatalog.

private String resolveByCatalog(String url) {
    if (StringUtils.isEmpty(url)) {
        return null;
    }
    Bus bus = env.get(Bus.class);
    OASISCatalogManager catalogResolver = OASISCatalogManager.getCatalogManager(bus);
    try {
        return new OASISCatalogManagerHelper().resolve(catalogResolver, url, null);
    } catch (Exception e1) {
        Message msg = new Message("FAILED_RESOLVE_CATALOG", LOG, url);
        throw new ToolException(msg, e1);
    }
}
Also used : Bus(org.apache.cxf.Bus) OASISCatalogManagerHelper(org.apache.cxf.catalog.OASISCatalogManagerHelper) Message(org.apache.cxf.common.i18n.Message) OASISCatalogManager(org.apache.cxf.catalog.OASISCatalogManager) ToolException(org.apache.cxf.tools.common.ToolException) URISyntaxException(java.net.URISyntaxException) XMLStreamException(javax.xml.stream.XMLStreamException) IOException(java.io.IOException) ToolException(org.apache.cxf.tools.common.ToolException)

Example 3 with OASISCatalogManagerHelper

use of org.apache.cxf.catalog.OASISCatalogManagerHelper in project cxf by apache.

the class WSDL11Validator method getWSDLDoc.

private Document getWSDLDoc(String wsdl) {
    LOG.log(Level.FINE, new Message("VALIDATE_WSDL", LOG, wsdl).toString());
    try {
        OASISCatalogManager catalogResolver = OASISCatalogManager.getCatalogManager(this.getBus());
        String nw = new OASISCatalogManagerHelper().resolve(catalogResolver, wsdl, null);
        if (nw == null) {
            nw = wsdl;
        }
        return new Stax2DOM().getDocument(URIParserUtil.getAbsoluteURI(nw));
    } catch (FileNotFoundException fe) {
        LOG.log(Level.WARNING, "Cannot find the wsdl " + wsdl + "to validate");
        return null;
    } catch (Exception e) {
        throw new ToolException(e);
    }
}
Also used : OASISCatalogManagerHelper(org.apache.cxf.catalog.OASISCatalogManagerHelper) Message(org.apache.cxf.common.i18n.Message) OASISCatalogManager(org.apache.cxf.catalog.OASISCatalogManager) FileNotFoundException(java.io.FileNotFoundException) ToolException(org.apache.cxf.tools.common.ToolException) URISyntaxException(java.net.URISyntaxException) IOException(java.io.IOException) FileNotFoundException(java.io.FileNotFoundException) WSDLException(javax.wsdl.WSDLException) ToolException(org.apache.cxf.tools.common.ToolException)

Example 4 with OASISCatalogManagerHelper

use of org.apache.cxf.catalog.OASISCatalogManagerHelper in project cxf by apache.

the class CatalogWSDLLocator method getImportInputSource.

public InputSource getImportInputSource(String parent, String importLocation) {
    String resolvedImportLocation = null;
    try {
        resolvedImportLocation = new OASISCatalogManagerHelper().resolve(manager, importLocation, parent);
    } catch (IOException e) {
        throw new RuntimeException("Catalog resolution failed", e);
    }
    InputSource in = null;
    if (resolvedImportLocation == null) {
        in = this.resolver.resolve(importLocation, parent);
    } else {
        in = this.resolver.resolve(resolvedImportLocation, null);
    }
    // we can throw a similar exception as in CatalogXmlSchemaURIResolver.
    if (in == null) {
        in = new InputSource();
    }
    return in;
}
Also used : OASISCatalogManagerHelper(org.apache.cxf.catalog.OASISCatalogManagerHelper) InputSource(org.xml.sax.InputSource) IOException(java.io.IOException)

Aggregations

OASISCatalogManagerHelper (org.apache.cxf.catalog.OASISCatalogManagerHelper)4 IOException (java.io.IOException)3 URISyntaxException (java.net.URISyntaxException)3 OASISCatalogManager (org.apache.cxf.catalog.OASISCatalogManager)2 Message (org.apache.cxf.common.i18n.Message)2 ToolException (org.apache.cxf.tools.common.ToolException)2 FileNotFoundException (java.io.FileNotFoundException)1 WSDLException (javax.wsdl.WSDLException)1 XMLStreamException (javax.xml.stream.XMLStreamException)1 Bus (org.apache.cxf.Bus)1 InputSource (org.xml.sax.InputSource)1