SourceForge.net Logo

de.mindmatters.faces.spring.context
Class ScopeApplicationEventMulticaster

java.lang.Object
  extended byorg.springframework.context.event.AbstractApplicationEventMulticaster
      extended byorg.springframework.context.event.SimpleApplicationEventMulticaster
          extended byde.mindmatters.faces.spring.context.ScopeApplicationEventMulticaster
All Implemented Interfaces:
ApplicationEventMulticaster, BeanFactoryAware

public class ScopeApplicationEventMulticaster
extends SimpleApplicationEventMulticaster
implements BeanFactoryAware

EventMulticaster that propagates events not only to singletons and prototypes instantiated on startup of type ApplicationListener (default behaviour of Spring) but also to listeners (managed beans) in session and request scope.

Listeners in session scope will be instantiated even if they are not instantiated yet; listeners in request scope will not be instantiated if they are not instantiated yet.

Author:
Andreas Kuhrwahl
See Also:
FacesWebApplicationContext

Constructor Summary
ScopeApplicationEventMulticaster()
           
 
Method Summary
protected  ManagedBeanFactory getBeanFactory()
           
 void multicastEvent(ApplicationEvent event)
          
protected  void multicastEvent(FacesContext context, ApplicationEvent event)
          Multicast the given application event to appropriate listeners.
protected  void publishEvent(ApplicationEvent event, java.lang.String scope, boolean createBeanIfNecessary)
          Publishes event for managed beans with scope scope.
 void setBeanFactory(BeanFactory beanFactory)
          Supplies the owning factory to this bean instance.
 
Methods inherited from class org.springframework.context.event.AbstractApplicationEventMulticaster
addApplicationListener, getApplicationListeners, removeAllListeners, removeApplicationListener, setCollectionClass
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScopeApplicationEventMulticaster

public ScopeApplicationEventMulticaster()
Method Detail

multicastEvent

public final void multicastEvent(ApplicationEvent event)

Specified by:
multicastEvent in interface ApplicationEventMulticaster

multicastEvent

protected void multicastEvent(FacesContext context,
                              ApplicationEvent event)
Multicast the given application event to appropriate listeners. Will not be invoked if no FacesContext is present.

Parameters:
context - the current FacesContext
event - the event to multicast

publishEvent

protected final void publishEvent(ApplicationEvent event,
                                  java.lang.String scope,
                                  boolean createBeanIfNecessary)
Publishes event for managed beans with scope scope.

Parameters:
event - event to publish (may be application-specific or a standard framework event)
scope - the scope of the listeners
createBeanIfNecessary - listeners will be created if not yet done if true

setBeanFactory

public final void setBeanFactory(BeanFactory beanFactory)
Supplies the owning factory to this bean instance. Must be of type ManagedBeanFactory.

Specified by:
setBeanFactory in interface BeanFactoryAware
Parameters:
beanFactory - the ManagedBeanFactory

getBeanFactory

protected final ManagedBeanFactory getBeanFactory()
Returns:
the owning factory of type ManagedBeanFactory

SourceForge.net Logo

Copyright © 2002 mindmatters GmbH & Co. KG