org.apache.shale.tiger.view.faces
Class LifecycleListener2

java.lang.Object
  extended by org.apache.shale.view.faces.LifecycleListener
      extended by org.apache.shale.tiger.view.faces.LifecycleListener2
All Implemented Interfaces:
EventListener, HttpSessionActivationListener, HttpSessionAttributeListener, HttpSessionListener, ServletContextAttributeListener, ServletContextListener, ServletRequestAttributeListener, ServletRequestListener

public class LifecycleListener2
extends org.apache.shale.view.faces.LifecycleListener

Specialized version of org.apache.shale.view.faces.LifecycleListener that implements callbacks to methods tagged by appropriate annotations, rather than requiring the containing classes to implement a particular interface or extend a particular subclass.

IMPLEMENTATION NOTE: The standard LifecycleListener instance will delegate to methods of this class after performing its own appropriate processing. Therefore, implementation methods must NOT call their superclass counterparts. Doing so will cause any infinite recursion and ultimately a stack overflow error.

$Id: LifecycleListener2.java 489966 2006-12-24 01:43:42Z craigmcc $

Since:
1.0.3

Field Summary
static String FACES_CONFIG_CONFIG
          Application scope attribute under which a configured FacesConfigConfig bean will be stored, containing information parsed from the relevant faces-config.xml resource(s) for this application.
static String SCAN_PACKAGES
           Servlet context init parameter which defines which packages to scan for beans.
 
Constructor Summary
LifecycleListener2()
          Create a new lifecycle listener.
 
Method Summary
 void attributeAdded(HttpSessionBindingEvent event)
          Respond to a session scope attribute being added.
 void attributeAdded(ServletContextAttributeEvent event)
          Respond to an application scope attribute being added.
 void attributeAdded(ServletRequestAttributeEvent event)
          Respond to a request scope attribute being added.
 void attributeRemoved(HttpSessionBindingEvent event)
          Respond to a session scope attribute being removed.
 void attributeRemoved(ServletContextAttributeEvent event)
          Respond to an application scope attribute being removed.
 void attributeRemoved(ServletRequestAttributeEvent event)
          Respond to a request scope attribute being removed.
 void attributeReplaced(HttpSessionBindingEvent event)
          Respond to a session scope attribute being replaced.
 void attributeReplaced(ServletContextAttributeEvent event)
          Respond to an application scope attribute being replaced.
 void attributeReplaced(ServletRequestAttributeEvent event)
          Respond to a request scope attribute being replaced.
 void contextDestroyed(ServletContextEvent event)
          Respond to a context destroyed event.
 void contextInitialized(ServletContextEvent event)
          Respond to a context initialized event.
protected  void fireApplicationDestroy(Object bean)
          Fire a destroy event on an @{link AbstractApplicationBean}.
protected  void fireApplicationInit(Object bean)
          Fire an init event on an AbstractApplicationBean.
protected  void fireRequestDestroy(Object bean)
          Fire a destroy event on an @{link AbstractRequestBean}.
protected  void fireRequestInit(Object bean)
          Fire an init event on an AbstractRequestBean.
protected  void fireSessionActivate(Object bean)
          Fire an activate event on an @{link AbstractSessionBean}.
protected  void fireSessionDestroy(Object bean)
          Fire a destroy event on an @{link AbstractSessionBean}.
protected  void fireSessionInit(Object bean)
          Fire an init event on an AbstractSessionBean.
protected  void fireSessionPassivate(Object bean)
          Fire an passivate event on an @{link AbstractSessionBean}.
 void requestDestroyed(ServletRequestEvent event)
          Respond to a request destroyed event.
 void requestInitialized(ServletRequestEvent event)
          Respond to a request created event.
 void sessionCreated(HttpSessionEvent event)
          Respond to a session created event.
 void sessionDestroyed(HttpSessionEvent event)
          Respond to a session destroyed event.
 void sessionDidActivate(HttpSessionEvent event)
          Respond to a "session did activate" event.
 void sessionWillPassivate(HttpSessionEvent event)
          Respond to a "session will passivate" event.
 
Methods inherited from class org.apache.shale.view.faces.LifecycleListener
handleException
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SCAN_PACKAGES

public static final String SCAN_PACKAGES

Servlet context init parameter which defines which packages to scan for beans.

See Also:
Constant Field Values

FACES_CONFIG_CONFIG

public static final String FACES_CONFIG_CONFIG

Application scope attribute under which a configured FacesConfigConfig bean will be stored, containing information parsed from the relevant faces-config.xml resource(s) for this application.

