portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rwat...@apache.org
Subject svn commit: r330134 [1/2] - in /portals/jetspeed-2/trunk: components/page-manager/src/java/JETSPEED-INF/castor/ components/page-manager/src/java/JETSPEED-INF/ojb/ components/page-manager/src/java/org/apache/jetspeed/om/folder/impl/ components/page-mana...
Date Tue, 01 Nov 2005 22:13:39 GMT
Author: rwatler
Date: Tue Nov  1 14:13:18 2005
New Revision: 330134

URL: http://svn.apache.org/viewcvs?rev=330134&view=rev
Log:
- simplify Fragment properties API and deprecate layout name in properties
- snapshot progress with DB PageManager implementation


Added:
    portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/document/impl/NodeAttributes.java   (with props)
Removed:
    portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/om/page/Property.java
Modified:
    portals/jetspeed-2/trunk/components/page-manager/src/java/JETSPEED-INF/castor/page-mapping.xml
    portals/jetspeed-2/trunk/components/page-manager/src/java/JETSPEED-INF/ojb/page-manager-repository.xml
    portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/folder/impl/FolderImpl.java
    portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/folder/psml/FolderImpl.java
    portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/ContentFragmentImpl.java
    portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/FragmentImpl.java
    portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/PageImpl.java
    portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/psml/FragmentImpl.java
    portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/psml/PageImpl.java
    portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/psml/PropertyImpl.java
    portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/AbstractPageManager.java
    portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/document/impl/NodeImpl.java
    portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/impl/DatabasePageManager.java
    portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/psml/CastorXmlPageManager.java
    portals/jetspeed-2/trunk/components/page-manager/src/test/database-page-manager.xml
    portals/jetspeed-2/trunk/components/page-manager/src/test/org/apache/jetspeed/page/TestCastorXmlPageManager.java
    portals/jetspeed-2/trunk/components/page-manager/src/test/org/apache/jetspeed/page/TestDatabasePageManager.java
    portals/jetspeed-2/trunk/components/portal-site/src/java/org/apache/jetspeed/om/folder/proxy/FolderProxy.java
    portals/jetspeed-2/trunk/components/portal-site/src/java/org/apache/jetspeed/portalsite/view/SiteView.java
    portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/aggregator/impl/PortletAggregatorFragmentImpl.java
    portals/jetspeed-2/trunk/etc/schema/phase2-schema.xml
    portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/om/folder/Folder.java
    portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/om/page/Fragment.java
    portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/page/PageManager.java
    portals/jetspeed-2/trunk/layout-portlets/src/java/org/apache/jetspeed/portlets/layout/ColumnLayout.java
    portals/jetspeed-2/trunk/layout-portlets/src/java/org/apache/jetspeed/portlets/layout/MultiColumnPortlet.java
    portals/jetspeed-2/trunk/layout-portlets/src/java/org/apache/jetspeed/portlets/layout/PageManagerLayoutEventListener.java

Modified: portals/jetspeed-2/trunk/components/page-manager/src/java/JETSPEED-INF/castor/page-mapping.xml
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/JETSPEED-INF/castor/page-mapping.xml?rev=330134&r1=330133&r2=330134&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/JETSPEED-INF/castor/page-mapping.xml (original)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/JETSPEED-INF/castor/page-mapping.xml Tue Nov  1 14:13:18 2005
@@ -109,7 +109,7 @@
       <bind-xml name="fragment"/>
     </field>
 
-    <field name="properties"
+    <field name="propertiesList"
            type="org.apache.jetspeed.om.page.psml.PropertyImpl" collection="vector">
       <bind-xml name="property"/>
     </field>

Modified: portals/jetspeed-2/trunk/components/page-manager/src/java/JETSPEED-INF/ojb/page-manager-repository.xml
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/JETSPEED-INF/ojb/page-manager-repository.xml?rev=330134&r1=330133&r2=330134&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/JETSPEED-INF/ojb/page-manager-repository.xml (original)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/JETSPEED-INF/ojb/page-manager-repository.xml Tue Nov  1 14:13:18 2005
@@ -53,7 +53,7 @@
           element-class-ref="org.apache.jetspeed.om.folder.impl.FolderImpl"
           auto-retrieve="true"
           auto-delete="object"
-          auto-update="link"
+          auto-update="object"
           proxy="true"
       >
          <inverse-foreignkey field-ref="parentId"/>
@@ -64,14 +64,14 @@
           element-class-ref="org.apache.jetspeed.om.page.impl.PageImpl"
           auto-retrieve="true"
           auto-delete="object"
-          auto-update="link"
+          auto-update="object"
           proxy="true"
       >
          <inverse-foreignkey field-ref="parentId"/>
       </collection-descriptor>
 
       <field-descriptor
-         name="path"
+         name="attributes::path"
          column="PATH"
          jdbc-type="VARCHAR"
       />
@@ -87,6 +87,54 @@
          column="TITLE"
          jdbc-type="VARCHAR"
       />
+
+      <field-descriptor
+         name="attributes::subsite"
+         column="SUBSITE"
+         jdbc-type="VARCHAR"
+      />
+
+      <field-descriptor
+         name="attributes::user"
+         column="USER_PRINCIPAL"
+         jdbc-type="VARCHAR"
+      />
+
+      <field-descriptor
+         name="attributes::role"
+         column="ROLE_PRINCIPAL"
+         jdbc-type="VARCHAR"
+      />
+
+      <field-descriptor
+         name="attributes::group"
+         column="GROUP_PRINCIPAL"
+         jdbc-type="VARCHAR"
+      />
+
+      <field-descriptor
+         name="attributes::mediatype"
+         column="MEDIATYPE"
+         jdbc-type="VARCHAR"
+      />
+
+      <field-descriptor
+         name="attributes::locale"
+         column="LOCALE"
+         jdbc-type="VARCHAR"
+      />
+
+      <field-descriptor
+         name="attributes::extendedAttributeName"
+         column="EXT_ATTR_NAME"
+         jdbc-type="VARCHAR"
+      />
+
+      <field-descriptor
+         name="attributes::extendedAttributeValue"
+         column="EXT_ATTR_VALUE"
+         jdbc-type="VARCHAR"
+      />
    </class-descriptor>
 
    <!-- Page mapping -->
@@ -133,7 +181,7 @@
       </collection-descriptor>
 
       <field-descriptor
-         name="path"
+         name="attributes::path"
          column="PATH"
          jdbc-type="VARCHAR"
       />
@@ -169,44 +217,50 @@
       />
 
       <field-descriptor
-         name="subsite"
+         name="attributes::subsite"
          column="SUBSITE"
          jdbc-type="VARCHAR"
       />
 
       <field-descriptor
-         name="principal"
-         column="PRINCIPAL"
+         name="attributes::user"
+         column="USER_PRINCIPAL"
+         jdbc-type="VARCHAR"
+      />
+
+      <field-descriptor
+         name="attributes::role"
+         column="ROLE_PRINCIPAL"
          jdbc-type="VARCHAR"
       />
 
       <field-descriptor
-         name="principalType"
-         column="PRINCIPAL_TYPE"
+         name="attributes::group"
+         column="GROUP_PRINCIPAL"
          jdbc-type="VARCHAR"
       />
 
       <field-descriptor
-         name="mediatype"
+         name="attributes::mediatype"
          column="MEDIATYPE"
          jdbc-type="VARCHAR"
       />
 
       <field-descriptor
-         name="locale"
+         name="attributes::locale"
          column="LOCALE"
          jdbc-type="VARCHAR"
       />
 
       <field-descriptor
