Package org.apache.xml.resolver

Examples of org.apache.xml.resolver.Catalog


     * parsed immediately. The others will be queued and read if
     * they are needed later.
     */
    private void parseCatalogs () throws IOException {
        if (fCatalogsList != null) {
            fCatalog = new Catalog(fResolverCatalogManager);
            attachReaderToCatalog(fCatalog);
            for (int i = 0; i < fCatalogsList.length; ++i) {
                String catalog = fCatalogsList[i];
                if (catalog != null && catalog.length() > 0) {
                    fCatalog.parseCatalog(catalog);
View Full Code Here


        return getTargetNode(resolvedLocation);
    }

    private String resolveByCatalog(String url) {
        Bus bus = (Bus)env.get(Bus.class);
        Catalog catalogResolver = OASISCatalogManager.getCatalogManager(bus).getCatalog();
        String resolvedLocation;
        try {
            resolvedLocation = catalogResolver.resolveSystem(url);
            if (resolvedLocation == null) {
                resolvedLocation = catalogResolver.resolveURI(url);
            }
        } catch (Exception e1) {
            Message msg = new Message("FAILED_RESOLVE_CATALOG", LOG, url);
            throw new ToolException(msg, e1);
        }
View Full Code Here

    }

    private Document getWSDLDoc(String wsdl) {
        LOG.log(Level.FINE, new Message("VALIDATE_WSDL", LOG, wsdl).toString());
        try {
            Catalog catalogResolver = OASISCatalogManager.getCatalogManager(this.getBus()).getCatalog();

            String nw = catalogResolver.resolveSystem(wsdl);
            if (nw == null) {
                nw = catalogResolver.resolveURI(wsdl);
            }
            if (nw == null) {
                nw = catalogResolver.resolvePublic(wsdl, null);
            }
            if (nw == null) {
                nw = wsdl;
            }
            return XMLUtils.parse(new InputSource(URIParserUtil.getAbsoluteURI(nw)));
View Full Code Here

                    return;
                }
            }
        }

        Catalog catalog = loadCatalog();

        WSDLLocator wsdlLocator = null;
        if (isURL(this.wsdlURI.toString())) {
            wsdlLocator = new CatalogWSDLLocator(this.wsdlURI.toString(), catalog);
        } else {
View Full Code Here

        CatalogManager catalogManager = new CatalogManager();
        catalogManager.setUseStaticCatalog(false);
        catalogManager.setIgnoreMissingProperties(true);
        CatalogResolver catalogResolver = new CatalogResolver(catalogManager);
        Catalog catalog = catalogResolver.getCatalog();

        if (catalogURI != null) {
            LOG.debug("Found OASIS catalog {} ", catalogURI);
            try {
                catalog.parseCatalog(catalogURI);
            } catch (Exception e) {
                LOG.warn("Failed to read OASIS catalog", e);
            }
        }
View Full Code Here

     *
     * If this manager uses static catalogs, the same static catalog will
     * always be returned. Otherwise a new catalog will be returned.
     */
    public Catalog getCatalog() {
        Catalog catalog = staticCatalog;

        if (catalog == null || !super.getUseStaticCatalog()) {
            catalog = getPrivateCatalog();
        }
        return catalog;
View Full Code Here

     * This method returns an instance of the underlying catalog class.
     */
    public Catalog getPrivateCatalog() {
        try {
            final CatalogManager cm = this;
            Catalog catalog =
                (Catalog) AccessController.
                doPrivileged(new PrivilegedExceptionAction() {
                    public Object run() throws Exception {
                        Catalog catalog = staticCatalog;
                        boolean useStatic = cm.getUseStaticCatalog();

                        if (catalog == null || !useStatic) {

                            String catalogClassName = getCatalogClassName();
                            if (catalogClassName == null) {
                                catalog = new Catalog();
                            } else {
                                try {
                                    catalog = (Catalog) Class.forName(catalogClassName).newInstance();
                                } catch (ClassNotFoundException cnfe) {
                                    debug.message(1,"Catalog class named '"
                                                  + catalogClassName
                                                  + "' could not be found. Using default.");
                                    catalog = new Catalog();
                                } catch (ClassCastException cnfe) {
                                    debug.message(1,"Class named '"
                                                  + catalogClassName
                                                  + "' is not a Catalog. Using default.");
                                    catalog = new Catalog();
                                }
                            }

                            catalog.setCatalogManager(cm);
                            catalog.setupReaders();
                            catalog.loadSystemCatalogs();
                        }
                        return catalog;
                    }});
            staticCatalog = catalog;
            return catalog;
View Full Code Here

      
    }
   
    private String resolveWSDLLocationByCatalog(String wsdlLocation) {
        if (catalogManager != null) {
            Catalog catalog = catalogManager.getCatalog();
            if (catalog != null) {
                String resolvedLocation = null;
                try {
                    resolvedLocation = catalog.resolveSystem(wsdlLocation);
                    if (resolvedLocation == null) {
                        resolvedLocation = catalog.resolveURI(wsdlLocation);
                    }
                    // normally, one might also do the following, but in this case we're looking at a top-level WSDL, so no parent
                    // resolvedLocation = catalog.resolvePublic(wsdlLocation, parent);
                    if (resolvedLocation != null) {
                        if (log.isDebugEnabled()) {
View Full Code Here

     * XMLCatalog calls this to add an external catalog file for each
     * file within a <code>&lt;catalogfiles&gt;</code> fileset.
     */
    public void parseCatalog(String file) {

        Catalog _catalog = getCatalog();
        if (!(_catalog instanceof ApacheCatalog)) {
            throw new BuildException("Wrong catalog type found: " + _catalog.getClass().getName());
        }
        ApacheCatalog catalog = (ApacheCatalog) _catalog;

        // Pass in reference to ourselves so we can be called back.
        catalog.setResolver(this);
View Full Code Here

     *
     * If this manager uses static catalogs, the same static catalog will
     * always be returned. Otherwise a new catalog will be returned.
     */
    public Catalog getCatalog() {
        Catalog catalog = staticCatalog;

        if (catalog == null || !super.getUseStaticCatalog()) {
            catalog = getPrivateCatalog();
        }
        return catalog;
View Full Code Here

TOP

Related Classes of org.apache.xml.resolver.Catalog

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.