|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.merlotxml.util.xml.DTDCache
This singleton class is responsible for loading and caching all DTD's required by the system. This manager can load DTD's from the filesystem, URL's, and zip/jar files (not currently implemented).
Apps should use this class to retrieve all their DTD's for valid documents (non-validating apps usually ignore the DTD anyway, so they don't really need to use this, but if they do get a DTD, it might be a good idea to call into this class.
Here's an example of getting a dtd:
DTDCacheEntry dtdentry = DTDCache.getSharedInstance().findDTD(publicId, systemId);
where publicId is the DOCTYPE's given public identifier (can be null), and systemId
is a system designator (file path or URL)
This can also cache DTD's from other entity resolvers via the resolveDTD method.
Field Summary | |
protected java.util.Map |
_dtdEntries
List of unique dtd entries. |
protected java.util.Map |
_filepathCache
key is the file path (including a ! and the path within a jar), val is a DTDCacheEntry |
protected static DTDCache |
_instance
singleton instance |
protected java.util.Properties |
_properties
Properties for getting dtd path, etc. |
protected java.util.Map |
_publicIdCache
key is the public id, val is a DTDCacheEntry |
protected static java.lang.Object |
_synchronizer
synch object for creating the instance |
protected java.util.Map |
_systemIdCache
key is the system id, val is a DTDCacheEntry |
Constructor Summary | |
protected |
DTDCache()
|
Method Summary | |
void |
checkCacheEntryTimestamp(DTDCacheEntry entry)
Checks the timestamp associated with a cache entry and reloads the dtd file if it has changed. |
protected void |
debug(java.lang.String s)
simple debugging print routine |
DTDCacheEntry |
findDTD(java.lang.String pubid,
java.lang.String sysid,
java.lang.String fileLocation)
find a DTD based on the public id and system id |
DTDCacheEntry |
findDTDbyPublicId(java.lang.String publicId,
java.lang.String systemId)
Looks in our cache for a file with a given public ID |
DTDCacheEntry |
findDTDbySystemId(java.lang.String publicId,
java.lang.String systemId,
java.lang.String fileLocation)
Finds a dtd given a system identifier. |
protected java.lang.String |
fixslashes(java.lang.String s)
make all slashes forward slashes cause windows sucks |
java.util.Collection |
getCachedDTDEntries()
|
static DTDCache |
getSharedInstance()
gets the singleton instance. |
void |
loadDTDIntoCache(java.io.InputStream is,
DTDCacheEntry entry)
Loads a dtd into a DTDCacheEntry. |
void |
loadDTDIntoCache(java.io.Reader r,
DTDCacheEntry entry)
Loads a dtd into a DTDCacheEntry. |
void |
printCache()
|
DTDCacheEntry |
resolveDTD(java.lang.String publicId,
java.lang.String systemId,
org.xml.sax.EntityResolver resolver,
java.lang.String fileLocation)
resolve a dtd from another resolver. |
void |
setProperties(java.util.Properties props)
set the properties. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
protected java.util.Map _publicIdCache
protected java.util.Map _systemIdCache
protected java.util.Map _filepathCache
protected java.util.Map _dtdEntries
protected java.util.Properties _properties
protected static DTDCache _instance
protected static final java.lang.Object _synchronizer
Constructor Detail |
protected DTDCache()
Method Detail |
public static DTDCache getSharedInstance()
public void setProperties(java.util.Properties props)
public DTDCacheEntry findDTDbySystemId(java.lang.String publicId, java.lang.String systemId, java.lang.String fileLocation)
public DTDCacheEntry findDTDbyPublicId(java.lang.String publicId, java.lang.String systemId)
public DTDCacheEntry findDTD(java.lang.String pubid, java.lang.String sysid, java.lang.String fileLocation)
public DTDCacheEntry resolveDTD(java.lang.String publicId, java.lang.String systemId, org.xml.sax.EntityResolver resolver, java.lang.String fileLocation) throws org.xml.sax.SAXException, java.io.IOException
public void loadDTDIntoCache(java.io.InputStream is, DTDCacheEntry entry) throws java.io.IOException
public void loadDTDIntoCache(java.io.Reader r, DTDCacheEntry entry) throws java.io.IOException
public void checkCacheEntryTimestamp(DTDCacheEntry entry)
public java.util.Collection getCachedDTDEntries()
public void printCache()
protected java.lang.String fixslashes(java.lang.String s)
protected void debug(java.lang.String s)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |