catalogmanager.java

来自「JAVA 所有包」· Java 代码 · 共 836 行 · 第 1/2 页

JAVA
836
字号
   * are returned. If false, relative catalog entry file names are   * made absolute with respect to the properties file before returning   * them.</p>   *   * <p>This property <emph>only applies</emph> when the catalog files   * come from a properties file. If they come from a system property or   * the default list, they are never considered relative. (What would   * they be relative to?)</p>   *   * <p>In the properties, a value of 'yes', 'true', or '1' is considered   * true, anything else is false.</p>   *   * @return The relativeCatalogs setting from the propertyFile or the   * defaultRelativeCatalogs.   */  public boolean getRelativeCatalogs () {    if (relativeCatalogs == null) {      relativeCatalogs = new Boolean(queryRelativeCatalogs());    }    return relativeCatalogs.booleanValue();  }  /**   * Set the relativeCatalogs setting.   *   * @see #getRelativeCatalogs()   */  public void setRelativeCatalogs (boolean relative) {    relativeCatalogs = new Boolean(relative);  }  /**   * Get the relativeCatalogs setting.   *   * @deprecated No longer static; use get/set methods.   */  public boolean relativeCatalogs () {    return getRelativeCatalogs();  }  /**   * Obtain the list of catalog files from the properties.   *   * @return A semicolon delimited list of catlog file URIs   */  private String queryCatalogFiles () {    String catalogList = System.getProperty(pFiles);    fromPropertiesFile = false;    if (catalogList == null) {      if (resources == null) readProperties();      if (resources != null) {	try {	  catalogList = resources.getString("catalogs");	  fromPropertiesFile = true;	} catch (MissingResourceException e) {	  System.err.println(propertyFile + ": catalogs not found.");	  catalogList = null;	}      }    }    if (catalogList == null) {      catalogList = defaultCatalogFiles;    }    return catalogList;  }  /**   * Return the current list of catalog files.   *   * @return A vector of the catalog file names or null if no catalogs   * are available in the properties.   */  public Vector getCatalogFiles() {    if (catalogFiles == null) {      catalogFiles = queryCatalogFiles();    }    StringTokenizer files = new StringTokenizer(catalogFiles, ";");    Vector catalogs = new Vector();    while (files.hasMoreTokens()) {      String catalogFile = files.nextToken();      URL absURI = null;      if (fromPropertiesFile && !relativeCatalogs()) {	try {	  absURI = new URL(propertyFileURI, catalogFile);	  catalogFile = absURI.toString();	} catch (MalformedURLException mue) {	  absURI = null;	}      }      catalogs.add(catalogFile);    }    return catalogs;  }  /**   * Set the list of catalog files.   */  public void setCatalogFiles(String fileList) {    catalogFiles = fileList;    fromPropertiesFile = false;  }  /**   * Return the current list of catalog files.   *   * @return A vector of the catalog file names or null if no catalogs   * are available in the properties.   *   * @deprecated No longer static; use get/set methods.   */  public Vector catalogFiles() {    return getCatalogFiles();  }  /**   * Obtain the preferPublic setting from the properties.   *   * <p>In the properties, a value of 'public' is true,   * anything else is false.</p>   *   * @return True if prefer is public or the   * defaultPreferSetting.   */  private boolean queryPreferPublic () {    String prefer = System.getProperty(pPrefer);    if (prefer == null) {      if (resources==null) readProperties();      if (resources==null) return defaultPreferPublic;      try {	prefer = resources.getString("prefer");      } catch (MissingResourceException e) {	return defaultPreferPublic;      }    }    if (prefer == null) {      return defaultPreferPublic;    }    return (prefer.equalsIgnoreCase("public"));  }  /**   * Return the current prefer public setting.   *   * @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.   *   * @return True if public identifiers are preferred.   *   * @deprecated No longer static; use get/set methods.   */  public boolean preferPublic () {    return getPreferPublic();  }  /**   * Obtain the static-catalog setting from the properties.   *   * <p>In the properties, a value of 'yes', 'true', or '1' is considered   * true, anything else is false.</p>   *   * @return The static-catalog setting from the propertyFile or the   * defaultUseStaticCatalog.   */  private boolean queryUseStaticCatalog () {    String staticCatalog = System.getProperty(pStatic);    if (staticCatalog == null) {      if (resources==null) readProperties();      if (resources==null) return defaultUseStaticCatalog;      try {	staticCatalog = resources.getString("static-catalog");      } catch (MissingResourceException e) {	return defaultUseStaticCatalog;      }    }    if (staticCatalog == null) {      return defaultUseStaticCatalog;    }    return (staticCatalog.equalsIgnoreCase("true")	    || staticCatalog.equalsIgnoreCase("yes")	    || staticCatalog.equalsIgnoreCase("1"));  }  /**   * 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.   *   * @deprecated No longer static; use get/set methods.   */  public boolean staticCatalog() {    return getUseStaticCatalog();  }  /**   * Get a new catalog instance.   *   * This method always returns a new instance of the underlying catalog class.   */  public Catalog getPrivateCatalog() {    Catalog catalog = staticCatalog;    if (useStaticCatalog == null) {      useStaticCatalog = new Boolean(getUseStaticCatalog());    }    if (catalog == null || !useStaticCatalog.booleanValue()) {      try {	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(this);	catalog.setupReaders();	catalog.loadSystemCatalogs();      } catch (Exception ex) {	ex.printStackTrace();      }      if (useStaticCatalog.booleanValue()) {	staticCatalog = catalog;      }    }    return catalog;  }  /**   * Get a catalog instance.   *   * 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 (useStaticCatalog == null) {      useStaticCatalog = new Boolean(getUseStaticCatalog());    }    if (catalog == null || !useStaticCatalog.booleanValue()) {      catalog = getPrivateCatalog();      if (useStaticCatalog.booleanValue()) {	staticCatalog = catalog;      }    }    return catalog;  }  /**   * <p>Obtain the oasisXMLCatalogPI setting from the properties.</p>   *   * <p>In the properties, a value of 'yes', 'true', or '1' is considered   * true, anything else is false.</p>   *   * @return The oasisXMLCatalogPI setting from the propertyFile or the   * defaultOasisXMLCatalogPI.   */  public boolean queryAllowOasisXMLCatalogPI () {    String allow = System.getProperty(pAllowPI);    if (allow == null) {      if (resources==null) readProperties();      if (resources==null) return defaultOasisXMLCatalogPI;      try {	allow = resources.getString("allow-oasis-xml-catalog-pi");      } catch (MissingResourceException e) {	return defaultOasisXMLCatalogPI;      }    }    if (allow == null) {      return defaultOasisXMLCatalogPI;    }    return (allow.equalsIgnoreCase("true")	    || allow.equalsIgnoreCase("yes")	    || allow.equalsIgnoreCase("1"));  }  /**   * Get the current XML Catalog PI setting.   */  public boolean getAllowOasisXMLCatalogPI () {    if (oasisXMLCatalogPI == null) {      oasisXMLCatalogPI = new Boolean(queryAllowOasisXMLCatalogPI());    }    return oasisXMLCatalogPI.booleanValue();  }  /**   * Set the XML Catalog PI setting   */  public void setAllowOasisXMLCatalogPI(boolean allowPI) {    oasisXMLCatalogPI = new Boolean(allowPI);  }  /**   * Get the current XML Catalog PI setting.   *   * @deprecated No longer static; use get/set methods.   */  public boolean allowOasisXMLCatalogPI() {    return getAllowOasisXMLCatalogPI();  }  /**   * Obtain the Catalog class name setting from the properties.   *   */  public String queryCatalogClassName () {    String className = System.getProperty(pClassname);    if (className == null) {      if (resources==null) readProperties();      if (resources==null) return null;      try {	return resources.getString("catalog-class-name");      } catch (MissingResourceException e) {	return null;      }    }    return className;  }  /**   * Get the current Catalog class name.   */  public String getCatalogClassName() {    if (catalogClassName == null) {      catalogClassName = queryCatalogClassName();    }    return catalogClassName;  }  /**   * Set the Catalog class name.   */  public void setCatalogClassName(String className) {    catalogClassName = className;  }  /**   * Get the current Catalog class name.   *   * @deprecated No longer static; use get/set methods.   */  public String catalogClassName() {    return getCatalogClassName();  }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?