atg.xml.service
Class DocumentCacheKey

java.lang.Object
  extended by atg.xml.service.DocumentCacheKey

public class DocumentCacheKey
extends java.lang.Object

A DocumentCacheKey can be used to index DocumentCacheValue objects in a Cache.

There are three ways of specifying a Document Cache key:

Conversions from relative URLs to os specific file paths must be managed by the caller.


Field Summary
static java.lang.String CLASS_VERSION
           
 
Constructor Summary
DocumentCacheKey(RepositoryItem pItem, java.lang.String pPropertyName, long pContentTimeStamp, boolean pValidate, boolean pLoadDTD)
          Construct a document cache key using an atg.repository.RepositoryItem and the XML content property to be transformed into a W3C Document Object Model object.
DocumentCacheKey(java.lang.String pAbsoluteUrl, java.lang.String pAbsoluteFilePath, boolean pValidate)
          Construct a document cache key.
DocumentCacheKey(java.lang.String pAbsoluteUrl, java.lang.String pAbsoluteFilePath, boolean pValidate, boolean pLoadDTD)
          Construct a document cache key.
 
Method Summary
 boolean equals(java.lang.Object obj)
          DocumentCacheKey override of equals method
 java.lang.String getAbsoluteFilePath()
          Return the absoluteFilePath property of this key.
 java.lang.String getAbsoluteURL()
          Return the absoluteURL property of this key.
 java.lang.String getBaseURI()
          Get a base URI from a cache key.
 org.xml.sax.ErrorHandler getErrorHandler()
          Get the SAX ErrorHandler that is used to handle parsing errors produced for this key.
 java.lang.String getPropertyName()
          Get the PropertyName property
 RepositoryItem getRepositoryItem()
          Get the RepositoryItem property
 long getTimeStamp()
          The time at when the content in the repository was last modified.
 int hashCode()
          DocumentCacheKey override of the hashcode method.
 boolean isLoadDTD()
          A flag which will control whether the parser will load the DTD or not.
 boolean isValidate()
          Will XML validation be used when parsing the document?
 void setErrorHandler(org.xml.sax.ErrorHandler pErrorHandler)
          Set a SAX ErrorHandler to handle parsing errors produced for this key.
 java.lang.String toString()
          DocumentCacheKey override of the toString() method.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

CLASS_VERSION

public static java.lang.String CLASS_VERSION
Constructor Detail

DocumentCacheKey

public DocumentCacheKey(RepositoryItem pItem,
                        java.lang.String pPropertyName,
                        long pContentTimeStamp,
                        boolean pValidate,
                        boolean pLoadDTD)
Construct a document cache key using an atg.repository.RepositoryItem and the XML content property to be transformed into a W3C Document Object Model object. This document cache key constructor also takes a time stamp property used to determine whether to flush a previously cached DOM object. This time stamp should be the time at which the content in the content property was last modified.

Parameters:
pItem - A RepositoryItem
pPropertyName - The property on the repository item where the XML content is store.
pContentTimeStamp - When the RepositoryItem was last updated
pValidate - Whether validation will be used by the XML parser
pLoadDTD - Whether the XML parser will load the DTD or not.

DocumentCacheKey

public DocumentCacheKey(java.lang.String pAbsoluteUrl,
                        java.lang.String pAbsoluteFilePath,
                        boolean pValidate)
Construct a document cache key. Only one of AbsoluteUrl or AbsoluteFilePath is required, the URL will always take precedence.

Parameters:
pAbsoluteUrl - An absolute URL
pAbsoluteFilePath - An OS specific file absolute file path
pValidate - Whether validation will be used by the XML parser

DocumentCacheKey

public DocumentCacheKey(java.lang.String pAbsoluteUrl,
                        java.lang.String pAbsoluteFilePath,
                        boolean pValidate,
                        boolean pLoadDTD)
Construct a document cache key. Only one of AbsoluteUrl or AbsoluteFilePath is required, the URL will always take precedence.

Parameters:
pAbsoluteUrl - An absolute URL
pAbsoluteFilePath - An OS specific file absolute file path
pValidate - Whether validation will be used by the XML parser
pLoadDTD - Whether the XML parser will load the DTD or not.
Method Detail

getAbsoluteURL

public java.lang.String getAbsoluteURL()
Return the absoluteURL property of this key.


getAbsoluteFilePath

public java.lang.String getAbsoluteFilePath()
Return the absoluteFilePath property of this key.


isValidate

public boolean isValidate()
Will XML validation be used when parsing the document?


isLoadDTD

public boolean isLoadDTD()
A flag which will control whether the parser will load the DTD or not.


getRepositoryItem

public RepositoryItem getRepositoryItem()
Get the RepositoryItem property


getPropertyName

public java.lang.String getPropertyName()
Get the PropertyName property


getTimeStamp

public long getTimeStamp()
The time at when the content in the repository was last modified.


setErrorHandler

public void setErrorHandler(org.xml.sax.ErrorHandler pErrorHandler)
Set a SAX ErrorHandler to handle parsing errors produced for this key.


getErrorHandler

public org.xml.sax.ErrorHandler getErrorHandler()
Get the SAX ErrorHandler that is used to handle parsing errors produced for this key.


hashCode

public int hashCode()
DocumentCacheKey override of the hashcode method.

Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
DocumentCacheKey override of equals method

Overrides:
equals in class java.lang.Object

getBaseURI

public java.lang.String getBaseURI()
Get a base URI from a cache key. The base URI is either the file path or the url or the repository item id. If the key is constructed from a repository item + property name, the repository id is returned. If the absolute file path exists, it is returned as a URI in the form file://, otherwise the absolute URL is returned.


toString

public java.lang.String toString()
DocumentCacheKey override of the toString() method.

Overrides:
toString in class java.lang.Object