See Also:
Constant Field Values
Constructor Detail

LifecycleListener2

public LifecycleListener2()

Create a new lifecycle listener.

Method Detail

contextInitialized

public void contextInitialized(ServletContextEvent event)

Respond to a context initialized event. Forcibly replace the managed bean services that are different when the Tiger extensions are loaded. Then, process the faces-config.xml resources for this application in order to record the configuration of managed beans.

Specified by:
contextInitialized in interface ServletContextListener
Overrides:
contextInitialized in class org.apache.shale.view.faces.LifecycleListener
Parameters:
event - Event to be processed

contextDestroyed

public void contextDestroyed(ServletContextEvent event)

Respond to a context destroyed event. Clean up our allocated application scope attributes.

Specified by:
contextDestroyed in interface ServletContextListener
Overrides:
contextDestroyed in class org.apache.shale.view.faces.LifecycleListener
Parameters:
event - Event to be processed

attributeAdded

public void attributeAdded(ServletContextAttributeEvent event)

Respond to an application scope attribute being added. If the value is an AbstractApplicationBean, call its init() method.

Specified by:
attributeAdded in interface ServletContextAttributeListener
Overrides:
attributeAdded in class org.apache.shale.view.faces.LifecycleListener
Parameters:
event - Event to be processed

attributeReplaced

public void attributeReplaced(ServletContextAttributeEvent event)

Respond to an application scope attribute being replaced. If the old value was an AbstractApplicationBean, call its destroy() method. If the new value is an AbstractApplicationBean, call its init() method.

Specified by:
attributeReplaced in interface ServletContextAttributeListener
Overrides:
attributeReplaced in class org.apache.shale.view.faces.LifecycleListener
Parameters:
event - Event to be processed

attributeRemoved

public void attributeRemoved(ServletContextAttributeEvent event)

Respond to an application scope attribute being removed. If the old value was an AbstractApplicationBean, call its destroy() method.

Specified by:
attributeRemoved in interface ServletContextAttributeListener
Overrides:
attributeRemoved in class org.apache.shale.view.faces.LifecycleListener
Parameters:
event - Event to be processed

sessionCreated

public void sessionCreated(HttpSessionEvent event)

Respond to a session created event. No special processing is required.

Specified by:
sessionCreated in interface HttpSessionListener
Overrides:
sessionCreated in class org.apache.shale.view.faces.LifecycleListener
Parameters:
event - Event to be processed

sessionDestroyed

public void sessionDestroyed(HttpSessionEvent event)

Respond to a session destroyed event. No special processing is required

Specified by:
sessionDestroyed in interface HttpSessionListener
Overrides:
sessionDestroyed in class org.apache.shale.view.faces.LifecycleListener
Parameters:
event - Event to be processed

sessionWillPassivate

public void sessionWillPassivate(HttpSessionEvent event)

Respond to a "session will passivate" event. Notify all session scope attributes that are AbstractSessionBeans.

Specified by:
sessionWillPassivate in interface HttpSessionActivationListener
Overrides:
sessionWillPassivate in class org.apache.shale.view.faces.LifecycleListener
Parameters:
event - Event to be processed

sessionDidActivate

public void sessionDidActivate(HttpSessionEvent event)

Respond to a "session did activate" event. Notify all session scope attributes that are AbstractSessionBeans.

Specified by:
sessionDidActivate in interface HttpSessionActivationListener
Overrides:
sessionDidActivate in class org.apache.shale.view.faces.LifecycleListener
Parameters:
event - Event to be processed

attributeAdded

public void attributeAdded(HttpSessionBindingEvent event)

Respond to a session scope attribute being added. If the value is an AbstractSessionBean, call its init() method.

Specified by:
attributeAdded in interface HttpSessionAttributeListener
Overrides:
attributeAdded in class org.apache.shale.view.faces.LifecycleListener
Parameters:
event - Event to be processed

attributeReplaced

public void attributeReplaced(HttpSessionBindingEvent event)

Respond to a session scope attribute being replaced. If the old value was an AbstractSessionBean, call its destroy() method. If the new value is an AbstractSessionBean, call its init() method.

Specified by:
attributeReplaced in interface HttpSessionAttributeListener
Overrides:
attributeReplaced in class org.apache.shale.view.faces.LifecycleListener
Parameters:
event - Event to be processed

attributeRemoved

public void attributeRemoved(HttpSessionBindingEvent event)

Respond to a session scope attribute being removed. If the old value was an AbstractSessionBean, call its destroy() method.

