bloritsch 01/06/07 09:24:06
Modified: src/org/apache/cocoon Tag: cocoon_20_branch cocoon.roles
src/org/apache/cocoon/components/language/markup/sitemap/java
Tag: cocoon_20_branch sitemap.xsl
src/org/apache/cocoon/components/pipeline Tag:
cocoon_20_branch AbstractEventPipeline.java
AbstractStreamPipeline.java
CachingEventPipeline.java
CachingStreamPipeline.java EventPipeline.java
StreamPipeline.java
src/org/apache/cocoon/sitemap Tag: cocoon_20_branch
sitemap.roles
Log:
Add SitemapRedirector--works like a charm
Revision Changes Path
No revision
No revision
1.6.2.2 +9 -1 xml-cocoon2/src/org/apache/cocoon/cocoon.roles
Index: cocoon.roles
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/cocoon.roles,v
retrieving revision 1.6.2.1
retrieving revision 1.6.2.2
diff -u -r1.6.2.1 -r1.6.2.2
--- cocoon.roles 2001/06/06 17:12:59 1.6.2.1
+++ cocoon.roles 2001/06/07 16:23:32 1.6.2.2
@@ -52,7 +52,15 @@
default-class="org.apache.avalon.excalibur.component.ExcaliburComponentSelector">
<hint shorthand="jdbc"
class="org.apache.avalon.excalibur.datasource.JdbcDataSource"/>
<hint shorthand="j2ee" class="org.apache.excalibur.datasource.J2eeDataSource"/>
-</role>
+ </role>
+
+ <role name="org.apache.cocoon.components.pipeline.StreamPipeline"
+ shorthand="stream-pipeline"
+
default-class="org.apache.cocoon.components.pipeline.NonCachingStreamPipeline"/>
+
+ <role name="org.apache.cocoon.components.pipeline.EventPipeline"
+ shorthand="event-pipeline"
+
default-class="org.apache.cocoon.components.pipeline.NonCachingEventPipeline"/>
<role name="org.apache.cocoon.components.url.URLFactory"
shorthand="url-factory"
No revision
No revision
1.11.2.2 +34 -11
xml-cocoon2/src/org/apache/cocoon/components/language/markup/sitemap/java/sitemap.xsl
Index: sitemap.xsl
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/components/language/markup/sitemap/java/sitemap.xsl,v
retrieving revision 1.11.2.1
retrieving revision 1.11.2.2
diff -u -r1.11.2.1 -r1.11.2.2
--- sitemap.xsl 2001/06/06 17:13:11 1.11.2.1
+++ sitemap.xsl 2001/06/07 16:23:38 1.11.2.2
@@ -92,6 +92,7 @@
import org.apache.cocoon.sitemap.ErrorNotifier;
import org.apache.cocoon.sitemap.ContentAggregator;
import org.apache.cocoon.sitemap.Manager;
+ import org.apache.cocoon.sitemap.SitemapRedirector;
import org.apache.cocoon.components.language.markup.xsp.XSPRequestHelper;
import org.apache.cocoon.components.language.markup.xsp.XSPResponseHelper;
@@ -100,7 +101,7 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Berin Loritsch</a>
- * @version CVS $Id: sitemap.xsl,v 1.11.2.1 2001/06/06 17:13:11 bloritsch Exp $
+ * @version CVS $Id: sitemap.xsl,v 1.11.2.2 2001/06/07 16:23:38 bloritsch Exp $
*/
public class <xsl:value-of select="@file-name"/> extends AbstractSitemap {
static final String LOCATION = "<xsl:value-of select="translate(@file-path,
'/', '.')"/>.<xsl:value-of select="@file-name"/>";
@@ -292,6 +293,7 @@
Map map = null;
Parameters param = null;
Map objectModel = environment.getObjectModel();
+ SitemapRedirector redirector = new SitemapRedirector(environment);
<xsl:apply-templates select="./*"/>
return internalRequest;
}
@@ -313,6 +315,7 @@
eventPipeline.setSitemap(this);
Map map = null;
Parameters param = null;
+ SitemapRedirector redirector = new SitemapRedirector(environment);
<xsl:apply-templates select="./*"/>
return internalRequest;
}
@@ -329,7 +332,7 @@
* @return Wether the request has been processed or not
* @exception Exception If an error occurs during request evaluation and
production
*/
- private Map action_set_<xsl:value-of select="translate(@name, '- ',
'__')"/> (String cocoon_action, List listOfMaps, Environment environment, Map
objectModel, String src, Parameters param)
+ private Map action_set_<xsl:value-of select="translate(@name, '- ',
'__')"/> (SitemapRedirector redirector, String cocoon_action, List listOfMaps,
Environment environment, Map objectModel, String src, Parameters param)
throws Exception {
Map map;
Map allMap = null;
@@ -410,6 +413,7 @@
Map map;
Parameters param;
Map objectModel = environment.getObjectModel();
+ SitemapRedirector redirector = new SitemapRedirector(environment);
String cocoon_view = environment.getView();
String cocoon_action = environment.getAction();
@@ -672,7 +676,7 @@
</xsl:variable>
<!-- Modified 20010509 L.Sutic Changed to pass sitemap parameters. -->
- <!-- gets the string how the selector is to be invoced in java code -->
+ <!-- gets the string how the selector is to be invoked in java code -->
<xsl:variable name="selector-name">
<!-- check if we have a selector definition in this sitemap otherwise get
it from the parent -->
<xsl:choose>
@@ -760,15 +764,25 @@
<!-- generate the invocation of the act method of the action component -->
<xsl:choose>
<xsl:when test="./*[namespace-uri()='http://apache.org/cocoon/sitemap/1.0'
and local-name() != 'parameter']">
- if ((map = <xsl:value-of select="$action-name"/> ((Redirector)environment,
environment, objectModel, substitute(listOfMaps,<xsl:value-of
select="$action-source"/>), <xsl:value-of select="$component-param"/>)) != null) {
+ if ((map = <xsl:value-of select="$action-name"/> (redirector, environment,
objectModel, substitute(listOfMaps,<xsl:value-of select="$action-source"/>),
<xsl:value-of select="$component-param"/>)) != null) {
+ if (redirector.hasRedirected()) {
+ return true;
+ }
getLogger().debug("Action <xsl:value-of
select="translate($action-name,'"',' ')"/>");
listOfMaps.add (map);
<xsl:apply-templates/>
listOfMaps.remove(listOfMaps.size()-1);
}
+ if (redirector.hasRedirected()) {
+ return true;
+ }
</xsl:when>
<xsl:otherwise>
- map = <xsl:value-of select="$action-name"/> ((Redirector)environment,
environment, objectModel, substitute(listOfMaps,<xsl:value-of
select="$action-source"/>), <xsl:value-of select="$component-param"/>);
+ map = <xsl:value-of select="$action-name"/> (redirector, environment,
objectModel, substitute(listOfMaps,<xsl:value-of select="$action-source"/>),
<xsl:value-of select="$component-param"/>);
+
+ if (redirector.hasRedirected()) {
+ return true;
+ }
</xsl:otherwise>
</xsl:choose>
</xsl:template> <!-- match="map:act[@type]" -->
@@ -792,7 +806,7 @@
</xsl:call-template>
</xsl:variable>
- <!-- gets the string how the action is to be invoced in java code -->
+ <!-- gets the string how the action is to be invoked in java code -->
<xsl:variable name="action-name">
((Action)this.actions.select("<xsl:value-of select="$action-type"/>")).act
</xsl:variable>
@@ -813,7 +827,7 @@
<!-- generate the invocation of the act method of the action component -->
<xsl:choose>
<xsl:when test="./*[namespace-uri()='http://apache.org/cocoon/sitemap/1.0'
and local-name() != 'parameter']">
- if ((map = <xsl:value-of select="$action-name"/> ((Redirector)environment,
environment, objectModel, substitute(listOfMaps,<xsl:value-of
select="$action-source"/>), <xsl:value-of select="$component-param"/>)) != null) {
+ if ((map = <xsl:value-of select="$action-name"/> (redirector, environment,
objectModel, substitute(listOfMaps,<xsl:value-of select="$action-source"/>),
<xsl:value-of select="$component-param"/>)) != null) {
getLogger().debug("Action <xsl:value-of
select="translate($action-name,'"',' ')"/>");
listOfMaps.add (map);
<xsl:apply-templates/>
@@ -821,7 +835,7 @@
}
</xsl:when>
<xsl:otherwise>
- map = <xsl:value-of select="$action-name"/> ((Redirector)environment,
environment, objectModel, substitute(listOfMaps,<xsl:value-of
select="$action-source"/>), <xsl:value-of select="$component-param"/>);
+ map = <xsl:value-of select="$action-name"/> (redirector, environment,
objectModel, substitute(listOfMaps,<xsl:value-of select="$action-source"/>),
<xsl:value-of select="$component-param"/>);
</xsl:otherwise>
</xsl:choose>
</xsl:template> <!-- match="map:act[@type]" mode="set" -->
@@ -845,7 +859,7 @@
</xsl:call-template>
</xsl:variable>
- <!-- gets the string how the action is to be invoced in java code -->
+ <!-- gets the string how the action is to be invoked in java code -->
<xsl:variable name="action-name">
action_set_<xsl:value-of select="$action-set"/>
</xsl:variable>
@@ -882,15 +896,24 @@
<!-- generate the invocation of the act method of the action component -->
<xsl:choose>
<xsl:when test="./*[namespace-uri()='http://apache.org/cocoon/sitemap/1.0'
and local-name() != 'parameter']">
- if ((map = <xsl:value-of select="$action-name"/> (cocoon_action,
listOfMaps, environment, objectModel, substitute(listOfMaps,<xsl:value-of
select="$action-source"/>), <xsl:value-of select="$component-param"/>)) != null) {
+ if ((map = <xsl:value-of select="$action-name"/> (redirector,
cocoon_action, listOfMaps, environment, objectModel,
substitute(listOfMaps,<xsl:value-of select="$action-source"/>), <xsl:value-of
select="$component-param"/>)) != null) {
+ if (redirector.hasRedirected()) {
+ return true;
+ }
getLogger().debug("Action <xsl:value-of
select="translate($action-name,'"',' ')"/>");
listOfMaps.add (map);
<xsl:apply-templates/>
listOfMaps.remove(listOfMaps.size()-1);
}
+ if (redirector.hasRedirected()) {
+ return true;
+ }
</xsl:when>
<xsl:otherwise>
- map = <xsl:value-of select="$action-name"/> (cocoon_action, listOfMaps,
environment, objectModel, substitute(listOfMaps,<xsl:value-of
select="$action-source"/>), <xsl:value-of select="$component-param"/>);
+ map = <xsl:value-of select="$action-name"/> (redirector, cocoon_action,
listOfMaps, environment, objectModel, substitute(listOfMaps,<xsl:value-of
select="$action-source"/>), <xsl:value-of select="$component-param"/>);
+ if (redirector.hasRedirected()) {
+ return true;
+ }
</xsl:otherwise>
</xsl:choose>
</xsl:template> <!-- match="map:act[@set]" -->
No revision
No revision
1.5.2.1 +6 -6
xml-cocoon2/src/org/apache/cocoon/components/pipeline/AbstractEventPipeline.java
Index: AbstractEventPipeline.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/components/pipeline/AbstractEventPipeline.java,v
retrieving revision 1.5
retrieving revision 1.5.2.1
diff -u -r1.5 -r1.5.2.1
--- AbstractEventPipeline.java 2001/05/31 17:38:06 1.5
+++ AbstractEventPipeline.java 2001/06/07 16:23:44 1.5.2.1
@@ -35,7 +35,7 @@
/**
* @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a>
* @author <a href="mailto:cziegeler@Carsten Ziegeler">Carsten Ziegeler</a>
- * @version CVS $Revision: 1.5 $ $Date: 2001/05/31 17:38:06 $
+ * @version CVS $Revision: 1.5.2.1 $ $Date: 2001/06/07 16:23:44 $
*/
public abstract class AbstractEventPipeline
extends AbstractXMLProducer
@@ -80,7 +80,7 @@
this.sitemap = sitemap;
}
- public void setGenerator (String role, String source, Parameters param,
Exception e)
+ public void setGenerator (Component role, String source, Parameters param,
Exception e)
throws Exception {
this.setGenerator (role, source, param);
// FIXME(CZ) What can be done if this is not an ErrorNotifier?
@@ -91,12 +91,12 @@
}
}
- public void setGenerator (String role, String source, Parameters param)
+ public void setGenerator (Component role, String source, Parameters param)
throws Exception {
if (this.generator != null) {
throw new ProcessingException ("Generator already set. You can only
select one Generator (" + role + ")");
}
- this.generator = (Generator) generatorSelector.select(role);
+ this.generator = (Generator) role;
this.generatorSource = source;
this.generatorParam = param;
}
@@ -105,9 +105,9 @@
return this.generator;
}
- public void addTransformer (String role, String source, Parameters param)
+ public void addTransformer (Component role, String source, Parameters param)
throws Exception {
- this.transformers.add ((Transformer)transformerSelector.select(role));
+ this.transformers.add ((Transformer) role);
this.transformerSources.add (source);
this.transformerParams.add (param);
}
1.3.2.1 +9 -9
xml-cocoon2/src/org/apache/cocoon/components/pipeline/AbstractStreamPipeline.java
Index: AbstractStreamPipeline.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/components/pipeline/AbstractStreamPipeline.java,v
retrieving revision 1.3
retrieving revision 1.3.2.1
diff -u -r1.3 -r1.3.2.1
--- AbstractStreamPipeline.java 2001/05/31 17:38:07 1.3
+++ AbstractStreamPipeline.java 2001/06/07 16:23:46 1.3.2.1
@@ -34,7 +34,7 @@
* resource
* </UL>
* @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a>
- * @version CVS $Revision: 1.3 $ $Date: 2001/05/31 17:38:07 $
+ * @version CVS $Revision: 1.3.2.1 $ $Date: 2001/06/07 16:23:46 $
*/
public abstract class AbstractStreamPipeline extends AbstractLoggable implements
StreamPipeline, Disposable {
protected EventPipeline eventPipeline;
@@ -80,38 +80,38 @@
return this.eventPipeline;
}
- public void setReader (String role, String source, Parameters param)
+ public void setReader (Component role, String source, Parameters param)
throws Exception {
this.setReader (role, source, param, null);
}
- public void setReader (String role, String source, Parameters param, String
mimeType)
+ public void setReader (Component role, String source, Parameters param, String
mimeType)
throws Exception {
if (this.reader != null) {
throw new ProcessingException ("Reader already set. You can only select
one Reader (" + role + ")");
}
- this.reader = (Reader)readerSelector.select(role);
+ this.reader = (Reader) role;
this.readerSource = source;
this.readerParam = param;
this.readerMimeType = mimeType;
- this.sitemapReaderMimeType = readerSelector.getMimeTypeForRole(role);
+ this.sitemapReaderMimeType =
readerSelector.getMimeTypeForRole(role.getClass().getName());
}
- public void setSerializer (String role, String source, Parameters param)
+ public void setSerializer (Component role, String source, Parameters param)
throws Exception {
this.setSerializer (role, source, param, null);
}
- public void setSerializer (String role, String source, Parameters param, String
mimeType)
+ public void setSerializer (Component role, String source, Parameters param,
String mimeType)
throws Exception {
if (this.serializer != null) {
throw new ProcessingException ("Serializer already set. You can only
select one Serializer (" + role + ")");
}
- this.serializer = (Serializer)serializerSelector.select(role);
+ this.serializer = (Serializer) role;
this.serializerSource = source;
this.serializerParam = param;
this.serializerMimeType = mimeType;
- this.sitemapSerializerMimeType =
serializerSelector.getMimeTypeForRole(role);
+ this.sitemapSerializerMimeType =
serializerSelector.getMimeTypeForRole(role.getClass().getName());
}
public boolean process(Environment environment)
1.7.2.1 +5 -5
xml-cocoon2/src/org/apache/cocoon/components/pipeline/CachingEventPipeline.java
Index: CachingEventPipeline.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/components/pipeline/CachingEventPipeline.java,v
retrieving revision 1.7
retrieving revision 1.7.2.1
diff -u -r1.7 -r1.7.2.1
--- CachingEventPipeline.java 2001/05/31 17:38:07 1.7
+++ CachingEventPipeline.java 2001/06/07 16:23:47 1.7.2.1
@@ -52,7 +52,7 @@
* does not cache! (If it would cache, the response would be cached twice!)
*
* @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
- * @version CVS $Revision: 1.7 $ $Date: 2001/05/31 17:38:07 $
+ * @version CVS $Revision: 1.7.2.1 $ $Date: 2001/06/07 16:23:47 $
*/
public final class CachingEventPipeline
extends AbstractEventPipeline
@@ -81,19 +81,19 @@
/**
* Set the generator.
*/
- public void setGenerator (String role, String source, Parameters param)
+ public void setGenerator (Component role, String source, Parameters param)
throws Exception {
super.setGenerator(role, source, param);
- this.generatorRole = role;
+ this.generatorRole = role.getClass().getName();
}
/**
* Add a transformer.
*/
- public void addTransformer (String role, String source, Parameters param)
+ public void addTransformer (Component role, String source, Parameters param)
throws Exception {
super.addTransformer(role, source, param);
- this.transformerRoles.add(role);
+ this.transformerRoles.add(role.getClass().getName());
}
/**
1.3.2.1 +5 -5
xml-cocoon2/src/org/apache/cocoon/components/pipeline/CachingStreamPipeline.java
Index: CachingStreamPipeline.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/components/pipeline/CachingStreamPipeline.java,v
retrieving revision 1.3
retrieving revision 1.3.2.1
diff -u -r1.3 -r1.3.2.1
--- CachingStreamPipeline.java 2001/05/22 14:35:33 1.3
+++ CachingStreamPipeline.java 2001/06/07 16:23:48 1.3.2.1
@@ -45,7 +45,7 @@
* </ul>
*
* @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
- * @version CVS $Revision: 1.3 $ $Date: 2001/05/22 14:35:33 $
+ * @version CVS $Revision: 1.3.2.1 $ $Date: 2001/06/07 16:23:48 $
*/
public class CachingStreamPipeline extends AbstractStreamPipeline {
@@ -72,18 +72,18 @@
/** Set the serializer.
*/
- public void setSerializer (String role, String source, Parameters param, String
mimeType)
+ public void setSerializer (Component role, String source, Parameters param,
String mimeType)
throws Exception {
super.setSerializer(role, source, param, mimeType);
- this.serializerRole = role;
+ this.serializerRole = role.getClass().getName();
}
/** Set the Reader.
*/
- public void setReader (String role, String source, Parameters param, String
mimeType)
+ public void setReader (Component role, String source, Parameters param, String
mimeType)
throws Exception {
super.setReader(role, source, param, mimeType);
- this.readerRole = role;
+ this.readerRole = role.getClass().getName();
}
/** Process the pipeline using a reader.
1.2.2.1 +4 -4
xml-cocoon2/src/org/apache/cocoon/components/pipeline/EventPipeline.java
Index: EventPipeline.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/components/pipeline/EventPipeline.java,v
retrieving revision 1.2
retrieving revision 1.2.2.1
diff -u -r1.2 -r1.2.2.1
--- EventPipeline.java 2001/05/31 16:12:38 1.2
+++ EventPipeline.java 2001/06/07 16:23:50 1.2.2.1
@@ -18,13 +18,13 @@
/**
* @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a>
- * @version CVS $Revision: 1.2 $ $Date: 2001/05/31 16:12:38 $
+ * @version CVS $Revision: 1.2.2.1 $ $Date: 2001/06/07 16:23:50 $
*/
public interface EventPipeline extends Component, Composable, Recyclable, Processor
{
- void setGenerator (String role, String source, Parameters param, Exception e)
throws Exception;
- void setGenerator (String role, String source, Parameters param) throws
Exception;
+ void setGenerator (Component role, String source, Parameters param, Exception
e) throws Exception;
+ void setGenerator (Component role, String source, Parameters param) throws
Exception;
Generator getGenerator ();
- void addTransformer (String role, String source, Parameters param) throws
Exception;
+ void addTransformer (Component role, String source, Parameters param) throws
Exception;
void setSitemap(Sitemap sitemap);
boolean process(Environment environment) throws Exception;
}
1.2.2.1 +5 -5
xml-cocoon2/src/org/apache/cocoon/components/pipeline/StreamPipeline.java
Index: StreamPipeline.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/components/pipeline/StreamPipeline.java,v
retrieving revision 1.2
retrieving revision 1.2.2.1
diff -u -r1.2 -r1.2.2.1
--- StreamPipeline.java 2001/05/31 16:12:39 1.2
+++ StreamPipeline.java 2001/06/07 16:23:51 1.2.2.1
@@ -20,14 +20,14 @@
* <CODE>Serializer</CODE> and let them produce the character stream
* </UL>
* @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a>
- * @version CVS $Revision: 1.2 $ $Date: 2001/05/31 16:12:39 $
+ * @version CVS $Revision: 1.2.2.1 $ $Date: 2001/06/07 16:23:51 $
*/
public interface StreamPipeline extends Component, Composable, Recyclable,
Processor {
void setEventPipeline (EventPipeline eventPipeline) throws Exception;
EventPipeline getEventPipeline ();
- void setReader (String role, String source, Parameters param) throws Exception;
- void setReader (String role, String source, Parameters param, String mimeType)
throws Exception;
- void setSerializer (String role, String source, Parameters param) throws
Exception;
- void setSerializer (String role, String source, Parameters param, String
mimeType) throws Exception;
+ void setReader (Component role, String source, Parameters param) throws
Exception;
+ void setReader (Component role, String source, Parameters param, String
mimeType) throws Exception;
+ void setSerializer (Component role, String source, Parameters param) throws
Exception;
+ void setSerializer (Component role, String source, Parameters param, String
mimeType) throws Exception;
}
No revision
No revision
1.1.2.2 +0 -8 xml-cocoon2/src/org/apache/cocoon/sitemap/Attic/sitemap.roles
Index: sitemap.roles
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/sitemap/Attic/sitemap.roles,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- sitemap.roles 2001/06/06 17:13:23 1.1.2.1
+++ sitemap.roles 2001/06/07 16:24:02 1.1.2.2
@@ -1,14 +1,6 @@
<?xml version="1.0"?>
<role-list>
- <role name="org.apache.cocoon.components.pipeline.StreamPipeline"
- shorthand="stream-pipeline"
-
default-class="org.apache.cocoon.components.pipeline.NonCachingStreamPipeline"/>
-
- <role name="org.apache.cocoon.components.pipeline.EventPipeline"
- shorthand="event-pipeline"
-
default-class="org.apache.cocoon.components.pipeline.NonCachingEventPipeline"/>
-
<role name="org.apache.cocoon.acting.ActionSelector"
shorthand="action"
default-class="org.apache.avalon.excalibur.component.ExcaliburComponentSelector"/>
----------------------------------------------------------------------
In case of troubles, e-mail: [EMAIL PROTECTED]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]