jd.xml.xslt.util
Class ModelCache

java.lang.Object
  extended byjd.xml.xslt.util.ModelCache

public class ModelCache
extends Object

ModelCache is a helper class to hold the models used during a transformation.


Constructor Summary
ModelCache(NodeNamePool namePool, Object parser)
          Create a ModelCache.
 
Method Summary
 void cleanup()
          Call XPathRootNode.cleanup for every input document
protected  void finalize()
          Calls cleanup.
 Object getItem(XPathRootNode root, Object key)
          Return a cached value.
 KeyMap[] getKeyMaps(XPathRootNode root)
          Return the KeyMaps of a document.
 XPathRootNode getMainModel()
          Return the main model.
 XPathRootNode getModel(String href, String baseUri)
          Get a document.
 XPathRootNode getModel(String href, String baseUri, XsltSecurityManager securityManager)
           
 ModelReader getModelReader()
          Return the model reader.
 NodeNamePool getNodeNamePool()
          Return the NodeNamePool which is used as name pool for built documents.
 ParseHandler getParseHandler()
          Return the ModelReaders ParseHandler.
 XPathNode getTextNodeFragment(String text)
           
 void initMainModel(XmlSource source)
          Initialize the main model of the ModelCache.
 Object putItem(XPathRootNode root, Object key, Object value)
          Cache a value associated with a document.
 void setKeyMaps(XPathRootNode root, KeyMap[] maps)
          Set the KeyMaps of a document.
 void setUriResolver(UriResolver uriResolver)
          Set the UriResolver.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ModelCache

public ModelCache(NodeNamePool namePool,
                  Object parser)
           throws SAXException
Create a ModelCache.

Parameters:
namePool - the namePool of the stylesheet. It will not be changed (since all stylesheet data should be readonly so that a stylesheet can be used multiple times). Therefore create a copy of the pool is created and passed to the modelreader
parser - a Sax1, Sax2, or pull parser
Method Detail

setUriResolver

public void setUriResolver(UriResolver uriResolver)
Set the UriResolver.


getNodeNamePool

public NodeNamePool getNodeNamePool()
Return the NodeNamePool which is used as name pool for built documents.


getModelReader

public ModelReader getModelReader()
Return the model reader.


getParseHandler

public ParseHandler getParseHandler()
Return the ModelReaders ParseHandler.


initMainModel

public void initMainModel(XmlSource source)
                   throws IOException,
                          SAXException,
                          XsltException
Initialize the main model of the ModelCache.

Throws:
IOException
SAXException
XsltException

getMainModel

public XPathRootNode getMainModel()
Return the main model.


getModel

public XPathRootNode getModel(String href,
                              String baseUri)
                       throws IOException,
                              SAXException
Get a document.

Parameters:
baseUri - if uri is a relative uri, the baseUri parameter will be used to build an valid absolute uri.
Returns:
the root node or null if the document cannot be read but errors should be ignored
Throws:
XsltException - thrown if the document cannot be read but errors should not be ignored
IOException
SAXException

getModel

public XPathRootNode getModel(String href,
                              String baseUri,
                              XsltSecurityManager securityManager)
                       throws IOException,
                              SAXException,
                              SecurityException
Throws:
IOException
SAXException
SecurityException

getTextNodeFragment

public XPathNode getTextNodeFragment(String text)

putItem

public Object putItem(XPathRootNode root,
                      Object key,
                      Object value)
Cache a value associated with a document.


getItem

public Object getItem(XPathRootNode root,
                      Object key)
Return a cached value.


getKeyMaps

public KeyMap[] getKeyMaps(XPathRootNode root)
Return the KeyMaps of a document.


setKeyMaps

public void setKeyMaps(XPathRootNode root,
                       KeyMap[] maps)
Set the KeyMaps of a document.


cleanup

public void cleanup()
Call XPathRootNode.cleanup for every input document


finalize

protected void finalize()
                 throws Throwable
Calls cleanup.

Throws:
Throwable