com.atlassian.event
Class DefaultEventManager

java.lang.Object
  extended by com.atlassian.event.DefaultEventManager
All Implemented Interfaces:
EventManager, EventListener, org.springframework.context.ApplicationContextAware, org.springframework.context.ApplicationListener

public class DefaultEventManager
extends Object
implements EventManager, org.springframework.context.ApplicationListener, org.springframework.context.ApplicationContextAware

Manages the firing and receiving of events.

Any event passed to publishEvent(com.atlassian.event.Event) will be passed through Spring's event model, after which it will be returned to the EventManager for processing via onApplicationEvent(org.springframework.context.ApplicationEvent).

Plugin-based event listeners can register to receive events via registerListener(String, com.atlassian.event.EventListener)


Constructor Summary
DefaultEventManager()
           
 
Method Summary
 void onApplicationEvent(org.springframework.context.ApplicationEvent event)
           
 void publishEvent(Event event)
          Publish an event that will be consumed by any listener which has registered to receive it.
 void registerListener(String listenerKey, EventListener listener)
          Register a listener to receive events.
 void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
           
 void unregisterListener(String listenerKey)
          Unregister a listener so that it will no longer receive events.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultEventManager

public DefaultEventManager()
Method Detail

setApplicationContext

public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
Specified by:
setApplicationContext in interface org.springframework.context.ApplicationContextAware

publishEvent

public void publishEvent(Event event)
Description copied from interface: EventManager
Publish an event that will be consumed by any listener which has registered to receive it.

Specified by:
publishEvent in interface EventManager
Parameters:
event - the event to publish

onApplicationEvent

public void onApplicationEvent(org.springframework.context.ApplicationEvent event)
Specified by:
onApplicationEvent in interface org.springframework.context.ApplicationListener

registerListener

public void registerListener(String listenerKey,
                             EventListener listener)
Description copied from interface: EventManager
Register a listener to receive events. If you register a listener with the same key as an existing listener, the previous listener with that key will be unregistered.

Specified by:
registerListener in interface EventManager
Parameters:
listenerKey - A unique key for this listener. If the listener is a plugin module, use the modules complete key
listener - The listener that is being registered

unregisterListener

public void unregisterListener(String listenerKey)
Description copied from interface: EventManager
Unregister a listener so that it will no longer receive events. If no listener is registered under this key, nothing will happen.

Specified by:
unregisterListener in interface EventManager
Parameters:
listenerKey - the key under which the listener was registered.


Atlassian Event is developed by Atlassian Software Systems.