public class EventService
extends java.lang.Object
CommonBaseEvents
objects. This is the
central service to be used by the audit context and other components to handle the events.
This service will encapsulate how events are created and published so it can be easily customized.Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CONFIG_VALUE_PRIORITY_HIGH
The configuration value to specify the event is of high priority.
|
static java.lang.String |
CONFIG_VALUE_PRIORITY_LOW
The configuration value to specify the event is of low priority.
|
static java.lang.String |
CONSTANT_DEFAULT_PUBLISHER_KEY
This is the key that represents the default publisher.
|
static java.lang.String |
COPYRIGHT
IBM copyright notice field.
|
static java.lang.String |
EVENT_CONTEXT_SERIALIZER_PROPERTY_FILE
This is the name of the properties file that contains the mapping between the context name
and the context serializer to create the appropriate
CBE context data. |
static java.lang.String |
EVENT_FACTORY_PROPERTY_FILE
This is the name of the properties file that contains the mapping between event identifiers
and the
EventFactory object to create the CommonBaseEvent objects. |
static java.lang.String |
EVENT_PUBLISHER_PROPERTY_FILE
This is the name of the properties file that contains the mapping between the event's extension
name and the
EventPublisher that will raise the event. |
static short |
PRIORITY_HIGH
This is the constant value that represents high priority.
|
static short |
PRIORITY_LOW
This is the constant value that represents low priority.
|
static short |
PRIORITY_MEDIUM
This is the constant value that represents medium priority.
|
Modifier and Type | Method and Description |
---|---|
void |
changePriority(java.lang.String eventName,
java.lang.String eventKey,
short priority)
This method changes the priority of the event that matches the event key that uniquely identifies
the event.
|
org.eclipse.hyades.logging.events.cbe.CommonBaseEvent |
createEvent(java.lang.String eventIdentifier,
java.lang.Object eventData)
This method creates a
CommonBaseEvent object for the specified event type and populates
the object with the specified event data. |
org.eclipse.hyades.logging.events.cbe.CommonBaseEvent |
createEvent(java.lang.String eventIdentifier,
java.lang.Object eventData,
java.lang.String eventKey)
This method creates a
CommonBaseEvent object for the specified event type and populates
the object with the specified event data. |
void |
disableAllEvents()
This method disables all events.
|
void |
disableEvent(java.lang.String eventName)
This method disables the specified event.
|
void |
enableEvent(java.lang.String eventName)
This method enables the specified event.
|
void |
enableEvent(java.lang.String eventName,
com.ibm.commerce.event.EventContextFilter contextFilter)
This method enables the specified event.
|
void |
enableEvent(java.lang.String eventName,
java.lang.String priority,
com.ibm.commerce.event.EventContextFilter contextFilter)
This method enables the specified event.
|
boolean |
isEventEnabled(java.lang.String eventName)
This method returns whether the specified event name is enabled.
|
void |
publishEvent(org.eclipse.hyades.logging.events.cbe.CommonBaseEvent commonBaseEvent)
This method publishes the specified
CommonBaseEvent object. |
void |
raiseEvent(ActivityToken activityToken,
java.lang.String eventName,
java.lang.Object eventData)
This method raises the specified event with the given event data to associate with the event.
|
void |
raiseEvent(ActivityToken activityToken,
java.lang.String eventName,
java.lang.Object eventData,
java.lang.String eventKey)
This method raises the specified event with the given event data to associate with the event.
|
void |
raiseEvent(java.lang.String eventName,
java.lang.Object eventData)
This method raises the specified event with the given event data to associate with the event.
|
void |
raiseEvent(java.lang.String eventName,
java.lang.Object eventData,
java.lang.String eventKey)
This method raises the specified event with the given event data to associate with the event.
|
void |
reload()
This method reloads the configuration of the event service to pick up the new and changed
event factories and publishers that will create and publish events.
|
static EventService |
singleton()
This method gets the singleton object of the event service for the running instance.
|
public static final java.lang.String COPYRIGHT
public static final java.lang.String EVENT_FACTORY_PROPERTY_FILE
EventFactory
object to create the CommonBaseEvent
objects.public static final java.lang.String EVENT_PUBLISHER_PROPERTY_FILE
EventPublisher
that will raise the event.public static final java.lang.String EVENT_CONTEXT_SERIALIZER_PROPERTY_FILE
CBE
context data.public static final java.lang.String CONSTANT_DEFAULT_PUBLISHER_KEY
public static final short PRIORITY_HIGH
public static final short PRIORITY_MEDIUM
public static final short PRIORITY_LOW
public static final java.lang.String CONFIG_VALUE_PRIORITY_HIGH
public static final java.lang.String CONFIG_VALUE_PRIORITY_LOW
public static EventService singleton()
EventService
of the instance.public void reload()
public boolean isEventEnabled(java.lang.String eventName)
eventName
- The event name.public void enableEvent(java.lang.String eventName)
eventName
- This is the name of the event.public void enableEvent(java.lang.String eventName, com.ibm.commerce.event.EventContextFilter contextFilter)
eventName
- This is the name of the event.contextFilter
- The context filter to associated with the event.public void enableEvent(java.lang.String eventName, java.lang.String priority, com.ibm.commerce.event.EventContextFilter contextFilter)
eventName
- This is the name of the event.priority
- The default priority of the event.contextFilter
- The context filter to associated with the event.public void disableEvent(java.lang.String eventName)
eventName
- This is the name of the event.public void disableAllEvents()
public org.eclipse.hyades.logging.events.cbe.CommonBaseEvent createEvent(java.lang.String eventIdentifier, java.lang.Object eventData)
CommonBaseEvent
object for the specified event type and populates
the object with the specified event data. This operation will determine whether an
EventFactory
object exists for the given event identifier. If so, it will call it to
create the CommonBaseEvent
object. If no event factory is found then null will be
returned which represents that the event should not be raised.eventIdentifier
- This is the identifier of the event.eventData
- This is the data to associate with the event.CommonBaseEvent
object representing the specified event information.public org.eclipse.hyades.logging.events.cbe.CommonBaseEvent createEvent(java.lang.String eventIdentifier, java.lang.Object eventData, java.lang.String eventKey)
CommonBaseEvent
object for the specified event type and populates
the object with the specified event data. This operation will determine whether an
EventFactory
object exists for the given event identifier. If so, it will call it to
create the CommonBaseEvent
object. If no event factory is found then null will be
returned which represents that the event should not be raised.eventIdentifier
- This is the identifier of the event.eventData
- This is the data to associate with the event.eventKey
- This is an identifier of a maximum of 50 characters which can uniquely identify theCommonBaseEvent
object representing the specified event information.public void publishEvent(org.eclipse.hyades.logging.events.cbe.CommonBaseEvent commonBaseEvent) throws org.eclipse.hyades.logging.events.cbe.CompletionException
CommonBaseEvent
object. If null is specified as the
event to publish then nothing will be published. If an object is specified, the
EventPublisher
associated with the extension name of the CommonBaseEvent
object will be use to publish the event. If no EventPublisher
can be found for the
extension name then the default event publisher will be used.commonBaseEvent
- This is the CommonBaseEvent
object to be published.org.eclipse.hyades.logging.events.cbe.CompletionException
- This is thrown if there is a problem running the complete
operation on the specified common base event.public void changePriority(java.lang.String eventName, java.lang.String eventKey, short priority) throws java.lang.Exception
eventName
- This is the name of the event to raise.eventKey
- This is an identifier of a maximum of 50 characters which can uniquely identify the
event.priority
- This is the new priority of the event. The priority value should either be
EventService.PRIORITY_HIGH
, EventService.PRIORITY_MEDIUM
or
EventService.PRIORITY_LOW
.java.lang.Exception
- This is thrown when any exception occurs while changing the event priority.
For those cases where the event immediately executes, the listener may throw and exception and it will
be exposed when this change occurs.public void raiseEvent(java.lang.String eventName, java.lang.Object eventData)
eventName
- This is the name of the event to raise.eventData
- This is the external data to associate with the event.public void raiseEvent(java.lang.String eventName, java.lang.Object eventData, java.lang.String eventKey)
eventName
- This is the name of the event to raise.eventData
- This is the external data to associate with the event.eventKey
- This is an identifier of a maximum of 50 characters which can uniquely identify the
event.public void raiseEvent(ActivityToken activityToken, java.lang.String eventName, java.lang.Object eventData)
activityToken
- This is the activity to associate with the event.eventName
- This is the name of the event to raise.eventData
- This is the external data to associate with the event.public void raiseEvent(ActivityToken activityToken, java.lang.String eventName, java.lang.Object eventData, java.lang.String eventKey)
activityToken
- This is the activity to associate with the event.eventName
- This is the name of the event to raise.eventData
- This is the external data to associate with the event.eventKey
- This is an identifier of a maximum of 50 characters which can uniquely identify the
event.