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
  • 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

      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 interface IEventManager
      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 interface IEventManager
      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 interface IEventManager
      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 interface IEventManager
      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 interface IEventManager
      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 interface IEventManager
      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 interface IEventManager
      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:
      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

      public static org.osgi.service.event.Event newEvent(String topic, EventProperty... properties)
      Parameters:
      topic -
      properties -
      Returns:
      event object