com.isti.trinetwatch.params
Class ParamHistoryTable

java.lang.Object
  extended bycom.isti.trinetwatch.params.ParamHistoryTable
All Implemented Interfaces:
ParamHistory

public class ParamHistoryTable
extends java.lang.Object
implements ParamHistory

Class ParamHistoryTable defines the history table for station parameters.


Field Summary
static java.lang.String KEY_VALUE_SEPARATOR
          Key value separator.
 
Constructor Summary
ParamHistoryTable(ParamValues paramValues)
          Constructs a history table.
ParamHistoryTable(ParamValues paramValues, boolean archiveOverrideFlag)
          Constructs a history table.
 
Method Summary
 void add(DynamicParamHolder paramHolder, Station stationObj, DynamicParameter dParameter, long timeLastChanged, long timeLastReceived, long minTime)
          Adds the item to the history.
protected static java.lang.String addKey(java.lang.String key, java.lang.String str)
          Adds the specified string to the key.
protected  java.lang.String getFileName(java.lang.String key)
          Gets the file name for the specified key.
 java.util.Vector getHistoryVector(long startTime, long endTime)
          Returns a new Vector containing 'ValueTimeBlock' objects with timestamps in the specified range.
protected static java.lang.String getKey(Station stationObj, DynamicParamHolder paramHolder, DynamicParameter dParameter)
          Gets the key for the specified station and dynamic parameter.
protected  java.lang.String getRootDirName(java.lang.String key)
          Gets the root directory name for the specified key.
 boolean isHistoryEnabled()
          Determines if the history is enabled.
static void terminateArchiveWorkerThreads()
          Terminates the archive-worker threads for all parameter-history tables.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

KEY_VALUE_SEPARATOR

public static final java.lang.String KEY_VALUE_SEPARATOR
Key value separator.

See Also:
Constant Field Values
Constructor Detail

ParamHistoryTable

public ParamHistoryTable(ParamValues paramValues,
                         boolean archiveOverrideFlag)
Constructs a history table.

Parameters:
paramValues - the parameter values.
archiveOverrideFlag - true to have archiving for this parameter enabled regardless of 'paramValues.getArchiveNonVotingParamsFlag()' value.

ParamHistoryTable

public ParamHistoryTable(ParamValues paramValues)
Constructs a history table.

Parameters:
paramValues - the parameter values.
Method Detail

getRootDirName

protected java.lang.String getRootDirName(java.lang.String key)
Gets the root directory name for the specified key.

Parameters:
key - the key.
Returns:
the root directory name for the specified key.

getFileName

protected java.lang.String getFileName(java.lang.String key)
Gets the file name for the specified key.

Parameters:
key - the key.
Returns:
the file name for the specified key.

addKey

protected static java.lang.String addKey(java.lang.String key,
                                         java.lang.String str)
Adds the specified string to the key.

Parameters:
key - the current value of the key.
str - the string to add.
Returns:
the updated value of the key.

getKey

protected static java.lang.String getKey(Station stationObj,
                                         DynamicParamHolder paramHolder,
                                         DynamicParameter dParameter)
Gets the key for the specified station and dynamic parameter. The key is safe to use as a filename.

Parameters:
stationObj - the station object.
paramHolder - the parameter holder.
dParameter - the dynamic parameter.
Returns:
the key.

add

public void add(DynamicParamHolder paramHolder,
                Station stationObj,
                DynamicParameter dParameter,
                long timeLastChanged,
                long timeLastReceived,
                long minTime)
Adds the item to the history.

Specified by:
add in interface ParamHistory
Parameters:
paramHolder - the parameter holder.
stationObj - the station object.
dParameter - the dynamic parameter.
timeLastChanged - the time last changed (seconds since 1/1/1970).
timeLastReceived - the time last received (seconds since 1/1/1970).
minTime - the minimum time (seconds since 1/1/1970).

getHistoryVector

public java.util.Vector getHistoryVector(long startTime,
                                         long endTime)
Returns a new Vector containing 'ValueTimeBlock' objects with timestamps in the specified range. The start and end time parameter values are in seconds since 1/1/1970, and are "inclusive".

Specified by:
getHistoryVector in interface ParamHistory
Parameters:
startTime - the start time for the range, or 0 for the beginning of the history.
endTime - the end time for the range, or 0 for the end of the history.
Returns:
A Vector of 'ValueTimeBlock' objects with timestamps in the specified range, an empty Vector if no matching objects were found, or null if no history objects are available.

isHistoryEnabled

public boolean isHistoryEnabled()
Determines if the history is enabled.

Specified by:
isHistoryEnabled in interface ParamHistory
Returns:
true if enabled, false otherwise.

terminateArchiveWorkerThreads

public static void terminateArchiveWorkerThreads()
Terminates the archive-worker threads for all parameter-history tables.