org.openmuc.mux.dbprovider
Class SlotsDatabaseLayer

java.lang.Object
  extended by org.openmuc.mux.dbprovider.SlotsDatabaseLayer
All Implemented Interfaces:
DatabaseInterface

public class SlotsDatabaseLayer
extends java.lang.Object
implements DatabaseInterface


Constructor Summary
SlotsDatabaseLayer()
           
 
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SlotsDatabaseLayer

public SlotsDatabaseLayer()
Method Detail

addChannel

public void addChannel(ChannelConfiguration channel)
                throws java.io.IOException
Description copied from interface: DatabaseInterface
Add a new item (measurement channel) to the database

Specified by:
addChannel in interface DatabaseInterface
Parameters:
channel - unique identifier of the item
Throws:
java.io.IOException

getValue

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

Specified by:
getValue in interface DatabaseInterface
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

getValues

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

Specified by:
getValues in interface DatabaseInterface
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

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

Specified by:
getValues in interface DatabaseInterface
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

insertValue

public void insertValue(java.lang.String label,
                        Value reading)
                 throws java.io.IOException
Description copied from interface: DatabaseInterface
Insert a value into the database.

Specified by:
insertValue in interface DatabaseInterface
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