cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sylv...@apache.org
Subject svn commit: r292158 [4/4] - in /cocoon: blocks/ajax/ blocks/ajax/trunk/ blocks/ajax/trunk/WEB-INF/ blocks/ajax/trunk/WEB-INF/xconf/ blocks/ajax/trunk/java/ blocks/ajax/trunk/java/org/ blocks/ajax/trunk/java/org/apache/ blocks/ajax/trunk/java/org/apache...
Date Wed, 28 Sep 2005 10:25:30 GMT
Modified: cocoon/trunk/src/java/org/apache/cocoon/components/flow/WebContinuation.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/components/flow/WebContinuation.java?rev=292158&r1=292157&r2=292158&view=diff
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/components/flow/WebContinuation.java (original)
+++ cocoon/trunk/src/java/org/apache/cocoon/components/flow/WebContinuation.java Wed Sep 28
03:24:51 2005
@@ -16,9 +16,14 @@
 package org.apache.cocoon.components.flow;
 
 import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 import org.apache.avalon.framework.logger.AbstractLogEnabled;
+import org.apache.commons.collections.iterators.IteratorEnumeration;
 import org.apache.commons.lang.StringUtils;
 
 /**
@@ -102,6 +107,10 @@
      */
     protected ContinuationsDisposer disposer;
 
+    /**
+     * The attributes of this continuation
+     */
+    private Map attributes;
 
     /**
      * Create a <code>WebContinuation</code> object. Saves the object in
@@ -132,6 +141,57 @@
         if (parentContinuation != null) {
             this.parentContinuation.children.add(this);
         }
+    }
+
+    /**
+     * Get an attribute of this continuation
+     * 
+     * @param name the attribute name.
+     */
+    public Object getAttribute(String name) {
+        if (this.attributes == null)
+            return null;
+        
+        return this.attributes.get(name);
+    }
+    
+    /**
+     * Set an attribute of this continuation
+     * 
+     * @param name the attribute name
+     * @param value its value
+     */
+    public void setAttribute(String name, Object value) {
+        if (this.attributes == null) {
+            this.attributes = Collections.synchronizedMap(new HashMap());
+        }
+        
+        this.attributes.put(name, value);
+    }
+    
+    /**
+     * Remove an attribute of this continuation
+     * 
+     * @param name the attribute name
+     */
+    public void removeAttribute(String name) {
+        if (this.attributes == null)
+            return;
+        
+        this.attributes.remove(name);
+    }
+    
+    /**
+     * Enumerate the attributes of this continuation.
+     * 
+     * @return an enumeration of strings
+     */
+    public Enumeration getAttributeNames() {
+        if (this.attributes == null)
+            return new IteratorEnumeration();
+        
+        ArrayList keys = new ArrayList(this.attributes.keySet());
+        return new IteratorEnumeration(keys.iterator());
     }
 
     /**

Modified: cocoon/trunk/src/java/org/apache/cocoon/components/flow/javascript/fom/FOM_WebContinuation.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/components/flow/javascript/fom/FOM_WebContinuation.java?rev=292158&r1=292157&r2=292158&view=diff
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/components/flow/javascript/fom/FOM_WebContinuation.java
(original)
+++ cocoon/trunk/src/java/org/apache/cocoon/components/flow/javascript/fom/FOM_WebContinuation.java
Wed Sep 28 03:24:51 2005
@@ -103,6 +103,26 @@
         return "FOM_WebContinuation";
     }
 
+    public Object jsFunction_getAttribute(String name) {
+        return org.mozilla.javascript.Context.javaToJS(
+                wk.getAttribute(name),
+                getParentScope());
+    }
+
+    public void jsFunction_setAttribute(String name, Object value) {
+        wk.setAttribute(name, unwrap(value));
+    }
+
+    public void jsFunction_removeAttribute(String name) {
+        wk.removeAttribute(name);
+    }
+
+    public Object jsFunction_getAttributeNames() {
+        return org.mozilla.javascript.Context.javaToJS(
+                wk.getAttributeNames(),
+                getParentScope());
+    }
+
     public String jsGet_id() {
         return wk.getId();
     }



Mime
View raw message