Class 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 Detail

      • EventManager

        public EventManager()
    • 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 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:
      • newEvent

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