com.caucho.portal.generic
Class AbstractPreferencesStore

java.lang.Object
  extended by com.caucho.portal.generic.AbstractPreferencesStore
All Implemented Interfaces:
PreferencesStore

public abstract class AbstractPreferencesStore
extends java.lang.Object
implements PreferencesStore

Abstract base class for implementations that load and save preferences.


Field Summary
protected static java.lang.String[] DELETE
           
 
Constructor Summary
AbstractPreferencesStore()
           
 
Method Summary
 void addDefault(NameValuePair nameValuePair)
           
 void addDefault(java.lang.String name, java.lang.String value)
           
 void addNameLink(NameLink nameLink)
           
 void addNameLink(java.lang.String name, java.lang.String link)
          Add a link such that when the portlet uses the preferences name, the name that is used with the store is link.
 void finish(java.util.Map<java.lang.String,java.lang.String[]> preferencesMap)
          Called when a Map previously returned by getPreferencesMap() is no longer needed.
 java.util.Map<java.lang.String,java.lang.String[]> getPreferencesMap(PortletRequest request, java.lang.String namespace)
          Return a map of preferences.
protected abstract  java.util.Map<java.lang.String,java.lang.String[]> load(PortletRequest request, java.lang.String namespace)
          Load the user preferences, called once for each connection.
protected abstract  void save(java.util.Map<java.lang.String,java.lang.String[]> storeMap, java.util.Map<java.lang.String,java.lang.String[]> updateMap)
          Called just before unload() if the preferences have been updated.
protected abstract  void unload(java.util.Map<java.lang.String,java.lang.String[]> map)
          Called when the connection is complete.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DELETE

protected static java.lang.String[] DELETE
Constructor Detail

AbstractPreferencesStore

public AbstractPreferencesStore()
Method Detail

load

protected abstract java.util.Map<java.lang.String,java.lang.String[]> load(PortletRequest request,
                                                                           java.lang.String namespace)
                                                                    throws java.io.IOException
Load the user preferences, called once for each connection. Implementing classes use the request to determine the identity of the user.

Returns:
a Map of all the user preferences that are available for the user identified by request, null if no preferences are available.
Throws:
java.io.IOException

save

protected abstract void save(java.util.Map<java.lang.String,java.lang.String[]> storeMap,
                             java.util.Map<java.lang.String,java.lang.String[]> updateMap)
                      throws java.io.IOException
Called just before unload() if the preferences have been updated. The updateMap contains only entries that have changed. Entries with a value of DELETE are meant to be deleted from the store.

Parameters:
storeMap - the map returned by load()
updateMap - the map containing the updates
Throws:
java.lang.UnsupportedOperationException - if the implementation does not support updates to preferences.
java.io.IOException

unload

protected abstract void unload(java.util.Map<java.lang.String,java.lang.String[]> map)
Called when the connection is complete. A call to unload() is not guaranteed to occur for every connection, if an error occurs when processing a request unload() may never be called.

Parameters:
isModified - true if the map has been changed

addDefault

public void addDefault(java.lang.String name,
                       java.lang.String value)

addDefault

public void addDefault(NameValuePair nameValuePair)

addNameLink

public void addNameLink(java.lang.String name,
                        java.lang.String link)
Add a link such that when the portlet uses the preferences name, the name that is used with the store is link.


addNameLink

public void addNameLink(NameLink nameLink)

getPreferencesMap

public java.util.Map<java.lang.String,java.lang.String[]> getPreferencesMap(PortletRequest request,
                                                                            java.lang.String namespace)
                                                                     throws java.io.IOException
Description copied from interface: PreferencesStore
Return a map of preferences. Implementing classes use the information available from request to determine the identity of the user.

Specified by:
getPreferencesMap in interface PreferencesStore
Returns:
a Map of preference names to values, or null if no preferences are available.
Throws:
java.io.IOException

finish

public void finish(java.util.Map<java.lang.String,java.lang.String[]> preferencesMap)
            throws java.io.IOException
Description copied from interface: PreferencesStore
Called when a Map previously returned by getPreferencesMap() is no longer needed. A call to finish() is not guaranteed to occur for every Map returned by getPreferencesMap(). If an error occurs when processing a request, the portal may not have an opportunity to call finish().

Specified by:
finish in interface PreferencesStore
Throws:
java.io.IOException