-         name="extendedLocatorName"
-         column="EXT_LOCATOR_NAME"
+         name="attributes::extendedAttributeName"
+         column="EXT_ATTR_NAME"
          jdbc-type="VARCHAR"
       />
 
       <field-descriptor
-         name="extendedLocatorValue"
-         column="EXT_LOCATOR_VALUE"
+         name="attributes::extendedAttributeValue"
+         column="EXT_ATTR_VALUE"
          jdbc-type="VARCHAR"
       />
    </class-descriptor>
@@ -306,25 +360,25 @@
 
       <field-descriptor
          name="extendedPropertyName1"
-         column="EXT_PROPERTY_NAME_1"
+         column="EXT_PROP_NAME_1"
          jdbc-type="VARCHAR"
       />
 
       <field-descriptor
          name="extendedPropertyValue1"
-         column="EXT_PROPERTY_VALUE_1"
+         column="EXT_PROP_VALUE_1"
          jdbc-type="VARCHAR"
       />
 
       <field-descriptor
          name="extendedPropertyName2"
-         column="EXT_PROPERTY_NAME_2"
+         column="EXT_PROP_NAME_2"
          jdbc-type="VARCHAR"
       />
 
       <field-descriptor
          name="extendedPropertyValue2"
-         column="EXT_PROPERTY_VALUE_2"
+         column="EXT_PROP_VALUE_2"
          jdbc-type="VARCHAR"
       />
    </class-descriptor>

Modified: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/folder/impl/FolderImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/folder/impl/FolderImpl.java?rev=330134&r1=330133&r2=330134&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/folder/impl/FolderImpl.java (original)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/folder/impl/FolderImpl.java Tue Nov  1 14:13:18 2005
@@ -132,6 +132,15 @@
     }
 
     /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.folder.Folder#isRootFolder()
+     */
+    public boolean isRootFolder()
+    {
+        // test using Node implementation
+        return super.isRootNode();
+    }
+
+    /* (non-Javadoc)
      * @see org.apache.jetspeed.om.folder.Folder#getDefaultPage(boolean)
      */
     public String getDefaultPage(boolean allowDefaulting)

Modified: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/folder/psml/FolderImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/folder/psml/FolderImpl.java?rev=330134&r1=330133&r2=330134&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/folder/psml/FolderImpl.java (original)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/folder/psml/FolderImpl.java Tue Nov  1 14:13:18 2005
@@ -104,6 +104,16 @@
     /*
      * (non-Javadoc)
      * 
+     * @see org.apache.jetspeed.om.folder.Folder#isRootFolder()
+     */
+    public boolean isRootFolder()
+    {
+        return getPath().equals(PATH_SEPARATOR);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
      * @see org.apache.jetspeed.om.folder.Folder#getDefaultPage(boolean)
      */
     public String getDefaultPage(boolean allowDefaulting)
@@ -113,7 +123,7 @@
             String defaultPage = metadata.getDefaultPage();
             if(defaultPage == null)
             {
-                defaultPage = Folder.FALLBACK_DEFAULT_PAGE;
+                defaultPage = FALLBACK_DEFAULT_PAGE;
             }
             return getPage(defaultPage, false).getName();
         }
@@ -130,12 +140,12 @@
                     }
                     else
                     {
-                        return Folder.PAGE_NOT_FOUND_PAGE;
+                        return PAGE_NOT_FOUND_PAGE;
                     }
                 }
                 catch (NodeException e1)
                 {
-                    return Folder.PAGE_NOT_FOUND_PAGE;
+                    return PAGE_NOT_FOUND_PAGE;
                 }
             }
         }
