Author: vgritsenko
Date: Fri Mar 11 12:01:00 2005
New Revision: 157141
URL: http://svn.apache.org/viewcvs?view=rev&rev=157141
Log:
Remove unused method InvokeContext.reset()
Clear processingPipelineName, processingPipelineObjectModel on dispose.
Modified:
cocoon/trunk/src/java/org/apache/cocoon/components/treeprocessor/ConcreteTreeProcessor.java
cocoon/trunk/src/java/org/apache/cocoon/components/treeprocessor/InvokeContext.java
Modified:
cocoon/trunk/src/java/org/apache/cocoon/components/treeprocessor/ConcreteTreeProcessor.java
URL:
http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/components/treeprocessor/ConcreteTreeProcessor.java?view=diff&r1=157140&r2=157141
==============================================================================
---
cocoon/trunk/src/java/org/apache/cocoon/components/treeprocessor/ConcreteTreeProcessor.java
(original)
+++
cocoon/trunk/src/java/org/apache/cocoon/components/treeprocessor/ConcreteTreeProcessor.java
Fri Mar 11 12:01:00 2005
@@ -1,5 +1,5 @@
/*
- * Copyright 1999-2004 The Apache Software Foundation.
+ * Copyright 1999-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -38,13 +38,14 @@
* The concrete implementation of [EMAIL PROTECTED] Processor}, containing the
evaluation tree and associated
* data such as component manager.
*
- * @version CVS $Id$
+ * @version $Id$
*/
-public class ConcreteTreeProcessor extends AbstractLogEnabled implements
Processor {
+public class ConcreteTreeProcessor extends AbstractLogEnabled
+ implements Processor {
/** Our ServiceManager */
private ServiceManager manager;
-
+
/** Our class loader */
private ClassLoader classloader;
@@ -76,7 +77,7 @@
// Get the sitemap executor - we use the same executor for each sitemap
this.sitemapExecutor = sitemapExecutor;
}
-
+
/** Set the processor data, result of the treebuilder job */
public void setProcessorData(ServiceManager manager, ClassLoader
classloader, ProcessingNode rootNode, List disposableNodes) {
if (this.rootNode != null) {
@@ -110,7 +111,7 @@
System.arraycopy(parentArray, 0, newArray, 1, parentArray.length);
newArray[0] = this.componentConfigurations;
return newArray;
- }
+ }
return new Configuration[] {this.componentConfigurations};
}
@@ -192,11 +193,11 @@
synchronized (this) {
requestCount++;
}
-
+
Thread currentThread = Thread.currentThread();
ClassLoader oldClassLoader = currentThread.getContextClassLoader();
currentThread.setContextClassLoader(this.classloader);
-
+
try {
// and now process
EnvironmentHelper.enterProcessor(this, this.manager, environment);
@@ -329,14 +330,13 @@
public String getContext() {
return wrappingProcessor.getContext();
}
-
/**
* Return the sitemap executor
*/
public SitemapExecutor getSitemapExecutor() {
return this.sitemapExecutor;
}
-
+
public ServiceManager getServiceManager() {
return this.manager;
}
Modified:
cocoon/trunk/src/java/org/apache/cocoon/components/treeprocessor/InvokeContext.java
URL:
http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/components/treeprocessor/InvokeContext.java?view=diff&r1=157140&r2=157141
==============================================================================
---
cocoon/trunk/src/java/org/apache/cocoon/components/treeprocessor/InvokeContext.java
(original)
+++
cocoon/trunk/src/java/org/apache/cocoon/components/treeprocessor/InvokeContext.java
Fri Mar 11 12:01:00 2005
@@ -47,7 +47,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Torsten Curdt</a>
- * @version CVS $Id$
+ * @version $Id$
*/
public class InvokeContext extends AbstractLogEnabled
implements Serviceable, Disposable {
@@ -59,6 +59,10 @@
/** True if building pipeline only, not processing it. */
private boolean isBuildingPipelineOnly;
+ /** The redirector */
+ protected Redirector redirector;
+
+
/** The current component manager, as set by the last call to compose() or
recompose() */
private ServiceManager currentManager;
@@ -74,6 +78,9 @@
/** The object model used to resolve processingPipelineParameters */
protected Map processingPipelineObjectModel;
+ /** The Selector for the processing pipeline */
+ protected ServiceSelector pipelineSelector;
+
/** The ProcessingPipeline used */
protected ProcessingPipeline processingPipeline;
@@ -82,12 +89,7 @@
/** The last processor */
protected Processor lastProcessor;
-
- /** The redirector */
- protected Redirector redirector;
- /** The Selector for the processing pipeline */
- protected ServiceSelector pipelineSelector;
/**
* Create an <code>InvokeContext</code> without existing pipelines. This
also means
* the current request is external.
@@ -146,7 +148,8 @@
this.processingPipeline.setup(
VariableResolver.buildParameters(this.processingPipelineParameters,
- this,
this.processingPipelineObjectModel)
+ this,
+
this.processingPipelineObjectModel)
);
}
return this.processingPipeline;
@@ -164,7 +167,7 @@
this.processingPipeline, this.pipelineSelector,
this.pipelinesManager);
this.internalPipelineDescription.lastProcessor = this.lastProcessor;
this.internalPipelineDescription.prefix = desc.prefix;
- this.internalPipelineDescription.uri = desc.uri;
+ this.internalPipelineDescription.uri = desc.uri;
}
/**
@@ -180,11 +183,11 @@
}
return this.internalPipelineDescription;
}
-
- /**
+
+ /**
* Set the last processor
*/
- public void setLastProcessor(Processor p) {
+ public void setLastProcessor(Processor p) {
this.lastProcessor = p;
}
@@ -206,27 +209,26 @@
* Get the result Map by anchor name
*/
public final Map getMapByAnchor(String anchor) {
- return((Map) this.nameToMap.get(anchor));
+ return (Map) this.nameToMap.get(anchor);
}
/**
* Push a Map on top of the current Map stack.
*/
public final void pushMap(String anchorName, Map map) {
- mapStack.add(map);
+ this.mapStack.add(map);
- if (this.getLogger().isDebugEnabled()) {
+ if (getLogger().isDebugEnabled()) {
dumpParameters();
}
if (anchorName != null) {
- if (!nameToMap.containsKey(anchorName)) {
- nameToMap.put(anchorName,map);
- mapToName.put(map,anchorName);
- }
- else {
- if (this.getLogger().isErrorEnabled()) {
- this.getLogger().error("name [" + anchorName + "]
clashes");
+ if (!this.nameToMap.containsKey(anchorName)) {
+ this.nameToMap.put(anchorName,map);
+ this.mapToName.put(map,anchorName);
+ } else {
+ if (getLogger().isErrorEnabled()) {
+ getLogger().error("name [" + anchorName + "] clashes");
}
}
}
@@ -236,23 +238,23 @@
* Dumps all sitemap parameters to log
*/
protected void dumpParameters() {
- if (!mapStack.isEmpty()) {
+ if (!this.mapStack.isEmpty()) {
StringBuffer sb = new StringBuffer();
sb.append("\nCurrent Sitemap Parameters:\n");
String path = "";
- for (int i = mapStack.size() - 1; i >= 0; i--) {
- Map map = (Map) mapStack.get(i);
+ for (int i = this.mapStack.size() - 1; i >= 0; i--) {
+ Map map = (Map) this.mapStack.get(i);
sb.append("LEVEL ").append(i+1);
- if (mapToName.containsKey(map)) {
- sb.append(" is named
'").append(String.valueOf(mapToName.get(map))).append("'");
+ if (this.mapToName.containsKey(map)) {
+ sb.append(" is named
'").append(String.valueOf(this.mapToName.get(map))).append("'");
}
sb.append("\n");
- Iterator keys = map.keySet().iterator();
- while (keys.hasNext()) {
- Object key = keys.next();
+ for (Iterator iter = map.entrySet().iterator();
iter.hasNext();) {
+ final Map.Entry me = (Map.Entry)iter.next();
+ final Object key = me.getKey();
sb.append("PARAM: '").append(path).append(key).append("'
");
sb.append("VALUE: '").append(map.get(key)).append("'\n");
}
@@ -260,19 +262,18 @@
path = "../" + path;
}
- this.getLogger().debug(sb.toString());
+ getLogger().debug(sb.toString());
}
-
}
/**
* Pop the topmost element of the current Map stack.
*/
public final void popMap() {
- Object map = mapStack.remove(mapStack.size() - 1);
- Object name = mapToName.get(map);
- mapToName.remove(map);
- nameToMap.remove(name);
+ Object map = this.mapStack.remove(this.mapStack.size() - 1);
+ Object name = this.mapToName.get(map);
+ this.mapToName.remove(map);
+ this.nameToMap.remove(name);
}
/**
@@ -294,16 +295,6 @@
}
/**
- * Prepare this context for reuse
- */
- public final void reset() {
- this.mapStack.clear();
- this.mapToName.clear();
- this.nameToMap.clear();
- dispose();
- }
-
- /**
* Release the pipelines, if any, if they were looked up by this context.
*/
public void dispose() {
@@ -315,7 +306,10 @@
this.pipelineSelector = null;
}
this.pipelinesManager = null;
+
+ this.processingPipelineName = null;
this.processingPipelineParameters = null;
+ this.processingPipelineObjectModel = null;
}
}
}