cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r153807 - cocoon/trunk/src/blocks/scratchpad/java/org/apache/cocoon/environment/TemplateObjectModelHelper.java
Date Mon, 14 Feb 2005 17:19:16 GMT
Author: cziegeler
Date: Mon Feb 14 09:19:14 2005
New Revision: 153807

URL: http://svn.apache.org/viewcvs?view=rev&rev=153807
Log:
No need for dynamic wrappers anymore

Modified:
    cocoon/trunk/src/blocks/scratchpad/java/org/apache/cocoon/environment/TemplateObjectModelHelper.java

Modified: cocoon/trunk/src/blocks/scratchpad/java/org/apache/cocoon/environment/TemplateObjectModelHelper.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/scratchpad/java/org/apache/cocoon/environment/TemplateObjectModelHelper.java?view=diff&r1=153806&r2=153807
==============================================================================
--- cocoon/trunk/src/blocks/scratchpad/java/org/apache/cocoon/environment/TemplateObjectModelHelper.java
(original)
+++ cocoon/trunk/src/blocks/scratchpad/java/org/apache/cocoon/environment/TemplateObjectModelHelper.java
Mon Feb 14 09:19:14 2005
@@ -22,8 +22,6 @@
 
 import org.apache.avalon.framework.parameters.Parameters;
 import org.apache.cocoon.components.flow.FlowHelper;
-import org.apache.commons.beanutils.MethodUtils;
-import org.apache.commons.beanutils.PropertyUtils;
 import org.apache.commons.jxpath.DynamicPropertyHandler;
 import org.apache.commons.jxpath.JXPathBeanInfo;
 import org.apache.commons.jxpath.JXPathIntrospector;
@@ -35,7 +33,7 @@
  * 
  * Work-in-progress, derived from JXTemplateGenerator
  * 
- * @version CVS $Id: TemplateObjectModelHelper.java,v 1.2 2004/04/02 08:06:46 cziegeler Exp
$
+ * @version CVS $Id$
  */
 public class TemplateObjectModelHelper {
 
@@ -98,12 +96,12 @@
         
         // cocoon.request
         final Request request = ObjectModelHelper.getRequest( objectModel );
-        cocoon.put("request", new DynamicMap(request));
+        cocoon.put("request", request);
         
         // cocoon.session
         final Session session = request.getSession(false);
         if (session != null) {
-            cocoon.put("session", new DynamicMap(session));
+            cocoon.put("session", session);
         }
         
         // cocoon.context
@@ -134,59 +132,4 @@
         return map;
     }
 
-    /**
-     * This is a dynamic map that should provide the same functionality as the
-     * FOM wrappers for objects.
-     */
-    public static class DynamicMap extends HashMap {
-        
-        protected final Object information;
-        
-        public DynamicMap(Object info) {
-            this.information = info;
-        }
-        
-        /* (non-Javadoc)
-         * @see java.util.Map#get(java.lang.Object)
-         */
-        public Object get(Object key) {
-            Object result = super.get(key);
-            if ( result == null ) {
-                result = this.getDynamicInfo(key);
-            }
-            return result;
-        }
-        
-        
-        /* (non-Javadoc)
-         * @see java.util.Map#containsKey(java.lang.Object)
-         */
-        public boolean containsKey(Object key) {
-            boolean result = super.containsKey(key);
-            if ( result == false ) {
-                result = (this.getDynamicInfo(key) != null);
-            }
-            return result;
-        }
-        
-        protected Object getDynamicInfo(Object key) {
-            Object result = null;
-            try {
-                result = PropertyUtils.getProperty(this.information, key.toString());
-            } catch (Exception ignore) {                    
-            }
-            if ( result == null ) {
-                try {
-                    result = MethodUtils.invokeMethod(this.information, 
-                                                      "getAttribute", 
-                                                      key.toString());
-                } catch (Exception ignore) {                    
-                }                        
-            }
-            if ( result != null ) {
-                this.put(key, result);
-            }
-            return result;
-        }
-    }
 }



Mime
View raw message