Interface PersistenceService

All Known Subinterfaces:
ModifiablePersistenceService, QueryablePersistenceService

@NonNullByDefault public interface PersistenceService
A persistence service which can be used to store data from openHAB. This must not necessarily be a local database, a persistence service can also be cloud-based or a simply data-export facility (e.g. for sending data to an IoT (Internet of Things) service.
Author:
Kai Kreuzer - Initial contribution
  • Method Details

    • getId

      String getId()
      Returns the id of this PersistenceService. This id is used to uniquely identify the PersistenceService.
      Returns:
      the id to uniquely identify the PersistenceService.
    • getLabel

      String getLabel(@Nullable Locale locale)
      Returns the label of this PersistenceService. This label provides a user friendly name for the PersistenceService.
      Parameters:
      locale - the language to return the label in, or null for the default language
      Returns:
      the label of the PersistenceService.
    • store

      void store(Item item)
      Stores the current value of the given item.

      Implementors should keep in mind that all registered PersistenceServices are called synchronously. Hence long running operations should be processed asynchronously. E.g. store adds things to a queue which is processed by some asynchronous workers (Quartz Job, Thread, etc.).

      Parameters:
      item - the item which state should be persisted.
    • store

      void store(Item item, @Nullable String alias)

      Stores the current value of the given item under a specified alias.

      Implementors should keep in mind that all registered PersistenceServices are called synchronously. Hence long running operations should be processed asynchronously. E.g. store adds things to a queue which is processed by some asynchronous workers (Quartz Job, Thread, etc.).

      Parameters:
      item - the item which state should be persisted.
      alias - the alias under which the item should be persisted.
    • getDefaultStrategies

      List<PersistenceStrategy> getDefaultStrategies()
      Provides default persistence strategies that are used for all items if no user defined configuration is found.
      Returns:
      The default persistence strategies