/** * Initialization. Create a CatalogManager and set all * the properties upfront. This prevents JVM wide system properties * or a property file somewhere in the environment from affecting * the behaviour of this catalog resolver. */ private void init (String [] catalogs, boolean preferPublic) { fCatalogsList = (catalogs != null) ? (String[]) catalogs.clone() : null; fPreferPublic = preferPublic; fResolverCatalogManager = new CatalogManager(); fResolverCatalogManager.setAllowOasisXMLCatalogPI(false); fResolverCatalogManager.setCatalogClassName("org.apache.xml.resolver.Catalog"); fResolverCatalogManager.setCatalogFiles(""); fResolverCatalogManager.setIgnoreMissingProperties(true); fResolverCatalogManager.setPreferPublic(fPreferPublic); fResolverCatalogManager.setRelativeCatalogs(false); fResolverCatalogManager.setUseStaticCatalog(false); fResolverCatalogManager.setVerbosity(0); }
Vector<String> catalogs = catalogManager.getCatalogFiles(); if (catalogs != null)
default_override = catalogManager.getPreferPublic(); catalogManager.debug.message(DEBUG_NORMAL, "Parse catalog: " + fileName);
/** * Build a private {@link Catalog}, that is, not the static instance that {@link CatalogManager} * returns by default. * * <p>Care must be taken to use only private {@link Catalog} instances if there will ever be * more than one OASIS Catalog used in a single class loader (i.e. a single maven test run), * otherwise {@link Catalog} contents will be an amalgam of the entries of both OASIS Catalog * files, with likely unintended or incorrect results. See GEOT-2497. * * @param catalogLocation URL of OASIS Catalog * @return a private Catalog */ static Catalog buildPrivateCatalog(URL catalogLocation) { CatalogManager catalogManager = new CatalogManager(); catalogManager.setUseStaticCatalog(false); catalogManager.setVerbosity(0); catalogManager.setIgnoreMissingProperties(true); Catalog catalog = catalogManager.getCatalog(); try { catalog.parseCatalog(catalogLocation); } catch (IOException e) { throw new RuntimeException( "Error trying to load OASIS catalog from URL " + catalogLocation.toString(), e); } return catalog; }
/** * Loads mappings from configuration file */ private void init() { if (log.isDebugEnabled()) { log.debug("init catalog file " + this.catalogFileURI); } manager.setUseStaticCatalog(false); manager.setCatalogFiles(this.catalogFileURI.toString()); manager.setIgnoreMissingProperties(true); catalog = manager.getCatalog(); }
CatalogManager manager = new CatalogManager(); manager.setIgnoreMissingProperties(true); manager.setAllowOasisXMLCatalogPI(true); manager.setPreferPublic(true); manager.setRelativeCatalogs(false); manager.setUseStaticCatalog(false); manager.setVerbosity(0); _catalogResolver = new XmlValidatorCatalogResolver(manager); _catalogResolver.namespaceAware = _isNamespaceAware;
private static EntityResolver getResolver() { try { CatalogManager catalogManager = new CatalogManager(); if (DEBUG_LEVEL != null) { catalogManager.debug.setDebug(Integer.parseInt(DEBUG_LEVEL)); } catalogManager.setUseStaticCatalog(false); catalogManager.setIgnoreMissingProperties(true); return new CatalogResolver(catalogManager) { public String getResolvedEntity(String publicId, String systemId) { String s = super.getResolvedEntity(publicId, systemId); if (s != null && s.startsWith("classpath:")) { try { URIResolver r = new URIResolver(s); if (r.isResolved()) { r.getInputStream().close(); return r.getURL().toExternalForm(); } } catch (IOException e) { //ignore } } return s; } }; } catch (Throwable t) { //ignore } return null; }
public Object createCatalogResolver( String catalogs, Boolean preferPublic, Boolean allowCatalogPI) { CatalogManager cm = new CatalogManager(); cm.setIgnoreMissingProperties(true); cm.setUseStaticCatalog(false); if (preferPublic != null) { cm.setPreferPublic(preferPublic.booleanValue()); cm.setAllowOasisXMLCatalogPI(allowCatalogPI.booleanValue()); Vector v = cm.getCatalogFiles(); if (v != null) { sb = new StringBuffer(); cm.setCatalogFiles(catalogs + ";" + sb); } else { cm.setCatalogFiles(catalogs);
/** * Get CatalogResolver. * @return CatalogResolver */ public static synchronized CatalogResolver getCatalogResolver() { if (catalogResolver == null) { final CatalogManager manager = new CatalogManager(); manager.setIgnoreMissingProperties(true); manager.setUseStaticCatalog(false); // We'll use a private catalog. manager.setPreferPublic(true); final File catalogFilePath = new File(ditaDir, Configuration.pluginResourceDirs.get("org.dita.base") + File.separator + FILE_NAME_CATALOG); manager.setCatalogFiles(catalogFilePath.toURI().toASCIIString()); //manager.setVerbosity(10); catalogResolver = new CatalogResolver(manager); } return catalogResolver; } }
private void initResolver() throws IOException { CatalogManager catalogManager = new CatalogManager(); catalogManager.setUseStaticCatalog(true); catalogManager.setIgnoreMissingProperties(true); catalogManager.setVerbosity(1); catalogManager.setPreferPublic(true); CatalogResolver catalogResolver = new CatalogResolver(catalogManager); Catalog catalog = catalogResolver.getCatalog(); if (catalogFiles != null && catalogFiles.length > 0) { for (File catalogFile : catalogFiles) { LOGGER.trace("Using catalog file {}", catalogFile); catalog.parseCatalog(catalogFile.getPath()); } } else if (catalogResourceName != null) { LOGGER.trace("Using catalog from resource: {}", catalogResourceName); Enumeration<URL> catalogs = Thread.currentThread().getContextClassLoader().getResources(catalogResourceName); while (catalogs.hasMoreElements()) { URL catalogResourceUrl = catalogs.nextElement(); LOGGER.trace("Parsing catalog from URL: {}", catalogResourceUrl); catalog.parseCatalog(catalogResourceUrl); } } else { throw new IllegalStateException("Catalog is not defined"); } builtinSchemaResolver = catalogResolver; } //endregion
CatalogManager manager = new CatalogManager(); manager.setIgnoreMissingProperties(true); ClassLoader classLoader = Thread.currentThread() .getContextClassLoader(); getLog().warn("Failed to find catalog files."); } else { manager.setCatalogFiles(catalogFiles);
URIResolver testResolver = defaultResolver; if (catalog.exists()) { CatalogManager catman = new CatalogManager(); catman.setUseStaticCatalog(false); catman.setCatalogFiles(catalog.getPath()); testResolver = new CatalogResolver(catman);
private JavaTypeManager() { // create the entity resolver to ensure proper DTD resolution // regardless of whether or not the system id specified in an // xml file is valid: CatalogManager catalogManager = new CatalogManager(ENTITY_RESOLVER_PROPERTIES); resolver = new CatalogResolver(catalogManager); load(); }
CatalogManager catalogManager = new CatalogManager(); catalogManager.setVerbosity(999);
/** * How are missing properties handled? * * <p>If ignore is true, missing or unreadable property files will * not be reported. Otherwise, a message will be sent to System.err. * </p> * * @deprecated No longer static; use get/set methods. */ public void ignoreMissingProperties(boolean ignore) { setIgnoreMissingProperties(ignore); }
if (isTracing) { CatalogManager.getStaticManager().debug = new Debug() { @Override public void message(int level, String message) { if (CatalogManager.getStaticManager().getVerbosity() < 2) { CatalogManager.getStaticManager().setVerbosity(2);
@Test public void testParseCatalog() throws Exception { URL file = TestData.url(this, "commonSchemas_new.oasis.xml"); ResolvingXMLReader reader = new ResolvingXMLReader(); Catalog catalog = reader.getCatalog(); catalog.getCatalogManager().setVerbosity(9); catalog.parseCatalog(file); final URL baseUri = new URL("http://schemas.opengis.net/gml/"); // the system override defined in the catalog final URL override = new URL("file:///schemas/gml/trunk/gml/"); final String extraPath = "3.1.1/basicTypes.xsd"; final String uri = new URL(baseUri, extraPath).toExternalForm(); final String expected = new URL(override, extraPath).toExternalForm(); String resolved = catalog.resolveSystem(uri); assertNotNull(resolved); final String actual = new URL(resolved).toExternalForm(); assertEquals(expected, actual); } }
/** * Set the list of catalog files. * This method will reset the staticCatalog for this CatalogManager. */ public void setCatalogFiles(String fileList) { staticCatalog = null; super.setCatalogFiles(fileList); }
if ( properties.hasCatalogFile() ) CatalogManager catalogManager = CatalogManager.getStaticManager(); catalogManager.setCatalogFiles( properties.getCatalogFile() ); EntityResolver entityResolver = new CatalogResolver(); entityResolver = new PassThroughResolver( entityResolver );
/** * What is the current verbosity? * * @deprecated No longer static; use get/set methods. */ public int verbosity () { return getVerbosity(); }