|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ccs.xml.XSLCache
public class XSLCache
XSL Stylesheets are useful things, but they need to be compiled before use,
and this is fiercely expensive. This cache does this for you asynchronously.
While this class allows a considerable degree of control over the
compile process - sheets may be compiled asynchronously ahead of time -
apps which either use rather small sheets or cannot predict which sheets
are likely to be required can simply use the transform
method,
which handles eveything synchronously.
KNOWN BUG: The Cache will hang if asked to cache a non-existent sheet. If there's a significant risk of this happening in your application, you should do an existence check first.
Constructor Summary | |
---|---|
XSLCache()
|
Method Summary | |
---|---|
void |
expire(java.lang.String sheetURL)
Expires the specified sheet from the cache. |
void |
expireAll()
Expires all sheets from the cache. |
SwappingBuffer |
transform(java.lang.String sheetURL,
java.io.InputStream src,
java.lang.String srcURL)
Transforms the specified document. |
SwappingBuffer |
transform(java.lang.String sheetURL,
java.io.InputStream src,
java.lang.String srcURL,
boolean isClose,
java.util.Collection<XSLParameter> params,
boolean isNocache)
Transforms the specified document. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public XSLCache()
Method Detail |
---|
public void expire(java.lang.String sheetURL)
sheetURL
- The URL of the sheet to lose.public void expireAll()
public SwappingBuffer transform(java.lang.String sheetURL, java.io.InputStream src, java.lang.String srcURL) throws java.io.IOException
sheetURL
- The URL of the sheet to use.src
- The XML source document. If null, srcURL
will be opened instead.srcURL
- The URL where the source document is located. This is used to locate
any sub-parts of the document (e.g. includes / entities). This can be null, for
example, if the document was generated on the fly. Such documents cannot have
sub-parts. It is good form to supply a URL where such exists.
java.io.IOException
- if src gets annoyed.public SwappingBuffer transform(java.lang.String sheetURL, java.io.InputStream src, java.lang.String srcURL, boolean isClose, java.util.Collection<XSLParameter> params, boolean isNocache) throws java.io.IOException
sheetURL
- The URL of the sheet to use.src
- The XML source document. If null, srcURL
will be opened instead.srcURL
- The URL where the source document is located. This is used to locate
any sub-parts of the document (e.g. includes / entities). This can be null, for
example, if the document was generated on the fly. Such documents cannot have
sub-parts. It is good form to supply a URL where such exists.isClose
- Whether to close src when we're done with it.params
- An optional set of XSLParameter objects; these parameters will be given
to the sheet.isNocache
- If true, any previously-cached version of the sheet will be
flushed, and the sheet reloaded and recompiled synchronously. This should be
used as a permanent program feature. To disable caching for convenience during
development, set this false, and set the property
ccs.xml.noXSLCache
(the value of the property is ignored) instead.
java.io.IOException
- if src gets annoyed.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |