com.ibm.portal.state
Interface PortletStateManager

All Superinterfaces:
Disposable, Identifiable, ServerContextProvider, StateManagerService
All Known Subinterfaces:
PortletStateManagerController

public interface PortletStateManager
extends StateManagerService, Identifiable

This interface provides access to the state manager for portlets. See PortletStateManagerService for further details on how to access the portlet state manager. The following accessor factories can be obtained using the getAccessorFactory() method:

Since:
5.1

Method Summary
<T> T
getAccessorFactory(java.lang.Class<T> cls)
          Get a factory that generates an accessor for typed access on the state holder.
 PortletAccessor getPortletAccessor()
          Gets a portlet accessor that operates on the request-specific state holder.
 PortletAccessor getPortletAccessor(StateHolder state)
          Gets a portlet accessor for the given state holder.
 PortletAccessorController getPortletAccessorController(StateHolderController stateCtrl)
          Gets a portlet controller that operates on the given state.
 PortletTargetAccessorController getPortletTargetAccessorController()
          Returns a controller which allows for declaring a portlet as the target of an action or render link that encodes the given state document.
 PortletTargetAccessorController getPortletTargetAccessorController(StateHolderController state)
          Returns a accessor controller which allows for declaring a portlet as the target of an action or render link that encodes the given state document.
 StateHolder getStateHolder()
          Gets the current request-specific state holder.
 ResourceURLAccessor newResourceURL()
          Deprecated. Use the corresponding method in URLFactory instead.
 EngineURL newURL(Constants.Clone type)
          Deprecated. Use the corresponding method in URLFactory instead.
 EngineURL newURL(StateHolder state, Constants.Clone type)
          Deprecated. Use the corresponding method in URLFactory instead.
 EngineURL newURL(StateHolder state, URLContext allowedContext, Constants.Clone type)
          Deprecated. Use the corresponding method in URLFactory instead.
 EngineURL newURL(URLContext allowedContext, Constants.Clone type)
          Deprecated. Use the corresponding method in URLFactory instead.
 
Methods inherited from interface com.ibm.portal.state.service.StateManagerService
getServerContext, getURLFactory, getURLFactory
 
Methods inherited from interface com.ibm.portal.Disposable
dispose
 
Methods inherited from interface com.ibm.portal.Identifiable
getObjectID
 

Method Detail

getAccessorFactory

<T> T getAccessorFactory(java.lang.Class<T> cls)
                     throws UnknownAccessorTypeException,
                            CannotInstantiateAccessorException
Get a factory that generates an accessor for typed access on the state holder. There may be arbitrary accessors to custom state types, so this interface is designed as a generic factory. The result object may be cast to the type referenced by the class object.

Specified by:
getAccessorFactory in interface StateManagerService
Parameters:
cls - Class object for the accessor factory type (not for the implementation class of the accessor!)
Returns:
Instance of the accessor factory. You may keep a reference to this instance for performance reasons
Throws:
UnknownAccessorTypeException - The class object does not refer to a valid factory
CannotInstantiateAccessorException - The factory type has been recognized, but the factory could not be instantiated

getPortletTargetAccessorController

PortletTargetAccessorController getPortletTargetAccessorController()
                                                                   throws StateNotWriteableException,
                                                                          StateNotInRequestException
Returns a controller which allows for declaring a portlet as the target of an action or render link that encodes the given state document.

Returns:
Accessor controller that allows for reading and writing portlet target information. Not null.
Throws:
StateNotWriteableException - If a state holder can be associated with a request but the state is read-only.
StateNotInRequestException - If the request-specific state is not available.

getPortletTargetAccessorController

PortletTargetAccessorController getPortletTargetAccessorController(StateHolderController state)
Returns a accessor controller which allows for declaring a portlet as the target of an action or render link that encodes the given state document.

Parameters:
state - StateHolder to operate on. Must not be null.
Returns:
Accessor controller that allows for reading and writing portlet target information. Not null.

getPortletAccessor

PortletAccessor getPortletAccessor()
                                   throws StateNotInRequestException
Gets a portlet accessor that operates on the request-specific state holder.

Returns:
Accessor that allows to read portlet-specific state from the request-specific state holder. Not null.
Throws:
StateNotInRequestException - If the request-specific state holder is not available.

getPortletAccessor

PortletAccessor getPortletAccessor(StateHolder state)
Gets a portlet accessor for the given state holder.

Parameters:
state - The state holder on which the portlet accessor should operate on. Must not be null.
Returns:
Accessor that allows to read portlet-specific state from the given state holder. Not null.

