-
Notifications
You must be signed in to change notification settings - Fork 781
Initial commit of persistence extensions #1872
Changes from 2 commits
12c7c31
b532fa5
dfbbf7a
bcaa729
6779175
81fe974
c192e76
5b1238c
4632f69
406327b
acdf26a
c11d8c1
ad90d05
4a22703
1d36e4b
2bcb6af
04e65e9
1c0c9fd
1c3aa20
829fd5d
d093a17
6610b71
cbcd900
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/** | ||
* Copyright (c) 2014-2015 openHAB UG (haftungsbeschraenkt) and others. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
*/ | ||
package org.eclipse.smarthome.core.persistence; | ||
|
||
import java.util.Date; | ||
|
||
import org.eclipse.smarthome.core.items.Item; | ||
|
||
/** | ||
* This class provides an interface to the a {@link PersistenceService} to allow data to be stored | ||
* at a specific time. This allows bindings that interface to devices that store data internally, | ||
* and then periodically provide it to the server to be accommodated. | ||
* | ||
* @author Chris Jackson - Initial implementation and API | ||
* | ||
*/ | ||
public interface ModifiablePersistenceService extends QueryablePersistenceService { | ||
/** | ||
* <p> | ||
* Stores the historic item value. This allows the item, time and value to be specified. | ||
* </p> | ||
* <p> | ||
* Implementors should keep in mind that all registered {@link PersistenceService}s are called synchronously. Hence | ||
* long running operations should be processed asynchronously. E.g. <code>store</code> adds things to a queue which | ||
* is processed by some asynchronous workers (Quartz Job, Thread, etc.). | ||
* </p> | ||
* | ||
* @param date the date of the record | ||
* @param item the data to be stored | ||
*/ | ||
public void store(Date date, Item item); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you don't care, I would prefer to use Item as first argument and Date as second one. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can remove "public" modifiers on interface functions (its default). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know - the reason I added them was to maintain the same style as other interfaces in this package. I’m happy to remove it though. |
||
|
||
/** | ||
* Removes a data from a persistence store. | ||
* | ||
* @param filter the filter to apply to the data removal | ||
* @return true if the query executed successfully | ||
*/ | ||
public boolean remove(FilterCriteria filter); | ||
|
||
/** | ||
* Removes an item and all data associated with the item | ||
* | ||
* @return true if the item was deleted | ||
*/ | ||
public boolean removeItemData(String itemName); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. to make it very clear, I would call it There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am considering to remove this method and instead just have the What do you think? |
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/** | ||
* Copyright (c) 2014-2015 openHAB UG (haftungsbeschraenkt) and others. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
*/ | ||
package org.eclipse.smarthome.core.persistence; | ||
|
||
public interface PersistenceItem { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would prefer some other name to better express the purpose/content. |
||
String getName(); | ||
|
||
Integer getRows(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why "rows"? Shouldn't we use "count" or "size"? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could - I don’t mind. rows is common database terminology which is why I used it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You are right, that rows is used by SQL databases. IIRC it differs using NOSQL databases. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So? It needs to be called something - it wasn't planned to be SQL dependant - other databases use this term as well. |
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you re-run "mvn license:format" to update the headers to the latest version?