cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r328046 - in /cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal: coplet/ profile/impl/ util/
Date Mon, 24 Oct 2005 12:12:36 GMT
Author: cziegeler
Date: Mon Oct 24 05:12:27 2005
New Revision: 328046

URL: http://svn.apache.org/viewcvs?rev=328046&view=rev
Log:
Clean up Castor handling

Removed:
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/util/CopletBaseDataFieldHandler.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/util/CopletDataFieldHandler.java
Modified:
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletBaseData.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletData.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/copletbasedata.xml
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/copletdata.xml
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/impl/CopletBaseDataManager.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/impl/CopletDataManager.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/impl/GroupBasedProfileManager.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/impl/StaticProfileManager.java

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletBaseData.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletBaseData.java?rev=328046&r1=328045&r2=328046&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletBaseData.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletBaseData.java Mon
Oct 24 05:12:27 2005
@@ -30,20 +30,22 @@
 
 	private Map copletConfig = new HashMap();
 
-	private String id;
+	private final String id;
 
 	private String copletAdapterName;
 
 	public CopletBaseData() {
-        // Nothing to do
-	}
+        // this constructor is just to keep Castor happy (version 0.9.9)
+        // we can remove it in later versions
+        this.id = null;
+    }
+
+    public CopletBaseData(String id) {
+        this.id = id;
+    }
 
 	public String getId() {
 		return id;
-	}
-
-	public void setId(String name) {
-		this.id = name;
 	}
 
 	public String getCopletAdapterName() {

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletData.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletData.java?rev=328046&r1=328045&r2=328046&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletData.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletData.java Mon Oct
24 05:12:27 2005
@@ -34,7 +34,7 @@
 public class CopletData {
 
     /** The unique identifier. */
-    protected String id;
+    protected final String id;
 
     protected String title;
 
@@ -50,7 +50,13 @@
      * Constructor
      */
     public CopletData() {
-        // Nothing to do
+        // this constructor is just to keep Castor happy (version 0.9.9)
+        // we can remove it in later versions
+        this.id = null;
+    }
+
+    public CopletData(String id) {
+        this.id = id;
     }
 
     /**

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/copletbasedata.xml
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/copletbasedata.xml?rev=328046&r1=328045&r2=328046&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/copletbasedata.xml (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/copletbasedata.xml Mon
Oct 24 05:12:27 2005
@@ -14,42 +14,44 @@
   See the License for the specific language governing permissions and
   limitations under the License.
 -->
-<!-- SVN $Id:$ -->
+<!-- SVN $Id$ -->
 <mapping>
-	<description>Coplet base data mapping file</description>
+  <description>Coplet base data mapping file</description>
 
-	<class name="org.apache.cocoon.portal.profile.impl.CopletBaseDataManager">
-		<map-to xml="coplets" />
+  <class name="org.apache.cocoon.portal.profile.impl.CopletBaseDataManager">
+    <map-to xml="coplets" />
 
-		<field name="copletBaseData" type="org.apache.cocoon.portal.coplet.CopletBaseData" collection="vector"
handler="org.apache.cocoon.portal.util.CopletBaseDataFieldHandler">
-			<bind-xml auto-naming="deriveByClass" />
-		</field>
-	</class>
-
-	<class name="org.apache.cocoon.portal.coplet.CopletBaseData">
-		<map-to xml="coplet-base-data" />
-
-		<field name="id" type="java.lang.String">
-			<bind-xml name="id" node="attribute" />
-		</field>
-
-		<field name="copletAdapterName" type="java.lang.String">
-			<bind-xml name="coplet-adapter" />
-		</field>
-
-		<field name="copletConfig" type="org.exolab.castor.mapping.MapItem" collection="map"
handler="org.apache.cocoon.portal.util.ConfigurationFieldHandler">
-			<bind-xml name="configuration"/>
-		</field>
-	</class>
-   
-	<class name="org.exolab.castor.mapping.MapItem">
-		<field name="key" type="java.lang.String">
-			<bind-xml name="name"/>
-		</field>
-
-		<field name="value">
-			<bind-xml name="value"/>
-		</field>
-	</class>
+    <field name="copletBaseData"
+           type="org.apache.cocoon.portal.coplet.CopletBaseData"
+           collection="collection">
+      <bind-xml auto-naming="deriveByClass" />
+    </field>
+  </class>
+
+  <class name="org.apache.cocoon.portal.coplet.CopletBaseData">
+    <map-to xml="coplet-base-data" />
+
+    <field name="id" type="java.lang.String" set-method="%1" get-method="getId">
+      <bind-xml name="id" node="attribute" />
+    </field>
+
+    <field name="copletAdapterName" type="java.lang.String">
+      <bind-xml name="coplet-adapter" />
+    </field>
+
+    <field name="copletConfig" type="org.exolab.castor.mapping.MapItem" collection="map"
handler="org.apache.cocoon.portal.util.ConfigurationFieldHandler">
+      <bind-xml name="configuration"/>
+    </field>
+  </class>
+
+  <class name="org.exolab.castor.mapping.MapItem">
+    <field name="key" type="java.lang.String">
+      <bind-xml name="name"/>
+    </field>
+
+    <field name="value">
+      <bind-xml name="value"/>
+    </field>
+  </class>
 </mapping>
 

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/copletdata.xml
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/copletdata.xml?rev=328046&r1=328045&r2=328046&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/copletdata.xml (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/copletdata.xml Mon Oct
24 05:12:27 2005
@@ -16,48 +16,48 @@
 -->
 <!-- SVN $Id$ -->
 <mapping>
-	<description>Coplet data mapping file</description>
+  <description>Coplet data mapping file</description>
 
-	<class name="org.apache.cocoon.portal.profile.impl.CopletDataManager">
-		<map-to xml="coplets" />
+  <class name="org.apache.cocoon.portal.profile.impl.CopletDataManager">
+    <map-to xml="coplets" />
 
-		<field name="copletData" type="org.apache.cocoon.portal.coplet.CopletData"
-               collection="vector"
-               handler="org.apache.cocoon.portal.util.CopletDataFieldHandler">
-			<bind-xml auto-naming="deriveByClass"/>
-		</field>
-	</class>
-
-	<class name="org.apache.cocoon.portal.coplet.CopletData">
-		<map-to xml="coplet-data" />
-
-        <field name="id" type="java.lang.String" >
-            <bind-xml name="id" node="attribute"/>
-        </field>
-
-		<field name="title" type="java.lang.String">
-			<bind-xml name="title"/>
-		</field>
-
-		<field name="allowedRoles" type="java.lang.String">
-			<bind-xml name="roles"/>
-		</field>
-
-		<field name="attributes" type="org.exolab.castor.mapping.MapItem" collection="map" handler="org.apache.cocoon.portal.util.AttributesFieldHandler">
-			<bind-xml name="attribute"/>
-		</field>
-
-		<field name="copletBaseData" type="java.lang.String" handler="org.apache.cocoon.portal.util.CopletBaseDataReferenceFieldHandler"/>
-	</class>
+    <field name="copletData" type="org.apache.cocoon.portal.coplet.CopletData"
+           collection="collection">
+      <bind-xml auto-naming="deriveByClass"/>
+    </field>
+  </class>
+
+  <class name="org.apache.cocoon.portal.coplet.CopletData">
+    <map-to xml="coplet-data" />
+    
+    <field name="id" type="java.lang.String" set-method="%1" get-method="getId">
+      <bind-xml name="id" node="attribute" />
+    </field>
+    
+    <field name="title" type="java.lang.String">
+      <bind-xml name="title"/>
+    </field>
+
+    <field name="allowedRoles" type="java.lang.String">
+      <bind-xml name="roles"/>
+    </field>
+
+    <field name="attributes" type="org.exolab.castor.mapping.MapItem" collection="map"
handler="org.apache.cocoon.portal.util.AttributesFieldHandler">
+      <bind-xml name="attribute"/>
+    </field>
+
+    <field name="copletBaseData" type="java.lang.String"
+           handler="org.apache.cocoon.portal.util.CopletBaseDataReferenceFieldHandler"/>
+  </class>
    
-	<class name="org.exolab.castor.mapping.MapItem">
-		<field name="key" type="java.lang.String">
-			<bind-xml name="name"/>
-		</field>
-
-		<field name="value">
-			<bind-xml name="value"/>
-		</field>
-	</class>
+  <class name="org.exolab.castor.mapping.MapItem">
+    <field name="key" type="java.lang.String">
+      <bind-xml name="name"/>
+    </field>
+
+    <field name="value">
+      <bind-xml name="value"/>
+    </field>
+  </class>
 </mapping>
 

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/impl/CopletBaseDataManager.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/impl/CopletBaseDataManager.java?rev=328046&r1=328045&r2=328046&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/impl/CopletBaseDataManager.java
(original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/impl/CopletBaseDataManager.java
Mon Oct 24 05:12:27 2005
@@ -15,10 +15,8 @@
  */
 package org.apache.cocoon.portal.profile.impl;
 
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.cocoon.portal.coplet.CopletBaseData;
+import java.util.ArrayList;
+import java.util.Collection;
 
 /**
  * Holds instances of CopletBaseData.
@@ -30,26 +28,12 @@
 	/**
 	 * The coplet base data instances.
 	 */
-	private Map copletBaseData = new HashMap();
+	private Collection copletBaseData = new ArrayList();
 
 	/**
 	 * Gets all coplet base data.
 	 */
-	public Map getCopletBaseData() {
+	public Collection getCopletBaseData() {
 		return this.copletBaseData;
-	}
-
-	/**
-	 * Gets the specified coplet base data. 
-	 */
-	public CopletBaseData getCopletBaseData(String name) {
-		return (CopletBaseData)this.copletBaseData.get(name);
-	}
-
-	/**
-	 * Puts the specified coplet base data to the manager.
-	 */
-	public void putCopletBaseData(CopletBaseData data) {
-		this.copletBaseData.put(data.getId(), data);
 	}
 }

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/impl/CopletDataManager.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/impl/CopletDataManager.java?rev=328046&r1=328045&r2=328046&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/impl/CopletDataManager.java
(original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/impl/CopletDataManager.java
Mon Oct 24 05:12:27 2005
@@ -15,10 +15,8 @@
  */
 package org.apache.cocoon.portal.profile.impl;
 
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.cocoon.portal.coplet.CopletData;
+import java.util.ArrayList;
+import java.util.Collection;
 
 /**
  * Holds instances of CopletData.
@@ -30,26 +28,12 @@
 	/**
 	 * The coplet data instances.
 	 */
-	private Map copletData = new HashMap();
+	private Collection copletData = new ArrayList();
 
 	/**
 	 * Gets all coplet data.
 	 */
-	public Map getCopletData() {
+	public Collection getCopletData() {
 		return this.copletData;
-	}
-
-	/**
-	 * Gets the specified coplet data. 
-	 */
-	public CopletData getCopletData(String name) {
-		return (CopletData)this.copletData.get(name);
-	}
-
-	/**
-	 * Puts the specified coplet data to the manager.
-	 */
-	public void putCopletData(CopletData data) {
-		this.copletData.put(data.getId(), data);
 	}
 }

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/impl/GroupBasedProfileManager.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/impl/GroupBasedProfileManager.java?rev=328046&r1=328045&r2=328046&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/impl/GroupBasedProfileManager.java
(original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/impl/GroupBasedProfileManager.java
Mon Oct 24 05:12:27 2005
@@ -33,6 +33,7 @@
 import org.apache.avalon.framework.service.ServiceException;
 import org.apache.avalon.framework.service.ServiceSelector;
 import org.apache.cocoon.ProcessingException;
+import org.apache.cocoon.portal.coplet.CopletBaseData;
 import org.apache.cocoon.portal.coplet.CopletData;
 import org.apache.cocoon.portal.coplet.CopletInstanceData;
 import org.apache.cocoon.portal.coplet.adapter.CopletAdapter;
@@ -419,7 +420,13 @@
 
         // we have to load/reload
         synchronized ( this ) {
-            this.copletBaseDatas.objects = ((CopletBaseDataManager)loader.loadProfile(key,
MAP_FOR_BASE_DATA)).getCopletBaseData();
+            final Map objects = new HashMap();
+            final Iterator i = ((CopletBaseDataManager)loader.loadProfile(key, MAP_FOR_BASE_DATA)).getCopletBaseData().iterator();
+            while ( i.hasNext() ) {
+                final CopletBaseData current = (CopletBaseData)i.next();
+                objects.put(current.getId(), current);
+            }
+            this.copletBaseDatas.objects = objects;
             if ( newValidity == null ) {
                 newValidity = loader.getValidity(key, MAP_FOR_BASE_DATA);
             }
@@ -470,7 +477,13 @@
         }
 
         synchronized ( this ) {
-            this.copletDatas.objects = ((CopletDataManager)loader.loadProfile(key, parameters)).getCopletData();
+            final Map objects = new HashMap();
+            final Iterator i = ((CopletDataManager)loader.loadProfile(key, parameters)).getCopletData().iterator();
+            while ( i.hasNext() ) {
+                final CopletData current = (CopletData)i.next();
+                objects.put(current.getId(), current);
+            }
+            this.copletDatas.objects = objects;
             if ( newValidity == null ) {
                 newValidity = loader.getValidity(key, parameters);
             }

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/impl/StaticProfileManager.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/impl/StaticProfileManager.java?rev=328046&r1=328045&r2=328046&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/impl/StaticProfileManager.java
(original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/impl/StaticProfileManager.java
Mon Oct 24 05:12:27 2005
@@ -284,7 +284,7 @@
      */
     public Collection getCopletDatas() {
         try {
-            return this.getCopletDataManager().getCopletData().values();
+            return this.getCopletDataManager().getCopletData();
         } catch (Exception e) {
             throw new ProfileException("Error in getCopletDatas.", e);
         }



Mime
View raw message