You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by ta...@apache.org on 2008/10/30 08:10:44 UTC

svn commit: r709104 - in /portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade: components/jetspeed-portal/src/main/java/org/apache/jetspeed/engine/ components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletentity/ compon...

Author: taylor
Date: Thu Oct 30 00:10:43 2008
New Revision: 709104

URL: http://svn.apache.org/viewvc?rev=709104&view=rev
Log:
https://issues.apache.org/jira/browse/JS2-871
* rewrite of Preferences service. 
* start of cleanup of old preferences/entities impl and removing its hooks from within everything

noticed that JetspeedRegistrySerializer is getting a lot of syntax errors. This may need a merge with the trunk, so might be best to merge it first
Also, I removed all the FragmentPortletDefinition special code to associate a request with a specific entity/fragment
Suggest moving the fragment off of the entity object to the window will there is a 1-1 relationship

Removed:
    portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletpreferences/PersistenceBrokerPortletPreferencesProvider.java
    portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletpreferences/PreferencesRowReader.java
    portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/FragmentPortletDefinition.java
    portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/PreferenceImpl.java
    portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/PreferencesImpl.java
    portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/preference/
Modified:
    portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/main/java/org/apache/jetspeed/engine/JetspeedEngine.java
    portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletentity/PersistenceBrokerPortletEntityAccess.java
    portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletentity/PortletEntityImpl.java
    portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletpreferences/DatabasePreference.java
    portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletpreferences/JetspeedPreferencesMap.java
    portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletpreferences/PortletPreferencesServiceImpl.java
    portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletregistry/PersistenceBrokerPortletRegistry.java
    portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/jetspeed-api/src/main/java/org/apache/jetspeed/components/portletpreferences/PortletPreferencesProvider.java
    portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/jetspeed-api/src/main/java/org/apache/jetspeed/container/PortletEntity.java
    portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/jetspeed-portal-resources/src/main/resources/assembly/registry.xml
    portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/jetspeed-portal-resources/src/main/resources/assembly/static-bean-references.xml

Modified: portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/main/java/org/apache/jetspeed/engine/JetspeedEngine.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/main/java/org/apache/jetspeed/engine/JetspeedEngine.java?rev=709104&r1=709103&r2=709104&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/main/java/org/apache/jetspeed/engine/JetspeedEngine.java (original)
+++ portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-portal/src/main/java/org/apache/jetspeed/engine/JetspeedEngine.java Thu Oct 30 00:10:43 2008
@@ -25,7 +25,6 @@
 import org.apache.commons.configuration.Configuration;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.jetspeed.JetspeedPortalContext;
 import org.apache.jetspeed.PortalContext;
 import org.apache.jetspeed.PortalReservedParameters;
 import org.apache.jetspeed.administration.PortalConfiguration;
@@ -39,7 +38,6 @@
 import org.apache.ojb.broker.util.ClassHelper;
 import org.apache.pluto.PortletContainer;
 import org.apache.pluto.PortletContainerException;
-import org.springframework.beans.factory.NoSuchBeanDefinitionException;
 
 
 /**

Modified: portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletentity/PersistenceBrokerPortletEntityAccess.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletentity/PersistenceBrokerPortletEntityAccess.java?rev=709104&r1=709103&r2=709104&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletentity/PersistenceBrokerPortletEntityAccess.java (original)
+++ portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletentity/PersistenceBrokerPortletEntityAccess.java Thu Oct 30 00:10:43 2008
@@ -25,12 +25,10 @@
 import org.apache.jetspeed.om.page.ContentFragment;
 import org.apache.jetspeed.om.page.Fragment;
 import org.apache.jetspeed.om.portlet.PortletDefinition;
-import org.apache.jetspeed.util.JetspeedObjectID;
 import org.apache.ojb.broker.query.Criteria;
 import org.apache.ojb.broker.query.Query;
 import org.apache.ojb.broker.query.QueryFactory;
 import org.apache.jetspeed.container.PortletEntity;
-import org.apache.pluto.om.portlet.PortletDefinition;
 import org.apache.jetspeed.container.PortletWindow;
 import org.springframework.orm.ojb.support.PersistenceBrokerDaoSupport;
 
@@ -324,7 +322,6 @@
         try
         {
             getPersistenceBrokerTemplate().store(portletEntity);
-            ((PortletEntity)portletEntity).storeChildren();
         }
         catch (Exception e)
         {

Modified: portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletentity/PortletEntityImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletentity/PortletEntityImpl.java?rev=709104&r1=709103&r2=709104&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletentity/PortletEntityImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletentity/PortletEntityImpl.java Thu Oct 30 00:10:43 2008
@@ -16,66 +16,31 @@
  */
 package org.apache.jetspeed.components.portletentity;
 
-import java.io.IOException;
-import java.security.Principal;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Locale;
-import java.util.Map;
-
-import javax.portlet.PortletMode;
-
-import org.apache.jetspeed.JetspeedActions;
 import org.apache.jetspeed.aggregator.RenderTrackable;
-import org.apache.jetspeed.components.portletpreferences.PortletPreferencesProvider;
 import org.apache.jetspeed.components.portletregistry.PortletRegistry;
-import org.apache.jetspeed.om.common.portlet.PrincipalAware;
-import org.apache.jetspeed.om.common.preference.PreferenceComposite;
-import org.apache.jetspeed.om.common.preference.PreferenceSetComposite;
-import org.apache.jetspeed.om.page.Fragment;
-import org.apache.jetspeed.om.portlet.PortletApplication;
-import org.apache.jetspeed.om.portlet.PortletDefinition;
-import org.apache.jetspeed.om.portlet.impl.FragmentPortletDefinition;
-import org.apache.jetspeed.om.preference.FragmentPreference;
-import org.apache.jetspeed.om.preference.impl.PreferenceSetImpl;
-import org.apache.jetspeed.page.PageManager;
-import org.apache.jetspeed.request.RequestContext;
-import org.apache.jetspeed.request.RequestContextComponent;
-import org.apache.pluto.om.portlet.Description;
-import org.apache.pluto.om.portlet.Preference;
-import org.apache.pluto.om.portlet.PreferenceSet;
-import org.apache.pluto.om.portlet.PortletDefinition;
 import org.apache.jetspeed.container.PortletEntity;
 import org.apache.jetspeed.container.PortletWindow;
