org.apache.myfaces.config
Class ManagedBeanDestroyer

java.lang.Object
  extended by org.apache.myfaces.config.ManagedBeanDestroyer
All Implemented Interfaces:
java.util.EventListener, FacesListener, SystemEventListener

public class ManagedBeanDestroyer
extends java.lang.Object
implements SystemEventListener

Destroyes managed beans with the current LifecycleProvider. This guarantees the invocation of the @PreDestroy methods.

Since:
2.0
Version:
$Revision$ $Date$
Author:
Jakob Korherr (latest modification by $Author$)

Constructor Summary
ManagedBeanDestroyer()
           
 
Method Summary
 void destroy(java.lang.String name, java.lang.Object instance)
          Destroys the given managed bean with the current LifecycleProvider.
 void destroy(java.lang.String name, java.lang.Object instance, LifecycleProvider provider)
          Destroys the given managed bean with the given LifecycleProvider
 LifecycleProvider getCurrentLifecycleProvider()
          Retrieves the current LifecycleProvider from the LifecycleProviderFactory
 RuntimeConfig getRuntimeConfig()
           
 boolean isListenerForSource(java.lang.Object source)
           
 boolean isManagedBean(java.lang.String name)
          Checks if the given managed bean exists in the RuntimeConfig.
 void processEvent(SystemEvent event)
          Listens to PreDestroyCustomScopeEvent and PreDestroyViewMapEvent and invokes destroy() for every managed bean in the associated scope.
 void setRuntimeConfig(RuntimeConfig runtimeConfig)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ManagedBeanDestroyer

public ManagedBeanDestroyer()
Method Detail

setRuntimeConfig

public void setRuntimeConfig(RuntimeConfig runtimeConfig)

getRuntimeConfig

public RuntimeConfig getRuntimeConfig()

isListenerForSource

public boolean isListenerForSource(java.lang.Object source)
Specified by:
isListenerForSource in interface SystemEventListener

processEvent

public void processEvent(SystemEvent event)
Listens to PreDestroyCustomScopeEvent and PreDestroyViewMapEvent and invokes destroy() for every managed bean in the associated scope.

Specified by:
processEvent in interface SystemEventListener

isManagedBean

public boolean isManagedBean(java.lang.String name)
Checks if the given managed bean exists in the RuntimeConfig.

Parameters:
name -
Returns:

destroy

public void destroy(java.lang.String name,
                    java.lang.Object instance)
Destroys the given managed bean with the current LifecycleProvider.

Parameters:
name -
instance -

destroy

public void destroy(java.lang.String name,
                    java.lang.Object instance,
                    LifecycleProvider provider)
Destroys the given managed bean with the given LifecycleProvider

Parameters:
name -
instance -
provider -

getCurrentLifecycleProvider

public LifecycleProvider getCurrentLifecycleProvider()
Retrieves the current LifecycleProvider from the LifecycleProviderFactory

Returns:


Copyright © 2010 The Apache Software Foundation. All Rights Reserved.