Author: ilgrosso
Date: Wed Apr 4 06:56:00 2012
New Revision: 1309265
URL: http://svn.apache.org/viewvc?rev=1309265&view=rev
Log:
[COCOON3-96] Restoring pristine cocoon-pipeline modifications and delegating internal-only attribute management to PipelineNode
Modified:
cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/AbstractPipeline.java
cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/Pipeline.java
cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/Invocation.java
cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/InvocationImpl.java
cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/node/PipelineNode.java
Modified: cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/AbstractPipeline.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/AbstractPipeline.java?rev=1309265&r1=1309264&r2=1309265&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/AbstractPipeline.java (original)
+++ cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/AbstractPipeline.java Wed Apr 4 06:56:00 2012
@@ -43,9 +43,7 @@ public abstract class AbstractPipeline<T
*/
private static final Logger LOG =
LoggerFactory.getLogger(AbstractPipeline.class);
-
- private boolean internalOnly;
-
+
private final LinkedList<T> components = new LinkedList<T>();
private boolean setupDone;
@@ -95,19 +93,13 @@ public abstract class AbstractPipeline<T
return -1;
}
- @Override
- public boolean isInternalOnly() {
- return this.internalOnly;
- }
-
/**
* {@inheritDoc}
*
* @see org.apache.cocoon.pipeline.Pipeline#setConfiguration(java.util.Map)
*/
public void setConfiguration(Map<String, ? extends Object> parameters) {
- this.internalOnly = parameters.containsKey("internal-only")
- && "true".equalsIgnoreCase((String) parameters.get("internal-only"));
+ // do nothing
}
/**
Modified: cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/Pipeline.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/Pipeline.java?rev=1309265&r1=1309264&r2=1309265&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/Pipeline.java (original)
+++ cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/Pipeline.java Wed Apr 4 06:56:00 2012
@@ -81,13 +81,6 @@ public interface Pipeline<T extends Pipe
void execute() throws Exception;
/**
- * Indicates if this pipeline is only evaluated for internal (servlet:) requests. By default 'false'.
- *
- * @return whether this pipeline is only evaluated for internal (servlet:) requests.
- */
- boolean isInternalOnly();
-
- /**
* Get the mime-type {@linkref http://tools.ietf.org/html/rfc2046} of the
* content produced by the pipeline.
*
Modified: cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/Invocation.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/Invocation.java?rev=1309265&r1=1309264&r2=1309265&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/Invocation.java (original)
+++ cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/Invocation.java Wed Apr 4 06:56:00 2012
@@ -42,7 +42,7 @@ public interface Invocation {
void installComponent(String type, Map<String, ? extends Object> parameters);
- void installPipeline(String type, Map<String, ? extends Object> parameters);
+ void installPipeline(String type, boolean internalOnly, Map<String, ? extends Object> parameters);
boolean isErrorInvocation();
Modified: cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/InvocationImpl.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/InvocationImpl.java?rev=1309265&r1=1309264&r2=1309265&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/InvocationImpl.java (original)
+++ cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/InvocationImpl.java Wed Apr 4 06:56:00 2012
@@ -62,6 +62,8 @@ public class InvocationImpl implements I
private Pipeline<PipelineComponent> pipeline;
+ private boolean internalOnly;
+
private String requestURI;
private URL baseURL;
@@ -145,7 +147,7 @@ public class InvocationImpl implements I
this.pipeline.setup(this.outputStream, this.parameters);
// check whether we are executing an internalOnly pipeline
- if (this.pipeline.isInternalOnly() && this.getParameters().containsKey(HttpServletRequest.class.getName())) {
+ if (this.internalOnly && this.getParameters().containsKey(HttpServletRequest.class.getName())) {
final HttpServletRequest request =
(HttpServletRequest) this.getParameters().get(HttpServletRequest.class.getName());
@@ -261,10 +263,12 @@ public class InvocationImpl implements I
* @see org.apache.cocoon.sitemap.Invocation#installPipeline(java.lang.String,
* java.util.Map)
*/
- public void installPipeline(String type, Map<String, ? extends Object> componentParameters) {
+ public void installPipeline(String type, boolean internalOnly, Map<String, ? extends Object> componentParameters) {
this.pipeline = this.componentProvider.createPipeline(type);
Map<String, ? extends Object> resolvedParameters = this.resolveParameters(componentParameters);
this.pipeline.setConfiguration(resolvedParameters);
+
+ this.internalOnly = internalOnly;
}
/**
Modified: cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/node/PipelineNode.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/node/PipelineNode.java?rev=1309265&r1=1309264&r2=1309265&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/node/PipelineNode.java (original)
+++ cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/node/PipelineNode.java Wed Apr 4 06:56:00 2012
@@ -34,6 +34,8 @@ public class PipelineNode extends Abstra
@Parameter
private String type = "caching"; // "caching" is the default type
+ @Parameter
+ private String internalOnly = "false";
/**
* {@inheritDoc}
@@ -83,7 +85,7 @@ public class PipelineNode extends Abstra
*/
@Override
public String toString() {
- return "PipelineNode(" + this.type + ")";
+ return "PipelineNode(" + this.type + ", internalOnly=" + "true".equalsIgnoreCase(this.internalOnly) + ")";
}
private InvocationResult handleException(Invocation invocation, Exception ex) {
@@ -102,6 +104,7 @@ public class PipelineNode extends Abstra
}
protected void installPipeline(Invocation invocation) {
- invocation.installPipeline(PIPELINE_CATEGORY + this.type, this.getParameters());
+ invocation.installPipeline(PIPELINE_CATEGORY + this.type, "true".equalsIgnoreCase(this.internalOnly),
+ this.getParameters());
}
}
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.