com.caucho.portal.generic
Class AbstractUserAttributeStore

java.lang.Object
  extended by com.caucho.portal.generic.AbstractUserAttributeStore
All Implemented Interfaces:
UserAttributeStore

public abstract class AbstractUserAttributeStore
extends java.lang.Object
implements UserAttributeStore

Abstract base class for implementations that load user attributes.


Field Summary
protected static java.lang.String DELETE
           
 
Constructor Summary
AbstractUserAttributeStore()
           
 
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 attributename, the name that is used with the store is link.
 void finish(java.util.Map<java.lang.String,java.lang.String> userAttributeMap)
          Called when a Map previously returned by getUserAttributeMap() is no longer needed.
 java.util.Map<java.lang.String,java.lang.String> getUserAttributeMap(PortletRequest request, java.util.Set<java.lang.String> names)
          Return a map of user attributes.
protected abstract  java.util.Map<java.lang.String,java.lang.String> load(PortletRequest request)
          Load the user attributes, 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 attributes 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

AbstractUserAttributeStore

public AbstractUserAttributeStore()
Method Detail

load

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

Returns:
a Map of all the user attribute names that are available for the user identified by request, null if no attributes 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 attributes 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 user attributes.
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 attributename, the name that is used with the store is link.


addNameLink

public void addNameLink(NameLink nameLink)

getUserAttributeMap

public java.util.Map<java.lang.String,java.lang.String> getUserAttributeMap(PortletRequest request,
                                                                            java.util.Set<java.lang.String> names)
                                                                     throws java.io.IOException
Description copied from interface: UserAttributeStore
Return a map of user attributes. Implementing classes use the information available from request to determine the identity of the user.

Specified by:
getUserAttributeMap in interface UserAttributeStore
names - a Set of names indicating the user attributes that should be returned, may be null in which case all user attributes for the user should be returned.
Returns:
a Map of attribute names to values, or null if no user attributes are available.
Throws:
java.io.IOException

finish

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

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