openhab-core
openhab-core copied to clipboard
Persistence no default strategies and persistence configuration health check
Closes https://github.com/openhab/openhab-core/issues/4470
This is a breaking change.
With this PR, the default persistence strategy is not applied automatically anymore when no other strategy is defined.
~~The PersistenceService interface still keeps the getDefaultStrategies method. Therefore no change is required in the persistence services implementations. But rather than applying this automatically, these default strategies are now considered configuration suggestions.~~
The current PersistenceService.getDefaultStrategies() method has been deprecated and replaced by a PersistenceService.getSuggestedStrategies() method. A default implementation will redirect PersistenceService.getSuggestedStrategies() to PersistenceService.getDefaultStrategies(), so there is no need to immediately change PersistenceService implementations.
An extra sub-endpoint to the persistence REST API endpoint is defined to retrieve these strategy suggestions (GET persistence/strategysuggestions?serviceId={serviceId}). This endpoint can be used by the UI to suggest strategies when configuring the service. Applying these suggestions will then become a clear user decision.
File based persistence configurations will have to be changed by the user if they use the default strategies.
As part of this PR, a persistence configuration health check endpoint has been implemented(GET persistence/persistencehealth?serviceId={serviceId}). This endpoint will then be used in the UI to show persistence configuration health (similar to orphan links), and will allow more easy support when default strategies are being removed.
To complete this functionality, the following is also needed:
- [X] Breaking change notice (openhab-distro), see https://github.com/openhab/openhab-distro/pull/1737
- [X] Adapt the UI (openhab-web): remove default strategies and suggest when configuring, make setting a strategy required for the persistence configuration, persistence health in UI, see https://github.com/openhab/openhab-webui/pull/3123
- [X] Upgrade logic for managed persistence configurations: if no strategies are defined, add the suggested ones to the configuration (included in this PR)
- [X] Change documentation, see https://github.com/openhab/openhab-docs/pull/2478