Class AddonEventFactory

java.lang.Object
org.openhab.core.events.AbstractEventFactory
org.openhab.core.addon.AddonEventFactory
All Implemented Interfaces:
EventFactory

@NonNullByDefault public class AddonEventFactory extends AbstractEventFactory
This is an EventFactory for creating add-on events. The following event types are supported by this factory: AddonEvent.TYPE
Author:
Kai Kreuzer - Initial contribution
  • Constructor Details

    • AddonEventFactory

      public AddonEventFactory()
      Constructs a new AddonEventFactory.
  • Method Details

    • createEventByType

      protected Event createEventByType(String eventType, String topic, String payload, @Nullable String source) throws Exception
      Description copied from class: AbstractEventFactory
      Create a new event instance based on the event type.
      Specified by:
      createEventByType in class AbstractEventFactory
      Parameters:
      eventType - the event type
      topic - the topic
      payload - the payload
      source - the source, can be null
      Returns:
      the created event instance
      Throws:
      Exception - if the creation of the event fails
    • createAddonInstalledEvent

      public static AddonEvent createAddonInstalledEvent(String id)
      Creates an "add-on installed" event.
      Parameters:
      id - the id of the installed add-on
      Returns:
      the according event
    • createAddonUninstalledEvent

      public static AddonEvent createAddonUninstalledEvent(String id)
      Creates an "add-on uninstalled" event.
      Parameters:
      id - the id of the uninstalled add-on
      Returns:
      the according event
    • createAddonFailureEvent

      public static AddonEvent createAddonFailureEvent(String id, @Nullable String msg)
      Creates an "add-on failure" event.
      Parameters:
      id - the id of the add-on that caused a failure
      msg - the message text of the failure
      Returns:
      the according event