com.sun.org.apache.xml.internal.resolver.Catalog Java Examples

The following examples show how to use com.sun.org.apache.xml.internal.resolver.Catalog. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: XMLCatalogResolver.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Instruct the <code>Catalog</code> to parse each of the
 * catalogs in the list. Only the first catalog will actually be
 * 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);
            }
        }
    }
    else {
        fCatalog = null;
    }
}
 
Example #2
Source File: XmlUtil.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public static EntityResolver createEntityResolver(@Nullable URL catalogUrl) {
    // set up a manager
    CatalogManager manager = new CatalogManager();
    manager.setIgnoreMissingProperties(true);
    // Using static catalog may  result in to sharing of the catalog by multiple apps running in a container
    manager.setUseStaticCatalog(false);
    Catalog catalog = manager.getCatalog();
    try {
        if (catalogUrl != null) {
            catalog.parseCatalog(catalogUrl);
        }
    } catch (IOException e) {
        throw new ServerRtException("server.rt.err",e);
    }
    return workaroundCatalogResolver(catalog);
}
 
Example #3
Source File: XMLCatalogResolver.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Instruct the <code>Catalog</code> to parse each of the
 * catalogs in the list. Only the first catalog will actually be
 * 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);
            }
        }
    }
    else {
        fCatalog = null;
    }
}
 
Example #4
Source File: XMLCatalogResolver.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Instruct the <code>Catalog</code> to parse each of the
 * catalogs in the list. Only the first catalog will actually be
 * 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);
            }
        }
    }
    else {
        fCatalog = null;
    }
}
 
Example #5
Source File: XMLCatalogResolver.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Instruct the <code>Catalog</code> to parse each of the
 * catalogs in the list. Only the first catalog will actually be
 * 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);
            }
        }
    }
    else {
        fCatalog = null;
    }
}
 
Example #6
Source File: XMLCatalogResolver.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
/**
 * Instruct the <code>Catalog</code> to parse each of the
 * catalogs in the list. Only the first catalog will actually be
 * 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);
            }
        }
    }
    else {
        fCatalog = null;
    }
}
 
Example #7
Source File: XmlUtil.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public static EntityResolver createEntityResolver(@Nullable URL catalogUrl) {
    // set up a manager
    CatalogManager manager = new CatalogManager();
    manager.setIgnoreMissingProperties(true);
    // Using static catalog may  result in to sharing of the catalog by multiple apps running in a container
    manager.setUseStaticCatalog(false);
    Catalog catalog = manager.getCatalog();
    try {
        if (catalogUrl != null) {
            catalog.parseCatalog(catalogUrl);
        }
    } catch (IOException e) {
        throw new ServerRtException("server.rt.err",e);
    }
    return workaroundCatalogResolver(catalog);
}
 
Example #8
Source File: XmlUtil.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public static EntityResolver createEntityResolver(@Nullable URL catalogUrl) {
    // set up a manager
    CatalogManager manager = new CatalogManager();
    manager.setIgnoreMissingProperties(true);
    // Using static catalog may  result in to sharing of the catalog by multiple apps running in a container
    manager.setUseStaticCatalog(false);
    Catalog catalog = manager.getCatalog();
    try {
        if (catalogUrl != null) {
            catalog.parseCatalog(catalogUrl);
        }
    } catch (IOException e) {
        throw new ServerRtException("server.rt.err",e);
    }
    return workaroundCatalogResolver(catalog);
}
 
Example #9
Source File: XMLCatalogResolver.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * Instruct the <code>Catalog</code> to parse each of the
 * catalogs in the list. Only the first catalog will actually be
 * 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);
            }
        }
    }
    else {
        fCatalog = null;
    }
}
 
Example #10
Source File: XmlUtil.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public static EntityResolver createEntityResolver(@Nullable URL catalogUrl) {
    // set up a manager
    CatalogManager manager = new CatalogManager();
    manager.setIgnoreMissingProperties(true);
    // Using static catalog may  result in to sharing of the catalog by multiple apps running in a container
    manager.setUseStaticCatalog(false);
    Catalog catalog = manager.getCatalog();
    try {
        if (catalogUrl != null) {
            catalog.parseCatalog(catalogUrl);
        }
    } catch (IOException e) {
        throw new ServerRtException("server.rt.err",e);
    }
    return workaroundCatalogResolver(catalog);
}
 
Example #11
Source File: XmlUtil.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 *  Default CatalogResolver implementation is broken as it depends on CatalogManager.getCatalog() which will always create a new one when
 *  useStaticCatalog is false.
 *  This returns a CatalogResolver that uses the catalog passed as parameter.
 * @param catalog
 * @return  CatalogResolver
 */
