org.apache.beehive.netui.pageflow
Class PageFlowManagedObject

Object
  extended by PageFlowManagedObject
All Implemented Interfaces:
Serializable, EventListener, HttpSessionBindingListener
Direct Known Subclasses:
FacesBackingBean, FlowController

public abstract class PageFlowManagedObject
extends Object
implements Serializable, HttpSessionBindingListener

Base class for Page Flow managed objects (like page flows and JavaServer Faces backing beans).

See Also:
Serialized Form

Constructor Summary
protected PageFlowManagedObject()
           
 
Method Summary
 void create(HttpServletRequest request, HttpServletResponse response, ServletContext servletContext)
          Initialize after object creation.
abstract  void ensureFailover(HttpServletRequest request)
          Ensures that any changes to this object will be replicated in a cluster (for failover), even if the replication scheme uses a change-detection algorithm that relies on HttpSession.setAttribute to be aware of changes.
protected  boolean fieldIsUninitialized(Field field)
          Tell whether the given Field is uninitialized.
 long getCreateTime()
          Get the time at which this object was created.
abstract  String getDisplayName()
          Get the display name for this managed object.
protected  ServletContext getServletContext()
          Get the current ServletContext.
protected  void initializeField(Field field, Object instance)
          Initialize the given field with an instance.
protected  void onCreate()
          Create-time callback.
protected  void onDestroy(HttpSession session)
          Callback that occurs when this object is "destroyed", i.e., removed from the session.
abstract  void persistInSession(HttpServletRequest request, HttpServletResponse response)
          Store this object in the user session, in the appropriate place.
 void reinitialize(HttpServletRequest request, HttpServletResponse response, ServletContext servletContext)
          Reinitialize the object for a new request.
abstract  void removeFromSession(HttpServletRequest request)
          Remove this instance from the session.
 void valueBound(HttpSessionBindingEvent event)
          Callback when this object is added to the user session.
 void valueUnbound(HttpSessionBindingEvent event)
          Callback when this object is removed from the user session.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PageFlowManagedObject

protected PageFlowManagedObject()
Method Detail

reinitialize

public void reinitialize(HttpServletRequest request,
                         HttpServletResponse response,
                         ServletContext servletContext)
Reinitialize the object for a new request. Used by the framework; normally should not be called directly.


create

public void create(HttpServletRequest request,
                   HttpServletResponse response,
                   ServletContext servletContext)
            throws Exception
Initialize after object creation. This is a framework-invoked method; it should not normally be called directly.

Throws:
Exception

onCreate

protected void onCreate()
                 throws Exception
Create-time callback. Occurs after internal initialization (e.g., Control fields) is done.

Throws:
Exception

onDestroy

protected void onDestroy(HttpSession session)
Callback that occurs when this object is "destroyed", i.e., removed from the session.

Parameters:
session -

valueBound

public void valueBound(HttpSessionBindingEvent event)
Callback when this object is added to the user session.

Specified by:
valueBound in interface HttpSessionBindingListener

valueUnbound

public void valueUnbound(HttpSessionBindingEvent event)
Callback when this object is removed from the user session. Causes onDestroy(javax.servlet.http.HttpSession) to be called. This is a framework-invoked method that should not be called directly.

Specified by:
valueUnbound in interface HttpSessionBindingListener

removeFromSession

public abstract void removeFromSession(HttpServletRequest request)
Remove this instance from the session.


persistInSession

public abstract void persistInSession(HttpServletRequest request,
                                      HttpServletResponse response)
Store this object in the user session, in the appropriate place. Used by the framework; normally should not be called directly.


ensureFailover

public abstract void ensureFailover(HttpServletRequest request)
Ensures that any changes to this object will be replicated in a cluster (for failover), even if the replication scheme uses a change-detection algorithm that relies on HttpSession.setAttribute to be aware of changes. Note that this method is used by the framework and does not need to be called explicitly in most cases.

Parameters:
request - the current HttpServletRequest

getServletContext

protected ServletContext getServletContext()
Get the current ServletContext.


getDisplayName

public abstract String getDisplayName()
Get the display name for this managed object.


fieldIsUninitialized

protected boolean fieldIsUninitialized(Field field)
Tell whether the given Field is uninitialized.

Returns:
true if the field is non-null and its value is null.

initializeField

protected void initializeField(Field field,
                               Object instance)
Initialize the given field with an instance. Mainly useful for the error handling.


getCreateTime

public long getCreateTime()
Get the time at which this object was created.

Returns:
the system time, in milliseconds, at which this object was created.