getPortletAccessorController

PortletAccessorController getPortletAccessorController(StateHolderController stateCtrl)
Gets a portlet controller that operates on the given state.

Parameters:
stateCtrl - The writable state on which the accessor should operate on. Must not be null.
Returns:
Accessor controller that allows for reading and writing portlet-specific state. Not null.

getStateHolder

StateHolder getStateHolder()
                           throws StateNotInRequestException
Gets the current request-specific state holder.
NOTE: The StateHolder returned by this method must not be disposed as this is the request and no URL specific instance.

Returns:
Request-specific state holder. Not null.
Throws:
StateNotInRequestException - If the request-specific state holder is not available.

newResourceURL

ResourceURLAccessor newResourceURL()
                                   throws ResourceUrlException,
                                          StateNotInRequestException
Deprecated. Use the corresponding method in URLFactory instead.

Creates an accessor object that can generate links to resources in the portal application.

Returns:
a resource URL accessor
Throws:
StateNotInRequestException - - if no state could be associated with the request
ResourceUrlException - - if the URL accessor could not be initialized

newURL

EngineURL newURL(Constants.Clone type)
                 throws CannotCloneDocumentModelException,
                        CannotCreateDocumentException,
                        InvalidConstantException,
                        StateNotInRequestException
Deprecated. Use the corresponding method in URLFactory instead.

Returns a URL object for the current portlet window. The object operates on a copy of the current request state, so setting parameters to the engine URL will not modify the original state.

Parameters:
type - type of the clone operation to get a copy of the state holder for the URL, may be null in which case a SMART_COPY will be generated.
Returns:
engine URL object
Throws:
CannotCloneDocumentModelException - - if the state could not be cloned
CannotCreateDocumentException - - if a wrapper around the state could not be created
InvalidConstantException - - if the clone type is not supported
StateNotInRequestException - - if no state could be associated with the request

newURL

EngineURL newURL(StateHolder state,
                 Constants.Clone type)
                 throws CannotCloneDocumentModelException,
                        CannotCreateDocumentException,
                        InvalidConstantException
Deprecated. Use the corresponding method in URLFactory instead.

Returns a URL object for the current portlet window. The object operates on a copy of the state holder, so setting parameters to the engine URL will not modify the original state.

Parameters:
state - state of the current portlet window (must not be null)
type - type of the clone operation to get a copy of the state holder for the URL, may be null in which case a SMART_COPY will be generated.
Returns:
engine URL object
Throws:
CannotCloneDocumentModelException - - if the state could not be cloned
CannotCreateDocumentException - - if a wrapper around the state could not be created
InvalidConstantException - - if the clone type is not supported

newURL

EngineURL newURL(StateHolder state,
                 URLContext allowedContext,
                 Constants.Clone type)
                 throws CannotCloneDocumentModelException,
                        CannotCreateDocumentException,
                        InvalidConstantException
Deprecated. Use the corresponding method in URLFactory instead.

Returns a URL object for the current portlet window. The object operates on a copy of the state holder, so setting parameters to the engine URL will not modify the original state.

Parameters:
state - state of the current portlet window (must not be null)
allowedContext - specifies what type of URLs may be generated. May be null to not limit the URL generation
type - type of the clone operation to get a copy of the state holder for the URL, may be null in which case a SMART_COPY will be generated.
Returns:
engine URL object
Throws:
CannotCloneDocumentModelException - - if the state could not be cloned
CannotCreateDocumentException - - if a wrapper around the state could not be created
InvalidConstantException - - if the clone type is not supported

newURL

EngineURL newURL(URLContext allowedContext,
                 Constants.Clone type)
                 throws CannotCloneDocumentModelException,
                        CannotCreateDocumentException,
                        InvalidConstantException,
                        StateNotInRequestException
Deprecated. Use the corresponding method in URLFactory instead.

Returns a URL object for the current portlet window. The object operates on a copy of the current request state, so setting parameters to the engine URL will not modify the original state.

Parameters:
type - type of the clone operation to get a copy of the state holder for the URL, may be null in which case a SMART_COPY will be generated.
allowedContext - specifies what type of URLs may be generated. May be null to not limit the URL generation
Returns:
engine URL object
Throws:
CannotCloneDocumentModelException - - if the state could not be cloned
CannotCreateDocumentException - - if a wrapper around the state could not be created
InvalidConstantException - - if the clone type is not supported
StateNotInRequestException - - if no state could be associated with the request