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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic AddonEvent
createAddonFailureEvent
(String id, @Nullable String msg) Creates an "add-on failure" event.static AddonEvent
Creates an "add-on installed" event.static AddonEvent
Creates an "add-on uninstalled" event.protected Event
createEventByType
(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:AbstractEventFactory
Create a new event instance based on the event type.- Specified by:
createEventByType
in 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
-