Package org.adempiere.base.event
Class EventManager
- java.lang.Object
-
- org.adempiere.base.event.EventManager
-
- All Implemented Interfaces:
IEventManager
public class EventManager extends Object implements IEventManager
Simple wrapper for the osgi event admin service. Usage: EventManager.getInstance().sendEvent/postEvent- Author:
- hengsin
-
-
Field Summary
-
Fields inherited from interface org.adempiere.base.event.IEventManager
CLASS_NAME_PROPERTY, EVENT_DATA, EVENT_ERROR_MESSAGES, IMPORT_TABLE_NAME_PROPERTY, PROCESS_CLASS_NAME_PROPERTY, PROCESS_UID_PROPERTY, TABLE_NAME_PROPERTY
-
-
Constructor Summary
Constructors Constructor Description EventManager()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
bindEventAdmin(org.osgi.service.event.EventAdmin eventAdmin)
static IEventManager
getInstance()
Get the singleton instance created by the osgi service frameworkstatic org.osgi.service.event.Event
newEvent(String topic, Object data)
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(String[] topics, String filter, org.osgi.service.event.EventHandler eventHandler)
register a new event handlerboolean
register(String[] topics, org.osgi.service.event.EventHandler eventHandler)
register a new event handlerboolean
register(String topic, String filter, org.osgi.service.event.EventHandler eventHandler)
register a new event handlerboolean
register(String topic, org.osgi.service.event.EventHandler eventHandler)
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 handler-
Methods 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
-
-
-
-
Method Detail
-
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
public static IEventManager 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
public boolean register(String topic, 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, 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 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
public static org.osgi.service.event.Event newEvent(String topic, Object data)
- Parameters:
topic
-data
-- Returns:
-
newEvent
public static org.osgi.service.event.Event newEvent(String topic, EventProperty... properties)
- Parameters:
topic
-properties
-- Returns:
- event object
-
-