Class CatalogManager
- All Implemented Interfaces:
XMLCatalogResolver
- Direct Known Subclasses:
ResourceCache
CatalogManager
manages a list of OASIS XML Catalogs
and performs lookup operations on those catalogs.
The manager's job is to implement the semantics of XML Catalogs.
This class loads OASIS XML Catalog files and provides methods for searching the catalog. All of the XML Catalog entry types defined in §6 (catalog, group, public, system, rewriteSystem, systemSuffix, delegatePublic, delegateSystem, uri, rewriteURI, uriSuffix, delegateURI, and nextCatalog) are supported. In addition, the following TR9401 Catalog entry types from §D are supported: doctype, document, entity, and notation. (The other types do not apply to XML.)
For each of the query methods, the manager either returns the mapping
indicated by the catalog, or null
to indicate that no match was found.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected CatalogLoader
protected final ResolverLogger
protected final ResolverConfiguration
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
CatalogManager
(CatalogManager current, ResolverConfiguration newConfig) Constructs a catalog manager from the current one and a configuration.protected
CatalogManager
(ResolverConfiguration config) Construct a catalog manager for the specified configuration. -
Method Summary
Modifier and TypeMethodDescriptioncatalogs()
Get the catalog loader.Get the resolver configuration.loadCatalog
(URI catalog) Load the specified catalog.loadCatalog
(URI catalog, InputSource source) Load the specified catalog from a given input source.loadCatalog
(URI catalog, SaxProducer producer) Load the specified catalog by sending events to the ContentHandler.lookupDoctype
(String entityName, String systemId, String publicId) Lookup the specified document type in the catalog.Lookup the default document in the catalog.lookupEntity
(String entityName, String systemId, String publicId) Lookup the specified entity in the catalog.lookupNamespaceURI
(String uri, String nature, String purpose) Lookup the specified namespace URI in the catalog.lookupNotation
(String notationName, String systemId, String publicId) Lookup the specified notation in the catalog.lookupPublic
(String systemId, String publicId) Lookup the specified system and public identifiers in the catalog.lookupSystem
(String systemId) Lookup the specified system identifier in the catalog.Lookup the specified URI in the catalog.void
setCatalogLoader
(CatalogLoader loader) Set the catalog loader.
-
Field Details
-
logger
-
resolverConfiguration
-
catalogLoader
-
-
Constructor Details
-
CatalogManager
Construct a catalog manager for the specified configuration.- Parameters:
config
- The resolver configuration for this catalog manager.
-
CatalogManager
Constructs a catalog manager from the current one and a configuration.This constructor creates a new catalog manager using the catalog loader of the current manager and the specified configuration as its resolver configuration.
- Parameters:
current
- The manager to copy.newConfig
- The resolver configuration of the copied constructor.
-
-
Method Details
-
getResolverConfiguration
Get the resolver configuration.- Returns:
- the resolver configuration
-
getCatalogLoader
Get the catalog loader.This method returns the catalog loader that will be used by this manager if it attempts to load a catalog.
- Returns:
- the catalog loader.
-
setCatalogLoader
Set the catalog loader.This method sets the catalog loader that will be used by this manager if it attempts to load a catalog.
- Parameters:
loader
- the catalog loader.
-
catalogs
-
loadCatalog
Load the specified catalog.The manager maintains a set of the catalogs that it has loaded. If an attempt is made to load a catalog twice, the previously loaded catalog is returned.
- Parameters:
catalog
- The catalog URI.- Returns:
- The parsed catalog.
-
loadCatalog
Load the specified catalog from a given input source.This method exists so that a catalog can be loaded even if it doesn't have a URI that can be dereferenced. It must still have a URI.
The manager maintains a set of the catalogs that it has loaded. If an attempt is made to load a catalog twice, the previously loaded catalog is returned.
- Parameters:
catalog
- The catalog URI.source
- The input source.- Returns:
- The parsed catalog.
-
loadCatalog
Load the specified catalog by sending events to the ContentHandler.This method exists so that a catalog can be loaded even if it doesn't have a URI that can be dereferenced. It must still have a URI.
The manager maintains a set of the catalogs that it has loaded. If an attempt is made to load a catalog twice, the previously loaded catalog is returned.
- Parameters:
catalog
- The catalog URI.producer
- The producer that delivers events to the ContentHandler.- Returns:
- The parsed catalog.
-
lookupURI
Lookup the specified URI in the catalog.If a URI entry exists in the catalog for the URI specified, return the mapped value.
- Specified by:
lookupURI
in interfaceXMLCatalogResolver
- Parameters:
uri
- The URI to locate in the catalog.- Returns:
- The mapped value, or
null
if no matching entry is found.
-
lookupNamespaceURI
Lookup the specified namespace URI in the catalog.If a URI entry exists in the catalog for the URI specified, and with the specified nature and purpose, return the mapped value.
- Parameters:
uri
- The URI to locate in the catalog.nature
- The RDDL nature of the requested resourcepurpose
- The RDDL purpose of the requested resource- Returns:
- The mapped value, or
null
if no matching entry is found.
-
lookupPublic
Lookup the specified system and public identifiers in the catalog.If a SYSTEM or PUBLIC entry exists in the catalog for the system and public identifiers specified, return the mapped value.
On Windows and MacOS operating systems, the comparison between the system identifier provided and the SYSTEM entries in the Catalog is case-insensitive.
- Specified by:
lookupPublic
in interfaceXMLCatalogResolver
- Parameters:
systemId
- The nominal system identifier for the entity in question (as provided in the source document).publicId
- The public identifier to locate in the catalog. Public identifiers are normalized before comparison.- Returns:
- The mapped value, or
null
if no matching entry is found.
-
lookupSystem
Lookup the specified system identifier in the catalog.If a SYSTEM entry exists in the catalog for the system identifier specified, return the mapped value.
On Windows-based operating systems, the comparison between the system identifier provided and the SYSTEM entries in the Catalog is case-insensitive.
- Specified by:
lookupSystem
in interfaceXMLCatalogResolver
- Parameters:
systemId
- The system identifier to locate in the catalog.- Returns:
- The mapped value, or
null
if no matching entry is found.
-
lookupDoctype
Lookup the specified document type in the catalog.If a DOCTYPE entry exists in the catalog for the specified arguments, return the mapped value.
- Specified by:
lookupDoctype
in interfaceXMLCatalogResolver
- Parameters:
entityName
- The name of the entity (element) for which a doctype is required.systemId
- The nominal system identifier for the doctype (as provided in the source document).publicId
- The nominal public identifier for the doctype (as provided in the source document).- Returns:
- The mapped value, or
null
if no matching entry is found.
-
lookupDocument
Lookup the default document in the catalog.If a DOCUMENT entry exists in the catalog, return the mapped value.
- Specified by:
lookupDocument
in interfaceXMLCatalogResolver
- Returns:
- The mapped value, or
null
if no matching entry is found.
-
lookupEntity
Lookup the specified entity in the catalog.If an ENTITY entry exists in the catalog for the specified arguments, return the mapped value.
- Specified by:
lookupEntity
in interfaceXMLCatalogResolver
- Parameters:
entityName
- The name of the entitysystemId
- The nominal system identifier for the entitypublicId
- The nominal public identifier for the entity- Returns:
- The mapped value, or
null
if no matching entry is found.
-
lookupNotation
Lookup the specified notation in the catalog.If a NOTATION entry exists in the catalog for the specified arguments, return the mapped value.
- Specified by:
lookupNotation
in interfaceXMLCatalogResolver
- Parameters:
notationName
- The name of the notationsystemId
- The nominal system identifier for the entitypublicId
- The nominal public identifier for the entity- Returns:
- The mapped value, or
null
if no matching entry is found.
-
normalizedForComparison
-