Skip to content
This repository has been archived by the owner on May 7, 2020. It is now read-only.

Refactored core.persistence bundle #1962

Merged
merged 1 commit into from
Aug 3, 2016

Conversation

kaikreuzer
Copy link
Contributor

  • removed dependency to model.persistence
  • introduced PersistenceServiceRegistry
  • made persistence extensions available in script and rules
  • added meta data to make default service configurable through UI

Signed-off-by: Kai Kreuzer kai@openhab.org

@@ -125,9 +124,9 @@ public Response httpGetPersistenceServices(@Context HttpHeaders headers,
@ApiOperation(value = "Gets a list of items available via a specific persistence service.", response = String.class, responseContainer = "List")
@ApiResponses(value = @ApiResponse(code = 200, message = "OK"))
public Response httpGetPersistenceServiceItems(@Context HttpHeaders headers,
@ApiParam(value = "Name of the persistence service. If not provided the default service will be used", required = false) @QueryParam("servicename") String serviceName) {
@ApiParam(value = "Name of the persistence service. If not provided the default service will be used", required = false) @QueryParam("serviceId") String serviceId) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Help possibly should say "Id of persistence service" to be consistent.

@cdjackson
Copy link
Contributor

LGTM. Tested with the H2 service and seems to work ok

- removed dependency to model.persistence
- introduced PersistenceServiceRegistry
- made persistence extensions available in script and rules
- added meta data to make default service configurable through UI

Signed-off-by: Kai Kreuzer <kai@openhab.org>
@kaikreuzer
Copy link
Contributor Author

Thanks @cdjackson, I have updated the PR accordingly.

@maggu2810 Since the OH build is currently broken and requires this fix, I take the liberty to merge it myself. Feel free to add comments later on and I can address them in a follow-up PR.

@kaikreuzer kaikreuzer merged commit c564054 into eclipse-archived:master Aug 3, 2016
@kaikreuzer kaikreuzer deleted the persistence branch August 3, 2016 17:49
// if there is exactly one service available in the system, we assume that this should be used, if no
// default is specifically configured.
if (services.size() == 1) {
return services.keySet().iterator().next();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just an idea:

We could change the services member to a sorted map:
private SortedMap<String, PersistenceService> services = new TreeMap<String, PersistenceService>();

Then we could use firstKey() and don't need to create a iteratior.

I assume it will speed up the getDefaultId() method a little bit (insert and remove are perhaps called not so frequently as fetching the default ID and insert / remove in a tree is not to problematic).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that getting in iterator is by any means an expensive operation?

cdjackson added a commit to cdjackson/smarthome that referenced this pull request Aug 8, 2016
* master:
  Group item configuration (eclipse-archived#1968)
  added possibility to manage group functions through REST API (eclipse-archived#1963)
  eclipse-archived#1947: Create new method in DiscoveryServiceRegistry to expose discovery service timeout (eclipse-archived#1964)
  Fix scrollbar bug, add responsive images (eclipse-archived#1973)
  switched to composite update site for JmDNS (eclipse-archived#1966)
  Sonos binding: title channel for radio reset in a first time: (eclipse-archived#1965)
  Sonos binding: fix issues 1600 1942 1943 1944 1045 eclipse-archived#1954 (eclipse-archived#1957)
  Feature/eclipse-archived#1955 wemo discovery (eclipse-archived#1961)
  implemented the ThingTypeMigrator service (eclipse-archived#1958)
  Refactored core.persistence bundle (eclipse-archived#1962)
  Sonos binding: fix issues eclipse-archived#1900 and eclipse-archived#1902 (eclipse-archived#1905)
  don't register service if client has already gone (eclipse-archived#1949)
@kaikreuzer kaikreuzer added this to the 0.9.0 milestone Nov 30, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants