|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.neeve.root.RootObject
com.neeve.event.EventFactory
public final class EventFactory
Factory class used to instantiate event objects.
This class is a singleton class used to instantiate events. Events are classified by type. Type information is loaded at class load time from a deployment's default configuration repository and also can be registered by the user programattically.
Nested Class Summary | |
---|---|
static class |
EventFactory.EventType
Stores event type information. |
Method Summary | |
---|---|
Event |
createEvent(short id)
Create a event using an event type id. |
Event |
createEvent(String name)
Create a event using a event type name. |
EventFactory.EventType |
getEventType(short id)
Get an event type by id. |
EventFactory.EventType |
getEventType(String name)
Get an event type by name. |
String |
getEventTypeNameFromId(short id)
Get the event type name by id. |
static EventFactory |
getInstance()
Return the singleton event factory instance. |
cern.colt.bitvector.BitVector |
getRegisteredEventTypes()
Get a bitmask representing the registered set of event types |
void |
registerEventType(EventFactory.EventType evType)
Register an event type with the factory. |
Methods inherited from class com.neeve.root.RootObject |
---|
getChecked, getThreaded, getTracer, setChecked, setTracer |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static EventFactory getInstance()
public final void registerEventType(EventFactory.EventType evType)
IllegalArgumentException
- Thrown in case the supplied event
type is null.This method is supplied for programmatic registration of event types with the event factory. This method should be used with caution since the underlying event type table is not managed in a thread safe manner and invoking this method while eventing is in progress can corrupt the table. The recommended practice is to register all event types in the local configuration repository. The factory loads up all event types in the local repository in its class constructor thus ensuring thread safe management of the type table. If this method is used to register event types, the user must ensure it is done so before any eventing is started.
It is a fatal error to register a event type with a duplicate name or id. Doing so will result in an {link hava.lang.Error} being thrown.
public final EventFactory.EventType getEventType(short id)
id
- The event type's id.registerEventType(com.neeve.event.EventFactory.EventType, boolean)
.public final EventFactory.EventType getEventType(String name)
name
- The event type's name.registerEventType(com.neeve.event.EventFactory.EventType, boolean)
.public final cern.colt.bitvector.BitVector getRegisteredEventTypes()
public final String getEventTypeNameFromId(short id)
id
- The id for which to return the event type's name.registerEventType(com.neeve.event.EventFactory.EventType, boolean)
.public final Event createEvent(short id) throws EEventTypeInvalidException, EEventClassLoadException, EEventClassInstantiateException, EEventException
id
- The event type id.
EEventTypeInvalidException
- Thrown if the specified id is not a
valid event type id.
EEventClassLoadException
- Thrown if a failure was encountered
while loading the event class.
EEventClassInstantiateException
- Thrown if a failure was
encountered while instantiating the event object.
EEventException
- Thrown if any other exception was encountered
while creating the new event.registerEventType(com.neeve.event.EventFactory.EventType, boolean)
.public final Event createEvent(String name) throws EEventTypeInvalidException, EEventClassLoadException, EEventClassInstantiateException, EEventException
name
- The event type name.
EEventTypeInvalidException
- Thrown if the specified name is
not a valid event type name.
EEventClassLoadException
- Thrown if a failure was encountered
while loading the event class.
EEventClassInstantiateException
- Thrown if a failure was
encountered while instantiating the event object.
EEventException
- Thrown if any other exception was encountered
while creating the new event.registerEventType(com.neeve.event.EventFactory.EventType, boolean)
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |