portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rwat...@apache.org
Subject svn commit: r892529 [2/4] - in /portals/jetspeed-2/portal/trunk: components/jetspeed-page-layout/src/main/java/org/apache/jetspeed/layout/impl/ components/jetspeed-page-layout/src/main/java/org/apache/jetspeed/om/page/impl/ components/jetspeed-page-man...
Date Sat, 19 Dec 2009 23:33:50 GMT
Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/impl/BaseFragmentElementImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/impl/BaseFragmentElementImpl.java?rev=892529&r1=892528&r2=892529&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/impl/BaseFragmentElementImpl.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/impl/BaseFragmentElementImpl.java Sat Dec 19 23:33:49 2009
@@ -20,11 +20,12 @@
 import java.security.Permission;
 import java.util.ArrayList;
 import java.util.List;
-import java.util.Map;
 
 import org.apache.jetspeed.om.page.BaseFragmentElement;
 import org.apache.jetspeed.om.page.BaseFragmentValidationListener;
+import org.apache.jetspeed.om.page.FragmentProperty;
 import org.apache.jetspeed.om.page.PageSecurity;
+import org.apache.jetspeed.page.impl.DatabasePageManager;
 import org.apache.jetspeed.page.impl.DatabasePageManagerUtils;
 
 /**
@@ -37,10 +38,10 @@
 {
     private String ojbConcreteClass = getClass().getName();
     private String fragmentId;
-    private String skin;
-    private String decorator;
-    private String state;
-    private String mode;
+    private String skinProperty;
+    private String decoratorProperty;
+    private String stateProperty;
+    private String modeProperty;
     private int layoutRowProperty = -1;
     private int layoutColumnProperty = -1;
     private String layoutSizesProperty;
@@ -49,13 +50,9 @@
     private float layoutZProperty = -1.0F;
     private float layoutWidthProperty = -1.0F;
     private float layoutHeightProperty = -1.0F;
-    private String extendedPropertyName1;
-    private String extendedPropertyValue1;
-    private String extendedPropertyName2;
-    private String extendedPropertyValue2;
     private List preferences;
 
-    private FragmentPropertyMap propertiesMap;
+    private FragmentPropertyList fragmentProperties;
     private FragmentPreferenceList fragmentPreferences;
     private BaseFragmentsElementImpl baseFragmentsElement;
 
@@ -88,7 +85,7 @@
      *
      * @return owning base fragments implementation
      */
-    BaseFragmentsElementImpl getBaseFragmentsElement()
+    public BaseFragmentsElementImpl getBaseFragmentsElement()
     {
         return baseFragmentsElement;
     }
@@ -173,254 +170,14 @@
         return matchedFragments;
     }
 
-    /**
-     * getPropertyMemberKeys
-     *
-     * Get valid explicit property member keys.
-     *
-     * @return list of property member keys with values
-     */
-    List getPropertyMemberKeys()
-    {
-        List keys = DatabasePageManagerUtils.createList();
-        if (layoutRowProperty >= 0)
-        {
-            keys.add(ROW_PROPERTY_NAME);
-        }
-        if (layoutColumnProperty >= 0)
-        {
-            keys.add(COLUMN_PROPERTY_NAME);
-        }
-        if (layoutSizesProperty != null)
-        {
-            keys.add(SIZES_PROPERTY_NAME);
-        }
-        if (layoutXProperty >= 0.0F)
-        {
-            keys.add(X_PROPERTY_NAME);
-        }
-        if (layoutYProperty >= 0.0F)
-        {
-            keys.add(Y_PROPERTY_NAME);
-        }
-        if (layoutZProperty >= 0.0F)
-        {
-            keys.add(Z_PROPERTY_NAME);
-        }
-        if (layoutWidthProperty >= 0.0F)
-        {
-            keys.add(WIDTH_PROPERTY_NAME);
-        }
-        if (layoutHeightProperty >= 0.0F)
-        {
-            keys.add(HEIGHT_PROPERTY_NAME);
-        }
-        if ((extendedPropertyName1 != null) && (extendedPropertyValue1 != null))
-        {
-            keys.add(extendedPropertyName1);
-        }
-        if ((extendedPropertyName2 != null) && (extendedPropertyValue2 != null))
-        {
-            keys.add(extendedPropertyName2);
-        }
-        return keys;
-    }
-
-    /**
-     * getPropertyMember
-     *
-     * Get explicit property member.
-     *
-     * @param key property name
-     * @return property setting
-     */
-    String getPropertyMember(String key)
-    {
-        // set fragment explicit property member
-        if (key.equals(ROW_PROPERTY_NAME))
-        {
-            if (layoutRowProperty >= 0)
-            {
-                return String.valueOf(layoutRowProperty);
-            }
-        }
-        else if (key.equals(COLUMN_PROPERTY_NAME))
-        {
-            if (layoutColumnProperty >= 0)
-            {
-                return String.valueOf(layoutColumnProperty);
-            }
-        }
-        else if (key.equals(SIZES_PROPERTY_NAME))
-        {
-            return layoutSizesProperty;
-        }
-        else if (key.equals(X_PROPERTY_NAME))
-        {
-            if (layoutXProperty >= 0.0F)
-            {
-                return String.valueOf(layoutXProperty);
-            }
-        }
-        else if (key.equals(Y_PROPERTY_NAME))
-        {
-            if (layoutYProperty >= 0.0F)
-            {
-                return String.valueOf(layoutYProperty);
-            }
-        }
-        else if (key.equals(Z_PROPERTY_NAME))
-        {
-            if (layoutZProperty >= 0.0F)
-            {
-                return String.valueOf(layoutZProperty);
-            }
-        }
-        else if (key.equals(WIDTH_PROPERTY_NAME))
-        {
-            if (layoutWidthProperty >= 0.0F)
-            {
-                return String.valueOf(layoutWidthProperty);
-            }
-        }
-        else if (key.equals(HEIGHT_PROPERTY_NAME))
-        {
-            if (layoutHeightProperty >= 0.0F)
-            {
-                return String.valueOf(layoutHeightProperty);
-            }
-        }
-        else if (key.equals(extendedPropertyName1))
-        {
-            return extendedPropertyValue1;
-        }
-        else if (key.equals(extendedPropertyName2))
-        {
-            return extendedPropertyValue2;
-        }
-        return null;
-    }
-
-    /**
-     * setPropertyMember
-     *
-     * Set explicit property member.
-     *
-     * @param key property name
-     * @param value property setting
-     */
-    void setPropertyMember(String key, String value)
-    {
-        // set fragment explicit property member
-        if (key.equals(ROW_PROPERTY_NAME))
-        {
-            layoutRowProperty = Integer.parseInt(value);
-        }
-        else if (key.equals(COLUMN_PROPERTY_NAME))
-        {
-            layoutColumnProperty = Integer.parseInt(value);
-        }
-        else if (key.equals(SIZES_PROPERTY_NAME))
-        {
-            layoutSizesProperty = value;
-        }
-        else if (key.equals(X_PROPERTY_NAME))
-        {
-            layoutXProperty = Float.parseFloat(value);
-        }
-        else if (key.equals(Y_PROPERTY_NAME))
-        {
-            layoutYProperty = Float.parseFloat(value);
-        }
-        else if (key.equals(Z_PROPERTY_NAME))
-        {
-            layoutZProperty = Float.parseFloat(value);
-        }
-        else if (key.equals(WIDTH_PROPERTY_NAME))
-        {
-            layoutWidthProperty = Float.parseFloat(value);
-        }
-        else if (key.equals(HEIGHT_PROPERTY_NAME))
-        {
-            layoutHeightProperty = Float.parseFloat(value);
-        }
-        else if (key.equals(extendedPropertyName1))
-        {
-            extendedPropertyValue1 = value;
-        }
-        else if (key.equals(extendedPropertyName2))
-        {
-            extendedPropertyValue2 = value;
-        }
-        else if (extendedPropertyName1 == null)
-        {
-            extendedPropertyName1 = key;
-            extendedPropertyValue1 = value;
-        }
-        else if (extendedPropertyName2 == null)
-        {
-            extendedPropertyName2 = key;
-            extendedPropertyValue2 = value;
-        }
-        else
-        {
-            throw new RuntimeException("Unable to set fragment property " + key + ", extended properties already used.");
-        }
-    }
-
-    /**
-     * clearPropertyMember
-     *
-     * Clear explicit property member.
-     *
-     * @param key property name
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.page.impl.BaseElementImpl#getPageManager()
      */
-    void clearPropertyMember(String key)
+    public DatabasePageManager getPageManager()
     {
-        if (key.equals(ROW_PROPERTY_NAME))
-        {
-            layoutRowProperty = -1;
-        }
-        else if (key.equals(COLUMN_PROPERTY_NAME))
-        {
-            layoutColumnProperty = -1;
-        }
-        else if (key.equals(SIZES_PROPERTY_NAME))
-        {
-            layoutSizesProperty = null;
-        }
-        else if (key.equals(X_PROPERTY_NAME))
-        {
-            layoutXProperty = -1.0F;
-        }
-        else if (key.equals(Y_PROPERTY_NAME))
-        {
-            layoutYProperty = -1.0F;
-        }
-        else if (key.equals(Z_PROPERTY_NAME))
-        {
-            layoutZProperty = -1.0F;
-        }
-        else if (key.equals(WIDTH_PROPERTY_NAME))
-        {
-            layoutWidthProperty = -1.0F;
-        }
-        else if (key.equals(HEIGHT_PROPERTY_NAME))
-        {
-            layoutHeightProperty = -1.0F;
-        }
-        else if (key.equals(extendedPropertyName1))
-        {
-            extendedPropertyName1 = null;
-            extendedPropertyValue1 = null;
-        }
-        else if (key.equals(extendedPropertyName2))
-        {
-            extendedPropertyName2 = null;
-            extendedPropertyValue2 = null;
-        }
-    }
-
+        return ((baseFragmentsElement != null) ? baseFragmentsElement.getPageManager() : null);
+    }    
+    
     /* (non-Javadoc)
      * @see org.apache.jetspeed.om.page.impl.BaseElementImpl#getEffectivePageSecurity()
      */
