Interface ThingRegistry

All Superinterfaces:
Registry<Thing,ThingUID>

@NonNullByDefault public interface ThingRegistry extends Registry<Thing,ThingUID>
ThingRegistry tracks all Things from different ThingProviders and provides access to them. The ThingRegistry supports adding of listeners (see ThingRegistryChangeListener) and trackers (see ThingTracker).
Author:
Dennis Nobel - Initial contribution, Oliver Libutzki - Extracted ManagedThingProvider
  • Method Details

    • get

      @Nullable Thing get(ThingUID uid)
      Returns a thing for a given UID or null if no thing was found.
      Specified by:
      get in interface Registry<Thing,ThingUID>
      Parameters:
      uid - thing UID
      Returns:
      thing for a given UID or null if no thing was found
    • getChannel

      @Nullable Channel getChannel(ChannelUID channelUID)
      Returns a channel for the given channel UID or null if no channel was found
      Parameters:
      channelUID - channel UID
      Returns:
      channel for the given channel UID or null of no channel was found
    • updateConfiguration

      void updateConfiguration(ThingUID thingUID, Map<String,Object> configurationParameters)
      Updates the configuration of a thing for the given UID.
      Parameters:
      thingUID - thing UID
      configurationParameters - configuration parameters
      Throws:
      ConfigValidationException - if one or more of the given configuration parameters do not match their declarations in the configuration description
      IllegalArgumentException - if no thing with the given UID exists
      IllegalStateException - if no handler is attached to the thing
    • remove

      @Nullable Thing remove(ThingUID thingUID)
      Initiates the removal process for the Thing specified by the given ThingUID. Unlike in other Registrys, Things don't get removed immediately. Instead, the corresponding ThingHandler is given the chance to perform any required removal handling before it actually gets removed.

      If for any reasons the Thing should be removed immediately without any prior processing, use forceRemove(ThingUID) instead.

      Specified by:
      remove in interface Registry<Thing,ThingUID>
      Parameters:
      thingUID - Identificator of the Thing to be removed
      Returns:
      the Thing that was removed, or null if no Thing with the given ThingUID exists
    • forceRemove

      @Nullable Thing forceRemove(ThingUID thingUID)
      Removes the Thing specified by the given ThingUID. If the corresponding ThingHandler should be given the chance to perform any removal operations, use remove(ThingUID) instead.
      Parameters:
      thingUID - Identificator of the Thing to be removed
      Returns:
      the Thing that was removed, or null if no Thing with the given ThingUID exists
    • createThingOfType

      @Nullable Thing createThingOfType(ThingTypeUID thingTypeUID, @Nullable ThingUID thingUID, @Nullable ThingUID bridgeUID, @Nullable String label, Configuration configuration)
      Creates a thing based on the given configuration properties
      Parameters:
      thingTypeUID - thing type unique id
      thingUID - thing unique id which should be created. This id might be null.
      bridgeUID - the thing's bridge. Null if there is no bridge or if the thing is a bridge by itself.
      configuration - the configuration
      Returns:
      the created thing