[ 
https://issues.apache.org/jira/browse/PLUTO-487?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12603969#action_12603969
 ] 

Nikita Dubrovsky commented on PLUTO-487:
----------------------------------------

Hi Eric, sorry for the delay! The one use-case I was considering is whether the 
portal might expect to be able to read a portlet's preferences from the 
persistent store, without the portlet having called store() explicitly. 
However, I don't think this is a completely valid use-case, because it assumes 
that the portlet must have retrieved its preferences at least once (which would 
store them). So, I believe it makes sense to remove the call to internalStore() 
from the PortletPreferencesImpl constructor. The one suggestion I have is to 
make internalStore() protected instead of private, so that the method can be 
used if someone wants to modify the behavior by extending the class.

> PortletPreferencesImpl should not store the preferences every time it is 
> instantiated
> -------------------------------------------------------------------------------------
>
>                 Key: PLUTO-487
>                 URL: https://issues.apache.org/jira/browse/PLUTO-487
>             Project: Pluto
>          Issue Type: Improvement
>          Components: portlet container
>    Affects Versions: 1.1.5
>         Environment: Tomcat 5.5.26
>            Reporter: Nikita Dubrovsky
>            Assignee: Eric Dalquist
>             Fix For: 1.1.6
>
>         Attachments: P487-1.1.x-Rev656347.diff
>
>
> In Pluto 1.1.5, the constructor of 
> org.apache.pluto.internal.impl.PortletPreferencesImpl calls internalStore() 
> every time. It would be better to only store the preferences when it is 
> actually necessary -- I believe this is the case only when the prefs from 
> portlet.xml have not yet been stored:
>             ...
>             Set portletXmlPrefNames = getPreferenceNames(defaultPreferences);
>             Set persistedPrefNames = getPreferenceNames(storedPreferences);
>             if (!persistedPrefNames.containsAll(portletXmlPrefNames)) {
>                 internalStore();
>             }
>             ...
>     private Set getPreferenceNames(InternalPortletPreference[] prefs) {
>         Set prefNames = new HashSet();
>         for (int i = 0; i < prefs.length; i++) {
>           prefNames.add(prefs[i].getName());
>         }
>         return prefNames;
>     }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to