cziegeler 02/05/02 05:09:21
Modified: lib/core avalon-excalibur-20020501.jar
src/java/org/apache/cocoon cocoon.roles
src/java/org/apache/cocoon/components/language/markup
Logicsheet.java
src/java/org/apache/cocoon/components/xpath
XPathProcessor.java
src/java/org/apache/cocoon/components/xscript
XScriptObject.java
src/java/org/apache/cocoon/components/xslt
XSLTProcessorImpl.java
src/java/org/apache/cocoon/transformation
TraxTransformer.java
src/webapp/WEB-INF cocoon.xconf
Log:
Deprecating xslt processor and using excalibur version
Revision Changes Path
1.3 +308 -307 xml-cocoon2/lib/core/avalon-excalibur-20020501.jar
<<Binary file>>
1.24 +9 -3 xml-cocoon2/src/java/org/apache/cocoon/cocoon.roles
Index: cocoon.roles
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/cocoon.roles,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- cocoon.roles 25 Apr 2002 09:30:48 -0000 1.23
+++ cocoon.roles 2 May 2002 12:09:21 -0000 1.24
@@ -21,9 +21,9 @@
shorthand="entity-resolver"
default-class="org.apache.cocoon.components.resolver.ResolverImpl"/>
- <role name="org.apache.cocoon.components.xslt.XSLTProcessor"
- shorthand="xslt-processor"
- default-class="org.apache.cocoon.components.xslt.XSLTProcessorImpl"/>
+ <role name="org.apache.avalon.excalibur.xml.xslt.XSLTProcessor"
+ shorthand="xslt-stylesheet-processor"
+ default-class="org.apache.avalon.excalibur.xml.xslt.XSLTProcessorImpl"/>
<role name="org.apache.avalon.excalibur.xml.xpath.XPathProcessor"
shorthand="xpath-processor"
@@ -221,9 +221,15 @@
shorthand="url-factory"
default-class="org.apache.cocoon.components.url.URLFactoryImpl"/>
+ <!-- DEPRECATED, use the avalon excalibur source resolve instead -->
<role name="org.apache.cocoon.components.source.SourceHandler"
shorthand="source-handler"
default-class="org.apache.cocoon.components.source.SourceHandlerImpl"/>
+
+ <!-- DEPRECATED, use the avalon excalibur xslt processor instead -->
+ <role name="org.apache.cocoon.components.xslt.XSLTProcessor"
+ shorthand="xslt-processor"
+ default-class="org.apache.cocoon.components.xslt.XSLTProcessorImpl"/>
</role-list>
1.12 +7 -9
xml-cocoon2/src/java/org/apache/cocoon/components/language/markup/Logicsheet.java
Index: Logicsheet.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/language/markup/Logicsheet.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- Logicsheet.java 29 Apr 2002 12:53:17 -0000 1.11
+++ Logicsheet.java 2 May 2002 12:09:21 -0000 1.12
@@ -54,7 +54,8 @@
import org.apache.avalon.framework.component.ComponentManager;
import org.apache.avalon.framework.logger.AbstractLoggable;
-import org.apache.cocoon.components.xslt.XSLTProcessor;
+import org.apache.avalon.excalibur.xml.xslt.XSLTProcessor;
+import org.apache.avalon.excalibur.xml.xslt.XSLTProcessorException;
import org.apache.excalibur.source.Source;
import org.apache.excalibur.source.SourceException;
import org.apache.excalibur.source.SourceResolver;
@@ -81,10 +82,11 @@
* language will be transformed into an equivalent XSLT stylesheet
* anyway... This class should probably be based on an interface...
*
+ * @deprecated Use the avalon excalibur xslt processor instead.
* @author <a href="mailto:[EMAIL PROTECTED]">Ricardo Rocha</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Davanum Srinivas</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Ovidiu Predescu</a>
- * @version CVS $Id: Logicsheet.java,v 1.11 2002/04/29 12:53:17 cziegeler Exp $
+ * @version CVS $Id: Logicsheet.java,v 1.12 2002/05/02 12:09:21 cziegeler Exp $
*/
public class Logicsheet extends AbstractLoggable
{
@@ -165,13 +167,7 @@
// the old template object. If the Source is unchanged, the
// namespaces are not modified either.
XMLFilter saveNSFilter = new SaveNamespaceFilter(namespaceURIs);
- // FIXME: The wrapping will disappear as soon as we use excaliburs xslt
processor
- Object[] env =
org.apache.cocoon.components.CocoonComponentManager.getCurrentEnvironment();
- return xsltProcessor.getTransformerHandler(
- new
org.apache.cocoon.components.source.impl.AvalonToCocoonSource(source,
-
this.resolver,
-
(org.apache.cocoon.environment.Environment)env[0]),
- saveNSFilter);
+ return xsltProcessor.getTransformerHandler(source, saveNSFilter);
} catch (ComponentException e) {
throw new ProcessingException("Could not obtain XSLT processor", e);
@@ -181,6 +177,8 @@
throw new ProcessingException("Could not resolve " + this.systemId, e);
} catch (SourceException e) {
throw new ProcessingException("Could not resolve " + this.systemId, e);
+ } catch (XSLTProcessorException e) {
+ throw new ProcessingException("Could not transform " + this.systemId,
e);
} finally {
this.manager.release(xsltProcessor);
// Release used resources
1.7 +2 -2
xml-cocoon2/src/java/org/apache/cocoon/components/xpath/XPathProcessor.java
Index: XPathProcessor.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/xpath/XPathProcessor.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- XPathProcessor.java 13 Mar 2002 16:28:02 -0000 1.6
+++ XPathProcessor.java 2 May 2002 12:09:21 -0000 1.7
@@ -59,12 +59,12 @@
*
* @deprecated Use the org.apache.avalon.excalibur.xml.xpath.XPathProcessor instead.
* @author <a href="mailto:[EMAIL PROTECTED]">Davanum Srinivas</a>
- * @version CVS $Id: XPathProcessor.java,v 1.6 2002/03/13 16:28:02 cziegeler Exp $
+ * @version CVS $Id: XPathProcessor.java,v 1.7 2002/05/02 12:09:21 cziegeler Exp $
*/
public interface XPathProcessor
extends Component {
/**
- * The role implemented by an <code>XSLTProcessor</code>.
+ * The role implemented by an <code>XPathProcessor</code>.
*/
String ROLE = "org.apache.cocoon.components.xpath.XPathProcessor";
1.9 +13 -8
xml-cocoon2/src/java/org/apache/cocoon/components/xscript/XScriptObject.java
Index: XScriptObject.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/xscript/XScriptObject.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- XScriptObject.java 14 Apr 2002 00:45:29 -0000 1.8
+++ XScriptObject.java 2 May 2002 12:09:21 -0000 1.9
@@ -58,10 +58,11 @@
import org.xml.sax.SAXException;
import org.xml.sax.InputSource;
import org.xml.sax.ContentHandler;
-import org.apache.cocoon.xml.EmbeddedXMLPipe;
-import org.apache.cocoon.environment.Source;
-import org.apache.cocoon.components.xslt.XSLTProcessor;
import org.apache.cocoon.ProcessingException;
+import org.apache.cocoon.environment.Source;
+import org.apache.cocoon.xml.EmbeddedXMLPipe;
+import org.apache.avalon.excalibur.xml.xslt.XSLTProcessor;
+import org.apache.avalon.excalibur.xml.xslt.XSLTProcessorException;
import org.apache.avalon.excalibur.xml.Parser;
import org.apache.avalon.framework.parameters.Parameters;
import org.apache.avalon.framework.component.ComponentManager;
@@ -74,7 +75,7 @@
* Source object.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Ovidiu Predescu</a>
- * @version CVS $Id: XScriptObject.java,v 1.8 2002/04/14 00:45:29 vgritsenko Exp $
+ * @version CVS $Id: XScriptObject.java,v 1.9 2002/05/02 12:09:21 cziegeler Exp $
* @since August 4, 2001
*/
public abstract class XScriptObject implements Source, Composable
@@ -132,14 +133,18 @@
XSLTProcessor transformer
= (XSLTProcessor)componentManager.lookup(XSLTProcessor.ROLE);
- transformer.transform(this, stylesheet, params, result);
+ transformer.transform(new
org.apache.cocoon.components.source.impl.CocoonToAvalonSource(this),
+ new
org.apache.cocoon.components.source.impl.CocoonToAvalonSource(stylesheet),
+ params,
+ result);
componentManager.release(transformer);
return new XScriptObjectResult(xscriptManager, writer.toString());
- }
- catch (ComponentException ex) {
- throw new ProcessingException(ex);
+ } catch (XSLTProcessorException ex) {
+ throw new ProcessingException(ex);
+ } catch (ComponentException ex) {
+ throw new ProcessingException(ex);
}
}
1.22 +2 -1
xml-cocoon2/src/java/org/apache/cocoon/components/xslt/XSLTProcessorImpl.java
Index: XSLTProcessorImpl.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/xslt/XSLTProcessorImpl.java,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- XSLTProcessorImpl.java 29 Apr 2002 10:52:52 -0000 1.21
+++ XSLTProcessorImpl.java 2 May 2002 12:09:21 -0000 1.22
@@ -112,9 +112,10 @@
* classpath. If this property is not set, the transformer uses the standard TRAX
mechanism
* (<code>TransformerFactory.newInstance()</code>).
*
+ * @deprecated Use the avalon excalibur xslt processor instead.
* @author <a href="mailto:[EMAIL PROTECTED]">Ovidiu Predescu</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a>
- * @version CVS $Id: XSLTProcessorImpl.java,v 1.21 2002/04/29 10:52:52 cziegeler
Exp $
+ * @version CVS $Id: XSLTProcessorImpl.java,v 1.22 2002/05/02 12:09:21 cziegeler
Exp $
* @version 1.0
* @since July 11, 2001
*/
1.26 +26 -12
xml-cocoon2/src/java/org/apache/cocoon/transformation/TraxTransformer.java
Index: TraxTransformer.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/transformation/TraxTransformer.java,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- TraxTransformer.java 29 Apr 2002 10:52:52 -0000 1.25
+++ TraxTransformer.java 2 May 2002 12:09:21 -0000 1.26
@@ -50,6 +50,10 @@
*/
package org.apache.cocoon.transformation;
+import org.apache.excalibur.source.Source;
+import org.apache.excalibur.source.SourceException;
+import org.apache.avalon.excalibur.xml.xslt.XSLTProcessor;
+import org.apache.avalon.excalibur.xml.xslt.XSLTProcessorException;
import org.apache.avalon.framework.activity.Disposable;
import org.apache.avalon.framework.component.ComponentException;
import org.apache.avalon.framework.component.ComponentManager;
@@ -63,15 +67,13 @@
import org.apache.cocoon.ProcessingException;
import org.apache.cocoon.caching.CacheValidity;
import org.apache.cocoon.caching.Cacheable;
-import org.apache.cocoon.caching.TimeStampCacheValidity;
+import org.apache.cocoon.caching.SourceCacheValidity;
import org.apache.cocoon.components.browser.Browser;
-import org.apache.cocoon.components.xslt.XSLTProcessor;
import org.apache.cocoon.components.deli.Deli;
import org.apache.cocoon.environment.Session;
import org.apache.cocoon.environment.Cookie;
import org.apache.cocoon.environment.ObjectModelHelper;
import org.apache.cocoon.environment.Request;
-import org.apache.cocoon.environment.Source;
import org.apache.cocoon.environment.SourceResolver;
import org.apache.cocoon.util.HashUtil;
import org.apache.cocoon.xml.XMLConsumer;
@@ -157,7 +159,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Ovidiu Predescu</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Mark H. Butler</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a>
- * @version CVS $Id: TraxTransformer.java,v 1.25 2002/04/29 10:52:52 cziegeler Exp $
+ * @version CVS $Id: TraxTransformer.java,v 1.26 2002/05/02 12:09:21 cziegeler Exp $
*/
public class TraxTransformer extends AbstractTransformer
implements Transformer, Composable, Configurable, Cacheable, Disposable {
@@ -198,6 +200,8 @@
private Parameters par;
/** The object model */
private Map objectModel;
+ /** The source resolver */
+ private SourceResolver resolver;
/** The XSLTProcessor */
private XSLTProcessor xsltProcessor;
@@ -298,18 +302,27 @@
this.par = par;
this.objectModel = objectModel;
- this.inputSource = resolver.resolve(src);
+ this.resolver = resolver;
+ try {
+ this.inputSource = resolver.resolveURI(src);
+ } catch (SourceException se) {
+ throw new ProcessingException("Unable to resolve " + src, se);
+ }
_useParameters = par.getParameterAsBoolean("use-request-parameters",
this.useParameters);
_useBrowserCap = par.getParameterAsBoolean("use-browser-capabilities-db",
this.useBrowserCap);
_useCookies = par.getParameterAsBoolean("use-cookies", this.useCookies);
_useSessionInfo = par.getParameterAsBoolean("use-session-info",
this.useSessionInfo);
if (this.getLogger().isDebugEnabled()) {
- this.getLogger().debug("Using stylesheet: '" +
this.inputSource.getSystemId() + "' in " + this + ", last modified: " +
this.inputSource.getLastModified());
+ this.getLogger().debug("Using stylesheet: '" +
this.inputSource.getSystemId() + "' in " + this);
}
/** Get a Transformer Handler */
- this.transformerHandler =
this.xsltProcessor.getTransformerHandler(inputSource, null);
+ try {
+ this.transformerHandler =
this.xsltProcessor.getTransformerHandler(inputSource, null);
+ } catch (XSLTProcessorException se) {
+ throw new ProcessingException("Unable to get transformer handler for "
+ src, se);
+ }
}
/**
@@ -319,7 +332,7 @@
* @return The generated key hashes the src
*/
public long generateKey() {
- if (this.inputSource.getLastModified() != 0) {
+ if (this.inputSource.getValidity() != null) {
HashMap map = getLogicSheetParameters();
if (map == null) {
return HashUtil.hash(this.inputSource.getSystemId());
@@ -353,8 +366,8 @@
* (if parameter added/removed or value changed, key should
* change also), only stylesheet's modified time is included.
*/
- if (this.inputSource.getLastModified() != 0) {
- return new TimeStampCacheValidity(this.inputSource.getLastModified());
+ if (this.inputSource.getValidity() != null) {
+ return new SourceCacheValidity(this.inputSource.getValidity());
}
return null;
}
@@ -559,9 +572,10 @@
this.transformerHandler = null;
this.objectModel = null;
if (this.inputSource != null) {
- this.inputSource.recycle();
- this.inputSource = null;
+ this.resolver.release(this.inputSource);
+ this.inputSource = null;
}
+ this.resolver = null;
this.par = null;
if (this.finishedDocument == false) {
try {
1.14 +7 -8 xml-cocoon2/src/webapp/WEB-INF/cocoon.xconf
Index: cocoon.xconf
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/webapp/WEB-INF/cocoon.xconf,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- cocoon.xconf 26 Apr 2002 12:35:40 -0000 1.13
+++ cocoon.xconf 2 May 2002 12:09:21 -0000 1.14
@@ -113,8 +113,7 @@
Freememory should be greater than amount of memory necessary for normal
application operation.
-->
- <store-janitor class="org.apache.cocoon.components.store.StoreJanitorImpl"
- logger="core.store.janitor">
+ <store-janitor logger="core.store.janitor">
<!-- How much free memory shall be available in the jvm -->
<parameter name="freememory" value="1000000"/>
<!-- Indicates the limit of the jvm memory consumption. The default max
@@ -131,13 +130,13 @@
<!-- ============================ STORE END ========================= -->
<!-- XSLT Processor:
- For Xalan: Turn 'incremental-processing' to true if you want a continous output
(if set to false the transformer
- delivers SAX events after all transformations has been done). -->
- <xslt-processor class="org.apache.cocoon.components.xslt.XSLTProcessorImpl"
- logger="core.xslt-processor">
- <parameter name="use-store" value="true"/>
+ For Xalan: Turn 'incremental-processing' to true if you want a continous output
+ (if set to false the transformer delivers SAX events after all transformations
has been done).
+ -->
+ <xslt-stylesheet-processor logger="core.xslt-processor">
+ <parameter name="use-store" value="false"/> <!-- Setting this to true will
crash Cocoon for now! -->
<parameter name="incremental-processing" value="true"/>
- </xslt-processor>
+ </xslt-stylesheet-processor>
<!-- Xpath Processor:
-->
----------------------------------------------------------------------
In case of troubles, e-mail: [EMAIL PROTECTED]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]