Top Description Methods
uk.ac.ed.ph.snuggletex.utilities

public Interface StylesheetCache

Known Direct Implementers
uk.ac.ed.ph.snuggletex.utilities.DoNothingStylesheetCache, uk.ac.ed.ph.snuggletex.utilities.SimpleStylesheetCache
Imports
uk.ac.ed.ph.snuggletex.SnuggleEngine, javax.xml.transform.Templates

Encapsulates a simple cache for the internal XSLT stylesheets used by SnuggleTeX. This can be used if you want SnuggleTeX to integrate with some kind of XSLT caching mechanism (e.g. your own).

A SnuggleEngine creates a default implementation of this that caches stylesheets over the lifetime of the SnuggleEngine Object, which is reasonable. If you want to change this, create your own implementation and attach it to your SnuggleEngine.

You can use the SimpleStylesheetCache in your own applications if you want to.

Internal Note

(I'm not currently enforcing that implementations of this should be thread-safe. Therefore, make sure that you synchronise correctly when accessing an instance of this cache. You would normally just use a StylesheetManager instance to do this safely.)
Author
David McKain
Version
$Revision$
See Also
SimpleStylesheetCache

Method Summary

Modifier and TypeMethod and Description
public Templates
getStylesheet(String key)

Tries to retrieve an XSLT stylesheet from the cache having the given key.

public void
putStylesheet(String key, Templates stylesheet)

Instructs the cache that it might want to store the given XSLT stylesheet corresponding to the given key.

Method Detail

getStylesheetback to summary
public Templates getStylesheet(String key)

Tries to retrieve an XSLT stylesheet from the cache having the given key.

Return a previously cached Templates or null if your cache doesn't want to cache this or if it does not contain the required result.

putStylesheetback to summary
public void putStylesheet(String key, Templates stylesheet)

Instructs the cache that it might want to store the given XSLT stylesheet corresponding to the given key.

Implementations can safely choose to do absolutely nothing here if they want.