org.apache.tapestry.services
Interface ApplicationStateManager

All Known Implementing Classes:
ApplicationStateManagerImpl

public interface ApplicationStateManager

Responsible for managing application state objects, objects which persist between requests, but are not tied to any individual page or component. ASOs are also created on demand. ASOs are typically stored in the session, so that they are specific to a particular client.


Method Summary
<T> boolean
exists(Class<T> asoClass)
          Returns true if the ASO already exists, false if it has not yet been created.
<T> T
get(Class<T> asoClass)
          For a given class, find the ASO for the class, creating it if necessary.
<T> T
getIfExists(Class<T> asoClass)
          For a given class, find the ASO for the class.
<T> void
set(Class<T> asoClass, T aso)
          Stores a new ASO, replacing the existing ASO (if any).
 

Method Detail

get

<T> T get(Class<T> asoClass)
For a given class, find the ASO for the class, creating it if necessary. The manager has a configuration that determines how an instance is stored and created as needed. A requested ASO not in the configuration is assumed to be created via a no-args constructor, and stored in the session.

Type Parameters:
T -
Parameters:
asoClass - identifies the ASO to access or create
Returns:
the ASO instance

getIfExists

<T> T getIfExists(Class<T> asoClass)
For a given class, find the ASO for the class. The manager has a configuration that determines how an instance is stored.

Type Parameters:
T -
Parameters:
asoClass - identifies the ASO to access or create
Returns:
the ASO instance or null if it does not already exist

exists

<T> boolean exists(Class<T> asoClass)
Returns true if the ASO already exists, false if it has not yet been created.

Parameters:
asoClass - used to select the ASO
Returns:
true if ASO exists, false if null

set

<T> void set(Class<T> asoClass,
             T aso)
Stores a new ASO, replacing the existing ASO (if any). Storing the value null will delete the ASO so that it may be re-created later.

Type Parameters:
T -
Parameters:
asoClass - the type of ASO
aso - the ASO instance


Copyright © 2006-2008 Apache Software Foundation. All Rights Reserved.