[jboss-cvs] jboss-portal/portlet/src/main/org/jboss/portal/portlet/state/producer ...
Julien Viet
julien at jboss.com
Tue Aug 22 10:08:54 EDT 2006
User: julien
Date: 06/08/22 10:08:54
Modified: portlet/src/main/org/jboss/portal/portlet/state/producer
State.java StateStore.java
StatefulPortletInvoker.java
Log:
- refactored the ValueMap to PropertyMap and moved it in org.jboss.portal.portlet.state package
- introduced TypedMap that is super type of ParameterMap and is reused for the PropertyMap
Revision Changes Path
1.4 +3 -3 jboss-portal/portlet/src/main/org/jboss/portal/portlet/state/producer/State.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: State.java
===================================================================
RCS file: /cvsroot/jboss/jboss-portal/portlet/src/main/org/jboss/portal/portlet/state/producer/State.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- State.java 30 Jul 2006 12:36:23 -0000 1.3
+++ State.java 22 Aug 2006 14:08:54 -0000 1.4
@@ -21,13 +21,13 @@
*/
package org.jboss.portal.portlet.state.producer;
-import org.jboss.portal.common.value.ValueMap;
+import org.jboss.portal.portlet.state.PropertyMap;
import java.util.Date;
/**
* @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision: 1.3 $
+ * @version $Revision: 1.4 $
*/
public interface State
{
@@ -50,7 +50,7 @@
*
* @return the state properties
*/
- ValueMap getProperties();
+ PropertyMap getProperties();
/**
* The scheduled termination time.
1.4 +7 -7 jboss-portal/portlet/src/main/org/jboss/portal/portlet/state/producer/StateStore.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: StateStore.java
===================================================================
RCS file: /cvsroot/jboss/jboss-portal/portlet/src/main/org/jboss/portal/portlet/state/producer/StateStore.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- StateStore.java 30 Jul 2006 12:36:23 -0000 1.3
+++ StateStore.java 22 Aug 2006 14:08:54 -0000 1.4
@@ -21,13 +21,13 @@
*/
package org.jboss.portal.portlet.state.producer;
-import org.jboss.portal.common.value.ValueMap;
+import org.jboss.portal.portlet.state.PropertyMap;
/**
* An abstraction for enabling state management on the producer side.
*
* @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision: 1.3 $
+ * @version $Revision: 1.4 $
*/
public interface StateStore
{
@@ -49,7 +49,7 @@
* @return the id of the state created
* @throws IllegalArgumentException if the portlet id is null
*/
- String createState(String portletId, ValueMap valueMap) throws IllegalArgumentException;
+ String createState(String portletId, PropertyMap propertyMap) throws IllegalArgumentException;
/**
* Clone an existing state.
@@ -66,24 +66,24 @@
* Clone an existing state.
*
* @param stateId the id that this state refers to
- * @param valueMap the values of the cloned state
+ * @param propertyMap the values of the cloned state
* @return the state id
* @throws IllegalArgumentException if the state id is null or the value is nul
* @throws NoSuchStateException is the specified state does not exist
* @throws InvalidStateIdException if the state id is not valid
*/
- String cloneState(String stateId, ValueMap valueMap) throws IllegalArgumentException, NoSuchStateException, InvalidStateIdException;
+ String cloneState(String stateId, PropertyMap propertyMap) throws IllegalArgumentException, NoSuchStateException, InvalidStateIdException;
/**
* Update the state.
*
* @param stateId
- * @param valueMap the updated state
+ * @param propertyMap the updated state
* @throws IllegalArgumentException if the state id is null or the values are null
* @throws NoSuchStateException is the specified state does not exist
* @throws InvalidStateIdException if the state id is not valid
*/
- void updateState(String stateId, ValueMap valueMap) throws IllegalArgumentException, NoSuchStateException, InvalidStateIdException;
+ void updateState(String stateId, PropertyMap propertyMap) throws IllegalArgumentException, NoSuchStateException, InvalidStateIdException;
/**
* Destroy the state.
1.12 +27 -27 jboss-portal/portlet/src/main/org/jboss/portal/portlet/state/producer/StatefulPortletInvoker.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: StatefulPortletInvoker.java
===================================================================
RCS file: /cvsroot/jboss/jboss-portal/portlet/src/main/org/jboss/portal/portlet/state/producer/StatefulPortletInvoker.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- StatefulPortletInvoker.java 22 Aug 2006 12:52:59 -0000 1.11
+++ StatefulPortletInvoker.java 22 Aug 2006 14:08:54 -0000 1.12
@@ -23,9 +23,9 @@
import org.jboss.portal.common.invocation.InvocationException;
import org.jboss.portal.common.system.AbstractJBossService;
-import org.jboss.portal.common.value.SimpleValueMap;
+import org.jboss.portal.portlet.state.SimplePropertyMap;
import org.jboss.portal.common.value.Value;
-import org.jboss.portal.common.value.ValueMap;
+import org.jboss.portal.portlet.state.PropertyMap;
import org.jboss.portal.portlet.NoSuchPortletException;
import org.jboss.portal.portlet.Portlet;
import org.jboss.portal.portlet.PortletInvoker;
@@ -45,7 +45,7 @@
/**
* @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision: 1.11 $
+ * @version $Revision: 1.12 $
*/
public class StatefulPortletInvoker extends AbstractJBossService implements PortletInvoker
{
@@ -186,7 +186,7 @@
}
// Value map of the state loaded
- ValueMap valueMap = null;
+ PropertyMap propertyMap = null;
// State id not null implies that we have an existing state
String stateId = null;
@@ -214,7 +214,7 @@
}
//
- valueMap = state.getProperties();
+ propertyMap = state.getProperties();
portletId = state.getPortletId();
}
@@ -236,7 +236,7 @@
PreferencesInfo prefsInfo = info.getPreferences();
//
- AbstractPropertyContext prefs = new AbstractPropertyContext(access, valueMap, prefsInfo);
+ AbstractPropertyContext prefs = new AbstractPropertyContext(access, propertyMap, prefsInfo);
//
try
@@ -262,7 +262,7 @@
if (invocation instanceof ActionInvocation && status == AbstractPropertyContext.UPDATE_SUCCEDED)
{
// Get the potentially updated prefs
- ValueMap newPrefs = prefs.getPrefs();
+ PropertyMap newPrefs = prefs.getPrefs();
//
if (access == AccessMode.CLONE_BEFORE_WRITE)
@@ -290,12 +290,12 @@
for (Iterator i = prefsInfo.getKeys().iterator(); i.hasNext();)
{
String key = (String)i.next();
- if (!newPrefs.getKeys().contains(key))
+ if (!newPrefs.keySet().contains(key))
{
PreferenceInfo pref = prefsInfo.getPreference(key);
if (Boolean.TRUE.equals(pref.isReadOnly()) == false)
{
- newPrefs.setValue(key, pref.getDefaultValue());
+ newPrefs.setProperty(key, pref.getDefaultValue());
}
}
}
@@ -359,13 +359,13 @@
}
else
{
- ValueMap originalState = getPropertiesFromMetaData(portletId);
- ValueMap newState = new SimpleValueMap();
- for (Iterator i = originalState.getKeys().iterator(); i.hasNext();)
+ PropertyMap originalState = getPropertiesFromMetaData(portletId);
+ PropertyMap newState = new SimplePropertyMap();
+ for (Iterator i = originalState.keySet().iterator(); i.hasNext();)
{
String key = (String)i.next();
- Value originalValue = originalState.getValue(key);
- newState.setValue(key, originalValue);
+ Value originalValue = originalState.getProperty(key);
+ newState.setProperty(key, originalValue);
}
String cloneId = CLONE_ID_PREFIX + stateStore.createState(portletId, newState);
return cloneId;
@@ -396,7 +396,7 @@
}
}
- public ValueMap getProperties(final String portletId) throws PortletInvokerException
+ public PropertyMap getProperties(final String portletId) throws PortletInvokerException
{
if (portletId == null)
{
@@ -413,7 +413,7 @@
State state = stateStore.loadState(stateId);
// Get the content
- ValueMap values = new SimpleValueMap(state.getProperties());
+ PropertyMap values = new SimplePropertyMap(state.getProperties());
// Dereference the portlet
String referencedPortletId = state.getPortletId();
@@ -436,10 +436,10 @@
{
String key = (String)i.next();
PreferenceInfo pref = prefs.getPreference(key);
- if (Boolean.TRUE.equals(pref.isReadOnly()) || values.getKeys().contains(pref.getKey()) == false)
+ if (Boolean.TRUE.equals(pref.isReadOnly()) || values.keySet().contains(pref.getKey()) == false)
{
Value defaultValue = pref.getDefaultValue();
- values.setValue(key, (Value)defaultValue.clone());
+ values.setProperty(key, (Value)defaultValue.clone());
}
}
@@ -462,7 +462,7 @@
}
}
- public void setProperties(String portletId, ValueMap properties) throws PortletInvokerException
+ public void setProperties(String portletId, PropertyMap properties) throws PortletInvokerException
{
if (portletId == null)
{
@@ -502,19 +502,19 @@
PreferencesInfo prefs = referencedPortletInfo.getPreferences();
// Clone argument
- properties = new SimpleValueMap(properties);
+ properties = new SimplePropertyMap(properties);
// Remove read only values
- for (Iterator i = new ArrayList(properties.getKeys()).iterator();i.hasNext();)
+ for (Iterator i = new ArrayList(properties.keySet()).iterator();i.hasNext();)
{
String key = (String)i.next();
- Value value = properties.getValue(key);
+ Value value = properties.getProperty(key);
PreferenceInfo pref = prefs.getPreference(key);
if (pref != null)
{
if (Boolean.TRUE.equals(pref.isReadOnly()))
{
- properties.setValue(key, null);
+ properties.setProperty(key, null);
}
}
}
@@ -539,7 +539,7 @@
* @return the properties
* @throws PortletInvokerException
*/
- private ValueMap getPropertiesFromMetaData(String portletId) throws PortletInvokerException
+ private PropertyMap getPropertiesFromMetaData(String portletId) throws PortletInvokerException
{
//
Portlet portlet = portletInvoker.getPortlet(portletId);
@@ -548,15 +548,15 @@
PreferencesInfo prefs = portlet.getInfo().getPreferences();
// Get the state
- ValueMap value = new SimpleValueMap();
+ PropertyMap property = new SimplePropertyMap();
for (Iterator i = prefs.getKeys().iterator(); i.hasNext();)
{
String key = (String)i.next();
PreferenceInfo pref = prefs.getPreference(key);
- value.setValue(key, (Value)pref.getDefaultValue().clone());
+ property.setProperty(key, (Value)pref.getDefaultValue().clone());
}
//
- return value;
+ return property;
}
}
More information about the jboss-cvs-commits
mailing list