com.ibm.portal.state.service
Interface PortalStateManagerService
- All Superinterfaces:
- Disposable, StateManagerService
public interface PortalStateManagerService
- extends StateManagerService
Portal service providing methods to create new state holders and
to inspect existing state holders via so-called state accessors.
State accessors may be requested via the factories returned by the
getAccessorFactory(Class) method. Usually each accessor factory
handles one particular state aspect (e.g. "page selection").
The portal service is accessed via a JNDI lookup using the lookup name
"portal:service/state/PortalStateManager".
Coding example for accessing this service:
PortalStateManagerServiceHome psh;
javax.naming.Context ctx = new javax.naming.InitialContext();
try {
psh = (PortalStateManagerServiceHome)
ctx.lookup("portal:service/state/PortalStateManager");
} catch(javax.naming.NameNotFoundException ex) {
... error handling ...
}
...
// request the service via the home interface
PortalStateManagerService service = psh.getPortalStateManagerService(request, response);
The returned PortalStateManagerServiceHome object is valid for the lifetime of the portal.
It is recommended to perform the JNDI lookup in the init() method of a servlet and store
the PortalStateManagerServiceHome object home in an instance variable. Note that it
is not permitted to access references to the actual service for longer than one request. The service must
be retrieved again from the PortalStateManagerServiceHome object whenever it is used
in another request.
This interface is derived from the Disposable interface to allow implementations to
pool instances of this service. Therefore IBM recommends to invoke the dispose() method
when the service is not needed any more or at the end of the current request at the latest.
- Since:
- 5.1.0.1
newState
StateHolderController newState()
throws CannotCreateDocumentException
- Creates a new modifiable state holder. This method is typically only called once during
one request and should be the first operation on this service. The state holder may then
be modified using accessor retrieved via the
getAccessorFactory
method.
- Returns:
- Reference to a new empty state holder (will not be
null
).
- Throws:
- CannotCreateDocumentException - The document could not be generated