XBRLAPI

A Java API for XBRL


org.xbrlapi.sax
Class EntityResolverImpl

java.lang.Object
  extended by org.xbrlapi.sax.EntityResolverImpl
All Implemented Interfaces:
Serializable, org.apache.xerces.xni.parser.XMLEntityResolver, EntityResolver

public class EntityResolverImpl
extends Object
implements EntityResolver

Entity resolver that dynamically adds to the local document cache if it is set up and that gives preference to the local cache (if it is set up) as resources are identified by the resolution process.

Author:
Geoffrey Shuetrim (geoff@galexy.net)
See Also:
Serialized Form

Constructor Summary
EntityResolverImpl()
          Construct the entity resolver without a cache.
EntityResolverImpl(Cache cache)
          Construct the entity resolver by storing the cache itself.
EntityResolverImpl(File cacheRoot)
          Construct the entity resolver by storing the cache root.
EntityResolverImpl(File cacheRoot, HashMap<URI,URI> uriMap)
          Create the entity resolver with a set of local URIs to be used by the loader in place of actual URIs.
 
Method Summary
 boolean equals(Object obj)
           
 int hashCode()
           
 InputSource resolveEntity(String publicId, String systemId)
          Resolve the entity for a SAX parser using the system identifier.
 org.apache.xerces.xni.parser.XMLInputSource resolveEntity(org.apache.xerces.xni.XMLResourceIdentifier resource)
          Implements the resolveEntity method defined in the org.apache.xerces.xni.parser.XMLEntityResolver interface, incorporating interactions with the local document cache (if it exists) to ensure that any new documents are cached and any documents already in the cache are sourced from the cache.
 org.apache.xerces.xni.parser.XMLInputSource resolveSchemaURI(URI originalURI)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EntityResolverImpl

public EntityResolverImpl()
Construct the entity resolver without a cache.


EntityResolverImpl

public EntityResolverImpl(File cacheRoot)
                   throws XBRLException
Construct the entity resolver by storing the cache root.

Parameters:
cacheRoot - The root directory of the local cache.
Throws:
XBRLException - if the cache cannot be initialised.

EntityResolverImpl

public EntityResolverImpl(Cache cache)
                   throws XBRLException
Construct the entity resolver by storing the cache itself.

Parameters:
cache - The local cache to use.
Throws:
XBRLException - if the cache cannot be initialised.

EntityResolverImpl

public EntityResolverImpl(File cacheRoot,
                          HashMap<URI,URI> uriMap)
                   throws XBRLException
Create the entity resolver with a set of local URIs to be used by the loader in place of actual URIs. These local URIs, pointing to resources on the local file system, are used by the loader's entity resolver to swap the local resource for the original resource at the original URI. Such substitutions are used by the entity resolver when doing SAX parsing and when building XML Schema grammar models.

Parameters:
cacheRoot - The root directory of the local cache.
uriMap - The map from original URIs to local URIs.
Throws:
XBRLException - if any of the objects in the list of URIs is not a java.net.URI object.
Method Detail

resolveEntity

public InputSource resolveEntity(String publicId,
                                 String systemId)
Resolve the entity for a SAX parser using the system identifier.

Specified by:
resolveEntity in interface EntityResolver
Parameters:
publicId - The public identifier.
systemId - The system identifier that gets resolved.

resolveEntity

public org.apache.xerces.xni.parser.XMLInputSource resolveEntity(org.apache.xerces.xni.XMLResourceIdentifier resource)
                                                          throws org.apache.xerces.xni.XNIException,
                                                                 IOException
Implements the resolveEntity method defined in the org.apache.xerces.xni.parser.XMLEntityResolver interface, incorporating interactions with the local document cache (if it exists) to ensure that any new documents are cached and any documents already in the cache are sourced from the cache.

Specified by:
resolveEntity in interface org.apache.xerces.xni.parser.XMLEntityResolver
Parameters:
resource - The XML Resource Identifier used to identify the XML resource to be converted into an XML input source and to be cached if it is not already cached.
Throws:
org.apache.xerces.xni.XNIException
IOException
See Also:
XMLEntityResolver.resolveEntity(org.apache.xerces.xni.XMLResourceIdentifier)

resolveSchemaURI

public org.apache.xerces.xni.parser.XMLInputSource resolveSchemaURI(URI originalURI)
Parameters:
originalURI - the URI to be resolved.
Returns:
the XMLInputSource for the given URI.

hashCode

public int hashCode()
Overrides:
hashCode in class Object
See Also:
Object.hashCode()

equals

public boolean equals(Object obj)
Overrides:
equals in class Object
See Also:
Object.equals(java.lang.Object)

Get Java XBRL API implementation at SourceForge.net.