cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: rev 37339 - in cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal: coplet layout layout/impl profile/impl
Date Wed, 01 Sep 2004 14:25:32 GMT
Author: cziegeler
Date: Wed Sep  1 07:25:30 2004
New Revision: 37339

Modified:
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplet/CopletInstanceData.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/layout/AbstractLayout.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/layout/Item.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/layout/Layout.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/layout/impl/CompositeLayoutImpl.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/layout/impl/CopletLayout.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/GroupBasedProfileManager.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/MapProfileLS.java
Log:
Add copy of layouts and coplets

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplet/CopletInstanceData.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplet/CopletInstanceData.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplet/CopletInstanceData.java
Wed Sep  1 07:25:30 2004
@@ -106,4 +106,13 @@
         return clone;
     }
     
+    public CopletInstanceData copy() {
+        try {
+            return (CopletInstanceData)this.clone();
+        } catch (CloneNotSupportedException cnse) {
+            // ignore
+            return null;
+        }
+    }
+    
 }

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/layout/AbstractLayout.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/layout/AbstractLayout.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/layout/AbstractLayout.java
Wed Sep  1 07:25:30 2004
@@ -89,9 +89,9 @@
     }
     
     /* (non-Javadoc)
-     * @see org.apache.cocoon.portal.layout.Layout#copy(java.util.Map)
+     * @see org.apache.cocoon.portal.layout.Layout#copy()
      */