private static CatalogResolver workaroundCatalogResolver(final Catalog catalog) {
    // set up a manager
    CatalogManager manager = new CatalogManager() {
        @Override
        public Catalog getCatalog() {
            return catalog;
        }
    };
    manager.setIgnoreMissingProperties(true);
    // Using static catalog may  result in to sharing of the catalog by multiple apps running in a container
    manager.setUseStaticCatalog(false);

    return new CatalogResolver(manager);
}
 
Example #12
Source File: XMLCatalogResolver.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Attaches the reader to the catalog.
 */
private void attachReaderToCatalog (Catalog catalog) {

    SAXParserFactory spf = new SAXParserFactoryImpl();
    spf.setNamespaceAware(true);
    spf.setValidating(false);

    SAXCatalogReader saxReader = new SAXCatalogReader(spf);
    saxReader.setCatalogParser(OASISXMLCatalogReader.namespaceName, "catalog",
        "com.sun.org.apache.xml.internal.resolver.readers.OASISXMLCatalogReader");
    catalog.addReader("application/xml", saxReader);
}
 
Example #13
Source File: XMLCatalogResolver.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Attaches the reader to the catalog.
 */
private void attachReaderToCatalog (Catalog catalog) {

    SAXParserFactory spf = JdkXmlUtils.getSAXFactory(
            catalog.getCatalogManager().overrideDefaultParser());
    spf.setValidating(false);

    SAXCatalogReader saxReader = new SAXCatalogReader(spf);
    saxReader.setCatalogParser(OASISXMLCatalogReader.namespaceName, "catalog",
        "com.sun.org.apache.xml.internal.resolver.readers.OASISXMLCatalogReader");
    catalog.addReader("application/xml", saxReader);
}
 
Example #14
Source File: XmlUtil.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Gets a default EntityResolver for catalog at META-INF/jaxws-catalog.xml
 */
public static EntityResolver createDefaultCatalogResolver() {

    // set up a manager
    CatalogManager manager = new CatalogManager();
    manager.setIgnoreMissingProperties(true);
    // Using static catalog may  result in to sharing of the catalog by multiple apps running in a container
    manager.setUseStaticCatalog(false);
    // parse the catalog
    ClassLoader cl = Thread.currentThread().getContextClassLoader();
    Enumeration<URL> catalogEnum;
    Catalog catalog = manager.getCatalog();
    try {
        if (cl == null) {
            catalogEnum = ClassLoader.getSystemResources("META-INF/jax-ws-catalog.xml");
        } else {
            catalogEnum = cl.getResources("META-INF/jax-ws-catalog.xml");
        }

        while(catalogEnum.hasMoreElements()) {
            URL url = catalogEnum.nextElement();
            catalog.parseCatalog(url);
        }
    } catch (IOException e) {
        throw new WebServiceException(e);
    }

    return workaroundCatalogResolver(catalog);
}
 
Example #15
Source File: XMLCatalogResolver.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
/**
 * Attaches the reader to the catalog.
 */
private void attachReaderToCatalog (Catalog catalog) {

    SAXParserFactory spf = new SAXParserFactoryImpl();
    spf.setNamespaceAware(true);
    spf.setValidating(false);

    SAXCatalogReader saxReader = new SAXCatalogReader(spf);
    saxReader.setCatalogParser(OASISXMLCatalogReader.namespaceName, "catalog",
        "com.sun.org.apache.xml.internal.resolver.readers.OASISXMLCatalogReader");
    catalog.addReader("application/xml", saxReader);
}
 
Example #16
Source File: XmlUtil.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 *  Default CatalogResolver implementation is broken as it depends on CatalogManager.getCatalog() which will always create a new one when
 *  useStaticCatalog is false.
 *  This returns a CatalogResolver that uses the catalog passed as parameter.
 * @param catalog
 * @return  CatalogResolver
 */
