cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r327805 - in /cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal: components/modules/input/ coplet/adapter/impl/ event/impl/ factory/ layout/ layout/renderer/aspect/impl/ layout/renderer/impl/
Date Sun, 23 Oct 2005 16:12:00 GMT
Author: cziegeler
Date: Sun Oct 23 09:10:43 2005
New Revision: 327805

URL: http://svn.apache.org/viewcvs?rev=327805&view=rev
Log:
Start cleaning up class hierarchy

Removed:
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/Parameters.java
Modified:
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/components/modules/input/SkinModule.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/adapter/impl/ApplicationCopletAdapter.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/impl/InternalEventReceiver.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/factory/Producible.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/AbstractLayout.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/AbstractParameters.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/Layout.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/LayoutDescription.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/layout.xml
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/FrameAspect.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/TabContentAspect.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/renderer/impl/DefaultLinkRenderer.java

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/components/modules/input/SkinModule.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/components/modules/input/SkinModule.java?rev=327805&r1=327804&r2=327805&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/components/modules/input/SkinModule.java
(original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/components/modules/input/SkinModule.java
Sun Oct 23 09:10:43 2005
@@ -85,7 +85,7 @@
             // fallback is: common
             final Layout rootLayout = portalService.getComponentManager().getProfileManager().getPortalLayout(null,
null);
             if ( rootLayout != null ) {
-                skinName = (String)rootLayout.getParameters().get("skin");
+                skinName = rootLayout.getParameter("skin");
             }
             // use the global module
             if ( skinName == null ) {

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/adapter/impl/ApplicationCopletAdapter.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/adapter/impl/ApplicationCopletAdapter.java?rev=327805&r1=327804&r2=327805&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/adapter/impl/ApplicationCopletAdapter.java
(original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/adapter/impl/ApplicationCopletAdapter.java
Sun Oct 23 09:10:43 2005
@@ -182,7 +182,7 @@
      * @return String the name of the new item
      */
     private String getNewInstanceTabName(CompositeLayout layout) {
-        Integer data = Integer.valueOf((String)layout.getParameters().get("tab"));
+        Integer data = Integer.valueOf(layout.getParameter("tab"));
         Item selectedItem = (NamedItem) layout.getItem(data.intValue());
 
         if (selectedItem instanceof NamedItem) {

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/impl/InternalEventReceiver.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/impl/InternalEventReceiver.java?rev=327805&r1=327804&r2=327805&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/impl/InternalEventReceiver.java
(original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/impl/InternalEventReceiver.java
Sun Oct 23 09:10:43 2005
@@ -111,6 +111,6 @@
      */
     public void inform(LayoutChangeParameterEvent e, PortalService service) {
         final Layout l = (Layout)e.getTarget();
-        l.getParameters().put(e.getParameterName(), e.getValue());
+        l.setParameter(e.getParameterName(), e.getValue());
     }
 }

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/factory/Producible.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/factory/Producible.java?rev=327805&r1=327804&r2=327805&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/factory/Producible.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/factory/Producible.java Sun Oct
23 09:10:43 2005
@@ -23,24 +23,24 @@
 public interface Producible {
 
     /**
-     * The name given from the factory
+     * The name given from the factory.
      */
     String getName();
 
     /**
-     * Get the unique id of this object
+     * Get the unique id of this object.
      * @return String Unique id
      */
     String getId();
 
     /**
-     * Set the layout description
+     * Set the layout description.
      */
     void setDescription(ProducibleDescription description);
 
     /**
      * Initialize the object. This should only be called once directly
-     * after the creation
+     * after the creation.
      */
     void initialize(String name, String id);
 }

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/AbstractLayout.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/AbstractLayout.java?rev=327805&r1=327804&r2=327805&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/AbstractLayout.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/AbstractLayout.java Sun
Oct 23 09:10:43 2005
@@ -15,15 +15,7 @@
  */
 package org.apache.cocoon.portal.layout;
 
-import java.util.Map;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.Iterator;
-
-import org.apache.cocoon.portal.factory.impl.AbstractProducible;
-import org.apache.cocoon.portal.pluto.om.common.ParameterImpl;
 import org.apache.commons.collections.map.LinkedMap;
-import org.apache.pluto.om.common.Parameter;
 
 /**
  * FIXME - We have to remove the dependency to pluto
@@ -31,38 +23,62 @@
  * @version $Id$
  */
 public abstract class AbstractLayout
-    extends AbstractProducible 
-    implements Layout, Parameters {
+    extends AbstractParameters
+    implements Layout {
 
     protected String rendererName;
 
     protected Item parent;
 
-    protected Map parameters = new LinkedMap();
+    protected String name;
+
+    protected String id;
+
+    transient protected LayoutDescription description;
 
     /**
-     * @see org.apache.cocoon.portal.layout.Parameters#getParameters()
+     * @return The configured name
      */
-    public final Map getParameters() {
-        return parameters;
+    public String getName() {
+        return name;
     }
 
-    public final Set getCastorParameters() {
-        Set set = new HashSet(this.parameters.size());
-        Iterator iterator = this.parameters.entrySet().iterator();
-        Map.Entry entry;
-        while (iterator.hasNext()) {
-            entry = (Map.Entry) iterator.next();
-            ParameterImpl param = new ParameterImpl();
-            param.setName((String) entry.getKey());
-            param.setValue((String) entry.getValue());
-            set.add(param);
-        }
-        return set;
+    /**
+     * @param string
+     */
+    public void setName(String string) {
+        name = string;
+    }
+
+    /**
+     * Set the layout description
+     */
+    public void setDescription(LayoutDescription description) {
+        this.description = description;
     }
 
-    public void addParameter(Parameter parameter) {
-        parameters.put(parameter.getName(), parameter.getValue());
+    /**
+     * Get the unique id of this object
+     * @return String Unique id
+     */
+    public String getId() {
+        return this.id;
+    }
+
+    /**
+     * Set the unique id of this object
+     */
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    /**
+     * Initialize the object. This should only be called once directly
+     * after the creation
+     */
+    public void initialize(String name, String id) {
+        this.name = name;
+        this.id = id;
     }
 
     /**
@@ -70,7 +86,7 @@
      */
     public String getRendererName() {
         if ( this.rendererName == null ) {
-            return ((LayoutDescription)this.description).getDefaultRendererName();
+            return this.description.getDefaultRendererName();
         }
         return this.rendererName;
     }
@@ -101,6 +117,9 @@
         AbstractLayout clone = (AbstractLayout)super.clone();
 
         // we don't clone the parent; we just set it to null
+        clone.name = this.name;
+        clone.id = this.id;
+        clone.description = this.description;
         clone.rendererName = this.rendererName;
         clone.parameters = new LinkedMap(this.parameters);
         clone.parent = null;

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/AbstractParameters.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/AbstractParameters.java?rev=327805&r1=327804&r2=327805&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/AbstractParameters.java
(original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/AbstractParameters.java
Sun Oct 23 09:10:43 2005
@@ -29,7 +29,7 @@
  * @version $Id$
  */
 public abstract class AbstractParameters 
-    implements Parameters, Cloneable {
+    implements Cloneable {
 
     protected Map parameters = new LinkedMap();
 
@@ -56,6 +56,24 @@
 
     public void addParameter(Parameter parameter) {
         parameters.put(parameter.getName(), parameter.getValue());
+    }
+
+    /**
+     * Return the parameter value for the given key.
+     * @param key The name of the parameter.
+     * @return The value of the parameter or null.
+     */
+    public String getParameter(String key) {
+        return (String)this.parameters.get(key);
+    }
+
+    /**
+     * Set the parameter to a value.
+     * @param key The name of the parameter.
+     * @param value The value.
+     */
+    public void setParameter(String key, String value) {
+        this.parameters.put(key, value);
     }
 
     /**

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/Layout.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/Layout.java?rev=327805&r1=327804&r2=327805&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/Layout.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/Layout.java Sun Oct 23
09:10:43 2005
@@ -15,14 +15,59 @@
  */
 package org.apache.cocoon.portal.layout;
 
-import org.apache.cocoon.portal.factory.Producible;
+import java.util.Map;
 
 /**
+ * 
+ * Parameters:
+ * A parameter is a key-value pair consisting of strings for both key and value.
  *
  * @version $Id$
  */
-public interface Layout 
-    extends Parameters, Producible {
+public interface Layout {
+
+    /**
+     * The name given from the factory.
+     */
+    String getName();
+
+    /**
+     * Get the unique id of this object.
+     * @return Unique id of the layout or null if this object does not provide a unique id.
+     */
+    String getId();
+
+    /**
+     * Set the layout description.
+     */
+    void setDescription(LayoutDescription description);
+
+    /**
+     * Initialize the object. This should only be called once directly
+     * after the creation.
+     */
+    void initialize(String name, String id);
+
+    /**
+     * Get parameters map.
+     * This method never returns null.
+     * @return A map with key value pairs.
+     */
+    Map getParameters();
+
+    /**
+     * Return the parameter value for the given key.
+     * @param key The name of the parameter.
+     * @return The value of the parameter or null.
+     */
+    String getParameter(String key);
+
+    /**
+     * Set the parameter to a value.
+     * @param key The name of the parameter.
+     * @param value The value.
+     */
+    void setParameter(String key, String value);
 
     /**
      * Get the name of the {@link org.apache.cocoon.portal.layout.renderer.Renderer} to draw
this layout.

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/LayoutDescription.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/LayoutDescription.java?rev=327805&r1=327804&r2=327805&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/LayoutDescription.java
(original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/LayoutDescription.java
Sun Oct 23 09:10:43 2005
@@ -17,15 +17,28 @@
 
 import java.util.Iterator;
 
-import org.apache.cocoon.portal.factory.ProducibleDescription;
 
 /**
  * A configured layout
  *
  * @version $Id$
  */
-public interface LayoutDescription
-    extends ProducibleDescription {
+public interface LayoutDescription {
+
+    /**
+     * @return The class name
+     */
+    String getClassName();
+
+    /**
+     * @return The configured name
+     */
+    String getName();
+
+    /**
+     * Create a unique id for objects of this type
+     */
+    boolean createId();
 
     /**
      * @return the default renderer name

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/layout.xml
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/layout.xml?rev=327805&r1=327804&r2=327805&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/layout.xml (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/layout.xml Sun Oct 23
09:10:43 2005
@@ -18,15 +18,6 @@
 <mapping>
   <description>Portalprofile mapping file</description>
 
-  <class name="org.apache.cocoon.portal.factory.impl.AbstractProducible">
-    <field name="name" type="java.lang.String">
-      <bind-xml name="name" node="attribute"/>
-    </field>
-    <field name="id" type="java.lang.String">
-      <bind-xml name="id" node="attribute"/>
-    </field>
-  </class>
-
   <class name="org.apache.cocoon.portal.layout.AbstractParameters">
     <field name="parameters" type="org.apache.cocoon.portal.pluto.om.common.ParameterImpl"
collection="set"
       get-method="getCastorParameters" set-method="addParameter">
@@ -35,7 +26,13 @@
   </class>
 
   <class name="org.apache.cocoon.portal.layout.AbstractLayout"
-    extends="org.apache.cocoon.portal.factory.impl.AbstractProducible">
+    extends="org.apache.cocoon.portal.layout.AbstractParameters">
+    <field name="name" type="java.lang.String">
+      <bind-xml name="name" node="attribute"/>
+    </field>
+    <field name="id" type="java.lang.String">
+      <bind-xml name="id" node="attribute"/>
+    </field>
     <field name="layoutRendererName" type="java.lang.String">
       <bind-xml name="layout-renderer-name" node="attribute"/>
     </field>

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/FrameAspect.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/FrameAspect.java?rev=327805&r1=327804&r2=327805&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/FrameAspect.java
(original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/FrameAspect.java
Sun Oct 23 09:10:43 2005
@@ -58,7 +58,7 @@
             throw new SAXException("Wrong layout type, FrameLayout expected: " + layout.getClass().getName());
         }
 
-        String source = (String)layout.getParameters().get(config.aspectName);
+        String source = layout.getParameter(config.aspectName);
         if (source == null) {
             source = ((FrameLayout) layout).getSource();
         }

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/TabContentAspect.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/TabContentAspect.java?rev=327805&r1=327804&r2=327805&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/TabContentAspect.java
(original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/TabContentAspect.java
Sun Oct 23 09:10:43 2005
@@ -126,7 +126,7 @@
             CompositeLayout tabLayout = (CompositeLayout) layout;
 
             // selected tab
-            String data = (String)layout.getParameters().get(config.aspectName);
+            String data = layout.getParameter(config.aspectName);
             int selected = 0;
             if ( data != null ) {
                 selected = Integer.valueOf(data).intValue();

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/renderer/impl/DefaultLinkRenderer.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/renderer/impl/DefaultLinkRenderer.java?rev=327805&r1=327804&r2=327805&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/renderer/impl/DefaultLinkRenderer.java
(original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/renderer/impl/DefaultLinkRenderer.java
Sun Oct 23 09:10:43 2005
@@ -36,8 +36,8 @@
     public void process(Layout layout, PortalService service, ContentHandler handler)
     throws SAXException {
         if (layout instanceof LinkLayout) {
-            String layoutKey = (String)layout.getParameters().get("link-layout-key");
-			String layoutId = (String)layout.getParameters().get("link-layout-id");
+            String layoutKey = layout.getParameter("link-layout-key");
+			String layoutId = layout.getParameter("link-layout-id");
             if ( layoutKey == null && layoutId == null){
 				// get default values
 				layoutKey = ((LinkLayout)layout).getLayoutKey();



Mime
View raw message