@@ -185,7 +195,7 @@
     public NodeSet getFolders(boolean checkAccess) throws FolderNotFoundException, DocumentException
     {
         // get list of all folders
-        NodeSet folders = getAllNodes().subset(Folder.FOLDER_TYPE);
+        NodeSet folders = getAllNodes().subset(FOLDER_TYPE);
 
         // filter node set by access
         if (checkAccess)
@@ -220,7 +230,7 @@
     public Folder getFolder(String name, boolean checkAccess) throws FolderNotFoundException, DocumentException
     {
         // get folder
-        Folder folder = (Folder) getAllNodes().subset(Folder.FOLDER_TYPE).get(name);
+        Folder folder = (Folder) getAllNodes().subset(FOLDER_TYPE).get(name);
         if (folder == null)
         {
             throw new FolderNotFoundException("Jetspeed PSML folder not found: " + name);
@@ -813,15 +823,6 @@
         return reservedType;
     }
     
-    private static final String RESERVED_FOLDER_PREFIX = "_";
-    private static final String RESERVED_USER_FOLDER_NAME = "_user";
-    private static final String RESERVED_ROLE_FOLDER_NAME = "_role";
-    private static final String RESERVED_GROUP_FOLDER_NAME = "_group";
-    private static final String RESERVED_SUBSITES_FOLDER_NAME = "__subsite-root";
-    private static final String RESERVED_MEDIATYPE_FOLDER_NAME = "_mediatype";
-    private static final String RESERVED_LANGUAGE_FOLDER_NAME = "_language";
-    private static final String RESERVED_COUNTRY_FOLDER_NAME = "_country";
-    
     private void setReservedType()
     {
         String name = getName();
@@ -833,7 +834,7 @@
                 reservedType = RESERVED_FOLDER_ROLES;
             else if (name.equals(RESERVED_GROUP_FOLDER_NAME))
                 reservedType = RESERVED_FOLDER_GROUPS;
-            else if (name.equals(RESERVED_SUBSITES_FOLDER_NAME))
+            else if (name.equals(RESERVED_SUBSITE_FOLDER_NAME))
                 reservedType = RESERVED_FOLDER_SUBSITES;
             else if (name.equals(RESERVED_MEDIATYPE_FOLDER_NAME))
                 reservedType = RESERVED_FOLDER_MEDIATYPE;

Modified: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/ContentFragmentImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/ContentFragmentImpl.java?rev=330134&r1=330133&r2=330134&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/ContentFragmentImpl.java (original)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/ContentFragmentImpl.java Tue Nov  1 14:13:18 2005
@@ -117,24 +117,6 @@
     }
 
     /* (non-Javadoc)
-     * @see org.apache.jetspeed.om.page.Fragment#addProperty(org.apache.jetspeed.om.page.Property)
-     */
-    public void addProperty(Property p)
-    {
-        
-        fragment.addProperty(p);
-    }
-
-    /* (non-Javadoc)
-     * @see org.apache.jetspeed.om.page.Fragment#clearProperties(java.lang.String)
-     */
-    public void clearProperties(String layoutName)
-    {
-        
-        fragment.clearProperties(layoutName);
-    }
-
-    /* (non-Javadoc)
      * @see org.apache.jetspeed.om.page.Fragment#clone()
      */
     public Object clone() throws CloneNotSupportedException
@@ -153,39 +135,39 @@
     }
 
     /* (non-Javadoc)
-     * @see org.apache.jetspeed.om.page.Fragment#getLayoutProperties()
+     * @see org.apache.jetspeed.om.page.Fragment#getName()
      */
-    public List getLayoutProperties()
+    public String getName()
     {
         
-        return fragment.getLayoutProperties();
+        return fragment.getName();
     }
 
     /* (non-Javadoc)
-     * @see org.apache.jetspeed.om.page.Fragment#getName()
+     * @see org.apache.jetspeed.om.page.Fragment#getProperties()
      */
-    public String getName()
+    public Map getProperties()
     {
-        
-        return fragment.getName();
+
+        return fragment.getProperties();
     }
 
     /* (non-Javadoc)
-     * @see org.apache.jetspeed.om.page.Fragment#getProperties(java.lang.String)
+     * @see org.apache.jetspeed.om.page.Fragment#getProperty(java.lang.String)
      */
-    public List getProperties(String layoutName)
+    public String getProperty(String propName)
     {
         
-        return fragment.getProperties(layoutName);
+        return fragment.getProperty(propName);
     }
 
     /* (non-Javadoc)
-     * @see org.apache.jetspeed.om.page.Fragment#getPropertyValue(java.lang.String, java.lang.String)
+     * @see org.apache.jetspeed.om.page.Fragment#getIntProperty(java.lang.String)
      */
-    public String getPropertyValue(String layout, String propName)
+    public int getIntProperty(String propName)
     {
         
-        return fragment.getPropertyValue(layout, propName);
+        return fragment.getIntProperty(propName);
     }
 
     /* (non-Javadoc)
@@ -225,15 +207,6 @@
     }
 
     /* (non-Javadoc)
-     * @see org.apache.jetspeed.om.page.Fragment#removeProperty(org.apache.jetspeed.om.page.Property)
-     */
-    public void removeProperty(Property p)
-    {
-        
-        fragment.removeProperty(p);
-    }
-
-    /* (non-Javadoc)
      * @see org.apache.jetspeed.om.page.Fragment#setDecorator(java.lang.String)
      */
     public void setDecorator(String decoratorName)
@@ -249,15 +222,6 @@
     {
         
         fragment.setName(name);
-    }
-
-    /* (non-Javadoc)
-     * @see org.apache.jetspeed.om.page.Fragment#setPropertyValue(java.lang.String, java.lang.String, java.lang.String)
-     */
-    public void setPropertyValue(String layout, String propName, String value)
-    {
-        
-        fragment.setPropertyValue(layout, propName, value);
     }
 
     /* (non-Javadoc)

Modified: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/FragmentImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/FragmentImpl.java?rev=330134&r1=330133&r2=330134&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/FragmentImpl.java (original)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/FragmentImpl.java Tue Nov  1 14:13:18 2005
@@ -16,10 +16,15 @@
 package org.apache.jetspeed.om.page.impl;
 
 import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
 import java.util.List;
+import java.util.Map;
 
 import org.apache.jetspeed.om.page.Fragment;
-import org.apache.jetspeed.om.page.Property;
+import org.apache.ojb.broker.PersistenceBroker;
+import org.apache.ojb.broker.PersistenceBrokerAware;
+import org.apache.ojb.broker.PersistenceBrokerException;
 
 /**
  * FragmentImpl
@@ -27,7 +32,7 @@
  * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
  * @version $Id$
  */
-public class FragmentImpl extends BaseElementImpl implements Fragment
+public class FragmentImpl extends BaseElementImpl implements Fragment, PersistenceBrokerAware
 {
     private List fragments;
     private String type;
@@ -42,6 +47,8 @@
     private String extendedPropertyName2;
     private String extendedPropertyValue2;
 
+    private Map properties;
+
     /* (non-Javadoc)
      * @see org.apache.jetspeed.om.page.Fragment#getType()
      */
@@ -120,113 +127,254 @@
     }
     
     /* (non-Javadoc)
-     * @see org.apache.jetspeed.om.page.Fragment#getLayoutProperties()
+     * @see org.apache.jetspeed.om.page.Fragment#getProperty(java.lang.String,java.lang.String)
      */
-    public List getLayoutProperties()
+    public String getProperty(String propName)
     {
-        return null; // NYI
+        if (properties != null)
+        {
+            return (String)properties.get(propName);
+        }
+        return null;
     }
-    
+
     /* (non-Javadoc)
-     * @see org.apache.jetspeed.om.page.Fragment#getProperties(java.lang.String)
+     * @see org.apache.jetspeed.om.page.Fragment#getProperty(java.lang.String,java.lang.String)
      */
-    public List getProperties(String layoutName)
+    public int getIntProperty(String propName)
     {
-        return null; // NYI
+        if (properties != null)
+        {
+            String propValue = (String)properties.get(propName);
+            if (propValue != null)
+            {
+                return Integer.parseInt(propValue);
+            }
+        }
+        return -1;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.page.Fragment#getProperties()
+     */
+    public Map getProperties()
+    {
+        // initialize and return writable properties map
+        if (properties == null)
+        {
+            properties = new HashMap(4);
+        }
+        return properties;
     }
     
     /* (non-Javadoc)
-     * @see org.apache.jetspeed.om.page.Fragment#getPropertyValue(java.lang.String,java.lang.String)
+     * @see org.apache.jetspeed.om.page.Fragment#getLayoutRow()
      */
-    public String getPropertyValue(String layout, String propName)
+    public int getLayoutRow()
     {
-        return null; // NYI
+        // get standard int property
+        return getIntProperty(ROW_PROPERTY_NAME);
     }
     
     /* (non-Javadoc)
-     * @see org.apache.jetspeed.om.page.Fragment#getPropertyValue(java.lang.String,java.lang.String,java.lang.String)
+     * @see org.apache.jetspeed.om.page.Fragment#setLayoutRow(int)
      */
-    public void setPropertyValue(String layout, String propName, String value)
+    public void setLayoutRow(int row)
     {
-        // NYI
+        // set standard int property
+        if (row >= 0)
+        {
+            getProperties().put(ROW_PROPERTY_NAME, String.valueOf(row));
+        }
+        else if (properties != null)
+        {
+            properties.remove(ROW_PROPERTY_NAME);
+        }
     }
-
+    
     /* (non-Javadoc)
-     * @see org.apache.jetspeed.om.page.Fragment#addProperty(org.apache.jetspeed.om.page.Property)
+     * @see org.apache.jetspeed.om.page.Fragment#getLayoutColumn()
      */
-    public void addProperty(Property p)
+    public int getLayoutColumn()
     {
-        // NYI
+        // get standard int property
+        return getIntProperty(COLUMN_PROPERTY_NAME);
     }
 
     /* (non-Javadoc)
-     * @see org.apache.jetspeed.om.page.Fragment#removeProperty(org.apache.jetspeed.om.page.Property)
+     * @see org.apache.jetspeed.om.page.Fragment#setLayoutColumn(int)
      */
-    public void removeProperty(Property p)
+    public void setLayoutColumn(int column)
     {
-        // NYI
+        // set standard int property
+        if (column >= 0)
+        {
+            getProperties().put(COLUMN_PROPERTY_NAME, String.valueOf(column));
+        }
+        else if (properties != null)
+        {
+            properties.remove(COLUMN_PROPERTY_NAME);
+        }
     }
-
+    
     /* (non-Javadoc)
-     * @see org.apache.jetspeed.om.page.Fragment#clearProperties(java.lang.String)
+     * @see org.apache.jetspeed.om.page.Fragment#getLayoutSizes()
      */
-    public void clearProperties(String layoutName)
+    public String getLayoutSizes()
     {
-        // NYI
+        // get standard string property
+        return getProperty(SIZES_PROPERTY_NAME);
     }
 
     /* (non-Javadoc)
-     * @see org.apache.jetspeed.om.page.Fragment#getLayoutWidths()
+     * @see org.apache.jetspeed.om.page.Fragment#setLayoutSizes(java.lang.String)
      */
-    public int getLayoutRow()
+    public void setLayoutSizes(String sizes)
     {
-        return layoutRowProperty;
+        // set standard string property
+        if (sizes != null)
+        {
+            getProperties().put(SIZES_PROPERTY_NAME, sizes);
+        }
+        else if (properties != null)
+        {
+            properties.remove(SIZES_PROPERTY_NAME);
+        }
     }
     
-    public void setLayoutRow(int row)
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.page.Fragment#isReference()
+     */
+    public boolean isReference()
     {
-        this.layoutRowProperty = row;
+        return false; // NYI
     }
-    
-    public void setLayoutColumn(int column)
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.page.Fragment#clone()
+     */
+    public Object clone() throws CloneNotSupportedException
+    {
+        return null; // NYI
+    }    
+
+    /* (non-Javadoc)
+     * @see org.apache.ojb.broker.PersistenceBrokerAware#beforeInsert(org.apache.ojb.broker.PersistenceBroker)
+     */
+    public void beforeInsert(PersistenceBroker broker) throws PersistenceBrokerException
     {
-        this.layoutColumnProperty = column;
+        // execute update hook
+        beforeUpdate(broker);
     }
-    
+
     /* (non-Javadoc)
-     * @see org.apache.jetspeed.om.page.Fragment#getLayoutWidths()
+     * @see org.apache.ojb.broker.PersistenceBrokerAware#afterInsert(org.apache.ojb.broker.PersistenceBroker)
      */
-    public int getLayoutColumn()
+    public void afterInsert(PersistenceBroker broker) throws PersistenceBrokerException
     {
-        return layoutColumnProperty;
+        // execute update hook
+        afterUpdate(broker);
     }
 
     /* (non-Javadoc)
-     * @see org.apache.jetspeed.om.page.Fragment#getLayoutSizes()
+     * @see org.apache.ojb.broker.PersistenceBrokerAware#beforeUpdate(org.apache.ojb.broker.PersistenceBroker)
      */
-    public String getLayoutSizes()
+    public void beforeUpdate(PersistenceBroker broker) throws PersistenceBrokerException
     {
-        return layoutSizesProperty;
+        // update concrete fields with properties
+        layoutRowProperty = -1;
+        layoutColumnProperty = -1;
+        layoutSizesProperty = null;
+        extendedPropertyName1 = null;
+        extendedPropertyValue1 = null;
+        extendedPropertyName2 = null;
+        extendedPropertyValue2 = null;
+        if ((properties != null) && !properties.isEmpty())
+        {
+            Iterator propsIter = properties.entrySet().iterator();
+            while (propsIter.hasNext())
+            {
+                Map.Entry prop = (Map.Entry)propsIter.next();
+                String propName = (String)prop.getKey();
+                String propValue = (String)prop.getValue();
+                if (propValue != null)
+                {
+                    if (propName.equals(ROW_PROPERTY_NAME))
+                    {
+                        layoutRowProperty = Integer.parseInt(propValue);
+                    }
+                    else if (propName.equals(COLUMN_PROPERTY_NAME))
+                    {
+                        layoutColumnProperty = Integer.parseInt(propValue);
+                    }
+                    else if (propName.equals(SIZES_PROPERTY_NAME))
+                    {
+                        layoutSizesProperty = propValue;
+                    }
+                    else if (extendedPropertyName1 == null)
+                    {
+                        extendedPropertyName1 = propName;
+                        extendedPropertyValue1 = propValue;
+                    }
+                    else if (extendedPropertyName2 == null)
+                    {
+                        extendedPropertyName2 = propName;
+                        extendedPropertyValue2 = propValue;
+                    }
+                }
+            }
+        }
     }
 
-    public void setLayoutSizes(String sizes)
+    /* (non-Javadoc)
+     * @see org.apache.ojb.broker.PersistenceBrokerAware#afterUpdate(org.apache.ojb.broker.PersistenceBroker)
+     */
+    public void afterUpdate(PersistenceBroker broker) throws PersistenceBrokerException
     {
-        this.layoutSizesProperty = sizes;
+        // nothing to do by default
     }
-    
+
     /* (non-Javadoc)
-     * @see org.apache.jetspeed.om.page.Fragment#isReference()
+     * @see org.apache.ojb.broker.PersistenceBrokerAware#beforeDelete(org.apache.ojb.broker.PersistenceBroker)
      */
-    public boolean isReference()
+    public void beforeDelete(PersistenceBroker broker) throws PersistenceBrokerException
     {
-        return false; // NYI
+        // nothing to do by default
     }
 
     /* (non-Javadoc)
-     * @see org.apache.jetspeed.om.page.Fragment#clone()
+     * @see org.apache.ojb.broker.PersistenceBrokerAware#afterDelete(org.apache.ojb.broker.PersistenceBroker)
      */
-    public Object clone() throws CloneNotSupportedException
+    public void afterDelete(PersistenceBroker broker) throws PersistenceBrokerException
     {
-        return null; // NYI
-    }    
+        // nothing to do by default
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.ojb.broker.PersistenceBrokerAware#afterLookup(org.apache.ojb.broker.PersistenceBroker)
+     */
+    public void afterLookup(PersistenceBroker broker) throws PersistenceBrokerException
+    {
+        // load properties from concrete fields
+        if (layoutRowProperty >= 0)
+        {
+            getProperties().put(ROW_PROPERTY_NAME, String.valueOf(layoutRowProperty));
+        }
+        if (layoutColumnProperty >= 0)
+        {
+            getProperties().put(COLUMN_PROPERTY_NAME, String.valueOf(layoutColumnProperty));
+        }
+        if (layoutSizesProperty != null)
+        {
+            getProperties().put(SIZES_PROPERTY_NAME, layoutSizesProperty);
+        }
+        if ((extendedPropertyName1 != null) && (extendedPropertyValue1 != null))
+        {
+            getProperties().put(extendedPropertyName1, extendedPropertyValue1);
+        }
+        if ((extendedPropertyName2 != null) && (extendedPropertyValue2 != null))
+        {
+            getProperties().put(extendedPropertyName2, extendedPropertyValue2);
+        }
+    }
 }

Modified: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/PageImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/PageImpl.java?rev=330134&r1=330133&r2=330134&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/PageImpl.java (original)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/PageImpl.java Tue Nov  1 14:13:18 2005
@@ -37,13 +37,6 @@
     private String skin;
     private String decorator;
     private String defaultFragmentDecorator;
-    private String subsite;
-    private String principal;
-    private String principalType;
-    private String mediatype;
-    private String locale;
-    private String extendedLocatorName;
-    private String extendedLocatorValue;
 
     /* (non-Javadoc)
      * @see org.apache.jetspeed.om.page.Page#getDefaultSkin()

Modified: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/psml/FragmentImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/psml/FragmentImpl.java?rev=330134&r1=330133&r2=330134&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/psml/FragmentImpl.java (original)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/psml/FragmentImpl.java Tue Nov  1 14:13:18 2005
@@ -17,14 +17,15 @@
 package org.apache.jetspeed.om.page.psml;
 
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Map;
 import java.util.Vector;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.jetspeed.om.page.Fragment;
-import org.apache.jetspeed.om.page.Property;
 
 /**
  * @version $Id$
@@ -42,7 +43,9 @@
 
     private List fragments = new Vector();
 
-    private List properties = new Vector();
+    private List propertiesList = new Vector();
+
+    private Map propertiesMap = new HashMap();
 
     private String name;
 
@@ -102,129 +105,38 @@
         return this.fragments;
     }
 
-    public List getLayoutProperties()
-    {
-        List layouts = new ArrayList();
-        Iterator i = this.properties.iterator();
-
-        while (i.hasNext())
-        {
-            Property p = (Property) i.next();
-            if (!layouts.contains(p.getLayout()))
-            {
-                layouts.add(p.getLayout());
-            }
-        }
-
-        return layouts;
-    }
-
-    public List getProperties( String layoutName )
-    {
-        List props = new ArrayList();
-        Iterator i = this.properties.iterator();
-
-        if (layoutName == null)
-        {
-            layoutName = "";
-        }
-
-        while (i.hasNext())
-        {
-            Property p = (Property) i.next();
-            if (layoutName.equals(p.getLayout()))
-            {
-                props.add(p);
-            }
-        }
-
-        return props;
-    }
-
-    public String getPropertyValue( String layout, String propName )
+    public Vector getPropertiesList()
     {
-        Iterator itr = getProperties(layout).iterator();
-        while (itr.hasNext())
-        {
-            Property aProp = (Property) itr.next();
-            if (aProp.getName().equals(propName))
-            {
-                return aProp.getValue();
-            }
-        }
-
-        return null;
+        return (Vector) this.propertiesList;
     }
 
-    public void setPropertyValue( String layout, String propName, String value )
-    {
-        Iterator itr = getProperties(layout).iterator();
-        while (itr.hasNext())
-        {
-            Property aProp = (Property) itr.next();
-            if (aProp.getName().equals(propName))
-            {
-                aProp.setValue(value);
-                return;
-            }
-        }
-
-        PropertyImpl newProp = new PropertyImpl();
-        newProp.setLayout(layout);
-        newProp.setName(propName);
-        newProp.setValue(value);
-        addProperty(newProp);
-    }
-
-    public void addProperty( Property p )
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.page.Fragment#getProperty(java.lang.String,java.lang.String)
+     */
+    public String getProperty(String propName)
     {
-        this.properties.add(p);
+        return (String)propertiesMap.get(propName);
     }
 
-    public void removeProperty( Property p )
-    {
-        Iterator i = this.properties.iterator();
-
-        while (i.hasNext())
-        {
-            Property p2 = (Property) i.next();
-
-            if (p2.equals(p))
-            {
-                i.remove();
-            }
-        }
-    }
-
-    public void clearProperties( String layoutName )
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.page.Fragment#getProperty(java.lang.String,java.lang.String)
+     */
+    public int getIntProperty(String propName)
     {
-        if (layoutName == null)
-        {
-            this.properties.clear();
-            return;
-        }
-
-        Iterator i = this.properties.iterator();
-
-        while (i.hasNext())
+        String prop = (String)propertiesMap.get(propName);
+        if (prop != null)
         {
-            Property p = (Property) i.next();
-
-            if (layoutName.equals(p.getLayout()))
-            {
-                i.remove();
-            }
+            return Integer.parseInt(prop);
         }
+        return -1;
     }
 
-    public Vector getProperties()
-    {
-        return (Vector) this.properties;
-    }
-
-    public void setProperties( Vector props )
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.page.Fragment#getProperties()
+     */
+    public Map getProperties()
     {
-        this.properties = props;
+        return propertiesMap;
     }
 
     /* (non-Javadoc)
@@ -232,30 +144,26 @@
      */
     public int getLayoutRow()
     {
-        // return first valid row layout property
-        Iterator i = this.properties.iterator();
-        while (i.hasNext())
+        String prop = (String)propertiesMap.get(ROW_PROPERTY_NAME);
+        if (prop != null)
         {
-            Property p = (Property) i.next();
-            if ((p.getLayout() != null) && (p.getLayout().length() > 0) && ROW_PROPERTY_NAME.equals(p.getName()) && (p.getValue() != null))
-            {
-                return p.getIntValue();
-            }
+            return Integer.parseInt(prop);
         }
         return -1;
     }
 
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.page.Fragment#setLayoutRow(int)
+     */
     public void setLayoutRow(int row)
     {
-        // return first valid sizes property
-        Iterator i = this.properties.iterator();
-        while (i.hasNext())
+        if (row >= 0)
         {
-            Property p = (Property) i.next();
-            if (ROW_PROPERTY_NAME.equals(p.getName()))
-            {
-                p.setValue(String.valueOf(row));
-            }
+            propertiesMap.put(ROW_PROPERTY_NAME, String.valueOf(row));
+        }
+        else
+        {
+            propertiesMap.remove(ROW_PROPERTY_NAME);
         }
     }
     
@@ -264,30 +172,26 @@
      */
     public int getLayoutColumn()
     {
-        // return first valid column layout property
-        Iterator i = this.properties.iterator();
-        while (i.hasNext())
+        String prop = (String)propertiesMap.get(COLUMN_PROPERTY_NAME);
+        if (prop != null)
         {
-            Property p = (Property) i.next();
-            if ((p.getLayout() != null) && (p.getLayout().length() > 0) && COLUMN_PROPERTY_NAME.equals(p.getName()) && (p.getValue() != null))
-            {
-                return p.getIntValue();
-            }
+            return Integer.parseInt(prop);
         }
         return -1;
     }
 
-    public void setLayoutColumn(int size)
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.page.Fragment#setLayoutColumn(int)
+     */
+    public void setLayoutColumn(int column)
     {
-        // return first valid sizes property
-        Iterator i = this.properties.iterator();
-        while (i.hasNext())
+        if (column >= 0)
         {
-            Property p = (Property) i.next();
-            if (COLUMN_PROPERTY_NAME.equals(p.getName()))
-            {
-                p.setValue(String.valueOf(size));
-            }
+            propertiesMap.put(COLUMN_PROPERTY_NAME, String.valueOf(column));
+        }
+        else
+        {
+            propertiesMap.remove(COLUMN_PROPERTY_NAME);
         }
     }
     
@@ -296,30 +200,21 @@
      */
     public String getLayoutSizes()
     {
-        // return first valid sizes property
-        Iterator i = this.properties.iterator();
-        while (i.hasNext())
-        {
-            Property p = (Property) i.next();
-            if (SIZES_PROPERTY_NAME.equals(p.getName()) && (p.getValue() != null))
-            {
-                return p.getValue();
-            }
-        }
-        return null;
+        return (String)propertiesMap.get(SIZES_PROPERTY_NAME);
     }
     
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.page.Fragment#setLayoutSizes(java.lang.String)
+     */
     public void setLayoutSizes(String sizes)
     {
-        // return first valid sizes property
-        Iterator i = this.properties.iterator();
-        while (i.hasNext())
+        if (sizes != null)
         {
-            Property p = (Property) i.next();
-            if (SIZES_PROPERTY_NAME.equals(p.getName()))
-            {
-                p.setValue(sizes);
-            }
+            propertiesMap.put(SIZES_PROPERTY_NAME, sizes);
+        }
+        else
+        {
+            propertiesMap.remove(SIZES_PROPERTY_NAME);
         }
     }
     
@@ -401,5 +296,76 @@
     {
         this.name = name;
 
+    }
+
+    /**
+     * unmarshalled - notification that this instance has been
+     *                loaded from the persistent store
+     */
+    public void unmarshalled()
+    {
+        // notify super class implementation
+        super.unmarshalled();
+
+        // propagate unmarshalled notification
+        // to all fragments
+        Iterator fragmentIter = fragments.iterator();
+        while (fragmentIter.hasNext())
+        {
+            ((FragmentImpl)fragmentIter.next()).unmarshalled();
+        }
+
+        // load the properties map from list
+        propertiesMap.clear();
+        Iterator propsIter = propertiesList.iterator();
+        while (propsIter.hasNext())
+        {
+            PropertyImpl prop = (PropertyImpl) propsIter.next();
+            propertiesMap.put(prop.getName(), prop.getValue());
+        }
+    }
+
+    /**
+     * marshalling - notification that this instance is to
+     *               be saved to the persistent store
+     */
+    public void marshalling()
+    {
+        // update the properties list from the map
+        // if change/edit detected
+        boolean changed = (propertiesMap.size() != propertiesList.size());
+        if (!changed)
+        {
+            Iterator propsIter = propertiesList.iterator();
+            while (!changed && propsIter.hasNext())
+            {
+                PropertyImpl prop = (PropertyImpl) propsIter.next();
+                changed = (prop.getValue() != propertiesMap.get(prop.getName()));
+            }
+        }
+        if (changed)
+        {
+            propertiesList.clear();
+            Iterator propsIter = propertiesMap.entrySet().iterator();
+            while (propsIter.hasNext())
+            {
+                Map.Entry prop = (Map.Entry) propsIter.next();
+                PropertyImpl listProp = new PropertyImpl();
+                listProp.setName((String)prop.getKey());
+                listProp.setValue((String)prop.getValue());
+                propertiesList.add(listProp);
+            }
+        }
+
+        // propagate marshalling notification
+        // to all fragments
+        Iterator fragmentIter = fragments.iterator();
+        while (fragmentIter.hasNext())
+        {
+            ((FragmentImpl)fragmentIter.next()).marshalling();
+        }
+
+        // notify super class implementation
+        super.marshalling();
     }
 }

