[prev in list] [next in list] [prev in thread] [next in thread]
List: forrest-svn
Subject: svn commit: r446701 - in
From: thorsten () apache ! org
Date: 2006-09-15 19:28:38
Message-ID: 20060915192838.433111A981A () eris ! apache ! org
[Download RAW message or body]
Author: thorsten
Date: Fri Sep 15 12:28:37 2006
New Revision: 446701
URL: http://svn.apache.org/viewvc?view=rev&rev=446701
Log:
FOR-931
Activating basic caching. Mind the FIXME notes.
The problem now is that the match is not cacheable since we are using the jx \
generator. See http://marc.theaimsgroup.com/?l=xml-cocoon-users&m=115194685214066&w=2 \
(read the whole mail, answer is on the bottom).
Modified:
forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/internal.xmap
forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/transformation/DispatcherTransformer.java
Modified: forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/internal.xmap
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/plugins/org.apache.forrest. \
plugin.internal.dispatcher/internal.xmap?view=diff&rev=446701&r1=446700&r2=446701 \
==============================================================================
--- forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/internal.xmap \
(original)
+++ forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/internal.xmap \
Fri Sep 15 12:28:37 2006 @@ -84,6 +84,7 @@
<map:actions>
<map:action name="locale" src="org.apache.cocoon.acting.LocaleAction" />
</map:actions>
+ <map:pipes default="caching"/>
</map:components>
<map:pipelines>
<!--
@@ -144,6 +145,8 @@
<map:parameter name="getRequestExtension" value="html" />
</map:generate>
<map:transform type="dispatcher">
+ <map:parameter name="cacheKey" value="{0}" />
+ <map:parameter name="validityFile" value="cocoon:/resolve.structurer.{1}" \
/> <map:parameter name="request" value="{1}" />
<map:parameter name="type" value="html" />
<map:parameter name="hooksTransformer" value="lm://hooks-to-html.xsl"
@@ -164,6 +167,8 @@
<map:parameter name="getRequestExtension" value="internal{2}" />
</map:generate>
<map:transform type="dispatcher">
+ <map:parameter name="cacheKey" value="{0}" />
+ <map:parameter name="validityFile" value="cocoon:/resolve.structurer.{1}" \
/> <map:parameter name="request" value="{1}" />
<map:parameter name="type" value="internal{2}" />
</map:transform>
@@ -176,6 +181,8 @@
<map:parameter name="getRequestExtension" value="css" />
</map:generate>
<map:transform type="dispatcher">
+ <map:parameter name="cacheKey" value="{0}" />
+ <map:parameter name="validityFile" value="cocoon:/resolve.structurer.{1}" \
/> <map:parameter name="request" value="{1}" />
<map:parameter name="type" value="css" />
</map:transform>
@@ -197,6 +204,8 @@
<map:parameter name="getRequestExtension" value="xhtml2" />
</map:generate>
<map:transform type="dispatcher">
+ <map:parameter name="cacheKey" value="{0}" />
+ <map:parameter name="validityFile" value="cocoon:/resolve.structurer.{1}" \
/> <map:parameter name="request" value="{1}" />
<map:parameter name="type" value="xhtml2" />
</map:transform>
Modified: forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.dispatch \
er/src/java/org/apache/forrest/dispatcher/transformation/DispatcherTransformer.java
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/plugins/org.apache.forrest. \
plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/transformation/DispatcherTransformer.java?view=diff&rev=446701&r1=446700&r2=446701
==============================================================================
--- forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/transformation/DispatcherTransformer.java \
(original)
+++ forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/transformation/DispatcherTransformer.java \
Fri Sep 15 12:28:37 2006 @@ -19,6 +19,7 @@
import java.io.File;
import java.io.IOException;
import java.io.Serializable;
+import java.net.MalformedURLException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
@@ -183,7 +184,7 @@
private boolean insideStructurer = false;
- private String hooksXSL;
+ private String hooksXSL,cacheKey,validityFile;
private HashMap hooksPosition;
@@ -195,11 +196,15 @@
private Document defaultProperties;
+ private SourceValidity validity;
+
public static final String HOOKS_TRANSFORMER_PARAMETER = "hooksTransformer";
public static final String PATH_PARAMETER = "path";
static public final String DISPATCHER_REQUEST_ATTRIBUTE = "request";
+ public static final String CACHE_PARAMETER = "cacheKey";
+ public static final String VALIDITY_PARAMETER = "validityFile";
/**
* Constructor Set the namespace
@@ -208,8 +213,6 @@
this.defaultNamespaceURI = DispatcherHelper.DISPATCHER_NAMESPACE_URI;
}
- // FIXME: turn on caching!!!
- // doing some testing
/**
* Generate the unique key. This key must be unique inside the space of this
* component.
@@ -217,10 +220,9 @@
* @return The generated key hashes the src
*/
public Serializable getKey() {
- return null;
+ return this.cacheKey;
}
- // FIXME: turn on caching!!!
/**
* Generate the validity object.
*
@@ -228,7 +230,7 @@
* component is currently not cacheable.
*/
public SourceValidity getValidity() {
- return null;
+ return this.validity;
}
/**
@@ -293,6 +295,20 @@
DISPATCHER_ALLOW_MARKUP, null));
this.requestId= parameters.getParameter(
DISPATCHER_REQUEST_ATTRIBUTE, null);
+ this.cacheKey = parameters.getParameter(
+ this.CACHE_PARAMETER, null);
+ if(null==this.cacheKey) getLogger().warn("Caching not activated! Declare the \
CACHE_KEY_PARAMETER="+CACHE_PARAMETER+" in your sitemap."); + \
this.validityFile = parameters.getParameter( + \
this.VALIDITY_PARAMETER, null); + // FIXME: We are taking here a shortcut that \
we need to enhance ASAP + // We assume that all contracts that a structurer \
may include + // have not changed, which may the wrong assumption.
+ // The workaround is to do a touch on the $validityFile
+ // to force a SourceValidity.INVALID
+ if(null!=validityFile)
+ this.validity=m_resolver.resolveURI(validityFile).getValidity();
+ else
+ this.validity=null;
if (requestId == null) {
String error = "dispatcherError:\n"
+ "You have to set the \"request\" parameter in the sitemap!";
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic