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
-
Method Summary
Modifier and TypeMethodDescriptionProvides default persistence strategies that are used for all items if no user defined configuration is found.getId()
Returns the id of thisPersistenceService
.Returns the label of thisPersistenceService
.void
Stores the current value of the given item.void
Stores 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
PersistenceService
s 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
Stores the current value of the given item under a specified alias.
Implementors should keep in mind that all registered
PersistenceService
s 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
-