org.apache.shale.view.faces
Class LifecycleListener

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

public class LifecycleListener
extends Object
implements ServletContextAttributeListener, ServletContextListener, HttpSessionActivationListener, HttpSessionAttributeListener, HttpSessionListener, ServletRequestAttributeListener, ServletRequestListener

LifecycleListener implements the lifecycle startup and shutdown calls (init() and destroy()) for subclasses of AbstractApplicationBean, AbstractRequestBean, and AbstractSessionBean.

It must be registered with the servlet container as a listener, through an entry in either the /WEB-INF/web.xml resource or a tag library descriptor included in the web application.

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

Since:
1.0.3

Constructor Summary
LifecycleListener()
          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 created 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}.
protected  void handleException(javax.faces.context.FacesContext context, Exception exception)
          Handle the specified exception according to the strategy defined by our current ExceptionHandler.
 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 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LifecycleListener

public LifecycleListener()

Create a new lifecycle listener.

Method Detail

contextInitialized

public void contextInitialized(ServletContextEvent event)

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

Specified by:
contextInitialized in interface ServletContextListener
Parameters:
event - Event to be processed

contextDestroyed

public void contextDestroyed(ServletContextEvent event)

Respond to a context destroyed event. Causes any application scope attribute that implements AbstractApplicationBean to be removed, triggering an attributeRemoved() event.

Specified by:
contextDestroyed in interface ServletContextListener
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
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
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
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
Parameters:
event - Event to be processed

sessionDestroyed

public void sessionDestroyed(HttpSessionEvent event)

Respond to a session destroyed event. Causes any session scope attribute that implements AbstractSessionBean to be removed, triggering an attributeRemoved() event.

Specified by:
sessionDestroyed in interface HttpSessionListener
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
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
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
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
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
Parameters:
event - Event to be processed

requestInitialized

public void requestInitialized(ServletRequestEvent event)

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

Specified by:
requestInitialized in interface ServletRequestListener
Parameters:
event - Event to be processed

requestDestroyed

public void requestDestroyed(ServletRequestEvent event)

Respond to a request destroyed event. Causes any request scope attribute that implements AbstractRequestBean or AbstractFragmentBean to be removed, triggering an attributeRemoved() event.

Specified by:
requestDestroyed in interface ServletRequestListener
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
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
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
Parameters:
event - Event to be processed

fireApplicationDestroy

protected void fireApplicationDestroy(Object bean)

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

Parameters:
bean - AbstractApplicationBean to fire event on

fireApplicationInit

protected void fireApplicationInit(Object bean)

Fire an init event on an AbstractApplicationBean.

Parameters:
bean - AbstractApplicationBean to fire event on

fireRequestDestroy

protected void fireRequestDestroy(Object bean)

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

Parameters:
bean - AbstractRequestBean to fire event on

fireRequestInit

protected void fireRequestInit(Object bean)

Fire an init event on an AbstractRequestBean.

Parameters:
bean - AbstractRequestBean to fire event on

fireSessionActivate

protected void fireSessionActivate(Object bean)

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

Parameters:
bean - AbstractSessionBean to fire event on

fireSessionDestroy

protected void fireSessionDestroy(Object bean)

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

Parameters:
bean - AbstractSessionBean to fire event on

fireSessionInit

protected void fireSessionInit(Object bean)

Fire an init event on an AbstractSessionBean.

Parameters:
bean - AbstractSessionBean to fire event on

fireSessionPassivate

protected void fireSessionPassivate(Object bean)

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

Parameters:
bean - AbstractSessionBean to fire event on

handleException

protected void handleException(javax.faces.context.FacesContext context,
                               Exception exception)

Handle the specified exception according to the strategy defined by our current ExceptionHandler.

Parameters:
context - FacesContext for the current request
exception - Exception to be handled


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