You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by re...@apache.org on 2008/02/06 17:57:20 UTC
svn commit: r619067 - in /cocoon/whiteboard/micro/core/cocoon-sitemap:
cocoon-sitemap-api/src/main/java/org/apache/cocoon/
cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/treeprocessor/
cocoon-sitemap-impl/src/main/java/org/apache/cocoon...
Author: reinhard
Date: Wed Feb 6 08:57:17 2008
New Revision: 619067
URL: http://svn.apache.org/viewvc?rev=619067&view=rev
Log:
remove checks if a pipeline is called internally
Modified:
cocoon/whiteboard/micro/core/cocoon-sitemap/cocoon-sitemap-api/src/main/java/org/apache/cocoon/Processor.java
cocoon/whiteboard/micro/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/treeprocessor/ConcreteTreeProcessor.java
cocoon/whiteboard/micro/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/treeprocessor/InvokeContext.java
cocoon/whiteboard/micro/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/treeprocessor/TreeProcessor.java
cocoon/whiteboard/micro/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/ErrorHandlerHelper.java
cocoon/whiteboard/micro/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/MountNode.java
cocoon/whiteboard/micro/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/ReadNode.java
cocoon/whiteboard/micro/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/SerializeNode.java
Modified: cocoon/whiteboard/micro/core/cocoon-sitemap/cocoon-sitemap-api/src/main/java/org/apache/cocoon/Processor.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/micro/core/cocoon-sitemap/cocoon-sitemap-api/src/main/java/org/apache/cocoon/Processor.java?rev=619067&r1=619066&r2=619067&view=diff
==============================================================================
--- cocoon/whiteboard/micro/core/cocoon-sitemap/cocoon-sitemap-api/src/main/java/org/apache/cocoon/Processor.java (original)
+++ cocoon/whiteboard/micro/core/cocoon-sitemap/cocoon-sitemap-api/src/main/java/org/apache/cocoon/Processor.java Wed Feb 6 08:57:17 2008
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -68,7 +68,7 @@
this.processor = null;
}
}
-
+
/**
* Process the given <code>Environment</code> producing the output.
* @return If the processing is successfull <code>true</code> is returned.
@@ -83,27 +83,17 @@
throws Exception;
/**
- * Process the given <code>Environment</code> to assemble
- * a <code>ProcessingPipeline</code>.
- * Don't forget to release the pipeline using
- * {@link InternalPipelineDescription#release()}.
- * @since 2.2
- */
- InternalPipelineDescription buildPipeline(Environment environment)
- throws Exception;
-
- /**
* Get the root processor parent of this processor.
* @since 2.1.1
*/
Processor getRootProcessor();
-
+
/**
* Get the source resolver for this processor
* @since 2.2
*/
SourceResolver getSourceResolver();
-
+
/**
* Get the context URI for this processor
* @since 2.2
Modified: cocoon/whiteboard/micro/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/treeprocessor/ConcreteTreeProcessor.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/micro/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/treeprocessor/ConcreteTreeProcessor.java?rev=619067&r1=619066&r2=619067&view=diff
==============================================================================
--- cocoon/whiteboard/micro/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/treeprocessor/ConcreteTreeProcessor.java (original)
+++ cocoon/whiteboard/micro/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/treeprocessor/ConcreteTreeProcessor.java Wed Feb 6 08:57:17 2008
@@ -149,25 +149,6 @@
}
/**
- * Process the given <code>Environment</code> to assemble
- * a <code>ProcessingPipeline</code>.
- * @since 2.1
- */
- public InternalPipelineDescription buildPipeline(Environment environment)
- throws Exception {
- InvokeContext context = new InvokeContext(true);
- try {
- if (process(environment, context)) {
- return context.getInternalPipelineDescription(environment);
- }
-
- return null;
- } finally {
- context.dispose();
- }
- }
-
- /**
* Do the actual processing, be it producing the response or just building the pipeline
* @param environment
* @param context
Modified: cocoon/whiteboard/micro/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/treeprocessor/InvokeContext.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/micro/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/treeprocessor/InvokeContext.java?rev=619067&r1=619066&r2=619067&view=diff
==============================================================================
--- cocoon/whiteboard/micro/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/treeprocessor/InvokeContext.java (original)
+++ cocoon/whiteboard/micro/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/treeprocessor/InvokeContext.java Wed Feb 6 08:57:17 2008
@@ -56,9 +56,6 @@
private Map nameToMap = new HashMap();
private Map mapToName = new HashMap();
- /** True if building pipeline only, not processing it. */
- private final boolean isBuildingPipelineOnly;
-
/** The redirector */
protected Redirector redirector;
@@ -95,21 +92,12 @@
* the current request is external.
*/
public InvokeContext() {
- this.isBuildingPipelineOnly = false;
- }
-
- /**
- * Create an <code>InvokeContext</code>
- */
- public InvokeContext(boolean isBuildingPipelineOnly) {
- this.isBuildingPipelineOnly = isBuildingPipelineOnly;
}
/**
* Create an <code>InvokeContext</code> based on existing context.
*/
public InvokeContext(InvokeContext context, ServiceManager manager) throws ServiceException {
- this.isBuildingPipelineOnly = context.isBuildingPipelineOnly;
this.redirector = context.redirector;
this.lastProcessor = context.lastProcessor;
service(manager);
@@ -128,13 +116,6 @@
}
/**
- * Are we building a pipeline (and not executing it) ?
- */
- public final boolean isBuildingPipelineOnly() {
- return this.isBuildingPipelineOnly;
- }
-
- /**
* Set the redirector to be used by nodes that need it.
*
* @param redirector the redirector
@@ -167,7 +148,7 @@
this.processingPipelineType = pipelineType;
this.processingPipelineParameters = parameters;
}
-
+
public String getPipelineType() {
return this.processingPipelineType;
}
@@ -175,7 +156,7 @@
public Parameters getPipelineParameters() {
return this.processingPipelineParameters;
}
-
+
/**
* Set the error handler for the pipeline.
*/
@@ -254,13 +235,12 @@
public final void pushMap(String anchorName, Map map) {
final String sitemapObjectModelPathPrefix = "sitemap";
final String sitemapObjectModelNamedPathPrefix = sitemapObjectModelPathPrefix + "/$named$";
-
- //if cocoon: protocol is used the isBuildingPipelineOnly() is true that means pipeline going to be set up
- //but not executed at the same time therefore it must be cocoon: protocol that takes responsibility for
- //maintaining OM's cleaness
- if (!isBuildingPipelineOnly())
- newObjectModel.markLocalContext();
-
+
+ //if cocoon: protocol is used the isBuildingPipelineOnly() is true that means pipeline going to be set up
+ //but not executed at the same time therefore it must be cocoon: protocol that takes responsibility for
+ //maintaining OM's cleaness
+ this.newObjectModel.markLocalContext();
+
this.mapStack.add(map);
if (getLogger().isDebugEnabled()) {
@@ -290,12 +270,11 @@
Object name = this.mapToName.get(map);
this.mapToName.remove(map);
this.nameToMap.remove(name);
+
//if cocoon: protocol is used the isBuildingPipelineOnly() is true that means pipeline going to be set up
//but not executed at the same time therefore it must be cocoon: protocol that takes responsibility for
//maintaining OM's cleaness
- if (!isBuildingPipelineOnly()) {
- this.newObjectModel.cleanupLocalContext();
- }
+ this.newObjectModel.cleanupLocalContext();
}
/**
Modified: cocoon/whiteboard/micro/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/treeprocessor/TreeProcessor.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/micro/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/treeprocessor/TreeProcessor.java?rev=619067&r1=619066&r2=619067&view=diff
==============================================================================
--- cocoon/whiteboard/micro/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/treeprocessor/TreeProcessor.java (original)
+++ cocoon/whiteboard/micro/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/treeprocessor/TreeProcessor.java Wed Feb 6 08:57:17 2008
@@ -87,10 +87,10 @@
/** Check for reload? */
protected boolean checkReload;
-
+
/** Need component classes to be reloaded, due to jci notification? */
protected boolean classReload;
-
+
/** The source resolver */
protected SourceResolver resolver;
@@ -116,7 +116,7 @@
this.checkReload = true;
this.lastModifiedDelay = 1000;
// create sitemap schema
- final SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ final SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
final StreamSource ss = new StreamSource(this.getClass().getResourceAsStream("/org/apache/cocoon/sitemap/schema/cocoon-sitemap-1.0.xsd"));
try {
this.sitemapSchema = factory.newSchema(ss);
@@ -223,7 +223,7 @@
this.lastModifiedDelay = config.getChild("reload").getAttributeAsLong("delay", this.settings.getReloadDelay("sitemap"));
String fileName = config.getAttribute("file", "sitemap.xmap");
-
+
try {
this.source = new DelayedRefreshSourceWrapper(this.resolver.resolveURI(fileName), lastModifiedDelay);
} catch (Exception e) {
@@ -247,19 +247,6 @@
return this.concreteProcessor.process(environment);
}
-
- /**
- * Process the given <code>Environment</code> to assemble
- * a <code>ProcessingPipeline</code>.
- * @since 2.1
- */
- public InternalPipelineDescription buildPipeline(Environment environment)
- throws Exception {
- // Get the concrete processor and delegate it the job
- setupConcreteProcessor(environment);
- return this.concreteProcessor.buildPipeline(environment);
- }
-
/**
* @see org.apache.cocoon.Processor#getRootProcessor()
*/
@@ -339,7 +326,7 @@
this.classReload = false;
}
}
-
+
private Configuration createSitemapProgram(Source sitemapSource)
throws ProcessingException, SAXException, IOException {
// do we validate? Default is false
@@ -354,9 +341,9 @@
NamespacedSAXConfigurationHandler handler = new NamespacedSAXConfigurationHandler();
AnnotationsFilter annotationsFilter = new AnnotationsFilter(handler);
SourceUtil.toSAX(this.manager, sitemapSource, null, annotationsFilter);
- return handler.getConfiguration();
+ return handler.getConfiguration();
}
-
+
/**
* Build the concrete processor (i.e. loads the sitemap). Should be called
* only by setupProcessor();
@@ -374,17 +361,17 @@
long newLastModified;
ConcreteTreeProcessor newProcessor;
ConcreteTreeProcessor oldProcessor = this.concreteProcessor;
-
+
if (oldProcessor != null) {
if (getLogger().isDebugEnabled()) {
getLogger().debug("found a previous ConcreteTreeProcessor");
- }
+ }
} else {
if (getLogger().isDebugEnabled()) {
getLogger().debug("first version of the ConcreteTreeProcessor");
- }
+ }
}
-
+
// Dispose the old processor, if any
if (oldProcessor != null) {
oldProcessor.markForDisposal();
@@ -415,7 +402,7 @@
treeBuilder.getWebApplicationContext(),
root,
treeBuilder.getDisposableNodes());
-
+
if (getLogger().isDebugEnabled()) {
getLogger().debug("ConcreteTreeProcessor ready");
}
@@ -426,7 +413,7 @@
final Interpreter interpreter = flowNode.getInterpreter();
newProcessor.setAttribute(Interpreter.ROLE, interpreter);
}
-
+
} finally {
this.manager.release(treeBuilder);
}
Modified: cocoon/whiteboard/micro/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/ErrorHandlerHelper.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/micro/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/ErrorHandlerHelper.java?rev=619067&r1=619066&r2=619067&view=diff
==============================================================================
--- cocoon/whiteboard/micro/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/ErrorHandlerHelper.java (original)
+++ cocoon/whiteboard/micro/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/ErrorHandlerHelper.java Wed Feb 6 08:57:17 2008
@@ -182,9 +182,7 @@
// Try to reset the response to avoid mixing already produced output
// and error page.
- if (!context.isBuildingPipelineOnly()) {
- env.tryResetResponse();
- }
+ env.tryResetResponse();
// Create a Notifying (deprecated)
NotifyingBuilder notifyingBuilder = (NotifyingBuilder) this.manager.lookup(NotifyingBuilder.ROLE);
Modified: cocoon/whiteboard/micro/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/MountNode.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/micro/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/MountNode.java?rev=619067&r1=619066&r2=619067&view=diff
==============================================================================
--- cocoon/whiteboard/micro/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/MountNode.java (original)
+++ cocoon/whiteboard/micro/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/MountNode.java Wed Feb 6 08:57:17 2008
@@ -101,24 +101,10 @@
try {
processor.getEnvironmentHelper().changeContext(env);
-
- if (context.isBuildingPipelineOnly()) {
- // Propagate pipelines
- Processor.InternalPipelineDescription pp = processor.buildPipeline(env);
- if (pp != null) {
- context.setInternalPipelineDescription(pp);
- return true;
- }
-
- return false;
- }
-
- // Processor will create its own pipelines
return processor.process(env);
} catch(Exception e) {
// Wrap with our location
throw ProcessingException.throwLocated("Sitemap: error when calling sub-sitemap", e, getLocation());
-
} finally {
// Restore context
env.setURI(oldPrefix, oldURI);
Modified: cocoon/whiteboard/micro/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/ReadNode.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/micro/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/ReadNode.java?rev=619067&r1=619066&r2=619067&view=diff
==============================================================================
--- cocoon/whiteboard/micro/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/ReadNode.java (original)
+++ cocoon/whiteboard/micro/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/ReadNode.java Wed Feb 6 08:57:17 2008
@@ -89,12 +89,7 @@
env.setStatus(this.statusCode);
}
- if (!context.isBuildingPipelineOnly()) {
- // Process pipeline
- return pipeline.process(env);
- }
-
- // Return true : pipeline is finished.
- return true;
+ // Process pipeline
+ return pipeline.process(env);
}
}
Modified: cocoon/whiteboard/micro/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/SerializeNode.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/micro/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/SerializeNode.java?rev=619067&r1=619066&r2=619067&view=diff
==============================================================================
--- cocoon/whiteboard/micro/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/SerializeNode.java (original)
+++ cocoon/whiteboard/micro/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/SerializeNode.java Wed Feb 6 08:57:17 2008
@@ -142,11 +142,7 @@
}
}
- if (!context.isBuildingPipelineOnly()) {
- // Process pipeline
- return pipeline.process(env);
- }
- // Return true : pipeline is finished.
- return true;
+ // Process pipeline
+ return pipeline.process(env);
}
}