-import org.apache.pluto.util.StringUtils;
+import org.apache.jetspeed.om.page.Fragment;
+import org.apache.jetspeed.om.portlet.PortletDefinition;
 
 /**
  * Portlet Entity default implementation.
+ * TODO: 2.2 - don't associate Fragment with Entity, should be with window
  * 
  * @author <a href="mailto:taylor@apache.org">David Sean Taylor </a>
  * @author <a href="mailto:weaver@apache.org">Scott T. Weaver </a>
  * @version $Id: PortletEntityImpl.java,v 1.9 2005/04/29 13:59:08 weaver Exp $
  */
-public class PortletEntityImpl implements PortletEntity, PrincipalAware, RenderTrackable
+public class PortletEntityImpl implements PortletEntity, RenderTrackable
 {   
-    private Long oid;
-    private String id;
-    private static PortletPreferencesProvider portletPreferencesProvider;
-    private static PortletEntityAccessComponent portletEntityAccess;    
     private static PortletRegistry registry;
-    private static RequestContextComponent requestContextComponent;
-    private static PageManager pageManager;
-    
-    protected PreferenceSetComposite pagePreferenceSet;
-    protected Map perPrincipalPrefs = new HashMap();
-    // TODO: temporary replacement for old api PortletWindowList - this should be removed too shortly
+
+    private Long oid;
+    private String id;    
     private PortletWindow portletWindow = null;
     private PortletDefinition portletDefinition = null;  
     protected String portletName;
     protected String appName;
-    private boolean dirty = false;
     private Fragment fragment;
     
     protected transient int timeoutCount = 0;
@@ -90,9 +55,11 @@
     {
         super();
     }
-
-    public static final String NO_PRINCIPAL = "no-principal";
-    public static final String ENTITY_DEFAULT_PRINCIPAL = "entity-default";
+    
+    public String getId()
+    {
+        return this.id;
+    }
     
     public Long getOid()
     {
@@ -104,101 +71,16 @@
         this.id = id;
     }
 
-    /**
-     * 
-     * <p>
-     * getPreferenceSet
-     * </p>
-     * 
-     * @see org.apache.jetspeed.container.PortletEntity#getPreferenceSet()
-     * @return
-     */
-    public PreferenceSet getPreferenceSet()
+    public void setPortletWindow(PortletWindow window)
     {
-        if (isEditDefaultsMode())
-        {
-            return getPreferenceSetFromPage();
-        }
-        else
-        {
-            Principal currentUser = getPrincipal();
-            return getPreferenceSet(currentUser);
-        }
-    }
+        this.portletWindow = window;
+    }    
 
-    public PreferenceSet getPreferenceSet(Principal principal)
+    public PortletWindow getPortletWindow()
     {
-        PreferenceSet preferenceSet = (PreferenceSet)perPrincipalPrefs.get(principal);
-//        PrefsPreferenceSetImpl preferenceSet = (PrefsPreferenceSetImpl) perPrincipalPrefs.get(principal);
-        if (preferenceSet == null || !dirty)
-        {
-            preferenceSet = portletPreferencesProvider.getPreferenceSet(this, principal.getName());
-            perPrincipalPrefs.put(principal, preferenceSet);
-            /*
-             * TODO:  MergeSharedPreferences is broken AFAIK, this features needs to be reevaluated now that we also have edit_defaults!
-            if (pac.isMergeSharedPreferences())
-            {
-                mergePreferencesSet(preferenceSet);
-            }
-            */
-            dirty = true;
-        }
-        return preferenceSet;
+        return this.portletWindow;
     }
     
-    private PreferenceSet getPreferenceSetFromPage()
-    {
-        PreferenceSetComposite preferenceSet = this.pagePreferenceSet;
-        
-        if (preferenceSet == null || !dirty)
-        {
-            preferenceSet = new PreferenceSetImpl();
-            this.pagePreferenceSet = preferenceSet;
-            
-            List fragmentPreferences = this.fragment.getPreferences();
-            
-            if (fragmentPreferences != null)
-            {
-                for (Iterator it = fragmentPreferences.iterator(); it.hasNext(); )
-                {
-                    FragmentPreference preference = (FragmentPreference) it.next();
-                    List preferenceValues = preference.getValueList();
-                    PreferenceComposite pref = (PreferenceComposite)preferenceSet.add(preference.getName(), preferenceValues);
-                    pref.setReadOnly(Boolean.toString(preference.isReadOnly()));
-                }
-            }
-            dirty = true;
-        }
-        return preferenceSet;
-    }
-    
-/*    
- * TODO:  MergeSharedPreferences is broken AFAIK, this features needs to be reevaluated now that we also have edit_defaults!
-    private void mergePreferencesSet(PrefsPreferenceSetImpl userPrefSet)
-    throws BackingStoreException
-    {
-        String sharedNodePath = MutablePortletEntity.PORTLET_ENTITY_ROOT + "/" + 
-                                getId() +"/"+ NO_PRINCIPAL +"/" +
-                                PrefsPreference.PORTLET_PREFERENCES_ROOT;                
-        Preferences sharedNode = Preferences.userRoot().node(sharedNodePath);     
-        if (sharedNode == null)
-            return;
-        PrefsPreferenceSetImpl sharedSet = new PrefsPreferenceSetImpl(sharedNode);
-        if (sharedSet.size() == 0)
-            return;
-        Set names = userPrefSet.getNames();
-        Iterator sharedPrefs = sharedSet.iterator();
-        int index = 0;
-        while (sharedPrefs.hasNext())
-        {
-            PrefsPreference sharedPref = (PrefsPreference) sharedPrefs.next();
-// this seems limiting, removing if (names.contains(sharedPref.getName()))
-            List prefs = Arrays.asList(sharedPref.getValueArray());
-            userPrefSet.add(sharedPref.getName(), prefs);
-            index++;
-        }        
-    }
-*/
     public PortletDefinition getPortletDefinition()
     {
         // there are cases when jetspeed gets initialized before
@@ -206,185 +88,22 @@
         // access to the portal would cause portlet entities to be cached
         // with their associated window without there corresponding PortletDefinition
         // (becuase the PortletApplication has yet to be registered).
-        if(this.portletDefinition == null)
+        if (this.portletDefinition == null)
         {
-            PortletDefinition pd = registry.getPortletDefinitionByUniqueName(getPortletUniqueName());
-            if ( pd != null )
-            {
-              // only store a really found PortletDefinition
-              // to prevent an IllegalArgumentException to be thrown
-              setPortletDefinition(pd);
+            PortletDefinition pd = registry
+                    .getPortletDefinitionByUniqueName(getPortletUniqueName());
+            if (pd != null)
+            {
+                // only store a really found PortletDefinition
+                // to prevent an IllegalArgumentException to be thrown
+                setPortletDefinition(pd);
             }
             else
             {
                 return null;
             }
-        }        
-        
-        // Wrap the portlet defintion every request thread
-        // JS2-852: don't use thread local
-        RequestContext rc = requestContextComponent.getRequestContext();
-        String entityFragmentKey = getEntityFragmentKey();
-        PortletDefinition fpd = null;
-        if (rc != null)
-        {
-            fpd= (PortletDefinition)rc.getAttribute(entityFragmentKey);
-        }
-        if (fpd == null)
-        {
-            fpd = new FragmentPortletDefinition(this.portletDefinition, fragment);
-            if (rc != null)
-            {
-                rc.setAttribute(entityFragmentKey, fpd);
-            }
-        }        
-        return fpd;
-    }
-
-    public void setPortletWindow(PortletWindow window)
-    {
-        this.portletWindow = window;
-    }
-
-    /**
-     * 
-     * <p>
-     * store
-     * </p>
-     *  
-     */
-    public void store() throws IOException
-    {
-        try
-        {
-            portletEntityAccess.storePortletEntity(this);
-        }
-        catch (PortletEntityNotStoredException e)
-        {
-            IOException ioe = new IOException(e.getMessage());
-            ioe.initCause(e);            
-            throw ioe;
-        }
-    }
-    
-    public void storeChildren()
-    {
-        if (isEditDefaultsMode())
-        {
-            storeToPage();
-        }
-        else
-        {
-            Principal currentUser = getPrincipal();
-            store(currentUser);
-        }
-    }
-    
-    private void store(Principal principal)
-    {
-        PreferenceSetComposite preferenceSet = (PreferenceSetComposite)perPrincipalPrefs.get(principal);
-        
-        if (preferenceSet != null)
-        {
-            portletPreferencesProvider.savePreferenceSet(this, principal.getName(), preferenceSet);
-        }
-        dirty = false;
-    }
-    
-    private void storeToPage()
-    {
-        PreferenceSet preferenceSet = this.pagePreferenceSet;
-        List preferences = new ArrayList();
-        
-        for (Iterator it = preferenceSet.iterator(); it.hasNext(); )
-        {
-            Preference pref = (Preference) it.next();
-            
-            FragmentPreference preference = pageManager.newFragmentPreference();
-            preference.setName(pref.getName());
-            List preferenceValues = new ArrayList();
-            
-            for (Iterator iterVals = pref.getValues(); iterVals.hasNext(); )
-            {
-                preferenceValues.add(iterVals.next());
-            }
-            
-            preference.setValueList(preferenceValues);
-            preferences.add(preference);
-        }
-        
-        this.fragment.setPreferences(preferences);
-        
-        try
-        {
-            pageManager.updatePage(requestContextComponent.getRequestContext().getPage());
-        }
-        catch (Exception e)
-        {
-        }
-        
-        dirty = false;
-    }
-
-    /**
-     * 
-     * <p>
-     * reset
-     * </p>
-     *  
-     */
-
-    public void reset() throws IOException
-    {
-        dirty = true;
-        getPreferenceSet(getPrincipal());        
-    }
-
-    // internal methods used for debugging purposes only
-
-    public String toString()
-    {
-        return toString(0);
-    }
-
-    public String toString( int indent )
-    {
-        StringBuffer buffer = new StringBuffer(1000);
-        StringUtils.newLine(buffer, indent);
-        buffer.append(getClass().toString());
-        buffer.append(":");
-        StringUtils.newLine(buffer, indent);
-        buffer.append("{");
-        StringUtils.newLine(buffer, indent);
-        buffer.append("id='");
-        buffer.append(oid);
-        buffer.append("'");
-        StringUtils.newLine(buffer, indent);
-        buffer.append("definition-id='");
-        if(portletDefinition != null)
-        {
-            buffer.append(portletDefinition.getId().toString());
-        }
-        else
-        {
-            buffer.append("null");
-        }
-        buffer.append("'");
-
-        StringUtils.newLine(buffer, indent);
-        //buffer.append(((PreferenceSetImpl)preferences).toString(indent));
-
-        StringUtils.newLine(buffer, indent);
-        buffer.append("}");
-        return buffer.toString();
-    }
-
-    /**
-     * @see org.apache.jetspeed.container.PortletEntity#getDescription(java.util.Locale)
-     */
-    public Description getDescription( Locale arg0 )
-    {
-        return portletDefinition.getDescription(arg0);
+        }            
+        return this.portletDefinition;
     }
 
     /**
@@ -395,17 +114,11 @@
      * @param composite
      *  
      */
-    public void setPortletDefinition( PortletDefinition composite )
+    public void setPortletDefinition(PortletDefinition pd)
     {
-        if(composite != null)
+        if (pd != null)
         {
-            portletDefinition = (PortletDefinition) composite;
-            // if the portletDefinition is modified, clear threadlocal fragmentPortletDefinition cache
-            RequestContext rc = requestContextComponent.getRequestContext();
-            if (rc != null)
-            {
-                rc.getRequest().removeAttribute(getEntityFragmentKey());
-            }
+            portletDefinition = pd;
             this.appName = portletDefinition.getApplication().getName();
             this.portletName = portletDefinition.getPortletName();
         }
@@ -414,107 +127,6 @@
             throw new IllegalArgumentException("Cannot pass a null PortletDefinition to a PortletEntity.");
         }
     }
-
-    /**
-     * @return Returns the principal.
-     */
-    public Principal getPrincipal()
-    {
-        if (requestContextComponent == null)
-        {
-            // TODO: shouldn't be possible anymore
-            return new PortletEntityUserPrincipal(NO_PRINCIPAL);
-        }            
-        RequestContext rc = requestContextComponent.getRequestContext();
-        if (rc == null)
-        {
-            return new PortletEntityUserPrincipal(NO_PRINCIPAL);
-        }
-        Principal principal = rc.getUserPrincipal();
-        if (principal == null)
-        {
-            principal = new PortletEntityUserPrincipal(NO_PRINCIPAL);
-        }
-        return principal;
-    }
-
-    class PortletEntityUserPrincipal implements Principal
-    {
-        String name;
-
-        protected PortletEntityUserPrincipal( String name )
-        {
-            this.name = name;
-        }
-
-        /**
-         * <p>
-         * getName
-         * </p>
-         * 
-         * @see java.security.Principal#getName()
-         * @return
-         */
-        public String getName()
-        {
-            return name;
-        }
-
-        /**
-         * <p>
-         * equals
-         * </p>
-         * 
-         * @see java.lang.Object#equals(java.lang.Object)
-         * @param obj
-         * @return
-         */
-        public boolean equals( Object obj )
-        {
-            if (obj != null && obj instanceof Principal)
-            {
-                Principal p = (Principal) obj;
-                return name != null && p.getName() != null && name.equals(p.getName());
-            }
-            else
-            {
-                return false;
-            }
-        }
-
-        /**
-         * <p>
-         * hashCode
-         * </p>
-         * 
-         * @see java.lang.Object#hashCode()
-         * @return
-         */
-        public int hashCode()
-        {
-            if (name != null)
-            {
-                return (getClass().getName()+ ":" + name).hashCode();
-            }
-            else
-            {
-                return -1;
-            }
-        }
-
-        /**
-         * <p>
-         * toString
-         * </p>
-         * 
-         * @see java.lang.Object#toString()
-         * @return
-         */
-        public String toString()
-        {
-            return name;
-        }
-    }
     
     public String getPortletUniqueName()
     {
@@ -532,15 +144,14 @@
         }
     }
 
+    public Fragment getFragment()
+    {
+        return this.fragment;
+    }
+    
     public void setFragment(Fragment fragment)
     {
         this.fragment = fragment;
-        // if the fragment is set, clear threadlocal fragmentPortletDefinition cache
-        RequestContext rc = requestContextComponent.getRequestContext();
-        if (rc != null)
-        {
-            rc.getRequest().removeAttribute(getEntityFragmentKey());
-        }
     }
 
     public int getRenderTimeoutCount()
@@ -573,26 +184,6 @@
         this.timeoutCount = timeoutCount;
     }
 
-    private boolean isEditDefaultsMode()
-    {
-        boolean editDefaultsMode = false;
-        
-        if (portletWindow != null)
-        {
-            RequestContext context = requestContextComponent.getRequestContext();
-            
-            try
-            {
-                PortletMode curMode = context.getPortalURL().getNavigationalState().getMode(portletWindow);
-                editDefaultsMode = (JetspeedActions.EDIT_DEFAULTS_MODE.equals(curMode));
-            }
-            catch (Exception e)
-            {
-            }
-        }
-        return editDefaultsMode;
-    }
-
     protected String getEntityFragmentKey()
     {
         String entityId = (this.getId() == null) ? "-unknown-entity" : this.getId().toString();
@@ -603,24 +194,5 @@
     {
         PortletEntityImpl.registry = registry;
     }
-
-    public static void setRequestContextComponent(RequestContextComponent requestContextComponent)
-    {
-        PortletEntityImpl.requestContextComponent = requestContextComponent;
-    }
-    
-    public static void setPortletPreferencesProvider(PortletPreferencesProvider portletPreferencesProvider)
-    {
-        PortletEntityImpl.portletPreferencesProvider = portletPreferencesProvider;
-    }
-
-    public static void setPortletEntityAccess(PortletEntityAccessComponent portletEntityAccess)
-    {
-        PortletEntityImpl.portletEntityAccess = portletEntityAccess;
-    }
-
-    public static void setPageManager(PageManager pageManager)
-    {
-        PortletEntityImpl.pageManager = pageManager;
-    }
+ 
 }
\ No newline at end of file

Modified: portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletpreferences/DatabasePreference.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletpreferences/DatabasePreference.java?rev=709104&r1=709103&r2=709104&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletpreferences/DatabasePreference.java (original)
+++ portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletpreferences/DatabasePreference.java Thu Oct 30 00:10:43 2008
@@ -18,8 +18,6 @@
 
 import java.util.Collection;
 
-import org.apache.jetspeed.om.preference.impl.PreferenceImpl;
-
 /**
  * <p>
  * The database representation of a preference object

Modified: portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletpreferences/JetspeedPreferencesMap.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletpreferences/JetspeedPreferencesMap.java?rev=709104&r1=709103&r2=709104&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletpreferences/JetspeedPreferencesMap.java (original)
+++ portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletpreferences/JetspeedPreferencesMap.java Thu Oct 30 00:10:43 2008
@@ -41,6 +41,11 @@
     public JetspeedPreferencesMap()
     {
     }
+
+    public JetspeedPreferencesMap(Map<String, InternalPortletPreference> copy)
+    {
+        this.putAll(copy);
+    }
     
     public void clear()
     {

Modified: portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletpreferences/PortletPreferencesServiceImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletpreferences/PortletPreferencesServiceImpl.java?rev=709104&r1=709103&r2=709104&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletpreferences/PortletPreferencesServiceImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletpreferences/PortletPreferencesServiceImpl.java Thu Oct 30 00:10:43 2008
@@ -21,20 +21,29 @@
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
+import java.util.Map.Entry;
 
-import javax.portlet.ActionRequest;
 import javax.portlet.PortletRequest;
 import javax.portlet.PreferencesValidator;
 import javax.portlet.ValidatorException;
 
+import org.apache.jetspeed.JetspeedActions;
+import org.apache.jetspeed.PortalReservedParameters;
 import org.apache.jetspeed.cache.CacheElement;
 import org.apache.jetspeed.cache.JetspeedCache;
+import org.apache.jetspeed.container.PortletWindow;
 import org.apache.jetspeed.factory.PortletFactory;
+import org.apache.jetspeed.om.page.impl.FragmentPreferenceValue;
+import org.apache.jetspeed.om.portlet.Preference;
+import org.apache.jetspeed.om.portlet.Preferences;
+import org.apache.jetspeed.om.preference.FragmentPreference;
+import org.apache.jetspeed.request.RequestContext;
+import org.apache.jetspeed.security.SubjectHelper;
+import org.apache.jetspeed.security.User;
 import org.apache.ojb.broker.query.Criteria;
 import org.apache.ojb.broker.query.QueryByCriteria;
 import org.apache.ojb.broker.query.QueryFactory;
 import org.apache.pluto.PortletContainerException;
-import org.apache.pluto.PortletWindow;
 import org.apache.pluto.internal.InternalPortletPreference;
 import org.apache.pluto.om.portlet.PortletDefinition;
 import org.springframework.orm.ojb.support.PersistenceBrokerDaoSupport;
@@ -49,12 +58,13 @@
  * @version $Id: $
  */
 public class PortletPreferencesServiceImpl extends PersistenceBrokerDaoSupport