Specified by:
attributeRemoved in interface HttpSessionAttributeListener
Overrides:
attributeRemoved in class org.apache.shale.view.faces.LifecycleListener
Parameters:
event - Event to be processed

requestInitialized

public void requestInitialized(ServletRequestEvent event)

Respond to a request created event. If we have accumulated any classes to register with our JSF implementation (but could not initially because it was not initialized before we were), register them now.

Specified by:
requestInitialized in interface ServletRequestListener
Overrides:
requestInitialized in class org.apache.shale.view.faces.LifecycleListener
Parameters:
event - Event to be processed

requestDestroyed

public void requestDestroyed(ServletRequestEvent event)

Respond to a request destroyed event. Cause any instance of ViewController or AbstractRequestBean, plus any bean whose class contains the appropriate annotations, to be removed (which will trigger an attribute removed event).

Specified by:
requestDestroyed in interface ServletRequestListener
Overrides:
requestDestroyed in class org.apache.shale.view.faces.LifecycleListener
Parameters:
event - Event to be processed

attributeAdded

public void attributeAdded(ServletRequestAttributeEvent event)

Respond to a request scope attribute being added. If the value is an AbstractRequestBean, call its init() method.

Specified by:
attributeAdded in interface ServletRequestAttributeListener
Overrides:
attributeAdded in class org.apache.shale.view.faces.LifecycleListener
Parameters:
event - Event to be processed

attributeReplaced

public void attributeReplaced(ServletRequestAttributeEvent event)

Respond to a request scope attribute being replaced. If the old value was an AbstractRequestBean, call its destroy() method. If the new value is an AbstractRequestBean, call its init() method.

Specified by:
attributeReplaced in interface ServletRequestAttributeListener
Overrides:
attributeReplaced in class org.apache.shale.view.faces.LifecycleListener
Parameters:
event - Event to be processed

attributeRemoved

public void attributeRemoved(ServletRequestAttributeEvent event)

Respond to a request scope attribute being removed. If the old value was an AbstractRequestBean, call its destroy() method.

Specified by:
attributeRemoved in interface ServletRequestAttributeListener
Overrides:
attributeRemoved in class org.apache.shale.view.faces.LifecycleListener
Parameters:
event - Event to be processed

fireApplicationDestroy

protected void fireApplicationDestroy(Object bean)

Fire a destroy event on an @{link AbstractApplicationBean}.

Overrides:
fireApplicationDestroy in class org.apache.shale.view.faces.LifecycleListener
Parameters:
bean - AbstractApplicationBean to fire event on

fireApplicationInit

protected void fireApplicationInit(Object bean)

Fire an init event on an AbstractApplicationBean.

Overrides:
fireApplicationInit in class org.apache.shale.view.faces.LifecycleListener
Parameters:
bean - AbstractApplicationBean to fire event on

fireRequestDestroy

protected void fireRequestDestroy(Object bean)

Fire a destroy event on an @{link AbstractRequestBean}.

Overrides:
fireRequestDestroy in class org.apache.shale.view.faces.LifecycleListener
Parameters:
bean - AbstractRequestBean to fire event on

fireRequestInit

protected void fireRequestInit(Object bean)

Fire an init event on an AbstractRequestBean.

Overrides:
fireRequestInit in class org.apache.shale.view.faces.LifecycleListener
Parameters:
bean - AbstractRequestBean to fire event on

fireSessionActivate

protected void fireSessionActivate(Object bean)

Fire an activate event on an @{link AbstractSessionBean}.

Overrides:
fireSessionActivate in class org.apache.shale.view.faces.LifecycleListener
Parameters:
bean - AbstractSessionBean to fire event on

fireSessionDestroy

protected void fireSessionDestroy(Object bean)

Fire a destroy event on an @{link AbstractSessionBean}.

Overrides:
fireSessionDestroy in class org.apache.shale.view.faces.LifecycleListener
Parameters:
bean - AbstractSessionBean to fire event on

fireSessionInit

protected void fireSessionInit(Object bean)

Fire an init event on an AbstractSessionBean.

Overrides:
fireSessionInit in class org.apache.shale.view.faces.LifecycleListener
Parameters:
bean - AbstractSessionBean to fire event on

fireSessionPassivate

protected void fireSessionPassivate(Object bean)

Fire an passivate event on an @{link AbstractSessionBean}.

Overrides:
fireSessionPassivate in class org.apache.shale.view.faces.LifecycleListener
Parameters:
bean - AbstractSessionBean to fire event on


Copyright © 2004-2007 Apache Software Foundation. All Rights Reserved.