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 "Nikita (JIRA)" <ji...@apache.org> on 2008/05/14 23:51:55 UTC
[jira] Created: (PLUTO-487) PortletPreferencesImpl should not store
the preferences every time it is instantiated
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
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.
[jira] Commented: (PLUTO-487) PortletPreferencesImpl should not
store the preferences every time it is instantiated
Posted by "Eric Dalquist (JIRA)" <ji...@apache.org>.
[ 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.
[jira] Resolved: (PLUTO-487) PortletPreferencesImpl should not
store the preferences every time it is instantiated
Posted by "Eric Dalquist (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PLUTO-487?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Eric Dalquist resolved PLUTO-487.
---------------------------------
Resolution: Fixed
Fix Version/s: 2.0-refactoring
Applied to refactoring branch
> 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: 2.0.0, 2.0-refactoring
> Environment: Tomcat 5.5.26
> Reporter: Nikita Dubrovsky
> Assignee: Eric Dalquist
> Fix For: 2.0.0, 2.0-refactoring, 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.
[jira] Commented: (PLUTO-487) PortletPreferencesImpl should not
store the preferences every time it is instantiated
Posted by "Nikita Dubrovsky (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PLUTO-487?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12602146#action_12602146 ]
Nikita Dubrovsky commented on PLUTO-487:
----------------------------------------
I had assumed that internalStore() is called in the constructor because of the last paragraph in PLT.14.1. For me, it sounds good to not make the call at all, but let me double-check this in more detail tomorrow.
> 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.
[jira] Updated: (PLUTO-487) PortletPreferencesImpl should not store
the preferences every time it is instantiated
Posted by "Craig Doremus (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PLUTO-487?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Craig Doremus updated PLUTO-487:
--------------------------------
Affects Version/s: (was: 1.1.5)
2.0-refactoring
2.0.0
> 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: 2.0.0, 2.0-refactoring
> Environment: Tomcat 5.5.26
> Reporter: Nikita Dubrovsky
> Assignee: Eric Dalquist
> Fix For: 2.0.0, 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.
[jira] Updated: (PLUTO-487) PortletPreferencesImpl should not store
the preferences every time it is instantiated
Posted by "Nikita Dubrovsky (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PLUTO-487?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Nikita Dubrovsky updated PLUTO-487:
-----------------------------------
Fix Version/s: 1.1.6
> 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
> 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.
[jira] Commented: (PLUTO-487) PortletPreferencesImpl should not
store the preferences every time it is instantiated
Posted by "Eric Dalquist (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PLUTO-487?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12606399#action_12606399 ]
Eric Dalquist commented on PLUTO-487:
-------------------------------------
I'll remove the initial call and make internalStore() protected for subclasses. I should get this in within the next week so it will make 1.1.6
> 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.
Re: [jira] Reopened: (PLUTO-487) PortletPreferencesImpl should not
store the preferences every time it is instantiated
Posted by Eric Dalquist <er...@doit.wisc.edu>.
Craig,
Sorry I missed the branch. I'll get it applied today or tomorrow.
Thanks for the catch,
-Eric
Craig Doremus (JIRA) wrote:
> [ https://issues.apache.org/jira/browse/PLUTO-487?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
>
> Craig Doremus reopened PLUTO-487:
> ---------------------------------
>
>
> This fix needs to be applied to trunk and 2.0-refactoring branch.
>
>
>> 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: 2.0.0, 2.0-refactoring
>> Environment: Tomcat 5.5.26
>> Reporter: Nikita Dubrovsky
>> Assignee: Eric Dalquist
>> Fix For: 2.0.0, 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;
>> }
>>
>
>
[jira] Reopened: (PLUTO-487) PortletPreferencesImpl should not
store the preferences every time it is instantiated
Posted by "Craig Doremus (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PLUTO-487?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Craig Doremus reopened PLUTO-487:
---------------------------------
This fix needs to be applied to trunk and 2.0-refactoring branch.
> 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: 2.0.0, 2.0-refactoring
> Environment: Tomcat 5.5.26
> Reporter: Nikita Dubrovsky
> Assignee: Eric Dalquist
> Fix For: 2.0.0, 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.
[jira] Assigned: (PLUTO-487) PortletPreferencesImpl should not
store the preferences every time it is instantiated
Posted by "Eric Dalquist (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PLUTO-487?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Eric Dalquist reassigned PLUTO-487:
-----------------------------------
Assignee: Eric Dalquist
> 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.
[jira] Issue Comment Edited: (PLUTO-487) PortletPreferencesImpl
should not store the preferences every time it is instantiated
Posted by "Nikita Dubrovsky (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PLUTO-487?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12603969#action_12603969 ]
nikd edited comment on PLUTO-487 at 6/10/08 11:47 AM:
------------------------------------------------------------------
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 ever called store() explicitly. However, I don't think this is a valid use-case, because it assumes that the portlet must have retrieved its preferences at least once (which currently would store them). So, I think it makes sense to remove the call to internalStore() from the PortletPreferencesImpl constructor. Removing the call would also be very good for efficiency and performance; for example, right now if 1000 users view the same portlet, there will be 1000 copies of the same default preferences in the persistent store, even if none of the users actually changed the portlet's preferences.
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.
was (Author: nikd):
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.
[jira] Commented: (PLUTO-487) PortletPreferencesImpl should not
store the preferences every time it is instantiated
Posted by "Eric Dalquist (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PLUTO-487?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12601084#action_12601084 ]
Eric Dalquist commented on PLUTO-487:
-------------------------------------
I'll take a look at the patch either today or early next week and see about applying it. I'll also take a look and see if the trunk needs this fix as well.
> 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
> 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.
[jira] Resolved: (PLUTO-487) PortletPreferencesImpl should not
store the preferences every time it is instantiated
Posted by "Eric Dalquist (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PLUTO-487?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Eric Dalquist resolved PLUTO-487.
---------------------------------
Resolution: Fixed
Fix Version/s: 2.0.0
Removed call to internalStore() in the constructor and made internalStore() a protected final method for sub-classes to use if needed.
> 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: 2.0.0, 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.
[jira] Commented: (PLUTO-487) PortletPreferencesImpl should not
store the preferences every time it is instantiated
Posted by "Nikita Dubrovsky (JIRA)" <ji...@apache.org>.
[ 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.
[jira] Issue Comment Edited: (PLUTO-487) PortletPreferencesImpl
should not store the preferences every time it is instantiated
Posted by "Nikita (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PLUTO-487?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12596955#action_12596955 ]
nikd edited comment on PLUTO-487 at 5/14/08 2:52 PM:
-------------------------------------------------------
Attached my proposed fix.
was (Author: nikd):
Proposed fix.
> 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
> 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.
[jira] Updated: (PLUTO-487) PortletPreferencesImpl should not store
the preferences every time it is instantiated
Posted by "Nikita (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PLUTO-487?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Nikita updated PLUTO-487:
-------------------------
Attachment: P487-1.1.x-Rev656347.diff
Proposed fix.
> 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
> 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.