-        implements PortletPreferencesProvider // TODO: 2.2 extend this interface
+        implements PortletPreferencesProvider 
 {
     protected static final String DISCRIMINATOR_PORTLET = "portlet";
     protected static final String DISCRIMINATOR_ENTITY = "entity";
     protected static final String DISCRIMINATOR_USER = "user";
     protected static final String KEY_SEPARATOR = ":";
+    protected static final String EMPTY_VALUE = "_";
     
     private PortletFactory portletFactory;
     /**
@@ -63,7 +73,19 @@
     private JetspeedCache preferenceCache;
     private List<String> preloadedApplications = null;
     private boolean preloadEntities = false;
+    private boolean useEntityPreferences = true;
+
     
+    public boolean isUseEntityPreferences()
+    {
+        return useEntityPreferences;
+    }
+
+    
+    public void setUseEntityPreferences(boolean useEntityPreferences)
+    {
+        this.useEntityPreferences = useEntityPreferences;
+    }
 
     public PortletPreferencesServiceImpl(PortletFactory portletFactory, JetspeedCache preferenceCache)
             throws ClassNotFoundException
@@ -88,72 +110,114 @@
     }
     
     public Map<String, InternalPortletPreference> getDefaultPreferences(
-            PortletWindow window, PortletRequest request)
+            org.apache.pluto.PortletWindow pw, PortletRequest request)
             throws PortletContainerException
     {
+        PortletWindow window = (PortletWindow)pw;
         String appName = window.getPortletEntity().getPortletDefinition().getApplication().getName();
-        String portletName = window.getPortletEntity().getPortletDefinition().getPortletName();
-        
-        // // TODO: 2.2 - Ate, is this your intention, to always go to the DB and avoid cache in a process action?
-        // I am removing this check as I don't think default preferences can ever be "for Update"
-        // boolean forUpdate = (request instanceof ActionRequest); 
-        String cacheKey = getPorletPreferenceKey(appName, portletName);
-        // first search in cache, but only if we are not in update mode        
-        CacheElement cachedElement = preferenceCache.get(cacheKey);        
-        if (cachedElement != null)
+        String portletName = window.getPortletEntity().getPortletDefinition().getPortletName();        
+        String entityId = window.getPortletEntity().getId();
+        String defaultsCacheKey = getPorletPreferenceKey(appName, portletName);
+        JetspeedPreferencesMap defaultsMap;         
+        // first search in cache        
+        CacheElement cachedDefaults = preferenceCache.get(defaultsCacheKey);        
+        if (cachedDefaults != null)
         {
-            JetspeedPreferencesMap map = (JetspeedPreferencesMap)cachedElement.getContent();
-            return map;
+            defaultsMap = (JetspeedPreferencesMap)cachedDefaults.getContent();
         }            
-        // TODO: 2.2 this api also supports getting default preferences via "entity" preferences
-        // if we were to look up first with a dtype of "entity" and add the entityId to the query,
-        // then if not found, fallback to dtype of "portlet"
-        // c.addEqualTo("entityId", window.getId()); // TODO: 2.2 need an API to get the entity id from the entity object
+        else
+        {
+            // not found in cache, lookup in database
+            JetspeedPreferencesMap map = new JetspeedPreferencesMap(); 
+            Criteria c = new Criteria();
+            c.addEqualTo("dtype", DISCRIMINATOR_PORTLET);
+            c.addEqualTo("applicationName", appName);
+            c.addEqualTo("portletName", portletName);                
+            QueryByCriteria query = QueryFactory.newQuery(DatabasePreference.class, c);
+            Iterator<DatabasePreference> preferences = getPersistenceBrokerTemplate().getIteratorByQuery(query);
+            while (preferences.hasNext())
+            {
+                DatabasePreference preference = preferences.next();            
+                JetspeedPreferenceImpl value = new JetspeedPreferenceImpl(preference.getName(), preference.getValues());
+                value.setReadOnly(preference.isReadOnly());
+                map.put(preference.getName(), value);
+            }
+            preferenceCache.put(preferenceCache.createElement(defaultsCacheKey, map));
+            defaultsMap = map;
+        }
         
-        // not found in cache, lookup in database
-        // TODO: 2.2 I want to avoid storing all this on the map to conserve memory (DISCRIMATOR_PORTLET, appName, portletName), 
-        // maybe we can get fields from cache key or from calling params
-        JetspeedPreferencesMap map = new JetspeedPreferencesMap(); 
-        Criteria c = new Criteria();
-        c.addEqualTo("dtype", DISCRIMINATOR_PORTLET);
-        c.addEqualTo("applicationName", appName);
-        c.addEqualTo("portletName", portletName);                
-        QueryByCriteria query = QueryFactory.newQuery(DatabasePreference.class, c);
-        Iterator<DatabasePreference> preferences = getPersistenceBrokerTemplate().getIteratorByQuery(query);
-        while (preferences.hasNext())
+        // retrieve entity preferences
+        if (useEntityPreferences)
         {
-            DatabasePreference preference = preferences.next();            
-            JetspeedPreferenceImpl value = new JetspeedPreferenceImpl(preference.getName(), preference.getValues());
-            map.put(preference.getName(), value);
+            JetspeedPreferencesMap entityMap = null;
+            String entityCacheKey = this.getEntityPreferenceKey(appName, portletName, entityId);
+            CacheElement cachedEntity = preferenceCache.get(entityCacheKey);        
+            if (cachedEntity != null)
+            {
+                entityMap = (JetspeedPreferencesMap)cachedEntity.getContent();
+            }            
+            else
+            {
+                List<FragmentPreference> fragmentPrefs = window.getPortletEntity().getFragment().getPreferences();
+                if (fragmentPrefs.size() > 0)
+                {
+                    entityMap = new JetspeedPreferencesMap();                 
+                    for (FragmentPreference fragmentPref : fragmentPrefs)
+                    {                  
+                        List<FragmentPreferenceValue> fragmentValues = fragmentPref.getValueList();
+                        String[] entityValues = new String[fragmentValues.size()];
+                        int ix = 0;
+                        for (FragmentPreferenceValue fragmentValue : fragmentValues)
+                        {
+                            entityValues[ix] = fragmentValue.getValue();
+                            ix++;
+                        }
+                        JetspeedPreferenceImpl preference = new JetspeedPreferenceImpl(fragmentPref.getName(), entityValues);
+                        preference.setReadOnly(fragmentPref.isReadOnly());                    
+                        entityMap.put(fragmentPref.getName(), preference);                    
+                    }
+                }
+            }
+            // merge default with entity preferences
+            if (entityMap != null && entityMap.size() > 0)
+            {
+                JetspeedPreferencesMap mergedMap = new JetspeedPreferencesMap(defaultsMap);                 
+                for (Entry<String, InternalPortletPreference> entry : entityMap.entrySet())
+                {
+                    mergedMap.put(entry.getKey(), entry.getValue());
+                }
+                return mergedMap;
+            }
         }
-        preferenceCache.put(preferenceCache.createElement(cacheKey, map));
-        return map;
+        return defaultsMap;
     }
 
     public Map<String, InternalPortletPreference> getStoredPreferences(
-            PortletWindow window, PortletRequest request)
+            org.apache.pluto.PortletWindow pw, PortletRequest request)
             throws PortletContainerException
     {
+        PortletWindow window = (PortletWindow)pw;
+        if (request.getPortletMode().equals(JetspeedActions.EDIT_DEFAULTS_MODE))
+        {
+            return retrieveEntityPreferences(window, request);
+        }
         String appName = window.getPortletEntity().getPortletDefinition().getApplication().getName();
         String portletName = window.getPortletEntity().getPortletDefinition().getPortletName();
-        String entityId = window.getId().getStringId(); // TODO: 2.2 - FIXME: think we need to add entity.getId()
+        String entityId = window.getPortletEntity().getId();
         String userName = request.getUserPrincipal() != null ? request.getUserPrincipal().getName() : null;
         if (userName == null)
         {
-            userName = "guest"; // TODO: 2.2 might not wanna do this, might wanna throw exception
+            RequestContext rc = (RequestContext)request.getAttribute(PortalReservedParameters.REQUEST_CONTEXT_ATTRIBUTE);
+            userName = SubjectHelper.getPrincipal(rc.getSubject(), User.class).getName();
         }
-        boolean forUpdate = (request instanceof ActionRequest); // TODO: 2.2 - Ate, is this your intention, to always go to the DB and avoid cache in a process action?
         String cacheKey = getUserPreferenceKey(appName, portletName, entityId, userName);
-        // first search in cache, but only if we are not in update mode        
-        if (!forUpdate)
+        // first search in cache        
+        CacheElement cachedElement = preferenceCache.get(cacheKey);        
+        if (cachedElement != null)
         {
-            CacheElement cachedElement = preferenceCache.get(cacheKey);        
-            if (cachedElement != null)
-            {
-                JetspeedPreferencesMap map = (JetspeedPreferencesMap)cachedElement.getContent();
-                return map;
-            }            
-        }
+            JetspeedPreferencesMap map = (JetspeedPreferencesMap)cachedElement.getContent();
+            return map;
+        }            
         // not found in cache, lookup in database
         JetspeedPreferencesMap map = new JetspeedPreferencesMap(); 
         Criteria c = new Criteria();
@@ -168,25 +232,32 @@
         {
             DatabasePreference preference = preferences.next();            
             JetspeedPreferenceImpl value = new JetspeedPreferenceImpl(preference.getName(), preference.getValues());
+            value.setReadOnly(preference.isReadOnly());
             map.put(preference.getName(), value);
         }
         preferenceCache.put(preferenceCache.createElement(cacheKey, map));
         return map;        
     }
 
-    public void store(PortletWindow window, PortletRequest request,
+    public void store(org.apache.pluto.PortletWindow pw, PortletRequest request,
             Map<String, InternalPortletPreference> map)
             throws PortletContainerException
     {
+        PortletWindow window = (PortletWindow)pw;
+        if (request.getPortletMode().equals(JetspeedActions.EDIT_DEFAULTS_MODE))
+        {
+            storeEntityPreferences(window, request, map);
+            return;
+        }        
         String appName = window.getPortletEntity().getPortletDefinition().getApplication().getName();
         String portletName = window.getPortletEntity().getPortletDefinition().getPortletName();
-        String entityId = window.getId().getStringId(); // TODO: 2.2 - FIXME: think we need to add entity.getId()
+        String entityId = window.getPortletEntity().getId();
         String userName = request.getUserPrincipal() != null ? request.getUserPrincipal().getName() : null;
         if (userName == null)
         {
-            userName = "guest"; // TODO: 2.2 might not wanna do this, might wanna throw exception
+            RequestContext rc = (RequestContext)request.getAttribute(PortalReservedParameters.REQUEST_CONTEXT_ATTRIBUTE);
+            userName = SubjectHelper.getPrincipal(rc.getSubject(), User.class).getName();
         }
-        // Merge: going through all this to keep down prefs memory footprint
         // always read in to get a fresh copy for merge
         Criteria c = new Criteria();
         c.addEqualTo("dtype", DISCRIMINATOR_USER);
@@ -278,6 +349,11 @@
         return DISCRIMINATOR_PORTLET + KEY_SEPARATOR + applicationName + KEY_SEPARATOR + portletName;        
     }
 
+    private String getEntityPreferenceKey(String applicationName, String portletName, String entityId)
+    {
+        return DISCRIMINATOR_PORTLET + KEY_SEPARATOR + applicationName + KEY_SEPARATOR + portletName + KEY_SEPARATOR + entityId;        
+    }
+    
     private String getUserPreferenceKey(String applicationName, String portletName, String entityId, String userName)
     {
         return DISCRIMINATOR_USER + KEY_SEPARATOR + applicationName + KEY_SEPARATOR + portletName + KEY_SEPARATOR + entityId + KEY_SEPARATOR + userName;        
@@ -285,12 +361,60 @@
     
     public void preloadApplicationPreferences(String portletApplicationName)
     {
-        // TODO: 2.2 implement
+        JetspeedPreferencesMap map = new JetspeedPreferencesMap();
+        Criteria c = new Criteria();
+        c.addEqualTo("dtype", DISCRIMINATOR_PORTLET);
+        c.addEqualTo("applicationName", portletApplicationName);
+        
+        String previousPortletName = "";
+        QueryByCriteria query = QueryFactory.newQuery(DatabasePreference.class, c);
+        query.addOrderByAscending("dtype");
+        query.addOrderByAscending("applicationName");
+        query.addOrderByAscending("portletName");        
+        Iterator<DatabasePreference> preferences = getPersistenceBrokerTemplate().getIteratorByQuery(query);
+        while (preferences.hasNext())
+        {
+            DatabasePreference preference = preferences.next();
+            if (preference.getPortletName().equals(previousPortletName))
+            {
+                map = new JetspeedPreferencesMap();
+                String defaultsCacheKey = getPorletPreferenceKey(portletApplicationName, preference.getPortletName());                
+                preferenceCache.put(preferenceCache.createElement(defaultsCacheKey, map));
+                previousPortletName = preference.getPortletName();
+            }
+            JetspeedPreferenceImpl value = new JetspeedPreferenceImpl(preference.getName(), preference.getValues());
+            value.setReadOnly(preference.isReadOnly());
+            map.put(preference.getName(), value);
+        }
     }
     
     public void preloadAllEntities()
     {
-        // TODO: 2.2 implement        
+        JetspeedPreferencesMap map = new JetspeedPreferencesMap();
+        Criteria c = new Criteria();
+        c.addEqualTo("dtype", DISCRIMINATOR_USER);        
+        String previousKey = "";
+        QueryByCriteria query = QueryFactory.newQuery(DatabasePreference.class, c);
+        query.addOrderByAscending("dtype");
+        query.addOrderByAscending("applicationName");
+        query.addOrderByAscending("portletName");        
+        query.addOrderByAscending("entityId");        
+        query.addOrderByAscending("userName");                        
+        Iterator<DatabasePreference> preferences = getPersistenceBrokerTemplate().getIteratorByQuery(query);
+        while (preferences.hasNext())
+        {
+            DatabasePreference preference = preferences.next();
+            String cacheKey = getUserPreferenceKey(preference.getApplicationName(), preference.getPortletName(), preference.getEntityId(), preference.getUserName());                            
+            if (!cacheKey.equals(previousKey))
+            {
+                map = new JetspeedPreferencesMap();
+                preferenceCache.put(preferenceCache.createElement(cacheKey, map));
+                previousKey = cacheKey;
+            }
+            JetspeedPreferenceImpl value = new JetspeedPreferenceImpl(preference.getName(), preference.getValues());
+            value.setReadOnly(preference.isReadOnly());
+            map.put(preference.getName(), value);
+        }
     }
 
     public void init() throws Exception
@@ -309,5 +433,52 @@
             preloadAllEntities();
         }
     }    
+
+    public void storeDefaults(org.apache.jetspeed.om.portlet.PortletApplication app)
+    {
+        for (org.apache.jetspeed.om.portlet.PortletDefinition pd : app.getPortlets())
+        {
+            storeDefaults(pd);
+        }
+    }
     
+    public void storeDefaults(org.apache.jetspeed.om.portlet.PortletDefinition pd)
+    {
+        Preferences preferences = pd.getPortletPreferences();
+        for (Preference preference : preferences.getPortletPreferences())
+        {
+            DatabasePreference dbPref = new DatabasePreference();
+            dbPref.setDtype(DISCRIMINATOR_PORTLET);
+            dbPref.setApplicationName(pd.getApplication().getName());
+            dbPref.setPortletName(pd.getPortletName());
+            dbPref.setEntityId(EMPTY_VALUE);
+            dbPref.setUserName(EMPTY_VALUE);
+            dbPref.setName(preference.getName());
+            dbPref.setReadOnly(preference.isReadOnly());
+            short index = 0;
+            for (String value : preference.getValues())
+            {
+                DatabasePreferenceValue dbValue = new DatabasePreferenceValue();
+                dbValue.setIndex(index);
+                dbValue.setValue(value);
+                index++;
+            }
+            getPersistenceBrokerTemplate().store(dbPref);
+            
+        }
+    }
+
+    public  Map<String, InternalPortletPreference>  retrieveEntityPreferences(PortletWindow window, PortletRequest request)
+    {
+        // TODO: 2.2 implement - need to better look at use cases for edit defaults mode
+        return new JetspeedPreferencesMap(); 
+    }
+    
+    public void storeEntityPreferences(PortletWindow pw, PortletRequest request,
+            Map<String, InternalPortletPreference> map)
+            throws PortletContainerException
+    {
+        // TODO: 2.2 implement - need to better look at use cases for edit defaults mode
+    }
+
 }

Modified: portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletregistry/PersistenceBrokerPortletRegistry.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletregistry/PersistenceBrokerPortletRegistry.java?rev=709104&r1=709103&r2=709104&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletregistry/PersistenceBrokerPortletRegistry.java (original)
+++ portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletregistry/PersistenceBrokerPortletRegistry.java Thu Oct 30 00:10:43 2008
@@ -34,7 +34,6 @@
 import org.apache.ojb.broker.query.Criteria;
 import org.apache.ojb.broker.query.QueryFactory;
 import org.apache.pluto.om.portlet.PortletApplicationDefinition;
-import org.apache.pluto.om.portlet.PortletDefinition;
 import org.springframework.dao.DataAccessException;
 
 /**

Modified: portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/jetspeed-api/src/main/java/org/apache/jetspeed/components/portletpreferences/PortletPreferencesProvider.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/jetspeed-api/src/main/java/org/apache/jetspeed/components/portletpreferences/PortletPreferencesProvider.java?rev=709104&r1=709103&r2=709104&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/jetspeed-api/src/main/java/org/apache/jetspeed/components/portletpreferences/PortletPreferencesProvider.java (original)
+++ portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/jetspeed-api/src/main/java/org/apache/jetspeed/components/portletpreferences/PortletPreferencesProvider.java Thu Oct 30 00:10:43 2008
@@ -16,6 +16,10 @@
  */
 package org.apache.jetspeed.components.portletpreferences;
 
+import org.apache.jetspeed.om.portlet.PortletApplication;
+import org.apache.jetspeed.om.portlet.PortletDefinition;
+
+
 /**
  * 
  * @version $Id$
@@ -25,4 +29,8 @@
 {
     public void preloadApplicationPreferences(String portletApplicationName);
     public void preloadAllEntities();    
+    public void storeDefaults(PortletDefinition pd);
+    public void storeDefaults(PortletApplication app);
+    
+
 }

Modified: portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/jetspeed-api/src/main/java/org/apache/jetspeed/container/PortletEntity.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/jetspeed-api/src/main/java/org/apache/jetspeed/container/PortletEntity.java?rev=709104&r1=709103&r2=709104&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/jetspeed-api/src/main/java/org/apache/jetspeed/container/PortletEntity.java (original)
+++ portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/jetspeed-api/src/main/java/org/apache/jetspeed/container/PortletEntity.java Thu Oct 30 00:10:43 2008
@@ -38,24 +38,7 @@
 
     String getPortletUniqueName();
 
-    // TODO: Moved from MutablePortletEntity - do we really still need this?
     void setFragment(Fragment fragment);
+    Fragment getFragment();
     
-    
-    // TODO: Moved from MutablePortletEntity - do we really still need this?
-    /**
-     * <p>
-     * Persistence callback to allow a PortletEntity instance to persist children
-     * objects (like portlet preferences) <em>within</em> the same transaction.
-     * </p>
-     * <p>
-     * This method must be called <em>always</em> from the #store() method. Using a callback from
-     * the persistence manager might not be reliable when the PortletEntity <em>itself</em>
-     * isn't changed but children might.
-     * </p>
-     * <p>
-     * Notably condition when this might happen is the Pluto 1.0.1 preferences handling calling
-     * the portletEntity store() method
-     * */
-    void storeChildren();    
 }

