Package org.openhab.core.addon
Class AddonEventFactory
java.lang.Object
org.openhab.core.events.AbstractEventFactory
org.openhab.core.addon.AddonEventFactory
- All Implemented Interfaces:
EventFactory
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
-
Nested Class Summary
Nested classes/interfaces inherited from class org.openhab.core.events.AbstractEventFactory
AbstractEventFactory.ZonedDateTimeAdapter -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic AddonEventcreateAddonFailureEvent(String id, @Nullable String msg) Creates an "add-on failure" event.static AddonEventCreates an "add-on installed" event.static AddonEventCreates an "add-on uninstalled" event.protected EventcreateEventByType(String eventType, String topic, String payload, @Nullable String source) Create a new event instance based on the event type.Methods inherited from class org.openhab.core.events.AbstractEventFactory
checkNotNull, checkNotNullOrEmpty, createEvent, deserializePayload, getSupportedEventTypes, getTopicElements, serializePayload
-
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:AbstractEventFactoryCreate a new event instance based on the event type.- Specified by:
createEventByTypein classAbstractEventFactory- Parameters:
eventType- the event typetopic- the topicpayload- the payloadsource- the source, can be null- Returns:
- the created event instance
- Throws:
Exception- if the creation of the event fails
-
createAddonInstalledEvent
Creates an "add-on installed" event.- Parameters:
id- the id of the installed add-on- Returns:
- the according event
-
createAddonUninstalledEvent
Creates an "add-on uninstalled" event.- Parameters:
id- the id of the uninstalled add-on- Returns:
- the according event
-
createAddonFailureEvent
Creates an "add-on failure" event.- Parameters:
id- the id of the add-on that caused a failuremsg- the message text of the failure- Returns:
- the according event
-