|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.apache.avalon.framework.logger.AbstractLogEnabled
org.apache.cocoon.portal.impl.AbstractComponent
org.apache.cocoon.portal.event.impl.DefaultEventManager
This is the default implementation of the event manager.
For each event class (interface and impl.) a DefaultEventManager.HierarchyInfo is created.
This helper object contains all subscribed receivers for the event and *all*
parents being it interfaces or classes. This makes adding new receivers
very easy: we just get the hierarchy info for the event in question and then
add the receiver.
Sending events is also very easy, we lookup the hierarchy info for the event,
get all receivers for this event and notify them. Finally we iterate over
all parents and notify the receivers of the all the parents.
The simplicity in subscribing and sending of events comes with the drawback that
unsubscribing is more costly.
| Nested Class Summary | |
protected static class |
DefaultEventManager.HierarchyInfo
|
protected static class |
DefaultEventManager.MethodInfo
|
protected static class |
DefaultEventManager.ReceiverInfo
|
| Field Summary | |
protected ServiceSelector |
aspectSelector
|
protected EventAspectChain |
chain
|
protected Configuration |
configuration
Our configuration. |
protected Map |
eventHierarchy
Map of all event classes and their corresponding receivers. |
protected Map |
receiverClasses
Introspected receiver classes. |
| Fields inherited from class org.apache.cocoon.portal.impl.AbstractComponent |
context, manager, portalService |
| Fields inherited from interface org.apache.cocoon.portal.event.EventManager |
ROLE |
| Constructor Summary | |
DefaultEventManager()
|
|
| Method Summary | |
protected void |
addToHierarchy(DefaultEventManager.HierarchyInfo info,
Class c)
|
protected void |
addToHierarchy(DefaultEventManager.HierarchyInfo info,
List parents)
|
void |
configure(Configuration conf)
|
void |
dispose()
|
protected DefaultEventManager.HierarchyInfo |
getHierarchyInfo(Class c)
Create a hierarchy information. |
protected Map |
getObjectModel()
Helper method to get the current object model |
void |
initialize()
|
protected List |
introspect(Class receiverClass)
|
void |
processEvents()
Process the events |
void |
send(Event event)
Publish an event. |
protected void |
send(Event event,
DefaultEventManager.HierarchyInfo hierarchy,
boolean recursive)
|
void |
subscribe(Receiver receiver)
Subscribes a receiver for a specific type of event. |
void |
unsubscribe(Receiver receiver)
Unsubscribes a receiver for all events. |
| Methods inherited from class org.apache.cocoon.portal.impl.AbstractComponent |
contextualize, service |
| Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled |
enableLogging, getLogger, setupLogger, setupLogger, setupLogger |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected Configuration configuration
protected EventAspectChain chain
protected ServiceSelector aspectSelector
protected Map receiverClasses
protected Map eventHierarchy
| Constructor Detail |
public DefaultEventManager()
| Method Detail |
protected Map getObjectModel()
public void configure(Configuration conf)
throws ConfigurationException
configure in interface ConfigurableConfigurationExceptionConfigurable.configure(org.apache.avalon.framework.configuration.Configuration)public void dispose()
dispose in interface Disposabledispose in class AbstractComponentDisposable.dispose()
public void initialize()
throws Exception
initialize in interface Initializableinitialize in class AbstractComponentExceptionInitializable.initialize()
public void processEvents()
throws ProcessingException
EventManager
processEvents in interface EventManagerProcessingExceptionEventManager.processEvents()public void send(Event event)
EventManager
send in interface EventManagerevent - The event to broadcast.EventManager.send(org.apache.cocoon.portal.event.Event)
protected void send(Event event,
DefaultEventManager.HierarchyInfo hierarchy,
boolean recursive)
protected List introspect(Class receiverClass)
public void subscribe(Receiver receiver)
EventManager
subscribe in interface EventManagerEventManager.subscribe(org.apache.cocoon.portal.event.Receiver)public void unsubscribe(Receiver receiver)
EventManager
unsubscribe in interface EventManagerEventManager.unsubscribe(org.apache.cocoon.portal.event.Receiver)protected DefaultEventManager.HierarchyInfo getHierarchyInfo(Class c)
protected void addToHierarchy(DefaultEventManager.HierarchyInfo info,
Class c)
protected void addToHierarchy(DefaultEventManager.HierarchyInfo info,
List parents)
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||