Modified: portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/jetspeed-portal-resources/src/main/resources/assembly/registry.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/jetspeed-portal-resources/src/main/resources/assembly/registry.xml?rev=709104&r1=709103&r2=709104&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/jetspeed-portal-resources/src/main/resources/assembly/registry.xml (original)
+++ portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/jetspeed-portal-resources/src/main/resources/assembly/registry.xml Thu Oct 30 00:10:43 2008
@@ -97,7 +97,8 @@
     </constructor-arg>
     <constructor-arg index="1">
       <ref bean="preferencesCache" />
-    </constructor-arg>
+    </constructor-arg>    
+    <property name="useEntityPreferences" ><value>true</value></property>
     </bean>
 
   <bean id="org.apache.jetspeed.components.portletpreferences.PortletPreferencesProvider" parent="baseTransactionProxy"

Modified: portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/jetspeed-portal-resources/src/main/resources/assembly/static-bean-references.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/jetspeed-portal-resources/src/main/resources/assembly/static-bean-references.xml?rev=709104&r1=709103&r2=709104&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/jetspeed-portal-resources/src/main/resources/assembly/static-bean-references.xml (original)
+++ portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/jetspeed-portal-resources/src/main/resources/assembly/static-bean-references.xml Thu Oct 30 00:10:43 2008
@@ -62,39 +62,6 @@
     </property>
   </bean>
 
