org.apache.tapestry5.services
Interface ApplicationStateManager

All Known Implementing Classes:
ApplicationStateManagerImpl

@UsesMappedConfiguration(key=java.lang.Class.class,
                         value=ApplicationStateContribution.class)
public interface ApplicationStateManager

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

The term "Application" is a hold-over from Tapestry 5.0, which used the ApplicationState annotation, and called them "ASOs" (Application State Objects).

Tapestry has a built-in default strategy for storing SSOs (in the session) and instantiating them. If desired, contributions to the service configuration can override the default behavior, either specifying an alternate storage strategy, or an alternate creation strategy.

See Also:
ApplicationState

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

Method Detail

get

<T> T get(Class<T> ssoClass)
For a given class, find the SSO 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 SSO not in the configuration is assumed to be created via a no-args constructor, and stored in the session.

Type Parameters:
T -
Parameters:
ssoClass - identifies the SSO to access or create
Returns:
the SSO instance

getIfExists

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

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

exists

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

Parameters:
ssoClass - used to select the SSO
Returns:
true if SSO exists, false if null

set

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

Type Parameters:
T -
Parameters:
ssoClass - the type of SSO
SSO - the SSO instance


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