Class AbstractRemoteAddonService
java.lang.Object
org.openhab.core.addon.marketplace.AbstractRemoteAddonService
- All Implemented Interfaces:
AddonService
@NonNullByDefault
public abstract class AbstractRemoteAddonService
extends Object
implements AddonService
The
AbstractRemoteAddonService
implements basic functionality of a remote add-on-service- Author:
- Jan N. Klug - Initial contribution
-
Field Summary
Modifier and TypeFieldDescriptionprotected final Set
<MarketplaceAddonHandler> protected final AddonInfoRegistry
protected final ExpiringCache
<List<Addon>> protected final org.osgi.service.cm.ConfigurationAdmin
protected final BundleVersion
protected final EventPublisher
protected final com.google.gson.Gson
-
Constructor Summary
ModifierConstructorDescriptionprotected
AbstractRemoteAddonService
(EventPublisher eventPublisher, org.osgi.service.cm.ConfigurationAdmin configurationAdmin, StorageService storageService, AddonInfoRegistry addonInfoRegistry, String servicePid) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract void
addAddonHandler
(MarketplaceAddonHandler handler) Add aMarketplaceAddonHandler
to this service This needs to be implemented by the addon-services because the handlers are references to OSGi services and the @Reference annotation is not inherited.Retrieves all add-ons.protected BundleVersion
get all addons from remoteRetrieves all possible types of add-ons.protected boolean
void
Installs the given add-on.void
Refreshes the source used for providing the add-ons.protected boolean
check if remote services are enabledprotected abstract void
Remove aMarketplaceAddonHandler
from this service This needs to be implemented by the addon-services because the handlers are references to OSGi services and unbind methods can't be inherited.void
Uninstalls the given add-on.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.openhab.core.addon.AddonService
getAddon, getAddonId, getId, getName
-
Field Details
-
coreVersion
-
gson
protected final com.google.gson.Gson gson -
addonHandlers
-
installedAddonStorage
-
eventPublisher
-
configurationAdmin
protected final org.osgi.service.cm.ConfigurationAdmin configurationAdmin -
cachedRemoteAddons
-
addonInfoRegistry
-
cachedAddons
-
installedAddonIds
-
-
Constructor Details
-
AbstractRemoteAddonService
protected AbstractRemoteAddonService(EventPublisher eventPublisher, org.osgi.service.cm.ConfigurationAdmin configurationAdmin, StorageService storageService, AddonInfoRegistry addonInfoRegistry, String servicePid)
-
-
Method Details
-
getCoreVersion
-
refreshSource
public void refreshSource()Description copied from interface:AddonService
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.- Specified by:
refreshSource
in interfaceAddonService
-
addAddonHandler
Add aMarketplaceAddonHandler
to this service This needs to be implemented by the addon-services because the handlers are references to OSGi services and the @Reference annotation is not inherited. It is added here to make sure that implementations comply with that.- Parameters:
handler
- the handler that shall be added
-
removeAddonHandler
Remove aMarketplaceAddonHandler
from this service This needs to be implemented by the addon-services because the handlers are references to OSGi services and unbind methods can't be inherited. It is added here to make sure that implementations comply with that.- Parameters:
handler
- the handler that shall be removed
-
getRemoteAddons
get all addons from remote- Returns:
- a list of
Addon
that are available on the remote side
-
getAddons
Description copied from interface:AddonService
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.- Specified by:
getAddons
in interfaceAddonService
- Parameters:
locale
- the locale to use for the result- Returns:
- the localized add-ons
-
getTypes
Description copied from interface:AddonService
Retrieves all possible types of add-ons.- Specified by:
getTypes
in interfaceAddonService
- Parameters:
locale
- the locale to use for the result- Returns:
- the localized types
-
install
Description copied from interface:AddonService
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.- Specified by:
install
in interfaceAddonService
- Parameters:
id
- the id of the add-on to install
-
uninstall
Description copied from interface:AddonService
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.- Specified by:
uninstall
in interfaceAddonService
- Parameters:
id
- the id of the add-on to uninstall
-
remoteEnabled
protected boolean remoteEnabled()check if remote services are enabled- Returns:
- true if network access is allowed
-
includeIncompatible
protected boolean includeIncompatible()
-