You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pluto-dev@portals.apache.org by "Eric Dalquist (JIRA)" <ji...@apache.org> on 2008/06/03 16:42:45 UTC

[jira] Commented: (PLUTO-487) PortletPreferencesImpl should not store the preferences every time it is instantiated

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

Eric Dalquist commented on PLUTO-487:
-------------------------------------

The more I read PLT.14.1 and look at the code I'm not sure why the PortletPreferencesImpl calls internalStore() at all in the constructor. PLT.14.1 seems to be more worded towards ensuring the PortletPreferencesImpl does not contain stale preferences, especially since the spec doesn't address how preferences are actually persisted or the layering is done when loading them.

As far as I can tell from the code the only downside of not calling internalStore() in the constructor is that the PortletPreferencesService does not get a chance to store the default preferences post-merge. This seems like a minor down-side as the PortletPreferencesService impl would have access to the default portlet.xml preferences via the PortletDD if it needed to store/use them. The PortletPreferencesImpl always loads the default prefs then loads the stored prefs and then merges them, no default preference information will be lost by removing the internalStore() call and PLT.14.1 should be fulfilled.

I'll bring this up on the Pluto list as well but perhaps the internalStore() method can just be removed.

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