org.datanucleus.util
Class AbstractXMLEntityResolver

java.lang.Object
  extended by org.datanucleus.util.AbstractXMLEntityResolver
All Implemented Interfaces:
org.xml.sax.EntityResolver
Direct Known Subclasses:
PluginEntityResolver, XMLAutoStarterEntityResolver

public abstract class AbstractXMLEntityResolver
extends java.lang.Object
implements org.xml.sax.EntityResolver

Abstract implementation of an entity resolver for XML files. Supports a series of internally supported public or system identities, allowing implementers to support particular identities and direct them to local copies of the DTD for example.


Field Summary
protected static Localiser LOCALISER
          Localiser for messages.
protected  java.util.HashMap publicIdEntities
          Map of public identity entities supported.
protected  java.util.HashMap systemIdEntities
          Map of system identity entities supported.
 
Constructor Summary
AbstractXMLEntityResolver()
           
 
Method Summary
protected  org.xml.sax.InputSource getLocalInputSource(java.lang.String publicId, java.lang.String systemId, java.lang.String localPath)
          Accessor for the input source for a path.
 org.xml.sax.InputSource resolveEntity(java.lang.String publicId, java.lang.String systemId)
          Method to resolve XML entities.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOCALISER

protected static Localiser LOCALISER
Localiser for messages.


publicIdEntities

protected java.util.HashMap publicIdEntities
Map of public identity entities supported. The key will be the identity, and the value is the local input to use.


systemIdEntities

protected java.util.HashMap systemIdEntities
Map of system identity entities supported. The key will be the identity, and the value is the local input to use.

Constructor Detail

AbstractXMLEntityResolver

public AbstractXMLEntityResolver()
Method Detail

resolveEntity

public org.xml.sax.InputSource resolveEntity(java.lang.String publicId,
                                             java.lang.String systemId)
                                      throws org.xml.sax.SAXException
Method to resolve XML entities. Allows for the internally supported public and system identity entities.

Specified by:
resolveEntity in interface org.xml.sax.EntityResolver
Parameters:
publicId - The public id.
systemId - The system id.
Returns:
Input Source for the URI.
Throws:
org.xml.sax.SAXException
See Also:
EntityResolver.resolveEntity(java.lang.String,java.lang.String)

getLocalInputSource

protected org.xml.sax.InputSource getLocalInputSource(java.lang.String publicId,
                                                      java.lang.String systemId,
                                                      java.lang.String localPath)
                                               throws java.io.FileNotFoundException
Accessor for the input source for a path.

Parameters:
publicId - Public identity
systemId - System identity
localPath - The local path
Returns:
The input source
Throws:
java.io.FileNotFoundException - if the local file is not accessible


Copyright © 2011. All Rights Reserved.