Package org.adempiere.base.event
Class EventManager
java.lang.Object
org.adempiere.base.event.EventManager
- All Implemented Interfaces:
IEventManager
Simple wrapper for the osgi event admin service.
Usage: EventManager.getInstance().sendEvent/postEvent
Usage: EventManager.getInstance().sendEvent/postEvent
- Author:
- hengsin
-
Field Summary
Fields inherited from interface org.adempiere.base.event.IEventManager
CLASS_NAME_PROPERTY, EVENT_CONTEXT, EVENT_DATA, EVENT_ERROR_MESSAGES, IMPORT_TABLE_NAME_PROPERTY, PROCESS_CLASS_NAME_PROPERTY, PROCESS_UID_PROPERTY, TABLE_NAME_PROPERTY
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
bindEventAdmin
(org.osgi.service.event.EventAdmin eventAdmin) static IEventManager
Get the singleton instance created by the osgi service frameworkstatic org.osgi.service.event.Event
static org.osgi.service.event.Event
Create new event instance.static org.osgi.service.event.Event
newEvent
(String topic, EventProperty... properties) boolean
postEvent
(org.osgi.service.event.Event event) Initiate asynchronous delivery of an event.boolean
register a new event handlerboolean
register a new event handlerboolean
register a new event handlerboolean
register a new event handlerboolean
sendEvent
(org.osgi.service.event.Event event) Initiate synchronous delivery of an event.void
unbindEventAdmin
(org.osgi.service.event.EventAdmin eventAdmin) boolean
unregister
(org.osgi.service.event.EventHandler eventHandler) un-register an event handlerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.adempiere.base.event.IEventManager
register
-
Constructor Details
-
EventManager
public EventManager()
-
-
Method Details
-
bindEventAdmin
public void bindEventAdmin(org.osgi.service.event.EventAdmin eventAdmin) - Parameters:
eventAdmin
-
-
unbindEventAdmin
public void unbindEventAdmin(org.osgi.service.event.EventAdmin eventAdmin) - Parameters:
eventAdmin
-
-
getInstance
Get the singleton instance created by the osgi service framework- Returns:
- EventManager
-
postEvent
public boolean postEvent(org.osgi.service.event.Event event) Description copied from interface:IEventManager
Initiate asynchronous delivery of an event. This method returns to the caller before delivery of the event is completed.- Specified by:
postEvent
in interfaceIEventManager
- Parameters:
event
- The event to send to all listeners which subscribe to the topic of the event.
-
sendEvent
public boolean sendEvent(org.osgi.service.event.Event event) Description copied from interface:IEventManager
Initiate synchronous delivery of an event. This method does not return to the caller until delivery of the event is completed.- Specified by:
sendEvent
in interfaceIEventManager
- Parameters:
event
- The event to send to all listeners which subscribe to the topic of the event.
-
register
Description copied from interface:IEventManager
register a new event handler- Specified by:
register
in interfaceIEventManager
- Returns:
- true if registration is successful, false otherwise
-
register
Description copied from interface:IEventManager
register a new event handler- Specified by:
register
in interfaceIEventManager
- Returns:
- true if registration is successful, false otherwise
-
register
public boolean register(String topic, String filter, org.osgi.service.event.EventHandler eventHandler) Description copied from interface:IEventManager
register a new event handler- Specified by:
register
in interfaceIEventManager
- Returns:
- true if registration is successful, false otherwise
-
register
public boolean register(String[] topics, String filter, org.osgi.service.event.EventHandler eventHandler) Description copied from interface:IEventManager
register a new event handler- Specified by:
register
in interfaceIEventManager
- Returns:
- true if registration is successful, false otherwise
-
unregister
public boolean unregister(org.osgi.service.event.EventHandler eventHandler) Description copied from interface:IEventManager
un-register an event handler- Specified by:
unregister
in interfaceIEventManager
- Returns:
- true if unregistration is done, false otherwise
-
newEvent
- Parameters:
topic
-data
-- Returns:
- new Event instance
-
newEvent
public static org.osgi.service.event.Event newEvent(String topic, Object data, boolean copySessionContext) Create new event instance. If copySessionContext is true, a copy of current session context is added as EVENT_CONTEXT property to event data.- Parameters:
topic
-data
-copySessionContext
- true to copy current session context (usually for postEvent).- Returns:
- new Event instance
-
newEvent
- Parameters:
topic
-properties
-- Returns:
- event object
-