Tom/Dick/Harry/anybody,
We are trying to come up with a decent design for transparent
translet caching with JAXP/TrAX. Please let me first make a
distinction between caching javax.xml.transform.Transformer
objects and caching Translet classes. A Transformer object can
be instanciated (using a factory class) and then kept in
memory (ie. cached) for a sequence of similar transformations.
A translet is a Java class and not an instance of a class, and
we don't want to compile such classes more often than we have
to, and this is the reason why we want cache translets. The
best way of doing this using JAXP is to make the XSL->translet
compilation transparent, similar to the way JSPs are compiled
into servlets. This could be done by having the Transformer
object check for the existance (and validity) of an already
compiled translet, and then either use the existing translet
or create a new one if needed, and then run the transformation
using this translet:
+-------------+ +----------+
| XSLTC | -> | Translet |
| compiler | | storage |
+-------------+ +----------+
^ |
| v
xsl/xml +-------------+ +----------+
JAXP ----------> | JAXP/TrAX | -> | XSLTC |
user <---------- | Transformer | <- | Translet |
*ml +-------------+ +-----------
Our main concern is where to store the translets (a simple Java
property file pointing to a directory may do) and how to
make sure that a translet in the cache is still valid (the
Source interface does not give much info on the XSL source).
Any suggestions are welcome!
Thanks
Morten