Class CatalogResolver
java.lang.Object
org.apache.commons.configuration.resolver.CatalogResolver
- All Implemented Interfaces:
EntityResolver
Thin wrapper around xml commons CatalogResolver to allow list of catalogs
to be provided.
- Since:
- 1.7
- Version:
- $Id: CatalogResolver.java 1301991 2012-03-17 20:18:02Z sebb $
- Author:
- Commons Configuration team
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classOverrides the Catalog implementation to use the underlying FileSystem.static classExtend the CatalogManager to make the FileSystem and base directory accessible. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected FileSystemThe FileSystem in use.protected CatalogResolver.CatalogManagerThe CatalogManager -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.commons.logging.LogReturns the logger used by this configuration object.resolveEntity(String publicId, String systemId) Implements theresolveEntitymethod for the SAX interface.voidsetBaseDir(String baseDir) Set the base path.voidsetCatalogFiles(String catalogs) Set the list of catalog file namesvoidsetDebug(boolean debug) Enables debug logging of xml-commons Catalog processing.voidsetFileSystem(FileSystem fileSystem) Set the FileSystem.voidsetLogger(org.apache.commons.logging.Log log) Allows to set the logger to be used by this configuration object.voidsetSubstitutor(org.apache.commons.lang.text.StrSubstitutor substitutor) Set the StrSubstitutor.
-
Field Details
-
manager
The CatalogManager -
fs
The FileSystem in use.
-
-
Constructor Details
-
CatalogResolver
public CatalogResolver()Constructs the CatalogResolver
-
-
Method Details
-
setCatalogFiles
Set the list of catalog file names- Parameters:
catalogs- The delimited list of catalog files.
-
setFileSystem
Set the FileSystem.- Parameters:
fileSystem- The FileSystem.
-
setBaseDir
Set the base path.- Parameters:
baseDir- The base path String.
-
setSubstitutor
Set the StrSubstitutor.- Parameters:
substitutor- The StrSubstitutor.
-
setDebug
Enables debug logging of xml-commons Catalog processing.- Parameters:
debug- True if debugging should be enabled, false otherwise.
-
resolveEntity
Implements theresolveEntitymethod for the SAX interface.Presented with an optional public identifier and a system identifier, this function attempts to locate a mapping in the catalogs.
If such a mapping is found, the resolver attempts to open the mapped value as an InputSource and return it. Exceptions are ignored and null is returned if the mapped value cannot be opened as an input source.
If no mapping is found (or an error occurs attempting to open the mapped value as an input source), null is returned and the system will use the specified system identifier as if no entityResolver was specified.
- Specified by:
resolveEntityin interfaceEntityResolver- Parameters:
publicId- The public identifier for the entity in question. This may be null.systemId- The system identifier for the entity in question. XML requires a system identifier on all external entities, so this value is always specified.- Returns:
- An InputSource for the mapped identifier, or null.
- Throws:
SAXException- if an error occurs.
-
getLogger
Returns the logger used by this configuration object.- Returns:
- the logger
-
setLogger
Allows to set the logger to be used by this configuration object. This method makes it possible for clients to exactly control logging behavior. Per default a logger is set that will ignore all log messages. Derived classes that want to enable logging should call this method during their initialization with the logger to be used.- Parameters:
log- the new logger
-