Modified: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/psml/PageImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/psml/PageImpl.java?rev=330134&r1=330133&r2=330134&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/psml/PageImpl.java (original)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/psml/PageImpl.java Tue Nov  1 14:13:18 2005
@@ -234,6 +234,13 @@
             }
         }
 
+        // propagate unmarshalled notification
+        // to root fragment
+        if (root != null)
+        {
+            ((FragmentImpl)root).unmarshalled();
+        }
+
         // default title of pages to name
         if (getTitle() == null)
         {
@@ -247,6 +254,13 @@
      */
     public void marshalling()
     {
+        // propagate marshalling notification
+        // to root fragment
+        if (root != null)
+        {
+            ((FragmentImpl)root).marshalling();
+        }
+
         // propagate marshalling notification
         // to all menu definitions
         if (menuDefinitions != null)

Modified: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/psml/PropertyImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/psml/PropertyImpl.java?rev=330134&r1=330133&r2=330134&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/psml/PropertyImpl.java (original)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/psml/PropertyImpl.java Tue Nov  1 14:13:18 2005
@@ -16,8 +16,6 @@
 
 package org.apache.jetspeed.om.page.psml;
 
-import org.apache.jetspeed.om.page.Property;
-
 /**
  * Bean like implementation of the Parameter interface suitable for
  * Castor serialization.
@@ -26,12 +24,10 @@
  * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
  * @version $Id$
  */
-public class PropertyImpl implements Property, java.io.Serializable
+public class PropertyImpl implements java.io.Serializable
 {
-
     private String name;
     private String value;
-    private String layout;
 
     public PropertyImpl()
     {
@@ -39,12 +35,13 @@
 
     public String getLayout()
     {
-        return this.layout;
+        // property layout name deprecated
+        return null;
     }
 
     public void setLayout(String layout)
     {
-        this.layout = layout;
+        // property layout name deprecated
     }
 
     public String getName()
@@ -67,53 +64,12 @@
         this.value = value;
     }
 
-
-    public boolean equals(Object object)
-    {
-        boolean isEqual = true;
-
-        if (object instanceof Property)
-        {
-            if (this.name!=null)
-            {
-                isEqual&=this.name.equals(((Property)object).getName());
-            }
-            else
-            {
-                isEqual&=((Property)object).getName()==null;
-            }
-
-            if (this.value!=null)
-            {
-                isEqual&=this.value.equals(((Property)object).getValue());
-            }
-            else
-            {
-                isEqual&=((Property)object).getValue()==null;
-            }
-
-            if (this.layout!=null)
-            {
-                isEqual&=this.layout.equals(((Property)object).getLayout());
-            }
-            else
-            {
-                isEqual&=((Property)object).getLayout()==null;
-            }
-        }
-        else
-        {
-            isEqual = false;
-        }
-
-        return isEqual;
-    }
-
     public Object clone()
         throws java.lang.CloneNotSupportedException
     {
         return super.clone();
     }
+
     /**
      * <p>
      * getIntValue
@@ -126,4 +82,4 @@
     {        
         return Integer.parseInt(value);
     }
-}
\ No newline at end of file
+}

Modified: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/AbstractPageManager.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/AbstractPageManager.java?rev=330134&r1=330133&r2=330134&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/AbstractPageManager.java (original)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/AbstractPageManager.java Tue Nov  1 14:13:18 2005
@@ -36,7 +36,6 @@
 import org.apache.jetspeed.om.page.Fragment;
 import org.apache.jetspeed.om.page.Link;
 import org.apache.jetspeed.om.page.Page;
-import org.apache.jetspeed.om.page.Property;
 import org.apache.jetspeed.page.document.Node;
 import org.apache.jetspeed.portalsite.MenuElement;
 
@@ -84,7 +83,6 @@
         this.pageClass = (Class)modelClasses.get("PageImpl.class");
         this.folderClass = (Class)modelClasses.get("FolderImpl.class");
         this.linkClass = (Class)modelClasses.get("LinkImpl.class");
-        this.propertyClass = (Class)modelClasses.get("PropertyImpl.class");
         this.menuDefinitionClass = (Class)modelClasses.get("MenuDefinitionImpl.class");
         this.menuExcludeDefinitionClass = (Class)modelClasses.get("MenuExcludeDefinitionImpl.class");
         this.menuIncludeDefinitionClass = (Class)modelClasses.get("MenuIncludeDefinitionImpl.class");
@@ -240,26 +238,6 @@
         return fragment;        
     }
     
-    /* (non-Javadoc)
-     * @see org.apache.jetspeed.page.PageManager#newProperty()
-     */
-    public Property newProperty()
-    {
-        Property property = null;
-        try
-        {
-            property = (Property)createObject(this.propertyClass);
-            
-        }
-        catch (ClassCastException e)
-        {
-            String message = "Failed to create fragment-property object for " + this.propertyClass;
-            log.error(message, e);
-            // throw new JetspeedException(message, e);
-        }
-        return property;        
-    }
-
     /**
      * newMenuDefinition - creates a new empty menu definition
      *
@@ -516,20 +494,11 @@
         clone.setState(source.getState());
         
         // clone properties
-        Iterator names = source.getLayoutProperties().iterator();
-        while (names.hasNext())
+        Iterator props = source.getProperties().entrySet().iterator();
+        while (props.hasNext())
         {
-            String name = (String)names.next();
-            Iterator props = source.getProperties(name).iterator();
-            while (props.hasNext())
-            {
-                Property srcProp = (Property)props.next();
-                Property dstProp = newProperty();
-                dstProp.setLayout(name);
-                dstProp.setName(srcProp.getName());
-                dstProp.setValue(srcProp.getValue());
-                clone.addProperty(dstProp);
-            }            
+            Map.Entry prop = (Map.Entry)props.next();
+            clone.getProperties().put(prop.getKey(), prop.getValue());
         }
         
         // clone security constraints

Added: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/document/impl/NodeAttributes.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/document/impl/NodeAttributes.java?rev=330134&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/document/impl/NodeAttributes.java (added)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/document/impl/NodeAttributes.java Tue Nov  1 14:13:18 2005
@@ -0,0 +1,376 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.page.document.impl;
+
+import java.util.StringTokenizer;
+
+import org.apache.jetspeed.om.folder.Folder;
+import org.apache.ojb.broker.query.Criteria;
+
+/**
+ * NodeAttributes
+ *
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id$
+ */
+public class NodeAttributes
+{
+    private static final String NONE = "";
+
+    private String path = Folder.PATH_SEPARATOR;
+    private String subsite = NONE;
+    private String user = NONE;
+    private String role = NONE;
+    private String group = NONE;
+    private String mediatype = NONE;
+    private String locale = NONE;
+    private String extendedAttributeName = NONE;
+    private String extendedAttributeValue = NONE;
+
+    private String canonicalPath;
+
+    /**
+     * NodeAttributes
+     *
+     * Constructor used for Node nested member.
+     */
+    public NodeAttributes()
+    {
+    }
+
+    /**
+     * NodeAttributes
+     *
+     * Constructor used to generate Node queries.
+     *
+     * @param path canonical path
+     */
+    public NodeAttributes(String path)
+    {
+        setCanonicalPath(path);
+    }
+
+    /**
+     * getCanonicalPath
+     *
+     * Computed canonical path using attributes and base path.
+     *
+     * @retuns canonical path
+     */
+    public String getCanonicalPath()
+    {
+        // compute canonical path
+        if (canonicalPath == null)
+        {
+            // prepend attributes to path
+            StringBuffer newPath = new StringBuffer();
+            if ((subsite != NONE) && (subsite.length() > 0))
+            {
+                newPath.append(Folder.SUBSITE_FOLDER);
+                newPath.append(subsite.toLowerCase());
+            }
+            if ((user != NONE) && (user.length() > 0))
+            {
+                newPath.append(Folder.USER_FOLDER);
+                newPath.append(user.toLowerCase());
+            }
+            if ((role != NONE) && (role.length() > 0))
+            {
+                newPath.append(Folder.ROLE_FOLDER);
+                newPath.append(role.toLowerCase());
+            }
+            if ((group != NONE) && (group.length() > 0))
+            {
+                newPath.append(Folder.GROUP_FOLDER);
+                newPath.append(group.toLowerCase());
+            }
+            if ((mediatype != NONE) && (mediatype.length() > 0))
+            {
+                newPath.append(Folder.MEDIATYPE_FOLDER);
+                newPath.append(mediatype.toLowerCase());
+            }
+            if ((locale != NONE) && (locale.length() > 0))
+            {
+                newPath.append(Folder.LANGUAGE_FOLDER);
+                int localeSeparatorIndex = locale.indexOf('_');
+                if (localeSeparatorIndex > 0)
+                {
+                    newPath.append(locale.substring(0,localeSeparatorIndex).toLowerCase());
+                    if (localeSeparatorIndex + 1 < locale.length())
+                    {
+                        newPath.append(Folder.COUNTRY_FOLDER);
+                        newPath.append(locale.substring(localeSeparatorIndex+1).toLowerCase());
+                    }
+                }
+                else
+                {
+                    newPath.append(locale.toLowerCase());
+                }
+            }
+            if ((extendedAttributeName != NONE) && (extendedAttributeName.length() > 0) &&
+                (extendedAttributeValue != NONE) && (extendedAttributeValue.length() > 0))
+            {
+                newPath.append(Folder.PATH_SEPARATOR);
+                newPath.append(Folder.RESERVED_FOLDER_PREFIX);
+                newPath.append(extendedAttributeName.toLowerCase());
+                newPath.append(Folder.PATH_SEPARATOR);
+                newPath.append(extendedAttributeValue.toLowerCase());
+            }
+
+            // append base path
+            if (!path.equals(Folder.PATH_SEPARATOR))
+            {
+                newPath.append(path);
+            }
+
+            // save canonical path
+            if (newPath.length() > 0)
+            {
+                canonicalPath = newPath.toString();
+            }
+            else
+            {
+                canonicalPath = Folder.PATH_SEPARATOR;
+            }
+        }
+        return canonicalPath;
+    }
+    
+    /**
+     * setCanonicalPath
+     *
+     * Parses canonical path setting attributes and base path.
+     *
+     * @param newPath canonical path
+     */
+    public void setCanonicalPath(String newPath)
+    {
+        // cleanup path
+        if ((newPath == null) || (newPath.length() == 0))
+        {
+            newPath = Folder.PATH_SEPARATOR;
+        }
+        if (!newPath.startsWith(Folder.PATH_SEPARATOR))
+        {
+            newPath = Folder.PATH_SEPARATOR + newPath;
+        }
+        if (newPath.endsWith(Folder.PATH_SEPARATOR) && !newPath.equals(Folder.PATH_SEPARATOR))
+        {
+            newPath = newPath.substring(0, newPath.length() - 1);
+        }
+
+        // reset attributes and base path
+        path = Folder.PATH_SEPARATOR;
+        subsite = NONE;
+        user = NONE;
+        role = NONE;
+        group = NONE;
+        mediatype = NONE;
+        locale = NONE;
+        extendedAttributeName = NONE;
+        extendedAttributeValue = NONE;
+
+        // parse attributes and base path from path
+        StringBuffer basePath = new StringBuffer();
+        String attributeName = null;
+        StringTokenizer pathElements = new StringTokenizer(newPath, Folder.PATH_SEPARATOR);
+        while (pathElements.hasMoreTokens())
+        {
+            String pathElement = pathElements.nextToken();
+            if (attributeName != null)
+            {
+                // set last attribute name with attribute value
+                if (attributeName.startsWith(Folder.RESERVED_USER_FOLDER_NAME))
+                {
+                    user = pathElement.toLowerCase();
+                }
+                else if (attributeName.startsWith(Folder.RESERVED_ROLE_FOLDER_NAME))
+                {
+                    role = pathElement.toLowerCase();
+                }
+                else if (attributeName.startsWith(Folder.RESERVED_GROUP_FOLDER_NAME))
+                {
+                    group = pathElement.toLowerCase();
+                }
+                else if (attributeName.startsWith(Folder.RESERVED_MEDIATYPE_FOLDER_NAME))
+                {
+                    mediatype = pathElement.toLowerCase();
+                }
+                else if (attributeName.startsWith(Folder.RESERVED_LANGUAGE_FOLDER_NAME))
+                {
+                    if (locale != NONE)
+                    {
+                        locale = pathElement.toLowerCase() + "_" + locale;
+                    }
+                    else
+                    {
+                        locale = pathElement.toLowerCase();
+                    }
+                }
+                else if (attributeName.startsWith(Folder.RESERVED_COUNTRY_FOLDER_NAME))
+                {
+                    if (locale != NONE)
+                    {
+                        locale = locale + "_" + pathElement.toLowerCase() ;
+                    }
+                    else
+                    {
+                        locale = pathElement.toLowerCase();
+                    }
+                }
+                else if (attributeName.startsWith(Folder.RESERVED_SUBSITE_FOLDER_PREFIX))
+                {
+                    subsite = pathElement.toLowerCase();
+                }
+                else if (attributeName.startsWith(Folder.RESERVED_FOLDER_PREFIX))
+                {
+                    extendedAttributeName = attributeName.substring(1);
+                    extendedAttributeValue = pathElement.toLowerCase();
+                }
+
+                // reset attribute name
+                attributeName = null;
+            }
+            else if (pathElement.startsWith(Folder.RESERVED_FOLDER_PREFIX) || pathElement.startsWith(Folder.RESERVED_SUBSITE_FOLDER_PREFIX))
+            {
+                // save attribute name
+                attributeName = pathElement.toLowerCase();
+            }
+            else
+            {
+                // append element to base path
+                basePath.append(Folder.PATH_SEPARATOR);
+                basePath.append(pathElement);
+            }
+        }
+
+        // set base path
+        if (basePath.length() > 0)
+        {
+            path = basePath.toString();
+        }
+
+        // reset canonical path
+        canonicalPath = null;
+    }
+
+    /**
+     * getPath
+     *
+     * @retuns base path
+     */
+    public String getPath()
+    {
+        return path;
+    }
+
+    /**
+     * setPath
+     *
+     * @param basePath base path
+     */
+    public void setPath(String basePath)
+    {
+        // cleanup path
+        if ((basePath == null) || (basePath.length() == 0))
+        {
+            basePath = Folder.PATH_SEPARATOR;
+        }
+        if (!basePath.startsWith(Folder.PATH_SEPARATOR))
+        {
+            basePath = Folder.PATH_SEPARATOR + basePath;
+        }
+        if (basePath.endsWith(Folder.PATH_SEPARATOR) && !basePath.equals(Folder.PATH_SEPARATOR))
+        {
+            basePath = basePath.substring(0, basePath.length() - 1);
+        }
+
+        // set path
+        path = basePath;
+    }
+
+    /**
+     * newQueryCriteria
+     *
+     * Construct query Criteria for Node with matching attributes.
+     */
+    public Criteria newQueryCriteria()
+    {
+        // construct filter for base path and attributes
+        Criteria filter = new Criteria();
+        filter.addEqualTo("attributes::path", path);
+        if ((subsite != NONE) && (subsite.length() > 0))
+        {
+            filter.addEqualTo("attributes::subsite", subsite);
+        }
+        else
+        {
+            filter.addEqualTo("attributes::subsite", NONE);
+        }
+        if ((user != NONE) && (user.length() > 0))
+        {
+            filter.addEqualTo("attributes::user", user);
+        }
+        else
+        {
+            filter.addEqualTo("attributes::user", NONE);
+        }
+        if ((role != NONE) && (role.length() > 0))
+        {
+            filter.addEqualTo("attributes::role", role);
+        }
+        else
+        {
+            filter.addEqualTo("attributes::role", NONE);
+        }
+        if ((group != NONE) && (group.length() > 0))
+        {
+            filter.addEqualTo("attributes::group", group);
+        }
+        else
+        {
+            filter.addEqualTo("attributes::group", NONE);
+        }
+        if ((mediatype != NONE) && (mediatype.length() > 0))
+        {
+            filter.addEqualTo("attributes::mediatype", mediatype);
+        }
+        else
+        {
+            filter.addEqualTo("attributes::mediatype", NONE);
+        }
+        if ((locale != NONE) && (locale.length() > 0))
+        {
+            filter.addEqualTo("attributes::locale", locale);
+        }
+        else
+        {
+            filter.addEqualTo("attributes::locale", NONE);
+        }
+        if ((extendedAttributeName != NONE) && (extendedAttributeName.length() > 0) &&
+            (extendedAttributeValue != NONE) && (extendedAttributeValue.length() > 0))
+        {
+            filter.addEqualTo("attributes::extendedAttributeName", extendedAttributeName);
+            filter.addEqualTo("attributes::extendedAttributeValue", extendedAttributeValue);
+        }
+        else
+        {
+            filter.addEqualTo("attributes::extendedAttributeName", NONE);
+            filter.addEqualTo("attributes::extendedAttributeValue", NONE);
+        }
+        return filter;
+    }
+}

Propchange: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/document/impl/NodeAttributes.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/document/impl/NodeImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/document/impl/NodeImpl.java?rev=330134&r1=330133&r2=330134&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/document/impl/NodeImpl.java (original)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/document/impl/NodeImpl.java Tue Nov  1 14:13:18 2005
@@ -31,29 +31,75 @@
 public abstract class NodeImpl extends BaseElementImpl implements Node
 {
     private Node parent;
-    private String path;
+    private NodeAttributes attributes;
+
+    public NodeImpl()
+    {
+        super();
+        attributes = new NodeAttributes();
+    }
 
     /**
-     * setName
+     * isRootNode
      *
-     * @param name element name
+     * Test whether node attributes base path is a root node
+     * path, regardless of parent setting.
+     *
+     * @return root node flag
+     */
+    public boolean isRootNode()
+    {
+        return attributes.getPath().equals(Folder.PATH_SEPARATOR);
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.page.impl.BaseElementImpl#getName()
+     */
+    public String getName()
+    {
+        // get name or compute from path
+        String name = super.getName();
+        if (name == null)
+        {
+            String path = attributes.getPath();
+            if (path != null)
+            {
+                if (!path.equals(Folder.PATH_SEPARATOR))
+                {
+                    name = path.substring(path.lastIndexOf(Folder.PATH_SEPARATOR) + 1);
+                }
+                else
+                {
+                    name = Folder.PATH_SEPARATOR;
+                }
+                super.setName(name);
+            }
+
+        }
+        return name;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.page.impl.BaseElementImpl#setName(java.lang.String)
      */
     public void setName(String name)
     {
         // set path based on name
         if (name != null)
         {
+            String path = attributes.getPath();
             if (path != null)
             {
                 if (!name.equals(Folder.PATH_SEPARATOR))
                 {
-                    path = path.substring(0, path.lastIndexOf(Folder.PATH_SEPARATOR) + 1) + name;
+                    attributes.setPath(path.substring(0, path.lastIndexOf(Folder.PATH_SEPARATOR) + 1) + name);
                 }
                 else
                 {
-                    path = Folder.PATH_SEPARATOR;
+                    attributes.setPath(Folder.PATH_SEPARATOR);
                 }
             }
+
             super.setName(name);
         }
     }
@@ -73,6 +119,20 @@
     {
         // cast to check type
         this.parent = (NodeImpl)parent;
+
+        // update path if required
+        if (parent != null)
+        {
+            String parentPath = parent.getPath();
+            String path = getPath();
+            if ((parentPath.equals(Folder.PATH_SEPARATOR) &&
+                 (path.lastIndexOf(Folder.PATH_SEPARATOR) > 0)) ||
+                (!parentPath.equals(Folder.PATH_SEPARATOR) &&
+                 !parentPath.equals(path.substring(0, path.lastIndexOf(Folder.PATH_SEPARATOR)))))
+            {
+                setPath(parentPath + Folder.PATH_SEPARATOR + getName());
+            }
+        }
     }
 
     /* (non-Javadoc)
@@ -80,7 +140,8 @@
      */
     public String getPath()
     {
-        return path;
+        // return path from attributes and base path
+        return attributes.getCanonicalPath();
     }
     
     /* (non-Javadoc)
@@ -88,22 +149,11 @@
      */
     public void setPath(String path)
     {
-        // cleanup paths
-        if ((path == null) || (path.length() == 0))
-        {
-            path = Folder.PATH_SEPARATOR;
-        }
-        if (!path.startsWith(Folder.PATH_SEPARATOR))
-        {
-            path = Folder.PATH_SEPARATOR + path;
-        }
-        if (path.endsWith(Folder.PATH_SEPARATOR) && !path.equals(Folder.PATH_SEPARATOR))
-        {
-            path = path.substring(0, path.length() - 1);
-        }
-        this.path = path;
+        // set attributes and base path
+        attributes.setCanonicalPath(path);
 
         // set name based on path
+        path = attributes.getPath();
         if (!path.equals(Folder.PATH_SEPARATOR))
         {
             super.setName(path.substring(path.lastIndexOf(Folder.PATH_SEPARATOR) + 1));
@@ -111,6 +161,19 @@
         else
         {
             super.setName(Folder.PATH_SEPARATOR);
+        }
+
+        // reset parent if required
+        if (parent != null)
+        {
+            String parentPath = parent.getPath();
+            if ((parentPath.equals(Folder.PATH_SEPARATOR) &&
+                 (path.lastIndexOf(Folder.PATH_SEPARATOR) > 0)) ||
+                (!parentPath.equals(Folder.PATH_SEPARATOR) &&
+                 !parentPath.equals(path.substring(0, path.lastIndexOf(Folder.PATH_SEPARATOR)))))
+            {
+                setParent(null);
+            }
         }
     }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message