Package org.openhab.core.persistence
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, Mark Herwege - Make default strategy to be only a configuration suggestion
-
Method Summary
Modifier and TypeMethodDescriptiondefault List<PersistenceStrategy> Deprecated.getId()Returns the id of thisPersistenceService.Returns the label of thisPersistenceService.default List<PersistenceStrategy> Provides suggested persistence strategies that can be used in the UI as a suggestion for configuration.voidStores the current value of the given item.voidStores the current value of the given item under a specified alias.
-
Method Details
-
getId
String getId()Returns the id of thisPersistenceService. This id is used to uniquely identify thePersistenceService.- Returns:
- the id to uniquely identify the
PersistenceService.
-
getLabel
Returns the label of thisPersistenceService. This label provides a user friendly name for thePersistenceService.- Parameters:
locale- the language to return the label in, or null for the default language- Returns:
- the label of the
PersistenceService.
-
store
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.storeadds 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
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.storeadds 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
Deprecated.Provides default persistence strategies that are used for all items if no user defined configuration is found. This method has been deprecated andgetSuggestedStrategies()should be used instead. These persistence strategies are no longer applied automatically.- Returns:
- The suggested persistence strategies
-
getSuggestedStrategies
Provides suggested persistence strategies that can be used in the UI as a suggestion for configuration.- Returns:
- The suggested persistence strategies
-