jvanzyl 01/06/14 07:56:04
Modified: src/java/org/apache/turbine/services/xslt
TurbineXSLTService.java
Log:
- updated service as per notes and merged in sam's changes.
leon, do you think you could make a small test for this service
that i could add to the TDK?
Revision Changes Path
1.12 +16 -22
jakarta-turbine/src/java/org/apache/turbine/services/xslt/TurbineXSLTService.java
Index: TurbineXSLTService.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine/src/java/org/apache/turbine/services/xslt/TurbineXSLTService.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- TurbineXSLTService.java 2001/06/11 19:44:05 1.11
+++ TurbineXSLTService.java 2001/06/14 14:56:04 1.12
@@ -61,7 +61,6 @@
import java.io.StringWriter;
import java.io.Writer;
import java.util.Hashtable;
-
import javax.xml.transform.Result;
import javax.xml.transform.Source;
import javax.xml.transform.dom.DOMSource;
@@ -70,16 +69,11 @@
import javax.xml.transform.Templates;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
-
import org.w3c.dom.Node;
import org.xml.sax.InputSource;
-
-import org.apache.turbine.services.BaseInitable;
-import org.apache.turbine.services.TurbineBaseService;
-import org.apache.turbine.services.TurbineServices;
+import org.apache.turbine.services.BaseService;
+import org.apache.turbine.services.InitializationException;
import org.apache.turbine.services.resources.TurbineResources;
-import org.apache.turbine.services.servlet.TurbineServlet;
-import org.apache.turbine.util.Log;
/**
* Implementation of the Turbine XSLT Service. It transforms xml with a given
@@ -90,7 +84,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Sam Ruby</a>
*/
public class TurbineXSLTService
- extends TurbineBaseService
+ extends BaseService
implements XSLTService
{
@@ -109,7 +103,11 @@
* Cache of compiled Templates.
*/
protected Hashtable cache = new Hashtable();
+
+ protected final static String STYLESHEET_PATH = "path";
+ protected final static String STYLESHEET_CACHING = "cache";
+
/**
* Factory for producing templates and null transformers
*/
@@ -119,28 +117,24 @@
* Initialize the TurbineXSLT Service. Load the path to search for
* xsl files and initiates the cache.
*/
- public void init()
+ public void init()
+ throws InitializationException
{
- if (getInit())
+ //!! is this even needed? jvz.
+ if (isInitialized())
{
return;
}
-
- path = TurbineResources.getString (
- TurbineServices.SERVICE_PREFIX +
- XSLTService.SERVICE_NAME + ".path");
-
- path = TurbineServlet.getRealPath (path);
+
+ path = getRealPath(getConfiguration().getString(STYLESHEET_PATH));
if (!path.endsWith("/") && !path.endsWith ("\\"))
{
path=path+File.separator;
}
-
- caching = TurbineResources.getBoolean (
- TurbineServices.SERVICE_PREFIX +
- XSLTService.SERVICE_NAME + ".cache");
-
+
+ caching = getConfiguration().getBoolean(STYLESHEET_CACHING);
+
tfactory = TransformerFactory.newInstance();
setInit(true);
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]