org.apache.myfaces.trinidad.bean.util
Class StateUtils

java.lang.Object
  extended by org.apache.myfaces.trinidad.bean.util.StateUtils

public final class StateUtils
extends java.lang.Object

Utilities for handling state persistance.


Constructor Summary
StateUtils()
           
 
Method Summary
static boolean checkApplicationSerialization(javax.faces.context.ExternalContext extContext)
          Returns true if Object written to the ExternalContext's Application Map should be checked for Serializability when put is called.
static boolean checkComponentStateSerialization(javax.faces.context.FacesContext context)
          Returns true if components should be checked for serializability when when generating the view's state object.
static boolean checkComponentTreeStateSerialization(javax.faces.context.FacesContext context)
          Returns true if the component tree should be checked for serializability when when generating the view's state object.
static boolean checkSessionSerialization(javax.faces.context.ExternalContext extContext)
          Returns true if Object written to the ExternalContext's Session Map should be checked for Serializability when put is called.
static PropertyKey restoreKey(FacesBean.Type type, java.lang.Object value)
          Restores a persisted PropertyKey.
static java.lang.Object restoreList(javax.faces.context.FacesContext context, java.lang.Object savedValue)
          Restores a List whose elements may implement StateHolder.
static void restoreState(PropertyMap map, javax.faces.context.FacesContext context, FacesBean.Type type, java.lang.Object state, boolean useStateHolder)
          Generic (unoptimized) version of PropertyMap state restoring.
static java.lang.Object restoreStateHolder(javax.faces.context.FacesContext context, java.lang.Object savedValue)
          Restores an object that was saved using saveStateHolder()
static java.lang.Object saveKey(PropertyKey key)
          Persists a property key.
static java.lang.Object saveList(javax.faces.context.FacesContext context, java.lang.Object value)
          Saves a List whose elements may implement StateHolder.
static java.lang.Object saveState(PropertyMap map, javax.faces.context.FacesContext context, boolean useStateHolder)
          Generic (unoptimized) version of PropertyMap state saving.
static java.lang.Object saveStateHolder(javax.faces.context.FacesContext context, java.lang.Object value)
          Saves an object that may implement StateHolder.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StateUtils

public StateUtils()
Method Detail

checkComponentStateSerialization

public static boolean checkComponentStateSerialization(javax.faces.context.FacesContext context)
Returns true if components should be checked for serializability when when generating the view's state object.

By default component state serialization checking is off. It can be enabled by setting the system property org.apache.myfaces.trinidad.CHECK_STATE_SERIALIZATION to all or, more rarely, adding component to the comma-separated list of serialization checks to perform.

As property serialization checking is expensive, it is usually only enabled after component tree serialization checking has detected a problem. In addition, since component serialization checking only detects the problem component, it is usually combined with property state serialization checking either by specifying all.

Returns:
See Also:
checkComponentTreeStateSerialization(javax.faces.context.FacesContext)

checkComponentTreeStateSerialization

public static boolean checkComponentTreeStateSerialization(javax.faces.context.FacesContext context)
Returns true if the component tree should be checked for serializability when when generating the view's state object.

By default component tree state serialization checking is off. It can be enabled by setting the system property org.apache.myfaces.trinidad.CHECK_STATE_SERIALIZATION to all or, more commonly, adding tree to the comma-separated list of serialization checks to perform.

Because unserializable objects defeat fail-over, it is important to check for serializability when testing applications. While component tree state serializability checking isn't cheap, it is much faster to initially only enable checking of the component tree and then switch to all testing to determine the problem component and property when the component tree testing determines a problem.

Returns:
See Also:
checkComponentStateSerialization(javax.faces.context.FacesContext)

checkSessionSerialization

public static boolean checkSessionSerialization(javax.faces.context.ExternalContext extContext)
Returns true if Object written to the ExternalContext's Session Map should be checked for Serializability when put is called.

Configuring this property allows this aspect of high-availability to be tested without configuring the server to run in high-availability mode.

By default session serialization checking is off. It can be enabled by setting the system property org.apache.myfaces.trinidad.CHECK_STATE_SERIALIZATION to all or, more commonly, adding session to the comma-separated list of serialization checks to perform.

Returns:
See Also:
checkComponentStateSerialization(javax.faces.context.FacesContext), checkComponentTreeStateSerialization(javax.faces.context.FacesContext), checkApplicationSerialization(javax.faces.context.ExternalContext)

checkApplicationSerialization

public static boolean checkApplicationSerialization(javax.faces.context.ExternalContext extContext)
Returns true if Object written to the ExternalContext's Application Map should be checked for Serializability when put is called.

Configuring this property allows this aspect of high-availability to be tested without configuring the server to run in high-availability mode.

By default application serialization checking is off. It can be enabled by setting the system property org.apache.myfaces.trinidad.CHECK_STATE_SERIALIZATION to all or, more commonly, adding application to the comma-separated list of serialization checks to perform.

Returns:
See Also:
checkComponentStateSerialization(javax.faces.context.FacesContext), checkComponentTreeStateSerialization(javax.faces.context.FacesContext), checkSessionSerialization(javax.faces.context.ExternalContext)

saveKey

public static java.lang.Object saveKey(PropertyKey key)
Persists a property key.


restoreKey

public static PropertyKey restoreKey(FacesBean.Type type,
                                     java.lang.Object value)
Restores a persisted PropertyKey.


saveState

public static java.lang.Object saveState(PropertyMap map,
                                         javax.faces.context.FacesContext context,
                                         boolean useStateHolder)
Generic (unoptimized) version of PropertyMap state saving.


restoreState

public static void restoreState(PropertyMap map,
                                javax.faces.context.FacesContext context,
                                FacesBean.Type type,
                                java.lang.Object state,
                                boolean useStateHolder)
Generic (unoptimized) version of PropertyMap state restoring.


saveStateHolder

public static java.lang.Object saveStateHolder(javax.faces.context.FacesContext context,
                                               java.lang.Object value)
Saves an object that may implement StateHolder.


restoreStateHolder

public static java.lang.Object restoreStateHolder(javax.faces.context.FacesContext context,
                                                  java.lang.Object savedValue)
Restores an object that was saved using saveStateHolder()


saveList

public static java.lang.Object saveList(javax.faces.context.FacesContext context,
                                        java.lang.Object value)
Saves a List whose elements may implement StateHolder.


restoreList

public static java.lang.Object restoreList(javax.faces.context.FacesContext context,
                                           java.lang.Object savedValue)
Restores a List whose elements may implement StateHolder.



Copyright © 2001-2008 The Apache Software Foundation. All Rights Reserved.