@@ -494,7 +251,8 @@
      */
     public String getSkin()
     {
-        return skin;
+        // get standard property
+        return getProperty(SKIN_PROPERTY_NAME);
     }
     
     /* (non-Javadoc)
@@ -502,7 +260,17 @@
      */
     public void setSkin(String skinName)
     {
-        this.skin = skinName;
+        // set standard global property
+        this.skinProperty = skinName;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.page.BaseFragmentElement#setSkin(java.lang.String, java.lang.String, java.lang.String)
+     */
+    public void setSkin(String propScope, String propScopeValue, String skinName)
+    {
+        // set standard property
+        setProperty(SKIN_PROPERTY_NAME, propScope, propScopeValue, skinName);
     }
 
     /* (non-Javadoc)
@@ -510,7 +278,8 @@
      */
     public String getDecorator()
     {
-        return decorator;
+        // get standard property
+        return getProperty(DECORATOR_PROPERTY_NAME);
     }
     
     /* (non-Javadoc)
@@ -518,7 +287,17 @@
      */
     public void setDecorator(String decoratorName)
     {
-        this.decorator = decoratorName;
+        // set standard global property
+        this.decoratorProperty = decoratorName;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.page.BaseFragmentElement#setDecorator(java.lang.String, java.lang.String, java.lang.String)
+     */
+    public void setDecorator(String propScope, String propScopeValue, String decoratorName)
+    {
+        // set standard property
+        setProperty(DECORATOR_PROPERTY_NAME, propScope, propScopeValue, decoratorName);
     }
 
     /* (non-Javadoc)
@@ -526,7 +305,8 @@
      */
     public String getState()
     {
-        return state;
+        // get standard property
+        return getProperty(STATE_PROPERTY_NAME);
     }
     
     /* (non-Javadoc)
@@ -534,7 +314,17 @@
      */
     public void setState(String state)
     {
-        this.state = state;
+        // set standard global property
+        this.stateProperty = state;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.page.BaseFragmentElement#setState(java.lang.String, java.lang.String, java.lang.String)
+     */
+    public void setState(String propScope, String propScopeValue, String state)
+    {
+        // set standard property
+        setProperty(STATE_PROPERTY_NAME, propScope, propScopeValue, state);
     }
 
     /* (non-Javadoc)
@@ -542,7 +332,8 @@
      */
     public String getMode()
     {
-        return mode;
+        // get standard property
+        return getProperty(MODE_PROPERTY_NAME);
     }
     
     /* (non-Javadoc)
@@ -550,7 +341,17 @@
      */
     public void setMode(String mode)
     {
-        this.mode = mode;
+        // set standard global property
+        this.modeProperty = mode;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.page.BaseFragmentElement#setMode(java.lang.String, java.lang.String, java.lang.String)
+     */
+    public void setMode(String propScope, String propScopeValue, String mode)
+    {
+        // set standard property
+        setProperty(MODE_PROPERTY_NAME, propScope, propScopeValue, mode);
     }
 
     /* (non-Javadoc)
@@ -558,7 +359,143 @@
      */
     public String getProperty(String propName)
     {
-        return (String)getProperties().get(propName);
+        // scoped property values
+        String [] userValue = new String[1];
+        String [] groupValue = new String[1];
+        String [] roleValue = new String[1];
+        String [] globalValue = new String[1];
+
+        // get property values from properties list
+        FragmentPropertyImpl.getFragmentProperty(propName, getProperties(), userValue, groupValue, roleValue, globalValue);
+
+        // override global property value members if not found in scoped properties
+        if ((userValue[0] == null) && (groupValue[0] == null) && (roleValue[0] == null))
+        {
+            if (SKIN_PROPERTY_NAME.equals(propName))
+            {
+                globalValue[0] = skinProperty;
+            }
+            else if (DECORATOR_PROPERTY_NAME.equals(propName))
+            {
+                globalValue[0] = decoratorProperty;
+            }
+            else if (STATE_PROPERTY_NAME.equals(propName))
+            {
+                globalValue[0] = stateProperty;
+            }
+            else if (MODE_PROPERTY_NAME.equals(propName))
+            {
+                globalValue[0] = modeProperty;
+            }
+            else if (ROW_PROPERTY_NAME.equals(propName))
+            {
+                globalValue[0] = ((layoutRowProperty >= 0) ? Integer.toString(layoutRowProperty) : null);
+            }
+            else if (COLUMN_PROPERTY_NAME.equals(propName))
+            {
+                globalValue[0] = ((layoutColumnProperty >= 0) ? Integer.toString(layoutColumnProperty) : null);
+            }
+            else if (SIZES_PROPERTY_NAME.equals(propName))
+            {
+                globalValue[0] = layoutSizesProperty;
+            }
+            else if (X_PROPERTY_NAME.equals(propName))
+            {
+                globalValue[0] = ((layoutXProperty >= 0) ? Float.toString(layoutXProperty) : null);
+            }
+            else if (Y_PROPERTY_NAME.equals(propName))
+            {
+                globalValue[0] = ((layoutYProperty >= 0) ? Float.toString(layoutYProperty) : null);
+            }
+            else if (Z_PROPERTY_NAME.equals(propName))
+            {
+                globalValue[0] = ((layoutZProperty >= 0) ? Float.toString(layoutZProperty) : null);
+            }
+            else if (WIDTH_PROPERTY_NAME.equals(propName))
+            {
+                globalValue[0] = ((layoutWidthProperty >= 0) ? Float.toString(layoutWidthProperty) : null);
+            }
+            else if (HEIGHT_PROPERTY_NAME.equals(propName))
+            {
+                globalValue[0] = ((layoutHeightProperty >= 0) ? Float.toString(layoutHeightProperty) : null);
+            }
+        }
+
+        // return most specifically scoped property value
+        return ((userValue[0] != null) ? userValue[0] : ((groupValue[0] != null) ? groupValue[0] : ((roleValue[0] != null) ? roleValue[0] : globalValue[0])));
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.page.BaseFragmentElement#getProperty(java.lang.String, java.lang.String, java.lang.String)
+     */
+    public String getProperty(String propName, String propScope, String propScopeValue)
+    {
+        // lookup global property value members
+        if (propScope == null)
+        {
+            if (SKIN_PROPERTY_NAME.equals(propName))
+            {
+                return skinProperty;
+            }
+            else if (DECORATOR_PROPERTY_NAME.equals(propName))
+            {
+                return decoratorProperty;
+            }
+            else if (STATE_PROPERTY_NAME.equals(propName))
+            {
+                return stateProperty;
+            }
+            else if (MODE_PROPERTY_NAME.equals(propName))
+            {
+                return modeProperty;
+            }
+            else if (ROW_PROPERTY_NAME.equals(propName))
+            {
+                return ((layoutRowProperty >= 0) ? Integer.toString(layoutRowProperty) : null);
+            }
+            else if (COLUMN_PROPERTY_NAME.equals(propName))
+            {
+                return ((layoutColumnProperty >= 0) ? Integer.toString(layoutColumnProperty) : null);
+            }
+            else if (SIZES_PROPERTY_NAME.equals(propName))
+            {
+                return layoutSizesProperty;
+            }
+            else if (X_PROPERTY_NAME.equals(propName))
+            {
+                return ((layoutXProperty >= 0) ? Float.toString(layoutXProperty) : null);
+            }
+            else if (Y_PROPERTY_NAME.equals(propName))
+            {
+                return ((layoutYProperty >= 0) ? Float.toString(layoutYProperty) : null);
+            }
+            else if (Z_PROPERTY_NAME.equals(propName))
+            {
+                return ((layoutZProperty >= 0) ? Float.toString(layoutZProperty) : null);
+            }
+            else if (WIDTH_PROPERTY_NAME.equals(propName))
+            {
+                return ((layoutWidthProperty >= 0) ? Float.toString(layoutWidthProperty) : null);
+            }
+            else if (HEIGHT_PROPERTY_NAME.equals(propName))
+            {
+                return ((layoutHeightProperty >= 0) ? Float.toString(layoutHeightProperty) : null);
+            }
+        }
+
+        // default user scope value
+        if ((propScope != null) && propScope.equals(USER_PROPERTY_SCOPE) && (propScopeValue == null))
+        {
+            propScopeValue = FragmentPropertyImpl.getCurrentUserScopeValue();
+        }
+
+        // find specified scoped property value
+        FragmentProperty fragmentProperty = FragmentPropertyImpl.findFragmentProperty(propName, propScope, propScopeValue, getProperties());
+        if (fragmentProperty != null)
+        {
+            return fragmentProperty.getValue();
+        }
+        return null;
     }
     
     /* (non-Javadoc)
@@ -566,7 +503,7 @@
      */
     public int getIntProperty(String propName)
     {
-        String propValue = (String)getProperties().get(propName);
+        String propValue = getProperty(propName);
         if (propValue != null)
         {
             return Integer.parseInt(propValue);
@@ -575,11 +512,44 @@
     }
     
     /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.page.BaseFragmentElement#getIntProperty(java.lang.String, java.lang.String, java.lang.String)
+     */
+    public int getIntProperty(String propName, String propScope, String propScopeValue)
+    {
+        // lookup global property value members
+        if (propScope == null)
+        {
+            if (ROW_PROPERTY_NAME.equals(propName))
+            {
+                return layoutRowProperty;
+            }
+            else if (COLUMN_PROPERTY_NAME.equals(propName))
+            {
+                return layoutColumnProperty;
+            }
+        }
+
+        // default user scope value
+        if ((propScope != null) && propScope.equals(USER_PROPERTY_SCOPE) && (propScopeValue == null))
+        {
+            propScopeValue = FragmentPropertyImpl.getCurrentUserScopeValue();
+        }
+
+        // find specified scoped property value
+        FragmentProperty fragmentProperty = FragmentPropertyImpl.findFragmentProperty(propName, propScope, propScopeValue, getProperties());
+        if (fragmentProperty != null)
+        {
+            return Integer.parseInt(fragmentProperty.getValue());
+        }
+        return -1;
+    }
+    
+    /* (non-Javadoc)
      * @see org.apache.jetspeed.om.page.BaseFragmentElement#getFloatProperty(java.lang.String)
      */
     public float getFloatProperty(String propName)
     {
-        String propValue = (String)getProperties().get(propName);
+        String propValue = getProperty(propName);
         if (propValue != null)
         {
             return Float.parseFloat(propValue);
@@ -588,16 +558,261 @@
     }
     
     /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.page.BaseFragmentElement#getFloatProperty(java.lang.String, java.lang.String, java.lang.String)
+     */
+    public float getFloatProperty(String propName, String propScope, String propScopeValue)
+    {
+        // lookup global property value members
+        if (propScope == null)
+        {
+            if (X_PROPERTY_NAME.equals(propName))
+            {
+                return layoutXProperty;
+            }
+            else if (Y_PROPERTY_NAME.equals(propName))
+            {
+                return layoutYProperty;
+            }
+            else if (Z_PROPERTY_NAME.equals(propName))
+            {
+                return layoutZProperty;
+            }
+            else if (WIDTH_PROPERTY_NAME.equals(propName))
+            {
+                return layoutWidthProperty;
+            }
+            else if (HEIGHT_PROPERTY_NAME.equals(propName))
+            {
+                return layoutHeightProperty;
+            }
+        }
+
+        // default user scope value
+        if ((propScope != null) && propScope.equals(USER_PROPERTY_SCOPE) && (propScopeValue == null))
+        {
+            propScopeValue = FragmentPropertyImpl.getCurrentUserScopeValue();
+        }
+
+        // find specified scoped property value
+        FragmentProperty fragmentProperty = FragmentPropertyImpl.findFragmentProperty(propName, propScope, propScopeValue, getProperties());
+        if (fragmentProperty != null)
+        {
+            return Float.parseFloat(fragmentProperty.getValue());
+        }
+        return -1.0F;
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.page.BaseFragmentElement#setProperty(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
+     */
+    public void setProperty(String propName, String propScope, String propScopeValue, String propValue)
+    {
+        // set global property value members
+        if (propScope == null)
+        {
+            if (SKIN_PROPERTY_NAME.equals(propName))
+            {
+                skinProperty = propValue;
+                return;
+            }
+            else if (DECORATOR_PROPERTY_NAME.equals(propName))
+            {
+                decoratorProperty = propValue;
+                return;
+            }
+            else if (STATE_PROPERTY_NAME.equals(propName))
+            {
+                stateProperty = propValue;
+                return;
+            }
+            else if (MODE_PROPERTY_NAME.equals(propName))
+            {
+                modeProperty = propValue;
+                return;
+            }
+            else if (ROW_PROPERTY_NAME.equals(propName))
+            {
+                layoutRowProperty = ((propValue != null) ? Integer.parseInt(propValue) : -1);
+                return;
+            }
+            else if (COLUMN_PROPERTY_NAME.equals(propName))
+            {
+                layoutColumnProperty = ((propValue != null) ? Integer.parseInt(propValue) : -1);
+                return;
+            }
+            else if (SIZES_PROPERTY_NAME.equals(propName))
+            {
+                layoutSizesProperty = propValue;
+                return;
+            }
+            else if (X_PROPERTY_NAME.equals(propName))
+            {
+                layoutXProperty = ((propValue != null) ? Integer.parseInt(propValue) : -1.0F);
+                return;
+            }
+            else if (Y_PROPERTY_NAME.equals(propName))
+            {
+                layoutYProperty = ((propValue != null) ? Integer.parseInt(propValue) : -1.0F);
+                return;
+            }
+            else if (Z_PROPERTY_NAME.equals(propName))
+            {
+                layoutZProperty = ((propValue != null) ? Integer.parseInt(propValue) : -1.0F);
+                return;
+            }
+            else if (WIDTH_PROPERTY_NAME.equals(propName))
+            {
+                layoutWidthProperty = ((propValue != null) ? Integer.parseInt(propValue) : -1.0F);
+                return;
+            }
+            else if (HEIGHT_PROPERTY_NAME.equals(propName))
+            {
+                layoutHeightProperty = ((propValue != null) ? Integer.parseInt(propValue) : -1.0F);
+                return;
+            }
+        }
+        
+        // default user scope value
+        if ((propScope != null) && propScope.equals(USER_PROPERTY_SCOPE) && (propScopeValue == null))
+        {
+            propScopeValue = FragmentPropertyImpl.getCurrentUserScopeValue();
+        }
+
+        // find specified scoped property value
+        FragmentProperty fragmentProperty = FragmentPropertyImpl.findFragmentProperty(propName, propScope, propScopeValue, getProperties());
+
+        // add, set, or remove property
+        if (propValue != null)
+        {
+            if (fragmentProperty == null)
+            {
+                fragmentProperty = new FragmentPropertyImpl();
+                fragmentProperty.setName(propName);
+                fragmentProperty.setScope(propScope);
+                fragmentProperty.setScopeValue(propScopeValue);
+                fragmentProperty.setValue(propValue);
+                getProperties().add(fragmentProperty);
+            }
+            else
+            {
+                fragmentProperty.setValue(propValue);
+            }
+        }
+        else if (fragmentProperty != null)
+        {
+            getProperties().remove(fragmentProperty);
+        }
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.page.BaseFragmentElement#setProperty(java.lang.String, java.lang.String, java.lang.String, int)
+     */
+    public void setProperty(String propName, String propScope, String propScopeValue, int propValue)
+    {
+        // set global property value members
+        if (propScope == null)
+        {
+            if (ROW_PROPERTY_NAME.equals(propName))
+            {
+                layoutRowProperty = propValue;
+                return;
+            }
+            else if (COLUMN_PROPERTY_NAME.equals(propName))
+            {
+                layoutColumnProperty = propValue;
+                return;
+            }
+        }
+
+        // update scoped property
+        setProperty(propName, propScope, propScopeValue, Integer.toString(propValue));
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.page.BaseFragmentElement#setProperty(java.lang.String, java.lang.String, java.lang.String, float)
+     */
+    public void setProperty(String propName, String propScope, String propScopeValue, float propValue)
+    {
+        // set global property value members
+        if (propScope == null)
+        {
+            if (X_PROPERTY_NAME.equals(propName))
+            {
+                layoutXProperty = propValue;
+                return;
+            }
+            else if (Y_PROPERTY_NAME.equals(propName))
+            {
+                layoutYProperty = propValue;
+                return;
+            }
+            else if (Z_PROPERTY_NAME.equals(propName))
+            {
+                layoutZProperty = propValue;
+                return;
+            }
+            else if (WIDTH_PROPERTY_NAME.equals(propName))
+            {
+                layoutWidthProperty = propValue;
+                return;
+            }
+            else if (HEIGHT_PROPERTY_NAME.equals(propName))
+            {
+                layoutHeightProperty = propValue;
+                return;
+            }
+        }
+        
+        // update scoped property
+        setProperty(propName, propScope, propScopeValue, Float.toString(propValue));
+    }
+    
+    /* (non-Javadoc)
      * @see org.apache.jetspeed.om.page.BaseFragmentElement#getProperties()
      */
-    public Map getProperties()
+    public List getProperties()
+    {
+        // get properties for this fragment from page manager
+        // if fragment is not newly constructed
+        if (getIdentity() != 0)
+        {
+            fragmentProperties = null;
+            DatabasePageManager pageManager = getPageManager();
+            if (pageManager != null)
+            {
+                FragmentPropertyList properties = pageManager.getFragmentPropertiesList(this);
+                if (properties != null)
+                {
+                    return properties;
+                }
+            }
+        }
+        if (fragmentProperties == null)
+        {
+            // create properties list place holder
+            fragmentProperties = new FragmentPropertyList(this);
+        }
+        return fragmentProperties;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.page.BaseFragmentElement#setProperties(java.util.List)
+     */
+    public void setProperties(List properties)
     {
-        // initialize and return writable properties map
-        if (propertiesMap == null)
+        // set properties by replacing existing
+        // entries with new elements if new collection
+        // is specified
+        List fragmentProperties = getProperties();
+        if (properties != fragmentProperties)
         {
-            propertiesMap = new FragmentPropertyMap(this);
+            // replace all preferences
+            fragmentProperties.clear();
+            if (properties != null)
+            {
+                fragmentProperties.addAll(properties);
+            }
         }
-        return propertiesMap;
     }
     
     /* (non-Javadoc)
@@ -614,15 +829,17 @@
      */
     public void setLayoutRow(int row)
     {
-        // set standard int property
-        if (row >= 0)
-        {
-            getProperties().put(ROW_PROPERTY_NAME, String.valueOf(row));
-        }
-        else
-        {
-            getProperties().remove(ROW_PROPERTY_NAME);
-        }
+        // set standard global int property
+        layoutRowProperty = row;
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.page.BaseFragmentElement#setLayoutRow(java.lang.String, java.lang.String, int)
+     */
+    public void setLayoutRow(String scope, String scopeValue, int row)
+    {
+        // set standard global int property
+        setProperty(ROW_PROPERTY_NAME, scope, scopeValue, row);
     }
     
     /* (non-Javadoc)
@@ -639,15 +856,17 @@
      */
     public void setLayoutColumn(int column)
     {
-        // set standard int property
-        if (column >= 0)
-        {
-            getProperties().put(COLUMN_PROPERTY_NAME, String.valueOf(column));
-        }
-        else
-        {
-            getProperties().remove(COLUMN_PROPERTY_NAME);
-        }
+        // set standard global int property
+        layoutColumnProperty = column;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.page.BaseFragmentElement#setLayoutColumn(java.lang.String, java.lang.String, int)
+     */
+    public void setLayoutColumn(String scope, String scopeValue, int column)
+    {
+        // set standard global int property
+        setProperty(COLUMN_PROPERTY_NAME, scope, scopeValue, column);
     }
 
     /* (non-Javadoc)
@@ -664,15 +883,17 @@
      */
     public void setLayoutSizes(String sizes)
     {
-        // set standard string property
-        if (sizes != null)
-        {
-            getProperties().put(SIZES_PROPERTY_NAME, sizes);
-        }
-        else
-        {
-            getProperties().remove(SIZES_PROPERTY_NAME);
-        }
+        // set standard global string property
+        layoutSizesProperty = sizes;
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.page.BaseFragmentElement#setLayoutSizes(java.lang.String, java.lang.String, java.lang.String)
+     */
+    public void setLayoutSizes(String scope, String scopeValue, String sizes)
+    {
+        // set standard global string property
+        setProperty(SIZES_PROPERTY_NAME, scope, scopeValue, sizes);
     }
     
     /* (non-Javadoc)
@@ -689,15 +910,17 @@
      */
     public void setLayoutX(float x)
     {
-        // set standard float property
-        if (x >= 0.0F)
-        {
-            getProperties().put(X_PROPERTY_NAME, String.valueOf(x));
-        }
-        else
-        {
-            getProperties().remove(X_PROPERTY_NAME);
-        }
+        // set standard global float property
+        layoutXProperty = x;
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.page.BaseFragmentElement#setLayoutX(java.lang.String, java.lang.String, float)
+     */
+    public void setLayoutX(String scope, String scopeValue, float x)
+    {
+        // set standard global float property
+        setProperty(X_PROPERTY_NAME, scope, scopeValue, x);
     }
     
     /* (non-Javadoc)
@@ -714,15 +937,17 @@
      */
     public void setLayoutY(float y)
     {
-        // set standard float property
-        if (y >= 0.0F)
-        {
-            getProperties().put(Y_PROPERTY_NAME, String.valueOf(y));
-        }
-        else
-        {
-            getProperties().remove(Y_PROPERTY_NAME);
-        }
+        // set standard global float property
+        layoutYProperty = y;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.page.BaseFragmentElement#setLayoutY(java.lang.String, java.lang.String, float)
+     */
+    public void setLayoutY(String scope, String scopeValue, float y)
+    {
+        // set standard global float property
+        setProperty(Y_PROPERTY_NAME, scope, scopeValue, y);
     }
 
     /* (non-Javadoc)
@@ -739,15 +964,17 @@
      */
     public void setLayoutZ(float z)
     {
-        // set standard float property
-        if (z >= 0.0F)
-        {
-            getProperties().put(Z_PROPERTY_NAME, String.valueOf(z));
-        }
-        else
-        {
-            getProperties().remove(Z_PROPERTY_NAME);
-        }
+        // set standard global float property
+        layoutZProperty = z;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.page.BaseFragmentElement#setLayoutZ(java.lang.String, java.lang.String, float)
+     */
+    public void setLayoutZ(String scope, String scopeValue, float z)
+    {
+        // set standard global float property
+        setProperty(Z_PROPERTY_NAME, scope, scopeValue, z);
     }
 
     /* (non-Javadoc)
@@ -764,15 +991,17 @@
      */
     public void setLayoutWidth(float width)
     {
-        // set standard float property
-        if (width >= 0.0F)
-        {
-            getProperties().put(WIDTH_PROPERTY_NAME, String.valueOf(width));
-        }
-        else
-        {
-            getProperties().remove(WIDTH_PROPERTY_NAME);
-        }
+        // set standard global float property
+        layoutWidthProperty = width;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.page.BaseFragmentElement#setLayoutWidth(java.lang.String, java.lang.String, float)
+     */
+    public void setLayoutWidth(String scope, String scopeValue, float width)
+    {
+        // set standard global float property
+        setProperty(WIDTH_PROPERTY_NAME, scope, scopeValue, width);
     }
 
     /* (non-Javadoc)
@@ -789,15 +1018,17 @@
      */
     public void setLayoutHeight(float height)
     {
-        // set standard float property
-        if (height >= 0.0F)
-        {
-            getProperties().put(HEIGHT_PROPERTY_NAME, String.valueOf(height));
-        }
-        else
-        {
-            getProperties().remove(HEIGHT_PROPERTY_NAME);
-        }
+        // set standard global float property
+        layoutHeightProperty = height;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.page.BaseFragmentElement#setLayoutHeight(java.lang.String, java.lang.String, float)
+     */
+    public void setLayoutHeight(String scope, String scopeValue, float height)
+    {
+        // set standard global float property
+        setProperty(HEIGHT_PROPERTY_NAME, scope, scopeValue, height);
     }
 
     /* (non-Javadoc)

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/impl/BaseFragmentsElementImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/impl/BaseFragmentsElementImpl.java?rev=892529&r1=892528&r2=892529&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/impl/BaseFragmentsElementImpl.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/impl/BaseFragmentsElementImpl.java Sat Dec 19 23:33:49 2009
@@ -147,8 +147,7 @@
                 reuseFragment.setDecorator(baseFragmentImpl.getDecorator());
                 reuseFragment.setState(baseFragmentImpl.getState());
                 reuseFragment.setSecurityConstraints(baseFragmentImpl.getSecurityConstraints());
-                reuseFragment.getProperties().clear();
-                reuseFragment.getProperties().putAll(baseFragmentImpl.getProperties());
+                reuseFragment.setProperties(baseFragmentImpl.getProperties());
                 reuseFragment.setPreferences(baseFragmentImpl.getPreferences());
             }
             this.fragment.add(addFragment);

Added: portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/impl/FragmentPropertyImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/impl/FragmentPropertyImpl.java?rev=892529&view=auto
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/impl/FragmentPropertyImpl.java (added)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/impl/FragmentPropertyImpl.java Sat Dec 19 23:33:49 2009
@@ -0,0 +1,168 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.om.page.impl;
+
+import org.apache.jetspeed.om.page.BaseFragmentPropertyImpl;
+import org.apache.jetspeed.om.page.FragmentProperty;
+
+/**
+ * FragmentPropertyImpl
+ *
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id$
+ */
+public class FragmentPropertyImpl extends BaseFragmentPropertyImpl implements FragmentProperty
+{
+    private int id;
+    private String name;
+    private String scope;
+    private String scopeValue;
+    private String value;
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.page.FragmentProperty#getName()
+     */
+    public String getName()
+    {
+        return name;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.page.FragmentProperty#getScope()
+     */
+    public String getScope()
+    {
+        return scope;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.page.FragmentProperty#getScopeValue()
+     */
+    public String getScopeValue()
+    {
+        return scopeValue;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.page.FragmentProperty#getValue()
+     */
+    public String getValue()
+    {
+        return value;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.page.FragmentProperty#setName(java.lang.String)
+     */
+    public void setName(String name)
+    {
+        this.name = name;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.page.FragmentProperty#setScope(java.lang.String)
+     */
+    public void setScope(String scope)
+    {
+        if ((scope != null) && !scope.equals(USER_PROPERTY_SCOPE) && 
+            (!GROUP_AND_ROLE_PROPERTY_SCOPES_ENABLED || (!scope.equals(GROUP_PROPERTY_SCOPE) && !scope.equals(ROLE_PROPERTY_SCOPE))))
+        {
+            throw new IllegalArgumentException("Fragment property scope "+scope+" invalid or not enabled");
+        }
+        this.scope = scope;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.page.FragmentProperty#setScopeValue(java.lang.String)
+     */
+    public void setScopeValue(String scopeValue)
+    {
+        this.scopeValue = scopeValue;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.page.FragmentProperty#setValue(java.lang.String)
+     */
+    public void setValue(String value)
+    {
+        this.value = value;
+    }
+    
+    /* (non-Javadoc)
+     * @see java.lang.Object#equals(java.lang.Object)
+     */
+    public boolean equals(Object o)
+    {
+        if (o instanceof FragmentPropertyImpl)
+        {
+            FragmentPropertyImpl other = (FragmentPropertyImpl)o;
+            if (this == other)
+            {
+                return true;
+            }
+            if ((id != 0) || (other.id != 0))
+            {
+                return (id == other.id);
+            }
+            return ((((name != null) && name.equals(other.name)) || ((name == null) && (other.name == null))) &&
+                    (((scope != null) && scope.equals(other.scope)) || ((scope == null) && (other.scope == null))) &&
+                    (((scopeValue != null) && scopeValue.equals(other.scopeValue)) || ((scopeValue == null) && (other.scopeValue == null))) &&
+                    (((value != null) && value.equals(other.value)) || ((value == null) && (other.value == null))));
+        }
+        return false;
+    }
+
+    /* (non-Javadoc)
+     * @see java.lang.Object#hashCode()
+     */
+    public int hashCode()
+    {
+        if (id != 0)
+        {
+            return id;
+        }
+        int hashcode = 0;
+        hashcode *= ((name != null) ? name.hashCode() : 0);
+        hashcode *= ((scope != null) ? scope.hashCode() : 0);
+        hashcode *= ((scopeValue != null) ? scopeValue.hashCode() : 0);
+        hashcode *= ((value != null) ? value.hashCode() : 0);
+        return hashcode;
+    }
+    
+    /**
+     * Get implementation identity key.
+     * 
+     * @return identity key.
+     */
+    public int getIdentity()
+    {
+        return id;
+    }
+
+    /**
+     * Test whether property object matches.
+     * 
+     * @param other match candidate
+     * @return match flag
+     */
+    boolean match(FragmentPropertyImpl other)
+    {
+        return ((((name != null) && name.equals(other.name)) || ((name == null) && (other.name == null))) &&
+                (((scope != null) && scope.equals(other.scope)) || ((scope == null) && (other.scope == null))) &&
+                (((scopeValue != null) && scopeValue.equals(other.scopeValue)) || ((scopeValue == null) && (other.scopeValue == null))));        
+    }
+}

Added: portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/impl/FragmentPropertyList.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/impl/FragmentPropertyList.java?rev=892529&view=auto
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/impl/FragmentPropertyList.java (added)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/impl/FragmentPropertyList.java Sat Dec 19 23:33:49 2009
@@ -0,0 +1,204 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.om.page.impl;
+
+import java.util.AbstractList;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.jetspeed.om.page.BaseFragmentElement;;
+
+/**
+ * FragmentPropertyList
+ *
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id$
+ */
+public class FragmentPropertyList extends AbstractList
+{
+    private BaseFragmentElement fragment;
+
+    private List properties;
+    private List removedProperties;
+
+    public FragmentPropertyList(BaseFragmentElement fragment)
+    {
+        super();
+        this.properties = new ArrayList();
+        this.fragment = fragment;
+    }
+
+    /* (non-Javadoc)
+     * @see java.util.List#add(int,java.lang.Object)
+     */
+    public void add(int index, Object element)
+    {
+        // implement for modifiable AbstractList:
+        FragmentPropertyImpl add = (FragmentPropertyImpl)element;
+        if ((add.getName() == null) || (add.getValue() == null))
+        {
+            throw new IllegalArgumentException("Property name and value must be set.");
+        }
+        // find existing matching property
+        FragmentPropertyImpl addMatch = getMatchingProperty(add);
+        if (addMatch != null)
+        {
+            // modify existing property
+            addMatch.setValue(add.getValue());
+        }
+        else
+        {
+            // try to recycle removed properties
+            add = recycleProperty(add);
+            // add new property
+            properties.add(index, add);
+        }
+    }
+
+    /* (non-Javadoc)
+     * @see java.util.List#get(int)
+     */
+    public Object get(int index)
+    {
+        // implement for modifiable AbstractList
+        return properties.get(index);
+    }
+
+    /* (non-Javadoc)
+     * @see java.util.List#remove(int)
+     */
+    public Object remove(int index)
+    {
+        // implement for modifiable AbstractList:
+        // save removed element 
+        FragmentPropertyImpl removed = (FragmentPropertyImpl)properties.remove(index);
+        return removedProperty(removed);
+    }
+
+    /* (non-Javadoc)
+     * @see java.util.List#set(int,java.lang.Object)
+     */
+    public Object set(int index, Object element)
+    {
+        // implement for modifiable AbstractList:
+        FragmentPropertyImpl set = (FragmentPropertyImpl)element;
+        if ((set.getName() == null) || (set.getValue() == null))
+        {
+            throw new IllegalArgumentException("Property name and value must be set.");
+        }
+        // find existing matching property
+        FragmentPropertyImpl setMatch = getMatchingProperty(set);
+        if (setMatch != null)
+        {
+            // modify existing property
+            setMatch.setValue(set.getValue());
+            // remove property if not matching
+            if (properties.get(index) != setMatch)
+            {
+                return remove(index);
+            }
+            return null;
+        }
+        else
+        {
+            // try to recycle removed properties
+            set = recycleProperty(set);
+            // replace property
+            FragmentPropertyImpl replaced = (FragmentPropertyImpl)properties.set(index, set);
+            return removedProperty(replaced);
+        }
+    }
+
+    /* (non-Javadoc)
+     * @see java.util.List#size()
+     */
+    public int size()
+    {
+        // implement for modifiable AbstractList
+        return properties.size();
+    }
+    
+    /**
+     * Get fragment property list owner.
+     * 
+     * @return fragment owner
+     */
+    public BaseFragmentElement getFragment()
+    {
+        return fragment;
+    }
+    
+    /**
+     * Find matching property.
+     * 
+     * @param match match property
+     * @return matching property
+     */
+    protected FragmentPropertyImpl getMatchingProperty(FragmentPropertyImpl match)
+    {
+        Iterator matchIter = properties.iterator();
+        while (matchIter.hasNext())
+        {
+            FragmentPropertyImpl test = (FragmentPropertyImpl)matchIter.next();
+            if (test.match(match))
+            {
+                return test;
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Recycle removed property.
+     * 
+     * @param original original property
+     * @return recycled or original property
+     */
+    protected FragmentPropertyImpl recycleProperty(FragmentPropertyImpl original)
+    {
+        if ((removedProperties != null) && !removedProperties.isEmpty())
+        {
+            FragmentPropertyImpl recycle = (FragmentPropertyImpl)removedProperties.remove(removedProperties.size()-1);
+            recycle.setName(original.getName());
+            recycle.setScope(original.getScope());
+            recycle.setScopeValue(original.getScopeValue());
+            recycle.setValue(original.getValue());
+            return recycle;
+        }
+        return original;
+    }
+
+    /**
+     * Track removed property.
+     * 
+     * @param removed removed property
+     * @return removed property
+     */
+    protected FragmentPropertyImpl removedProperty(FragmentPropertyImpl removed)
+    {
+        if ((removed != null) && (removed.getIdentity() != 0))
+        {
+            if (removedProperties == null)
+            {
+                removedProperties = new ArrayList();
+            }
+            removedProperties.add(removed);
+        }
+        return removed;
+    }
+}

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/psml/AbstractBaseFragmentElement.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/psml/AbstractBaseFragmentElement.java?rev=892529&r1=892528&r2=892529&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/psml/AbstractBaseFragmentElement.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/psml/AbstractBaseFragmentElement.java Sat Dec 19 23:33:49 2009
@@ -20,14 +20,13 @@
 import java.security.AccessController;
 import java.security.Permission;
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
-import java.util.Map;
 
 import org.apache.jetspeed.idgenerator.IdGenerator;
 import org.apache.jetspeed.om.page.BaseFragmentElement;
 import org.apache.jetspeed.om.page.BaseFragmentValidationListener;
+import org.apache.jetspeed.om.page.FragmentProperty;
 import org.apache.jetspeed.om.page.PageSecurity;
 
 /**
@@ -47,12 +46,10 @@
 
     private String skin = null;
 
-    private List propertiesList = new ArrayList();
+    private List properties = new ArrayList();
     
     private List preferences = new ArrayList();
     
-    private Map propertiesMap = new HashMap();
-
     private String name;
 
     private AbstractBaseFragmentsElement baseFragmentsElement;
@@ -68,57 +65,180 @@
     {
     }
 
+    /**
+     * @see org.apache.jetspeed.om.page.BaseFragmentElement#getState()
+     */
     public String getState()
     {
-        return this.state;
+        return getProperty(STATE_PROPERTY_NAME);
     }
 
+    /**
+     * @see org.apache.jetspeed.om.page.BaseFragmentElement#setState(java.lang.String)
+     */
     public void setState( String state )
     {
         this.state = state;
     }
 
+    /**
+     * @see org.apache.jetspeed.om.page.BaseFragmentElement#setState(java.lang.String, java.lang.String, java.lang.String)
+     */
+    public void setState(String scope, String scopeValue, String state)
+    {
+        setProperty(STATE_PROPERTY_NAME, scope, scopeValue, state);
+    }
+
+    /**
+     * @see org.apache.jetspeed.om.page.BaseFragmentElement#getMode()
+     */
     public String getMode()
     {
-        return this.mode;
+        return getProperty(MODE_PROPERTY_NAME);
     }
 
+    /**
+     * @see org.apache.jetspeed.om.page.BaseFragmentElement#setMode(java.lang.String)
+     */
     public void setMode( String mode )
     {
         this.mode = mode;
     }
 
+    /**
+     * @see org.apache.jetspeed.om.page.BaseFragmentElement#setMode(java.lang.String, java.lang.String, java.lang.String)
+     */
+    public void setMode(String scope, String scopeValue, String mode)
+    {
+        setProperty(MODE_PROPERTY_NAME, scope, scopeValue, mode);
+    }
+
+    /**
+     * @see org.apache.jetspeed.om.page.BaseFragmentElement#getDecorator()
+     */
     public String getDecorator()
     {
-        return this.decorator;
+        return getProperty(DECORATOR_PROPERTY_NAME);
     }
 
+    /**
+     * @see org.apache.jetspeed.om.page.BaseFragmentElement#setDecorator(java.lang.String)
+     */
     public void setDecorator( String decoratorName )
     {
         this.decorator = decoratorName;
     }
 
+    /**
+     * @see org.apache.jetspeed.om.page.BaseFragmentElement#setDecorator(java.lang.String, java.lang.String, java.lang.String)
+     */
+    public void setDecorator(String scope, String scopeValue, String decorator)
+    {
+        setProperty(DECORATOR_PROPERTY_NAME, scope, scopeValue, decorator);
+    }
+
+    /**
+     * @see org.apache.jetspeed.om.page.BaseFragmentElement#getSkin()
+     */
     public String getSkin()
     {
-        return this.skin;
+        return getProperty(SKIN_PROPERTY_NAME);
     }
 
+    /**
+     * @see org.apache.jetspeed.om.page.BaseFragmentElement#setSkin(java.lang.String)
+     */
     public void setSkin( String skin )
     {
         this.skin = skin;
     }
 
-    public List getPropertiesList()
+    /**
+     * @see org.apache.jetspeed.om.page.BaseFragmentElement#setSkin(java.lang.String, java.lang.String, java.lang.String)
+     */
+    public void setSkin(String scope, String scopeValue, String skin)
     {
-        return (List) this.propertiesList;
+        setProperty(SKIN_PROPERTY_NAME, scope, scopeValue, skin);
     }
-    
+
     /**
      * @see org.apache.jetspeed.om.page.BaseFragmentElement#getProperty(java.lang.String)
      */
     public String getProperty(String propName)
     {
-        return (String)propertiesMap.get(propName);
+        // scoped property values
+        String [] userValue = new String[1];
+        String [] groupValue = new String[1];
+        String [] roleValue = new String[1];
+        String [] globalValue = new String[1];
+
+        // get property values from properties list
+        PropertyImpl.getFragmentProperty(propName, getProperties(), userValue, groupValue, roleValue, globalValue);
+
+        // override global property value members if not found in scoped properties
+        if ((userValue[0] == null) && (groupValue[0] == null) && (roleValue[0] == null))
+        {
+            if (propName.equals(STATE_PROPERTY_NAME))
+            {
+                globalValue[0] = state;
+            }
+            else if (propName.equals(MODE_PROPERTY_NAME))
+            {
+                globalValue[0] = mode;                    
+            }
+            else if (propName.equals(DECORATOR_PROPERTY_NAME))
+            {
+                globalValue[0] = decorator;                    
+            }
+            else if (propName.equals(SKIN_PROPERTY_NAME))
+            {
+                globalValue[0] = skin;                                        
+            }
+        }
+
+        // return most specifically scoped property value
+        return ((userValue[0] != null) ? userValue[0] : ((groupValue[0] != null) ? groupValue[0] : ((roleValue[0] != null) ? roleValue[0] : globalValue[0])));
+    }
+    
+    /**
+     * @see org.apache.jetspeed.om.page.BaseFragmentElement#getProperty(java.lang.String, java.lang.String, java.lang.String)
+     */
+    public String getProperty(String propName, String propScope, String propScopeValue)
+    {
+        // lookup global property value members
+        if (propScope == null)
+        {
+            if (propName.equals(STATE_PROPERTY_NAME))
+            {
+                return state;
+            }
+            else if (propName.equals(MODE_PROPERTY_NAME))
+            {
+                return mode;                    
+            }
+            else if (propName.equals(DECORATOR_PROPERTY_NAME))
+            {
+                return decorator;                    
+            }
+            else if (propName.equals(SKIN_PROPERTY_NAME))
+            {
+                return skin;                                        
+            }
+        }
+        
+        // default user scope value
+        if ((propScope != null) && propScope.equals(USER_PROPERTY_SCOPE) && (propScopeValue == null))
+        {
+            propScopeValue = PropertyImpl.getCurrentUserScopeValue();
+        }
+
+        // find specified scoped property value
+        FragmentProperty fragmentProperty = PropertyImpl.findFragmentProperty(propName, propScope, propScopeValue, properties);
+        if (fragmentProperty != null)
+        {
+            return fragmentProperty.getValue();
+        }
+        return null;
     }
     
     /**
@@ -126,7 +246,20 @@
      */
     public int getIntProperty(String propName)
     {
-        String prop = (String)propertiesMap.get(propName);
+        String prop = getProperty(propName);
+        if (prop != null)
+        {
+            return Integer.parseInt(prop);
+        }
+        return -1;
+    }
+    
+    /**
+     * @see org.apache.jetspeed.om.page.BaseFragmentElement#getIntProperty(java.lang.String, java.lang.String, java.lang.String)
+     */
+    public int getIntProperty(String propName, String propScope, String propScopeValue)
+    {
+        String prop = getProperty(propName, propScope, propScopeValue);
         if (prop != null)
         {
             return Integer.parseInt(prop);
@@ -139,23 +272,126 @@
      */
     public float getFloatProperty(String propName)
     {
-        String prop = (String)propertiesMap.get(propName);
+        String prop = getProperty(propName);
+        if (prop != null)
+        {
+            return Float.parseFloat(prop);
+        }
+        return -1.0F;
+    }
+    
+    /**
+     * @see org.apache.jetspeed.om.page.BaseFragmentElement#getFloatProperty(java.lang.String, java.lang.String, java.lang.String)
+     */
+    public float getFloatProperty(String propName, String propScope, String propScopeValue)
+    {
+        String prop = getProperty(propName, propScope, propScopeValue);
         if (prop != null)
         {
             return Float.parseFloat(prop);
         }
         return -1.0F;
     }
+
+    /**
+     * @see org.apache.jetspeed.om.page.BaseFragmentElement#setProperty(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
+     */
+    public void setProperty(String propName, String propScope, String propScopeValue, String propValue)
+    {
+        // set global property value members
+        if (propScope == null)
+        {
+            if (propName.equals(STATE_PROPERTY_NAME))
+            {
+                state = propValue;
+                return;
+            }
+            else if (propName.equals(MODE_PROPERTY_NAME))
+            {
+                mode = propValue;
+                return;                    
+            }
+            else if (propName.equals(DECORATOR_PROPERTY_NAME))
+            {
+                decorator = propValue;
+                return;                    
+            }
+            else if (propName.equals(SKIN_PROPERTY_NAME))
+            {
+                skin = propValue;
+                return;                                        
+            }
+        }
+        
+        // default user scope value
+        if ((propScope != null) && propScope.equals(USER_PROPERTY_SCOPE) && (propScopeValue == null))
+        {
+            propScopeValue = PropertyImpl.getCurrentUserScopeValue();
+        }
+
+        // find specified scoped property value
+        FragmentProperty fragmentProperty = PropertyImpl.findFragmentProperty(propName, propScope, propScopeValue, properties);
+
+        // add, set, or remove property
+        if (propValue != null)
+        {
+            if (fragmentProperty == null)
+            {
+                fragmentProperty = new PropertyImpl();
+                fragmentProperty.setName(propName);
+                fragmentProperty.setScope(propScope);
+                fragmentProperty.setScopeValue(propScopeValue);
+                fragmentProperty.setValue(propValue);
+                properties.add(fragmentProperty);
+            }
+            else
+            {
+                fragmentProperty.setValue(propValue);
+            }
+        }
+        else if (fragmentProperty != null)
+        {
+            properties.remove(fragmentProperty);
+        }
+    }
+    
+    /**
+     * @see org.apache.jetspeed.om.page.BaseFragmentElement#setProperty(java.lang.String, java.lang.String, java.lang.String, int)
+     */
+    public void setProperty(String propName, String propScope, String propScopeValue, int propValue)
+    {
+        setProperty(propName, propScope, propScopeValue, ((propValue >= 0) ? String.valueOf(propValue) : null));
+    }
+    
+    /**
+     * @see org.apache.jetspeed.om.page.BaseFragmentElement#setProperty(java.lang.String, java.lang.String, java.lang.String, float)
+     */
+    public void setProperty(String propName, String propScope, String propScopeValue, float propValue)
+    {
+        setProperty(propName, propScope, propScopeValue, ((propValue >= 0.0F) ? String.valueOf(propValue) : null));
+    }
     
     /**
      * @see org.apache.jetspeed.om.page.BaseFragmentElement#getProperties()
      */
-    public Map getProperties()
+    public List getProperties()
     {
-        return propertiesMap;
+        return properties;
     }
 
     /**
+     * @see org.apache.jetspeed.om.page.BaseFragmentElement#setProperties(java.util.List)
+     */
+    public void setProperties(List properties)
+    {
+        if (properties == null)
+        {
+            properties = new ArrayList();
+        }
+        this.properties = properties;  
+    } 
+    
+    /**
      * @see org.apache.jetspeed.om.page.BaseFragmentElement#getLayoutRow()
      */
     public int getLayoutRow()
@@ -168,14 +404,15 @@
      */
     public void setLayoutRow(int row)
     {
-        if (row >= 0)
-        {
-            propertiesMap.put(ROW_PROPERTY_NAME, String.valueOf(row));
-        }
-        else
-        {
-            propertiesMap.remove(ROW_PROPERTY_NAME);
-        }
+        setProperty(ROW_PROPERTY_NAME, null, null, row);
+    }
+    
+    /**
+     * @see org.apache.jetspeed.om.page.BaseFragmentElement#setLayoutRow(java.lang.String, java.lang.String, int)
+     */
+    public void setLayoutRow(String scope, String scopeValue, int row)
+    {
+        setProperty(ROW_PROPERTY_NAME, scope, scopeValue, row);
     }
     
     /**
@@ -191,14 +428,15 @@
      */
     public void setLayoutColumn(int column)
     {
-        if (column >= 0)
-        {
-            propertiesMap.put(COLUMN_PROPERTY_NAME, String.valueOf(column));
-        }
-        else
-        {
-            propertiesMap.remove(COLUMN_PROPERTY_NAME);
-        }
+        setProperty(COLUMN_PROPERTY_NAME, null, null, column);
+    }
+    
+    /**
+     * @see org.apache.jetspeed.om.page.BaseFragmentElement#setLayoutColumn(java.lang.String, java.lang.String, int)
+     */
+    public void setLayoutColumn(String scope, String scopeValue, int column)
+    {
+        setProperty(COLUMN_PROPERTY_NAME, scope, scopeValue, column);
     }
     
     /**
@@ -206,7 +444,7 @@
      */
     public String getLayoutSizes()
     {
-        return (String)propertiesMap.get(SIZES_PROPERTY_NAME);
+        return getProperty(SIZES_PROPERTY_NAME);
     }
     
     /**
@@ -214,14 +452,15 @@
      */
     public void setLayoutSizes(String sizes)
     {
-        if (sizes != null)
-        {
-            propertiesMap.put(SIZES_PROPERTY_NAME, sizes);
-        }
-        else
-        {
-            propertiesMap.remove(SIZES_PROPERTY_NAME);
-        }
+        setProperty(SIZES_PROPERTY_NAME, null, null, sizes);
+    }
+
+    /**
+     * @see org.apache.jetspeed.om.page.BaseFragmentElement#setLayoutSizes(java.lang.String, java.lang.String, java.lang.String)
+     */
+    public void setLayoutSizes(String scope, String scopeValue, String sizes)
+    {
+        setProperty(SIZES_PROPERTY_NAME, scope, scopeValue, sizes);
     }
 
     /**
@@ -237,14 +476,15 @@
      */
     public void setLayoutX(float x)
     {
-        if (x >= 0.0F)
-        {
-            propertiesMap.put(X_PROPERTY_NAME, String.valueOf(x));
-        }
-        else
-        {
-            propertiesMap.remove(X_PROPERTY_NAME);
-        }
+        setProperty(X_PROPERTY_NAME, null, null, x);
+    }
+    
+    /**
+     * @see org.apache.jetspeed.om.page.BaseFragmentElement#setLayoutX(java.lang.String, java.lang.String, float)
+     */
+    public void setLayoutX(String scope, String scopeValue, float x)
+    {
+        setProperty(X_PROPERTY_NAME, scope, scopeValue, x);
     }
     
     /**
@@ -260,14 +500,15 @@
      */
     public void setLayoutY(float y)
     {
-        if (y >= 0.0F)
-        {
-            propertiesMap.put(Y_PROPERTY_NAME, String.valueOf(y));
-        }
-        else
-        {
-            propertiesMap.remove(Y_PROPERTY_NAME);
-        }
+        setProperty(Y_PROPERTY_NAME, null, null, y);
+    }
+
+    /**
+     * @see org.apache.jetspeed.om.page.BaseFragmentElement#setLayoutY(java.lang.String, java.lang.String, float)
+     */
+    public void setLayoutY(String scope, String scopeValue, float y)
+    {
+        setProperty(Y_PROPERTY_NAME, scope, scopeValue, y);
     }
 
     /**
@@ -283,14 +524,15 @@
      */
     public void setLayoutZ(float z)
     {
-        if (z >= 0.0F)
-        {
-            propertiesMap.put(Z_PROPERTY_NAME, String.valueOf(z));
-        }
-        else
-        {
-            propertiesMap.remove(Z_PROPERTY_NAME);
-        }
+        setProperty(Z_PROPERTY_NAME, null, null, z);
+    }
+
+    /**
+     * @see org.apache.jetspeed.om.page.BaseFragmentElement#setLayoutZ(java.lang.String, java.lang.String, float)
+     */
+    public void setLayoutZ(String scope, String scopeValue, float z)
+    {
+        setProperty(Z_PROPERTY_NAME, scope, scopeValue, z);
     }
 
     /**
@@ -306,14 +548,15 @@
      */
     public void setLayoutWidth(float width)
     {
-        if (width >= 0.0F)
-        {
-            propertiesMap.put(WIDTH_PROPERTY_NAME, String.valueOf(width));
-        }
-        else
-        {
-            propertiesMap.remove(WIDTH_PROPERTY_NAME);
-        }
+        setProperty(WIDTH_PROPERTY_NAME, null, null, width);
+    }
+
+    /**
+     * @see org.apache.jetspeed.om.page.BaseFragmentElement#setLayoutWidth(java.lang.String, java.lang.String, float)
+     */
+    public void setLayoutWidth(String scope, String scopeValue, float width)
+    {
+        setProperty(WIDTH_PROPERTY_NAME, scope, scopeValue, width);
     }
 
     /**
@@ -329,14 +572,15 @@
      */
     public void setLayoutHeight(float height)
     {
-        if (height >= 0.0F)
-        {
-            propertiesMap.put(HEIGHT_PROPERTY_NAME, String.valueOf(height));
-        }
-        else
-        {
-            propertiesMap.remove(HEIGHT_PROPERTY_NAME);
-        }
+        setProperty(HEIGHT_PROPERTY_NAME, null, null, height);
+    }
+
+    /**
+     * @see org.apache.jetspeed.om.page.BaseFragmentElement#setLayoutHeight(java.lang.String, java.lang.String, float)
+     */
+    public void setLayoutHeight(String scope, String scopeValue, float height)
+    {
+        setProperty(HEIGHT_PROPERTY_NAME, scope, scopeValue, height);
     }
 
     /**
@@ -388,15 +632,26 @@
      * </p>
      * 
      * @see org.apache.jetspeed.om.page.BaseFragmentElement#getPreferences()
-     * @param name
      */
     public List getPreferences()
     {
         return preferences;
     }
 
+    /**
+     * <p>
+     * setPreferences
+     * </p>
+     * 
+     * @see org.apache.jetspeed.om.page.BaseFragmentElement#setPreferences(java.util.List)
+     * @param preferences
+     */
     public void setPreferences(List preferences)
     {
+        if (preferences == null)
+        {
+            preferences = new ArrayList();
+        }
         this.preferences = preferences;  
     } 
     
@@ -480,55 +735,10 @@
             dirty = true;
         }
 
-        // 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());
-        }
-        
         return dirty;
     }
 
     /**
-     * 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);
-            }
-        }
-
-        // notify super class implementation
-        super.marshalling();
-    }
-    
-    /**
      * Validate fragment using specified validation listener.
      * 
      * @param validationListener validation listener

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/psml/PropertyImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/psml/PropertyImpl.java?rev=892529&r1=892528&r2=892529&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/psml/PropertyImpl.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/psml/PropertyImpl.java Sat Dec 19 23:33:49 2009
@@ -17,17 +17,22 @@
 
 package org.apache.jetspeed.om.page.psml;
 
+import org.apache.jetspeed.om.page.BaseFragmentPropertyImpl;
+import org.apache.jetspeed.om.page.FragmentProperty;
+
 /**
- * Bean like implementation of the Parameter interface suitable for
+ * Bean like implementation of the FragmentProperty interface suitable for
  * Castor serialization.
  *
  * @see org.apache.jetspeed.om.registry.PsmlParameter
  * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
  * @version $Id$
  */
-public class PropertyImpl implements java.io.Serializable
+public class PropertyImpl extends BaseFragmentPropertyImpl implements FragmentProperty, java.io.Serializable
 {
     private String name;
+    private String scope;
+    private String scopeValue;
     private String value;
 
     public PropertyImpl()
@@ -55,6 +60,31 @@
         this.name = name;
     }
 
+    public String getScope()
+    {
+        return this.scope;
+    }
+
+    public void setScope(String scope)
+    {
+        if ((scope != null) && !scope.equals(USER_PROPERTY_SCOPE) && 
+            (!GROUP_AND_ROLE_PROPERTY_SCOPES_ENABLED || (!scope.equals(GROUP_PROPERTY_SCOPE) && !scope.equals(ROLE_PROPERTY_SCOPE))))
+            {
+                throw new IllegalArgumentException("Fragment property scope "+scope+" invalid or not enabled");
+            }
+        this.scope = scope;
+    }
+
+    public String getScopeValue()
+    {
+        return this.scopeValue;
+    }
+
+    public void setScopeValue(String scopeValue)
+    {
+        this.scopeValue = scopeValue;
+    }
+
     public String getValue()
     {
         return this.value;
@@ -77,4 +107,24 @@
     {        
         return Integer.parseInt(value);
     }
+
+    /**
+     * Unchecked read access to scope value.
+     * 
+     * @return scope
+     */
+    public String getUncheckedScope()
+    {
+        return this.scope;
+    }
+
+    /**
+     * Unchecked write access to scope value.
+     * 
+     * @param scope
+     */
+    public void setUncheckedScope(String scope)
+    {
+        this.scope = scope;
+    }
 }

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/page/AbstractPageManager.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/page/AbstractPageManager.java?rev=892529&r1=892528&r2=892529&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/page/AbstractPageManager.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/page/AbstractPageManager.java Sat Dec 19 23:33:49 2009
@@ -24,8 +24,6 @@
 
 import javax.security.auth.Subject;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.apache.jetspeed.idgenerator.IdGenerator;
 import org.apache.jetspeed.om.common.SecurityConstraint;
 import org.apache.jetspeed.om.common.SecurityConstraints;
@@ -43,6 +41,7 @@
 import org.apache.jetspeed.om.page.DynamicPage;
 import org.apache.jetspeed.om.page.Fragment;
 import org.apache.jetspeed.om.page.FragmentDefinition;
+import org.apache.jetspeed.om.page.FragmentProperty;
 import org.apache.jetspeed.om.page.FragmentReference;
 import org.apache.jetspeed.om.page.Link;
 import org.apache.jetspeed.om.page.Page;
@@ -55,6 +54,9 @@
 import org.apache.jetspeed.page.document.NodeException;
 import org.apache.jetspeed.page.impl.DatabasePageManagerUtils;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 /**
  * AbstractPageManagerService
  *
@@ -102,6 +104,7 @@
     protected Class pageTemplateClass;
     protected Class dynamicPageClass;
     protected Class fragmentDefinitionClass;
+    protected Class fragmentPropertyClass;
 
     private IdGenerator generator;
 
@@ -177,6 +180,7 @@
         this.pageTemplateClass = (Class)modelClasses.get("PageTemplateImpl");
         this.dynamicPageClass = (Class)modelClasses.get("DynamicPageImpl");
         this.fragmentDefinitionClass = (Class)modelClasses.get("FragmentDefinitionImpl");
+        this.fragmentPropertyClass = (Class)modelClasses.get("FragmentPropertyImpl");
     }
     
     /* (non-Javadoc)
@@ -805,7 +809,7 @@
     }
 
     /**
-     * newFragmentPreference - creates a new security constraints definition
+     * newFragmentPreference - creates a new fragment preference
      *
      * @return a newly created FragmentPreference object
      */
@@ -817,7 +821,26 @@
         }
         catch (ClassCastException e)
         {
-            String message = "Failed to create security constraints definition object for " + this.fragmentPreferenceClass;
+            String message = "Failed to create fragment preference object for " + this.fragmentPropertyClass;
+            log.error(message, e);
+        }
+        return null;
+    }
+
+    /**
+     * newFragmentProperty - creates a new fragment property
+     *
+     * @return a newly created FragmentProperty object
+     */
+    public FragmentProperty newFragmentProperty()
+    {
+        try
+        {
+            return (FragmentProperty)createObject(this.fragmentPropertyClass);
+        }
+        catch (ClassCastException e)
+        {
+            String message = "Failed to create fragment property object for " + this.fragmentPropertyClass;
             log.error(message, e);
         }
         return null;
@@ -1241,11 +1264,20 @@
             copy.setId(source.getId());
         }
         copy.setDecorator(source.getDecorator());
+        copy.setLayoutColumn(source.getLayoutColumn());
+        copy.setLayoutHeight(source.getLayoutHeight());
+        copy.setLayoutRow(source.getLayoutRow());
+        copy.setLayoutSizes(source.getLayoutSizes());
+        copy.setLayoutX(source.getLayoutX());
+        copy.setLayoutY(source.getLayoutY());
+        copy.setLayoutZ(source.getLayoutZ());
+        copy.setLayoutWidth(source.getLayoutWidth());
+        copy.setMode(source.getMode());
         copy.setShortTitle(source.getShortTitle());
         copy.setSkin(source.getSkin());
-        copy.setTitle(source.getTitle());
         copy.setState(source.getState());
-
+        copy.setTitle(source.getTitle());
+        
         // copy security constraints
         SecurityConstraints srcSecurity = source.getSecurityConstraints();        
         if ((srcSecurity != null) && !srcSecurity.isEmpty())
@@ -1255,15 +1287,22 @@
         }
         
         // copy properties
-        Iterator props = source.getProperties().entrySet().iterator();
+        Iterator props = source.getProperties().iterator();
         while (props.hasNext())
         {
-            Map.Entry prop = (Map.Entry)props.next();
-            copy.getProperties().put(prop.getKey(), prop.getValue());
+            FragmentProperty prop = (FragmentProperty)props.next();
+            if (copy.getProperty(prop.getName(), prop.getScope(), prop.getScopeValue()) == null)
+            {
+                FragmentProperty newProp = newFragmentProperty();
+                newProp.setName(prop.getName());
+                newProp.setScope(prop.getScope());
+                newProp.setScopeValue(prop.getScopeValue());
+                newProp.setValue(prop.getValue());
+                copy.getProperties().add(newProp);
+            }
         }
                   
         // copy preferences
-        copy.setPreferences(DatabasePageManagerUtils.createList());
         Iterator prefs = source.getPreferences().iterator();
         while (prefs.hasNext())
         {
@@ -1769,6 +1808,14 @@
         }
         return true;
     }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.page.PageManager#cleanupRequestCache()
+     */
+    public void cleanupRequestCache()
+    {
+        // nothing to cleanup by default
+    }
     
     /**
      * Creates a user's home page from the roles of the current user.

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/page/impl/DatabasePageManager.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/page/impl/DatabasePageManager.java?rev=892529&r1=892528&r2=892529&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/page/impl/DatabasePageManager.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/page/impl/DatabasePageManager.java Sat Dec 19 23:33:49 2009
@@ -50,6 +50,7 @@
 import org.apache.jetspeed.om.page.DynamicPage;
 import org.apache.jetspeed.om.page.Fragment;
 import org.apache.jetspeed.om.page.FragmentDefinition;
+import org.apache.jetspeed.om.page.FragmentProperty;
 import org.apache.jetspeed.om.page.FragmentReference;
 import org.apache.jetspeed.om.page.Link;
 import org.apache.jetspeed.om.page.Page;
@@ -57,11 +58,14 @@
 import org.apache.jetspeed.om.page.PageSecurity;
 import org.apache.jetspeed.om.page.PageTemplate;
 import org.apache.jetspeed.om.page.SecurityConstraintsDef;
+import org.apache.jetspeed.om.page.impl.BaseFragmentElementImpl;
 import org.apache.jetspeed.om.page.impl.BaseFragmentsElementImpl;
 import org.apache.jetspeed.om.page.impl.DynamicPageImpl;
 import org.apache.jetspeed.om.page.impl.FragmentDefinitionImpl;
 import org.apache.jetspeed.om.page.impl.FragmentImpl;
 import org.apache.jetspeed.om.page.impl.FragmentPreferenceImpl;
+import org.apache.jetspeed.om.page.impl.FragmentPropertyImpl;
+import org.apache.jetspeed.om.page.impl.FragmentPropertyList;
 import org.apache.jetspeed.om.page.impl.FragmentReferenceImpl;
 import org.apache.jetspeed.om.page.impl.FragmentSecurityConstraintImpl;
 import org.apache.jetspeed.om.page.impl.LinkImpl;
@@ -114,6 +118,8 @@
  */
 public class DatabasePageManager extends InitablePersistenceBrokerDaoSupport implements PageManager
 {
+    private static ThreadLocal fragmentPropertyListsCache = new ThreadLocal();
+    
     private static Map modelClasses = new HashMap();
     static
     {
@@ -145,6 +151,7 @@
         modelClasses.put("PageTemplateImpl", PageTemplateImpl.class);
         modelClasses.put("DynamicPageImpl", DynamicPageImpl.class);
         modelClasses.put("FragmentDefinitionImpl", FragmentDefinitionImpl.class);
+        modelClasses.put("FragmentPropertyImpl", FragmentPropertyImpl.class);
     }
 
     private DelegatingPageManager delegator;
@@ -444,6 +451,14 @@
     }
 
     /* (non-Javadoc)
+     * @see org.apache.jetspeed.page.PageManager#newFragmentPreference()
+     */
+    public FragmentProperty newFragmentProperty()
+    {
+        return delegator.newFragmentProperty();
+    }
+
+    /* (non-Javadoc)
      * @see org.apache.jetspeed.page.PageManager#addListener(org.apache.jetspeed.page.PageManagerEventListener)
      */
     public void addListener(PageManagerEventListener listener)
@@ -2576,4 +2591,80 @@
         // notify page manager listeners
         delegator.notifyUpdatedNode(node);
     }
+    
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.page.PageManager#cleanupRequestCache()
+     */
+    public void cleanupRequestCache()
+    {
+        // clear thread local cache on request completion
+        rollbackTransactions();
+    }
+    
+    /**
+     * Get and cache fragment property list for specified fragment.
+     * 
+     * @param baseFragmentElement owning fragment of fragment property list
+     * @return new or cached fragment property list
+     */
+    public FragmentPropertyList getFragmentPropertiesList(BaseFragmentElementImpl baseFragmentElement)
+    {
+        // check thread local fragment property lists cache
+        String cacheKey = baseFragmentElement.getBaseFragmentsElement().getPath()+"/"+baseFragmentElement.getId();
+        Map cache = (Map)fragmentPropertyListsCache.get();
+        FragmentPropertyList list = ((cache != null) ? (FragmentPropertyList)cache.get(cacheKey) : null);
+        if (list == null)
+        {
+            // create new fragment property list
+            list = new FragmentPropertyList(baseFragmentElement);
+            
+            // TODO: query for fragment property list using database query
+        
+            // save fragment property list in thread local cache
+            if (cache == null)
+            {
+                cache = new HashMap();
+                fragmentPropertyListsCache.set(cache);
+            }
+            cache.put(cacheKey, list);
+        }
+        return list;
+    }
+
+    /**
+     * Update fragment property list.
+     * 
+     * @param list fragment property list
+     */
+    public void updateFragmentPropertiesList(FragmentPropertyList list)
+    {
+        // TODO: NYI
+    }
+
+    /**
+     * Remove fragment property list.
+     * 
+     * @param list fragment property list
+     */
+    public void removeFragmentPropertiesList(FragmentPropertyList list)
+    {
+        // TODO: NYI
+    }
+
+    /**
+     * Rollback transactions registered with current thread.
+     */
+    public static void rollbackTransactions()
+    {
+        // clear thread local cache on rollback to ensure clean reset
+        fragmentPropertyListsCache.remove();
+    }
+
+    /**
+     * Clear transactions registered with current thread.
+     */
+    public static void clearTransactions()
+    {
+        // do not clear thread local cache: cache across transactions
+    }
 }

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/page/impl/DatabasePageManagerCache.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/page/impl/DatabasePageManagerCache.java?rev=892529&r1=892528&r2=892529&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/page/impl/DatabasePageManagerCache.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/page/impl/DatabasePageManagerCache.java Sat Dec 19 23:33:49 2009
@@ -82,10 +82,7 @@
                 // paths cache
                 node.setConstraintsEnabled(constraintsEnabled);
                 node.setPermissionsEnabled(permissionsEnabled);
-                if (node instanceof FolderImpl)
-                {
-                    ((FolderImpl)node).setPageManager(pageManager);
-                }
+                node.setPageManager(pageManager);
             }
 
             /* (non-Javadoc)
@@ -99,10 +96,7 @@
                 // paths cache 
                 node.setConstraintsEnabled(constraintsEnabled);
                 node.setPermissionsEnabled(permissionsEnabled);
-                if (node instanceof FolderImpl)
-                {
-                    ((FolderImpl)node).setPageManager(pageManager);
-                }
+                node.setPageManager(pageManager);
             }
 
             /* (non-Javadoc)



---------------------------------------------------------------------
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