Package org.openhab.core.addon
Interface AddonService
- All Known Implementing Classes:
AbstractRemoteAddonService
@NonNullByDefault
public interface AddonService
Classes implementing this interface can be registered as an OSGi service in order to provide functionality for
managing add-ons, such as listing, installing and uninstalling them.
The REST API offers a uri that exposes this functionality.
- Author:
- Kai Kreuzer - Initial contribution, Yannick Schaus - Add id, name and refreshSource
-
Method Summary
Modifier and TypeMethodDescription@Nullable Addon
Retrieves the add-on for the given id.@Nullable String
getAddonId
(URI addonURI) Parses the given URI and extracts an add-on Id.Retrieves all add-ons.getId()
Returns the ID of the service.getName()
Returns the name of the service.Retrieves all possible types of add-ons.void
Installs the given add-on.void
Refreshes the source used for providing the add-ons.void
Uninstalls the given add-on.
-
Method Details
-
getId
String getId()Returns the ID of the service.- Returns:
- the service identifier
-
getName
String getName()Returns the name of the service.- Returns:
- the service name
-
refreshSource
void refreshSource()Refreshes the source used for providing the add-ons. This can be called before getAddons to ensure the add-on information is up-to-date; otherwise they might be retrieved from a cache. -
getAddons
Retrieves all add-ons. It is expected that this method is rather cheap to call and will return quickly, i.e. some caching should be implemented if required.- Parameters:
locale
- the locale to use for the result- Returns:
- the localized add-ons
-
getAddon
Retrieves the add-on for the given id.- Parameters:
id
- the id of the add-onlocale
- the locale to use for the result- Returns:
- the localized add-on or
null
, if no add-on exists with this id
-
getTypes
Retrieves all possible types of add-ons.- Parameters:
locale
- the locale to use for the result- Returns:
- the localized types
-
install
Installs the given add-on. This can be a long running process. The framework makes sure that this is called within a separate thread and add-on events will be sent upon its completion.- Parameters:
id
- the id of the add-on to install
-
uninstall
Uninstalls the given add-on. This can be a long running process. The framework makes sure that this is called within a separate thread and add-on events will be sent upon its completion.- Parameters:
id
- the id of the add-on to uninstall
-
getAddonId
Parses the given URI and extracts an add-on Id. This must not be a long running process but return immediately.- Parameters:
addonURI
- the URI from which to parse the add-on Id.- Returns:
- the add-on Id if the URI can be parsed, otherwise
null
-