org.openmuc.core.datamanager
Interface DatabaseInterface

All Known Implementing Classes:
SlotsDatabaseLayer, SQLiteDatabaseLayerProvider

public interface DatabaseInterface


Method Summary
 void addChannel(ChannelConfiguration channel)
          Add a new item (measurement channel) to the database
 Value getValue(java.lang.String label, long timestamp)
          Gets a single value with a specified timestamp from the database.
 java.util.List<Value> getValues(java.lang.String label, long startTime)
          Gets all values (time series) of a channel from startTime until now.
 java.util.List<Value> getValues(java.lang.String label, long startTime, long endTime)
          Gets all values (time series) of a channel from startTime until endTime.
 void insertValue(java.lang.String label, Value reading)
          Insert a value into the database.
 

Method Detail

addChannel

void addChannel(ChannelConfiguration channel)
                throws java.io.IOException
Add a new item (measurement channel) to the database

Parameters:
channel - unique identifier of the item
Throws:
java.io.IOException

insertValue

void insertValue(java.lang.String label,
                 Value reading)
                 throws java.io.IOException
Insert a value into the database.

Parameters:
label - label unique identifier of the item
reading - a Value object
Throws:
java.io.IOException - Will be thrown if there is a problem with the underlying database layer

getValues

java.util.List<Value> getValues(java.lang.String label,
                                long startTime)
                                throws java.io.IOException
Gets all values (time series) of a channel from startTime until now. It is the same as the call getValues(label, startTime, System.currentTimeMillies)

Parameters:
label - unique identifier of the item
startTime - Time of the first value in the time series in ms since epoche.
Returns:
A List of value objects or an empty list if now matching object have been found.
Throws:
java.io.IOException

getValues

java.util.List<Value> getValues(java.lang.String label,
                                long startTime,
                                long endTime)
                                throws java.io.IOException
Gets all values (time series) of a channel from startTime until endTime.

Parameters:
label - unique identifier of the item
startTime - Time of the first value in the time series in ms since epoche.
endTime - Time of the last value in the time series in ms since epoche
Returns:
A List of value objects or an empty list if now matching object have been found.
Throws:
java.io.IOException

getValue

Value getValue(java.lang.String label,
               long timestamp)
               throws java.io.IOException
Gets a single value with a specified timestamp from the database.

Parameters:
label - unique identifier of the item
timestamp - timestamp of the value (ms since epoche)
Returns:
a Value object if to has been found or null
Throws:
java.io.IOException