Hi all,

I attach a patch to add a Map to RunData to allow user components to
move information through the pipeline. For sake of consistency I have
followed the pattern used by the debugVariables Map already in RunData.

Peter 

Patch follows:- 


Index: org/apache/turbine/services/rundata/DefaultTurbineRunData.java
===================================================================
retrieving revision 1.20
diff -u -r1.20 DefaultTurbineRunData.java
--- org/apache/turbine/services/rundata/DefaultTurbineRunData.java      16
Feb 2004 07:06:27 -0000 1.20
+++ org/apache/turbine/services/rundata/DefaultTurbineRunData.java      4 Apr
2004 16:09:42 -0000
@@ -116,6 +116,7 @@
  * @author <a href="mailto:[EMAIL PROTECTED]">Daniel Rall</a>
  * @author <a href="mailto:[EMAIL PROTECTED]">Henning P.
Schmiedehausen</a>
  * @author <a href="mailto:[EMAIL PROTECTED]">Quinton McCombs</a>
+ * @author <a href="mailto:[EMAIL PROTECTED]">Peter Courcoux</a>
  * @version $Id: DefaultTurbineRunData.java,v 1.20 2004/02/16 07:06:27
epugh Exp $
  */
 public class DefaultTurbineRunData
@@ -242,6 +243,12 @@
      * exception is thrown.
      */
     private Map debugVariables = new HashMap();
+    
+    /**
+     * A map of variables which is designed to be used to pass data 
+     * along the turbine pipeline.
+     */
+    private Map userVariables = new HashMap();
 
     /** Logging */
     private static Log log =
LogFactory.getLog(DefaultTurbineRunData.class);
@@ -1536,5 +1543,25 @@
     protected void setScriptName(String scriptName)
     {
         getServerData().setScriptName(scriptName);
+    }
+
+    /**
+     * Sets a name/value pair in an internal map which is accessible to
the
+     * valves in the pipeline. Designed to allow user components to
pass data
+     * along the pipeline.
+     * @param name The name of the variable.
+     * @param value The value of the variable.
+     */
+    public void setVariable(String name, Object value) {
+        this.userVariables.put(name, value);
+        
+    }
+
+    /**
+     * Returns the map of user variables. 
+     * @return A Map of variables.
+     */
+    public Map getVariables() {
+        return userVariables;
     }
 }
Index: org/apache/turbine/util/RunData.java
===================================================================
retrieving revision 1.9
diff -u -r1.9 RunData.java
--- org/apache/turbine/util/RunData.java        19 Jun 2003 18:16:26 -0000      1.9
+++ org/apache/turbine/util/RunData.java        4 Apr 2004 16:09:43 -0000
@@ -86,6 +86,7 @@
  * @author <a href="mailto:[EMAIL PROTECTED]">Bernie Hoeneisen</a>
  * @author <a href="mailto:[EMAIL PROTECTED]">Daniel Rall</a>
  * @author <a href="mailto:[EMAIL PROTECTED]">Quinton McCombs</a>
+ * @author <a href="mailto:[EMAIL PROTECTED]">Peter Courcoux</a>
  * @version $Id: RunData.java,v 1.9 2003/06/19 18:16:26 henning Exp $
  */
 public interface RunData
@@ -677,4 +678,20 @@
      * @return a Map of debug variables.
      */
     Map getDebugVariables();
+    
+    /**
+     * Sets a name/value pair in an internal map which is accessible to
the
+     * valves in the pipeline. Designed to allow user components to
pass data
+     * along the pipeline.
+     * @param name The name of the variable.
+     * @param value The value of the variable.
+     */
+    void setVariable(String name, Object value);
+    
+    /**
+     * Returns the map of user variables. 
+     * @return A Map of variables.
+     */
+    Map getVariables();
+    
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to