net.sf.asterisk.manager.impl
Class EventBuilderImpl

java.lang.Object
  extended by net.sf.asterisk.manager.impl.EventBuilderImpl
All Implemented Interfaces:
EventBuilder

public class EventBuilderImpl
extends java.lang.Object
implements EventBuilder

Default implementation of the EventBuilder interface.

Version:
$Id: EventBuilderImpl.java,v 1.18 2005/10/26 06:39:30 srt Exp $
Author:
srt
See Also:
ManagerEvent

Constructor Summary
EventBuilderImpl()
           
 
Method Summary
 ManagerEvent buildEvent(java.lang.Object source, java.util.Map attributes)
          Builds the event based on the given map of attributes and the registered event classes.
 void registerEventClass(java.lang.Class clazz)
          Registers a new event class.
 void registerEventClass(java.lang.String eventType, java.lang.Class clazz)
          Registers a new event class for the event given by eventType.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EventBuilderImpl

public EventBuilderImpl()
Method Detail

registerEventClass

public void registerEventClass(java.lang.Class clazz)
Description copied from interface: EventBuilder
Registers a new event class. The event this class is registered for is simply derived from the name of the class by stripping any package name (if present) and stripping the sufffix "Event". For example net.sf.asterisk.manager.event.JoinEvent is registered for the event "Join".

Specified by:
registerEventClass in interface EventBuilder
Parameters:
clazz - the event class to register, must extend net.sf.asterisk.manager.event.ManagerEvent.

registerEventClass

public void registerEventClass(java.lang.String eventType,
                               java.lang.Class clazz)
Registers a new event class for the event given by eventType.

Parameters:
eventType - the name of the event to register the class for. For example "Join".
clazz - the event class to register, must extend net.sf.asterisk.manager.event.Event.

buildEvent

public ManagerEvent buildEvent(java.lang.Object source,
                               java.util.Map attributes)
Description copied from interface: EventBuilder
Builds the event based on the given map of attributes and the registered event classes.

Specified by:
buildEvent in interface EventBuilder
Parameters:
source - source attribute for the event
attributes - map containing event attributes
Returns:
a concrete instance of ManagerEvent or null if no event class was registered for the event type.


Copyright © 2004-2005 Stefan Reuter. All Rights Reserved.