Portlet API 2

org.apache.jetspeed.portlet
Interface DynamicData


public interface DynamicData

The DynamicData is a collection of attributes (name-value pairs) that the portlet can use to tempoarily or persistently store information. Dynamic data can be found in various objects: the request, the session, the configuration, the user.

Actually, we want to put this up for discussion. Copying the Servlet API, the request and the session already have attribute manipulation. However, to introduce named section of attributes for configuration and personalized data, the dynamic data object was created which turned to be quite a good fit for request and session. It adds a uniform interface to attribute manipulation, plus it provides functionality for multi-value attributes an en-bloc copying.

The question is whether the similarity to the Servlet API or consistent APIs within the Portlet API has higher priority.


Method Summary
 void addAllFrom(DynamicData aData)
          Adds all attributes from the given data to this data.
 Object getAttribute(String name)
          Returns the value of the attribute with the given name, or null if no such attribute exists.
 Enumeration getAttributeNames()
          Returns an enumeration of all available attributes names.
 void removeAll()
          Removes all attributes.
 void removeAttribute(String name)
          Removes the attribute with the given name.
 void setAttribute(String name, Object value)
          Sets the attribute with the given name and value.
 

Method Detail

setAttribute

public void setAttribute(String name,
                         Object value)
                  throws AccessDeniedException
Sets the attribute with the given name and value.
Parameters:
name - the attribute name
value - the attribute value
Throws:
AccessDeniedException - if the caller isn't authorized to access this data object

getAttribute

public Object getAttribute(String name)
                    throws AccessDeniedException
Returns the value of the attribute with the given name, or null if no such attribute exists.
Parameters:
name - the attribute name
Returns:
the attribute value
Throws:
AccessDeniedException - if the caller isn't authorized to access this data object

getAttributeNames

public Enumeration getAttributeNames()
                              throws AccessDeniedException
Returns an enumeration of all available attributes names.
Returns:
an enumeration of attribute names
Throws:
AccessDeniedException - if the caller isn't authorized to access this data object
See Also:
getAttribute(String)

removeAttribute

public void removeAttribute(String name)
                     throws AccessDeniedException
Removes the attribute with the given name. If no such attribute exists, this method does nothing.
Parameters:
name - the attribute name
Throws:
AccessDeniedException - if the caller isn't authorized to access this data object

removeAll

public void removeAll()
               throws AccessDeniedException
Removes all attributes. If no attributes exist, this method does nothing.
Throws:
AccessDeniedException - if the caller isn't authorized to access this data object

addAllFrom

public void addAllFrom(DynamicData aData)
                throws AccessDeniedException
Adds all attributes from the given data to this data.
Parameters:
aData - the data which is to be copied into this data
Throws:
AccessDeniedException - if the caller isn't authorized to access either of the data objects

Portlet API 2