-    public Layout copy(Map copletInstanceDatas) {
+    public Layout copy() {
         try {
             return (Layout)this.clone();
         } catch (CloneNotSupportedException cnse) {

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/layout/Item.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/layout/Item.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/layout/Item.java
Wed Sep  1 07:25:30 2004
@@ -15,8 +15,6 @@
  */
 package org.apache.cocoon.portal.layout;
 
-import java.util.Map;
-
 
 /**
  *
@@ -68,11 +66,11 @@
         return clone;
     }
     
-    public Item copy(CompositeLayout parent, Map copletInstanceDatas) {
+    public Item copy(CompositeLayout parent) {
         try {
             Item clone = (Item)this.clone();
             if ( this.layout != null ) {
-                clone.layout = this.layout.copy(copletInstanceDatas);
+                clone.layout = this.layout.copy();
             }
             clone.parentLayout = parent;
             return clone;

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/layout/Layout.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/layout/Layout.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/layout/Layout.java
Wed Sep  1 07:25:30 2004
@@ -15,8 +15,6 @@
  */
 package org.apache.cocoon.portal.layout;
 
-import java.util.Map;
-
 import org.apache.cocoon.portal.factory.Producible;
 
 
@@ -49,11 +47,9 @@
     void setParent(Item item);
 
     /**
-     * Make a copy of this layout object and of all it's children.,
-     * Each reference to a coplet instance data is replaced to
-     * an instance from the provided map. (If the map is null,
-     * the reference is copied).
+     * Make a copy of this layout object and of all it's children.
+     * This includes copies of items and copletinstancedatas.
      */
-    Layout copy(Map copletInstanceDatas);
+    Layout copy();
 
 }

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/layout/impl/CompositeLayoutImpl.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/layout/impl/CompositeLayoutImpl.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/layout/impl/CompositeLayoutImpl.java
Wed Sep  1 07:25:30 2004
@@ -18,7 +18,6 @@
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
-import java.util.Map;
 
 import org.apache.cocoon.portal.layout.AbstractLayout;
 import org.apache.cocoon.portal.layout.CompositeLayout;
@@ -117,12 +116,12 @@
     /* (non-Javadoc)
      * @see org.apache.cocoon.portal.layout.Layout#copy(java.util.Map)
      */
-    public Layout copy(Map copletInstanceDatas) {
-        CompositeLayoutImpl clone = (CompositeLayoutImpl)super.copy(copletInstanceDatas);
+    public Layout copy() {
+        CompositeLayoutImpl clone = (CompositeLayoutImpl)super.copy();
         final Iterator i = this.items.iterator();
         while ( i.hasNext() ) {
             final Item current = (Item)i.next();
-            final Item clonedItem = current.copy(clone, copletInstanceDatas);
+            final Item clonedItem = current.copy(clone);
             clone.addItem(clonedItem);
         }
         return clone;

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/layout/impl/CopletLayout.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/layout/impl/CopletLayout.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/layout/impl/CopletLayout.java
Wed Sep  1 07:25:30 2004
@@ -54,15 +54,15 @@
     }
     
     /* (non-Javadoc)
-     * @see org.apache.cocoon.portal.layout.Layout#copy(java.util.Map)
+     * @see org.apache.cocoon.portal.layout.Layout#copy()
      */
     public Layout copy(Map copletInstanceDatas) {
-        CopletLayout clone = (CopletLayout)super.copy(copletInstanceDatas);
+        CopletLayout clone = (CopletLayout)super.copy();
         if (copletInstanceDatas == null) {
             clone.copletInstanceData = this.copletInstanceData;
         } else {
             if ( this.copletInstanceData != null ) {
-                clone.copletInstanceData = (CopletInstanceData)copletInstanceDatas.get(this.copletInstanceData.getId());
+                clone.copletInstanceData = this.copletInstanceData.copy();
             }
             
         }

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/GroupBasedProfileManager.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/GroupBasedProfileManager.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/GroupBasedProfileManager.java
Wed Sep  1 07:25:30 2004
@@ -115,6 +115,9 @@
     protected void prepareObject(Object object, PortalService service)
     throws ProcessingException {
         if ( object != null ) {
+            if ( object instanceof Map ) {
+                object = ((Map)object).values();
+            }
             if (object instanceof Layout) {
                 service.getComponentManager().getLayoutFactory().prepareLayout((Layout)object);
             } else if (object instanceof Collection) {
@@ -343,7 +346,7 @@
             final Map configs = new HashMap();
             if ( children != null ) {
                 for(int i=0; i < children.length; i++) {
-                    configs.put(children[i].getName(), children[i].getValue());
+                    configs.put(children[i].getName(), children[i].getAttribute("uri"));
                 }
             }
             info.setConfigurations(configs);
@@ -411,7 +414,7 @@
                     parameters.put(ProfileLS.PARAMETER_PROFILETYPE, 
                                    ProfileLS.PROFILETYPE_COPLETBASEDATA);        
 
-                    this.copletBaseDatas = ((CopletBaseDataManager)(Map)loader.loadProfile(key,
parameters)).getCopletBaseData();
+                    this.copletBaseDatas = ((CopletBaseDataManager)loader.loadProfile(key,
parameters)).getCopletBaseData();
                     this.prepareObject(this.copletBaseDatas, service);
                 }
             }
@@ -436,7 +439,7 @@
                     parameters.put(ProfileLS.PARAMETER_OBJECTMAP, 
                                    this.copletBaseDatas);
                     
-                    this.copletDatas = ((CopletDataManager)(Map)loader.loadProfile(key, parameters)).getCopletData();
                   
+                    this.copletDatas = ((CopletDataManager)loader.loadProfile(key, parameters)).getCopletData();
                   
                     this.prepareObject(this.copletDatas, service);
                 }
     }

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/MapProfileLS.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/MapProfileLS.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/MapProfileLS.java
Wed Sep  1 07:25:30 2004
@@ -85,6 +85,7 @@
         boolean first = true;
         while ( iter.hasNext() ) {
             final Map.Entry entry = (Entry) iter.next();
+            final String append = entry.getValue().toString();
             if ( pars ) {
                 if ( first ) {
                     first = false;
@@ -99,12 +100,11 @@
                 buffer.append(entry.getKey().toString());
                 buffer.append('=');
             } else {
-                if ( !first) {
+                if ( !first && !"?".equals(append) ) {
                     buffer.append('/');
                 }
                 first = false;
             }
-            String append = entry.getValue().toString();
             if ( "?".equals(append) ) {
                 first = true;
                 pars = true;

Mime
View raw message