-  <bean id="_portletEntityImplPortletEntityAccessComponentInitializer"
-    class="org.apache.jetspeed.components.LifecycleAwareStaticClassInitializer">
-    <meta key="j2:cat" value="default,registry" />
-    <property name="className" value="org.apache.jetspeed.components.portletentity.PortletEntityImpl" />
-    <property name="methodName" value="setPortletEntityAccess" />
-    <property name="typeName" value="org.apache.jetspeed.components.portletentity.PortletEntityAccessComponent" />
-    <property name="value">
-      <ref bean="portletEntityAccess" />
-    </property>
-  </bean>
-
-  <bean id="_portletEntityImplPortletPreferencesProviderInitializer"
-    class="org.apache.jetspeed.components.LifecycleAwareStaticClassInitializer">
-    <meta key="j2:cat" value="default,registry" />
-    <property name="className" value="org.apache.jetspeed.components.portletentity.PortletEntityImpl" />
-    <property name="methodName" value="setPortletPreferencesProvider" />
-    <property name="typeName" value="org.apache.jetspeed.components.portletpreferences.PortletPreferencesProvider" />
-    <property name="value">
-      <ref bean="org.apache.jetspeed.components.portletpreferences.PortletPreferencesProvider" />
-    </property>
-  </bean>
-
-  <bean id="_portletEntityImplPageManagerInitializer"
-    class="org.apache.jetspeed.components.LifecycleAwareStaticClassInitializer">
-    <meta key="j2:cat" value="default,xmlPageManager,dbPageManager" />
-    <property name="className" value="org.apache.jetspeed.components.portletentity.PortletEntityImpl" />
-    <property name="methodName" value="setPageManager" />
-    <property name="typeName" value="org.apache.jetspeed.page.PageManager" />
-    <property name="value">
-      <ref bean="org.apache.jetspeed.page.PageManager" />
-    </property>
-  </bean>
-
   <bean id="_portletEntityImplRequestContextComponentInitializer"
     class="org.apache.jetspeed.components.LifecycleAwareStaticClassInitializer">
     <meta key="j2:cat" value="default,registry" />



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