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

      List<Addon> getAddons(@Nullable Locale locale)
      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

      @Nullable Addon getAddon(String id, @Nullable Locale locale)
      Retrieves the add-on for the given id.
      Parameters:
      id - the id of the add-on
      locale - the locale to use for the result
      Returns:
      the localized add-on or null, if no add-on exists with this id
    • getTypes

      List<AddonType> getTypes(@Nullable Locale locale)
      Retrieves all possible types of add-ons.
      Parameters:
      locale - the locale to use for the result
      Returns:
      the localized types
    • install

      void install(String id)
      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

      void uninstall(String id)
      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

      @Nullable String getAddonId(URI addonURI)
      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