com.isti.trinetwatch.params
Class AgentInfo

java.lang.Object
  extended by com.isti.trinetwatch.station.StationTable
      extended by com.isti.trinetwatch.params.AgentInfo
All Implemented Interfaces:
java.io.Serializable

public class AgentInfo
extends StationTable
implements java.io.Serializable

Class AgentInfo defines a block of agent information items and holds a table of stations fed by the agent.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.isti.trinetwatch.station.StationTable
StationTable.PurgeLevelsCacheThread
 
Field Summary
 
Fields inherited from class com.isti.trinetwatch.station.StationTable
LAT_LON_PREFIX_TEXT
 
Constructor Summary
AgentInfo(java.lang.String name)
          Creates an agent information block.
 
Method Summary
 boolean addStation(Station stationObj)
          Adds the given Station object to the table of stations fed by this agent.
 void buildLongName()
          Builds and adds the "longName" property (if it does not already exist) and sets it as the long version of the this agent's name.
 boolean containsStation(Station stationObj)
          Tests if the given station object exists in the table of stations fed by this agent.
 boolean containsStationName(java.lang.String name)
          Tests if a station with the specified short name exists in the table of stations fed by this agent.
 java.lang.String formatTimeVal(long timeVal)
          Formats a time value into a date/time string.
 long getFirstIDMsgTime()
          Returns the time that the first agent-ID message was received from this agent.
 java.lang.String getLongName()
          Returns the long version of this agent's name.
 java.lang.String getName()
          Returns this agent's name.
 java.lang.String getPropsAsQuotedStrings(boolean dynamicFlag)
          Returns a string containing property item name/value pairs.
 void restoreSavedStaticProps()
          Adds the property items saved via the 'saveClearStaticProps()' method to the current table of static property items.
 void saveClearStaticProps()
          Moves all current static property items to a save table and clears the table of static property items.
 void setDPMsgTime(long timeVal)
          Updates the time that the last dynamic parameter message was received from this agent.
 void setIDMsgTime(long timeVal)
          Updates the time that the last agent-ID message was received from this agent.
 void setLongName(java.lang.String str)
          Sets the long version of this agent's name to the given value.
 void setProperty(java.lang.String name, java.lang.String value)
          Enters a name/value property pair item into this agent information block.
 void setProperty(java.lang.String name, java.lang.String value, boolean dynamicFlag)
          Enters a name/value property pair item into this agent information block.
 void setSPMsgTime(long timeVal)
          Updates the time that the last static parameter message was received from this agent.
 java.lang.String toString()
          Returns this agent's name.
 
Methods inherited from class com.isti.trinetwatch.station.StationTable
add, addAll, containsKey, containsValue, elements, enterTableData, enterTableData, get, getDefaultSameStatusPercent, getDisplayString, getDisplayString, getKeysVector, getSameStatusLevel, getSameStatusPerecentValidator, getSameStatusTime, getSnapshotStrFromCache, getSnapshotString, getStationForDParam, getThreadSyncObj, getUpdateString, getUpdateString, getUpdateString, getValuesVector, keys, loadDynParamsFromArchive, preloadAndEnableLevelsCaches, procSameStatusLevel, remove, removeAll, setSameStatusPercent, startLevelsCachesPurgeThread, stationCount, stopLevelsCachesPurgeThread
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AgentInfo

public AgentInfo(java.lang.String name)
Creates an agent information block.

Parameters:
name - name of the agent.
Method Detail

getName

public java.lang.String getName()
Returns this agent's name.


getLongName

public java.lang.String getLongName()
Returns the long version of this agent's name.


setProperty

public void setProperty(java.lang.String name,
                        java.lang.String value,
                        boolean dynamicFlag)
Enters a name/value property pair item into this agent information block. A static and a dynamic properties table are managed. When the 'dynamic' flag is set or when an item's value has changed then the item is put into the 'dynamic' table; otherwise it resides in the static table.

Parameters:
name - name of item.
value - value for item.
dynamicFlag - if true then the item is placed in the 'dynamic' properties table.

setProperty

public void setProperty(java.lang.String name,
                        java.lang.String value)
Enters a name/value property pair item into this agent information block. A static and a dynamic properties table are managed. When item's value has changed then the item is put into the 'dynamic' table; otherwise it resides in the static table.

Parameters:
name - name of item.
value - value for item.

saveClearStaticProps

public void saveClearStaticProps()
Moves all current static property items to a save table and clears the table of static property items. The saved items may be added to the table of static property items via the 'restoreSavedStaticProps()' method.


restoreSavedStaticProps

public void restoreSavedStaticProps()
Adds the property items saved via the 'saveClearStaticProps()' method to the current table of static property items.


getPropsAsQuotedStrings

public java.lang.String getPropsAsQuotedStrings(boolean dynamicFlag)
Returns a string containing property item name/value pairs.

Returns:
An ASCII string formatted as follows: '"NNNN"="VVVV";...' where NNNN is the name of a property and VVVV represents its value. Any number of property name/value pairs may be returned. There should be no semi-colon (';') after the last property.

addStation

public boolean addStation(Station stationObj)
Adds the given Station object to the table of stations fed by this agent.

Returns:
true if successful, false if a station with the same short name already exists in table or if the short name is invalid.

containsStationName

public boolean containsStationName(java.lang.String name)
Tests if a station with the specified short name exists in the table of stations fed by this agent.

Returns:
true if the station-name exists in the table, false if not.

containsStation

public boolean containsStation(Station stationObj)
Tests if the given station object exists in the table of stations fed by this agent.

Returns:
true if the station object exists in the table, false if not.

setLongName

public void setLongName(java.lang.String str)
Sets the long version of this agent's name to the given value. The long-name value may be overridden later by via the 'buildLongName()' method.

Parameters:
str - long name to use.

buildLongName

public void buildLongName()
Builds and adds the "longName" property (if it does not already exist) and sets it as the long version of the this agent's name.


setSPMsgTime

public void setSPMsgTime(long timeVal)
Updates the time that the last static parameter message was received from this agent.

Parameters:
timeVal - a time value in milliseconds since 1/1/1970.

setDPMsgTime

public void setDPMsgTime(long timeVal)
Updates the time that the last dynamic parameter message was received from this agent.

Parameters:
timeVal - a time value in milliseconds since 1/1/1970.

setIDMsgTime

public void setIDMsgTime(long timeVal)
Updates the time that the last agent-ID message was received from this agent.

Parameters:
timeVal - a time value in milliseconds since 1/1/1970.

getFirstIDMsgTime

public long getFirstIDMsgTime()
Returns the time that the first agent-ID message was received from this agent.

Returns:
A time value in milliseconds since 1/1/1970.

toString

public java.lang.String toString()
Returns this agent's name.

Overrides:
toString in class StationTable
Returns:
a string representation of this object. The string contains the name of each station in the table.

formatTimeVal

public final java.lang.String formatTimeVal(long timeVal)
Formats a time value into a date/time string.

Parameters:
timeVal - the time value to be formatted into a time string.
Returns:
the formatted time string.