src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/CatalogManager.java

Print this page

        

*** 1,19 **** /* ! * reserved comment block ! * DO NOT REMOVE OR ALTER! ! */ ! // CatalogManager.java - Access CatalogManager.properties ! ! /* ! * Copyright 2001-2004 The Apache Software Foundation or its licensors, ! * as applicable. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- 1,13 ---- /* ! * Licensed to the Apache Software Foundation (ASF) under one or more ! * contributor license agreements. See the NOTICE file distributed with ! * this work for additional information regarding copyright ownership. ! * The ASF licenses this file to You under the Apache License, Version 2.0 ! * (the "License"); you may not use this file except in compliance with ! * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*** 122,141 **** * * @version 1.0 */ public class CatalogManager { ! private static String pFiles = "xml.catalog.files"; ! private static String pVerbosity = "xml.catalog.verbosity"; ! private static String pPrefer = "xml.catalog.prefer"; ! private static String pStatic = "xml.catalog.staticCatalog"; ! private static String pAllowPI = "xml.catalog.allowPI"; ! private static String pClassname = "xml.catalog.className"; ! private static String pIgnoreMissing = "xml.catalog.ignoreMissing"; /** A static CatalogManager instance for sharing */ ! private static CatalogManager staticManager = new CatalogManager(); /** The bootstrap resolver to use when loading XML Catalogs. */ private BootstrapResolver bResolver = new BootstrapResolver(); /** Flag to ignore missing property files and/or properties */ --- 116,135 ---- * * @version 1.0 */ public class CatalogManager { ! private static final String pFiles = "xml.catalog.files"; ! private static final String pVerbosity = "xml.catalog.verbosity"; ! private static final String pPrefer = "xml.catalog.prefer"; ! private static final String pStatic = "xml.catalog.staticCatalog"; ! private static final String pAllowPI = "xml.catalog.allowPI"; ! private static final String pClassname = "xml.catalog.className"; ! private static final String pIgnoreMissing = "xml.catalog.ignoreMissing"; /** A static CatalogManager instance for sharing */ ! private static final CatalogManager staticManager = new CatalogManager(); /** The bootstrap resolver to use when loading XML Catalogs. */ private BootstrapResolver bResolver = new BootstrapResolver(); /** Flag to ignore missing property files and/or properties */
*** 178,188 **** /** Current setting of the static catalog flag. */ private Boolean useStaticCatalog = null; /** The static catalog used by this manager. */ ! private static Catalog staticCatalog = null; /** Default setting of the oasisXMLCatalogPI flag. */ private boolean defaultOasisXMLCatalogPI = true; /** Current setting of the oasisXMLCatalogPI flag. */ --- 172,182 ---- /** Current setting of the static catalog flag. */ private Boolean useStaticCatalog = null; /** The static catalog used by this manager. */ ! private static volatile Catalog staticCatalog = null; /** Default setting of the oasisXMLCatalogPI flag. */ private boolean defaultOasisXMLCatalogPI = true; /** Current setting of the oasisXMLCatalogPI flag. */
*** 229,249 **** // no attempt to read from the file before the caller has had a chance // to avoid it. if (System.getSecurityManager() == null) { useServicesMechanism = true; } } ! /** Set the bootstrap resolver.*/ public void setBootstrapResolver(BootstrapResolver resolver) { bResolver = resolver; } ! /** Get the bootstrap resolver.*/ public BootstrapResolver getBootstrapResolver() { return bResolver; } /** * Load the properties from the propertyFile and build the * resources from it. */ private synchronized void readProperties() { --- 223,265 ---- // no attempt to read from the file before the caller has had a chance // to avoid it. if (System.getSecurityManager() == null) { useServicesMechanism = true; } + // Make sure verbosity is set by xml.catalog.verbosity sysprop + // setting, if defined. + queryVerbosityFromSysProp(); } ! ! /** Set the bootstrap resolver ! * @param resolver the bootstrap resolver ! */ public void setBootstrapResolver(BootstrapResolver resolver) { bResolver = resolver; } ! /** Get the bootstrap resolver ! * @return the bootstrap resolver ! */ public BootstrapResolver getBootstrapResolver() { return bResolver; } + /** Query system property for verbosity level. */ + private void queryVerbosityFromSysProp() { + String verbStr = SecuritySupport.getSystemProperty(pVerbosity); + if (verbStr != null) { + try { + int verb = Integer.parseInt(verbStr.trim()); + verbosity = new Integer(verb); + debug.setDebug(verb); + } catch (Exception e) { + System.err.println("Cannot parse verbosity: \"" + verbStr + "\""); + } + } + } + /** * Load the properties from the propertyFile and build the * resources from it. */ private synchronized void readProperties() {
*** 439,449 **** * @return The relativeCatalogs setting from the propertyFile or the * defaultRelativeCatalogs. */ public boolean getRelativeCatalogs () { if (relativeCatalogs == null) { ! relativeCatalogs = new Boolean(queryRelativeCatalogs()); } return relativeCatalogs.booleanValue(); } --- 455,465 ---- * @return The relativeCatalogs setting from the propertyFile or the * defaultRelativeCatalogs. */ public boolean getRelativeCatalogs () { if (relativeCatalogs == null) { ! relativeCatalogs = queryRelativeCatalogs() ? Boolean.TRUE : Boolean.FALSE; } return relativeCatalogs.booleanValue(); }
*** 451,461 **** * Set the relativeCatalogs setting. * * @see #getRelativeCatalogs() */ public void setRelativeCatalogs (boolean relative) { ! relativeCatalogs = new Boolean(relative); } /** * Get the relativeCatalogs setting. * --- 467,477 ---- * Set the relativeCatalogs setting. * * @see #getRelativeCatalogs() */ public void setRelativeCatalogs (boolean relative) { ! relativeCatalogs = relative ? Boolean.TRUE : Boolean.FALSE; } /** * Get the relativeCatalogs setting. *
*** 580,599 **** * * @return True if public identifiers are preferred. */ public boolean getPreferPublic () { if (preferPublic == null) { ! preferPublic = new Boolean(queryPreferPublic()); } return preferPublic.booleanValue(); } /** * Set the prefer public setting. */ public void setPreferPublic (boolean preferPublic) { ! this.preferPublic = new Boolean(preferPublic); } /** * Return the current prefer public setting. * --- 596,615 ---- * * @return True if public identifiers are preferred. */ public boolean getPreferPublic () { if (preferPublic == null) { ! preferPublic = queryPreferPublic() ? Boolean.TRUE : Boolean.FALSE; } return preferPublic.booleanValue(); } /** * Set the prefer public setting. */ public void setPreferPublic (boolean preferPublic) { ! this.preferPublic = preferPublic ? Boolean.TRUE : Boolean.FALSE; } /** * Return the current prefer public setting. *
*** 639,659 **** /** * Get the current use static catalog setting. */ public boolean getUseStaticCatalog() { if (useStaticCatalog == null) { ! useStaticCatalog = new Boolean(queryUseStaticCatalog()); } return useStaticCatalog.booleanValue(); } /** * Set the use static catalog setting. */ public void setUseStaticCatalog(boolean useStatic) { ! useStaticCatalog = new Boolean(useStatic); } /** * Get the current use static catalog setting. * --- 655,675 ---- /** * Get the current use static catalog setting. */ public boolean getUseStaticCatalog() { if (useStaticCatalog == null) { ! useStaticCatalog = queryUseStaticCatalog() ? Boolean.TRUE : Boolean.FALSE; } return useStaticCatalog.booleanValue(); } /** * Set the use static catalog setting. */ public void setUseStaticCatalog(boolean useStatic) { ! useStaticCatalog = useStatic ? Boolean.TRUE : Boolean.FALSE; } /** * Get the current use static catalog setting. *
*** 670,680 **** */ public Catalog getPrivateCatalog() { Catalog catalog = staticCatalog; if (useStaticCatalog == null) { ! useStaticCatalog = new Boolean(getUseStaticCatalog()); } if (catalog == null || !useStaticCatalog.booleanValue()) { try { --- 686,696 ---- */ public Catalog getPrivateCatalog() { Catalog catalog = staticCatalog; if (useStaticCatalog == null) { ! useStaticCatalog = getUseStaticCatalog() ? Boolean.TRUE : Boolean.FALSE; } if (catalog == null || !useStaticCatalog.booleanValue()) { try {
*** 721,731 **** */ public Catalog getCatalog() { Catalog catalog = staticCatalog; if (useStaticCatalog == null) { ! useStaticCatalog = new Boolean(getUseStaticCatalog()); } if (catalog == null || !useStaticCatalog.booleanValue()) { catalog = getPrivateCatalog(); if (useStaticCatalog.booleanValue()) { --- 737,747 ---- */ public Catalog getCatalog() { Catalog catalog = staticCatalog; if (useStaticCatalog == null) { ! useStaticCatalog = getUseStaticCatalog() ? Boolean.TRUE : Boolean.FALSE; } if (catalog == null || !useStaticCatalog.booleanValue()) { catalog = getPrivateCatalog(); if (useStaticCatalog.booleanValue()) {
*** 770,780 **** /** * Get the current XML Catalog PI setting. */ public boolean getAllowOasisXMLCatalogPI () { if (oasisXMLCatalogPI == null) { ! oasisXMLCatalogPI = new Boolean(queryAllowOasisXMLCatalogPI()); } return oasisXMLCatalogPI.booleanValue(); } --- 786,796 ---- /** * Get the current XML Catalog PI setting. */ public boolean getAllowOasisXMLCatalogPI () { if (oasisXMLCatalogPI == null) { ! oasisXMLCatalogPI = queryAllowOasisXMLCatalogPI() ? Boolean.TRUE : Boolean.FALSE; } return oasisXMLCatalogPI.booleanValue(); }
*** 783,793 **** } /** * Set the XML Catalog PI setting */ public void setAllowOasisXMLCatalogPI(boolean allowPI) { ! oasisXMLCatalogPI = new Boolean(allowPI); } /** * Get the current XML Catalog PI setting. * --- 799,809 ---- } /** * Set the XML Catalog PI setting */ public void setAllowOasisXMLCatalogPI(boolean allowPI) { ! oasisXMLCatalogPI = allowPI ? Boolean.TRUE : Boolean.FALSE; } /** * Get the current XML Catalog PI setting. *