private static CatalogResolver workaroundCatalogResolver(final Catalog catalog) {
    // set up a manager
    CatalogManager manager = new CatalogManager() {
        @Override
        public Catalog getCatalog() {
            return catalog;
        }
    };
    manager.setIgnoreMissingProperties(true);
    // Using static catalog may  result in to sharing of the catalog by multiple apps running in a container
    manager.setUseStaticCatalog(false);

    return new CatalogResolver(manager);
}
 
Example #17
Source File: XMLCatalogResolver.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Attaches the reader to the catalog.
 */
private void attachReaderToCatalog (Catalog catalog) {

    SAXParserFactory spf = JdkXmlUtils.getSAXFactory(
            catalog.getCatalogManager().overrideDefaultParser());
    spf.setValidating(false);

    SAXCatalogReader saxReader = new SAXCatalogReader(spf);
    saxReader.setCatalogParser(OASISXMLCatalogReader.namespaceName, "catalog",
        "com.sun.org.apache.xml.internal.resolver.readers.OASISXMLCatalogReader");
    catalog.addReader("application/xml", saxReader);
}
 
Example #18
Source File: XmlUtil.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Gets a default EntityResolver for catalog at META-INF/jaxws-catalog.xml
 */
public static EntityResolver createDefaultCatalogResolver() {

    // set up a manager
    CatalogManager manager = new CatalogManager();
    manager.setIgnoreMissingProperties(true);
    // Using static catalog may  result in to sharing of the catalog by multiple apps running in a container
    manager.setUseStaticCatalog(false);
    // parse the catalog
    ClassLoader cl = Thread.currentThread().getContextClassLoader();
    Enumeration<URL> catalogEnum;
    Catalog catalog = manager.getCatalog();
    try {
        if (cl == null) {
            catalogEnum = ClassLoader.getSystemResources("META-INF/jax-ws-catalog.xml");
        } else {
            catalogEnum = cl.getResources("META-INF/jax-ws-catalog.xml");
        }

        while(catalogEnum.hasMoreElements()) {
            URL url = catalogEnum.nextElement();
            catalog.parseCatalog(url);
        }
    } catch (IOException e) {
        throw new WebServiceException(e);
    }

    return workaroundCatalogResolver(catalog);
}
 
Example #19
Source File: ResolvingXMLFilter.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Provide accessto the underlying Catalog.
 */
public Catalog getCatalog() {
  return catalogResolver.getCatalog();
}
 
Example #20
Source File: XCatalogReader.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/** Set the current catalog. */
public void setCatalog (Catalog catalog) {
  this.catalog = catalog;
  debug = catalog.getCatalogManager().debug;
}
 
Example #21
Source File: CatalogResolver.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/** Return the underlying catalog */
public Catalog getCatalog() {
  return catalog;
}
 
Example #22
Source File: ResolvingXMLFilter.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Provide accessto the underlying Catalog.
 */
public Catalog getCatalog() {
  return catalogResolver.getCatalog();
}
 
Example #23
Source File: OASISXMLCatalogReader.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/** Set the current catalog. */
public void setCatalog (Catalog catalog) {
  this.catalog = catalog;
  debug = catalog.getCatalogManager().debug;
}
 
Example #24
Source File: ResolvingXMLFilter.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Provide accessto the underlying Catalog.
 */
public Catalog getCatalog() {
  return catalogResolver.getCatalog();
}
 
Example #25
Source File: OASISXMLCatalogReader.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/** Get the current catalog. */
public Catalog getCatalog () {
  return catalog;
}
 
Example #26
Source File: XCatalogReader.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/** Constructor allowing for providing custom SAX parser factory */
public XCatalogReader(SAXParserFactory parserFactory, Catalog catalog) {
  super(parserFactory);
  setCatalog(catalog);
}
 
Example #27
Source File: XCatalogReader.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
/** Set the current catalog. */
public void setCatalog (Catalog catalog) {
  this.catalog = catalog;
}
 
Example #28
Source File: ResolvingXMLFilter.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Provide accessto the underlying Catalog.
 */
public Catalog getCatalog() {
  return catalogResolver.getCatalog();
}
 
Example #29
Source File: ResolvingParser.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
/** Return the Catalog being used. */
public Catalog getCatalog() {
  return catalogResolver.getCatalog();
}
 
Example #30
Source File: ResolvingParser.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/** Return the Catalog being used. */
public Catalog getCatalog() {
  return catalogResolver.getCatalog();
}