Class AbstractThingHandlerDiscoveryService<T extends ThingHandler>

java.lang.Object
org.openhab.core.config.discovery.AbstractDiscoveryService
org.openhab.core.config.discovery.AbstractThingHandlerDiscoveryService<T>
All Implemented Interfaces:
DiscoveryService, ThingHandlerService

@NonNullByDefault public abstract class AbstractThingHandlerDiscoveryService<T extends ThingHandler> extends AbstractDiscoveryService implements ThingHandlerService
The AbstractThingHandlerDiscoveryService extends the AbstractDiscoveryService for thing-based discovery services. It handles the injection of the ThingHandler
Author:
Jan N. Klug - Initial contribution, Laurent Garnier - Added discovery with an optional input parameter
  • Field Details

    • thingHandler

      @NonNullByDefault({}) protected T extends ThingHandler thingHandler
  • Constructor Details

    • AbstractThingHandlerDiscoveryService

      protected AbstractThingHandlerDiscoveryService(Class<T> thingClazz, @Nullable Set<ThingTypeUID> supportedThingTypes, int timeout, boolean backgroundDiscoveryEnabledByDefault, @Nullable String scanInputLabel, @Nullable String scanInputDescription) throws IllegalArgumentException
      Creates a new instance of this class with the specified parameters.
      Parameters:
      thingClazz - the ThingHandler class.
      supportedThingTypes - the list of Thing types which are supported (can be null).
      timeout - the discovery timeout in seconds after which the discovery service automatically stops its forced discovery process (>= 0).
      backgroundDiscoveryEnabledByDefault - defines, whether the default for this discovery service is to enable background discovery or not.
      scanInputLabel - the label of the optional input parameter to start the discovery or null if no input parameter supported.
      scanInputDescription - the description of the optional input parameter to start the discovery or null if no input parameter supported.
      Throws:
      IllegalArgumentException - if timeout < 0.
    • AbstractThingHandlerDiscoveryService

      protected AbstractThingHandlerDiscoveryService(Class<T> thingClazz, @Nullable Set<ThingTypeUID> supportedThingTypes, int timeout, boolean backgroundDiscoveryEnabledByDefault) throws IllegalArgumentException
      Creates a new instance of this class with the specified parameters and with scanInputLabel and scanInputDescription set to null.
      Parameters:
      thingClazz - the ThingHandler class.
      supportedThingTypes - the list of Thing types which are supported (can be null).
      timeout - the discovery timeout in seconds after which the discovery service automatically stops its forced discovery process (>= 0).
      backgroundDiscoveryEnabledByDefault - defines, whether the default for this discovery service is to enable background discovery or not.
      Throws:
      IllegalArgumentException - if timeout < 0.
    • AbstractThingHandlerDiscoveryService

      protected AbstractThingHandlerDiscoveryService(Class<T> thingClazz, @Nullable Set<ThingTypeUID> supportedThingTypes, int timeout) throws IllegalArgumentException
      Creates a new instance of this class with the specified parameters and with scanInputLabel and scanInputDescription set to null, and backgroundDiscoveryEnabledByDefault enabled.
      Parameters:
      thingClazz - the ThingHandler class.
      supportedThingTypes - the list of Thing types which are supported (can be null).
      timeout - the discovery timeout in seconds after which the discovery service automatically stops its forced discovery process (>= 0).
      Throws:
      IllegalArgumentException - if timeout < 0.
    • AbstractThingHandlerDiscoveryService

      protected AbstractThingHandlerDiscoveryService(Class<T> thingClazz, int timeout) throws IllegalArgumentException
      Creates a new instance of this class with the specified parameters and with scanInputLabel and scanInputDescription set to null, without any supportedThingTypes, and backgroundDiscoveryEnabledByDefault enabled.
      Parameters:
      thingClazz - the ThingHandler class.
      timeout - the discovery timeout in seconds after which the discovery service automatically stops its forced discovery process (>= 0).
      Throws:
      IllegalArgumentException - if timeout < 0.
    • AbstractThingHandlerDiscoveryService

      protected AbstractThingHandlerDiscoveryService(ScheduledExecutorService scheduler, Class<T> thingClazz, @Nullable Set<ThingTypeUID> supportedThingTypes, int timeout, boolean backgroundDiscoveryEnabledByDefault, @Nullable String scanInputLabel, @Nullable String scanInputDescription) throws IllegalArgumentException
      Creates a new instance of this class with the specified parameters.

      For use by tests only, allows setting a different ScheduledExecutorService like SameThreadExecutorService for synchronous behavior during testing.

      Parameters:
      thingClazz - the ThingHandler class.
      supportedThingTypes - the list of Thing types which are supported (can be null).
      timeout - the discovery timeout in seconds after which the discovery service automatically stops its forced discovery process (>= 0).
      backgroundDiscoveryEnabledByDefault - defines, whether the default for this discovery service is to enable background discovery or not.
      scanInputLabel - the label of the optional input parameter to start the discovery or null if no input parameter supported.
      scanInputDescription - the description of the optional input parameter to start the discovery or null if no input parameter supported.
      Throws:
      IllegalArgumentException - if timeout < 0.
  • Method Details