com.isti.trinetwatch.server
Class Server

java.lang.Object
  extended bycom.isti.trinetwatch.server.Server
All Implemented Interfaces:
ParamValues

public class Server
extends java.lang.Object
implements ParamValues

Class Server manages the gathering of information from collection agents, the controlling of the stations via the control agents, and services any requests coming from GUI-clients. This program contains many settings that can be set on the command line or in a configuration file.


Command Line Options

-c, --configFile [path] : The file to use as the configuration file for the SeisNetWatch server program.
-b, --programName [name_string] : The name of this program as it should be displayed. The default name is "SeisNetWatch".
-b, --baseDir [path] : The base directory into which the different program files, configuration files and log files are placed. The directories are [baseDir}/bin, [baseDir]/conf, [baseDir]/class, and [baseDir]/log. Any program binaries are place in 'bin', configuration files are placed in 'conf', the Java class files are placed in 'class', and any log files are placed in 'log'. The default base directory is "../".
-d, --daemon : Puts the NSI in daemon mode (no console input). Default is to accept a terminate command on the keyboard to shutdown.
-s, --staticParamsNap [seconds] : This option allows the user to set the length of time the program is to sleep after the initial request for the static parameter information for all the stations. The default setting is for 30 seconds.
-g, --gatherSPTimeout [seconds] : This option sets the length of time the program will spend gathering static parameters. Once the specified length of time has passed the program will no longer attempt to acquire more static parameter data from the collection agents. The default setting is for 300 seconds. A setting of zero indicates an infinite timeout, where the program will attempt to acquire more static parameter data until all of it is received.
-i, --inactivityTimeout [seconds] : This option sets the length of time that a client connection needs to be inactive before being automatically disconnected. The default setting is for 300 seconds. A setting of zero indicates an infinite timeout, where the clients will never be automatically disconnected. (Note that this setting does not refer to user inactivity on the client program, but rather whether or not the client has a live connection to the server.)
-y, --historyLengthHours [hours] : This option sets the length of time that dynamic parameter values are saved in the history buffer. A setting of zero disables the history feature. The maximum allowed setting is 32767 hours; the default setting is 4 hours. (This may be specified as a floating-point value.)
-r, --consoleRedirectFileName [file] : If a filename is given then the "standard" output and "standard" error console output streams are redirected into the given file. If an absolute pathname (starting with '/') is not given then the file is placed in the '[baseDir]/log' directory. The default filename is "" (empty string for no redirection).
-l, --globalLogFileName [file] : The NSI server places status information into the given log file. The default name of the file is "NSIserver.log" and it is placed in '[baseDir]/log'. This option accepts absolute paths, relative paths or just the file name.
--logFilesMaxAgeDays [days] : This option sets the maximum age for log files. A setting of zero indicates no maximum, where the program will not remove any log files. The default setting is for 90 days.
-L, --logfileLogLevel [level] : The logfileLogLevel selects what level of log messages are sent to the log file. There are six different levels: 'NO_MSGS', 'INFO', 'WARNING', 'ERROR', 'DEBUG', and 'ALL_MSGS'. One of these must be used as the argument. The default level is ERROR.
-C, --consoleLogLevel [level] : The consoleLogLevel selects what level of log messages are sent to the console output. The levels are the same as for the logfileLogLevel. The default level is NO_MSGS.
-p, --configFileParsingLogFlag : If specified then debug information pertaining to the file parsing routines will be sent to a log file named 'NSIparsing.log'.
-P, --configFileParsingLogfile [filename] : This switch tells the program where to store the NSI parsign log info. It accepts absolute paths, relative paths, or just the file name. The default location of this file is '[baseDir]/log/NSIparsing.log'.
-R, --rulesetFileName [file] : The ruleset file is a file which holds information about how the stations will be classified. The switch accepts absolute paths, relative paths, or just the file name. The default location of this file is '[baseDir]/conf/ruleset.ini'.
-S, --stationsFileName [file] : The Stations file contains the names and information about all the stations in the network that the NSI server should know about and care about. The switch accepts absolute paths, relative paths, or just the file name. The default location of this file is '[baseDir]/conf/stations_info.ini'.
-G, --guiAcceptorIORFile [file] : In this file is placed the CORBA Object Reference (IOR) for the GUIAcceptor class. The switch accepts absolute paths only. The default value for this parameter is 'gui_acceptor_ior.ref'.
-I, --hostIPAddress [address] : The IP address (in the form #.#.#.#) for the machine hosting this program may be specified. This can be useful when the machine has more than one IP address associated with it. If this parameter is not given then the program will attempt to determine and use a valid IP address for the machine (which, in most cases, works well).
-o, --orbPortNum [number] : This parameter allows the port number used by the CORBA services to be specified (as a number between 0 and 32768). The default value is 1045.
-ORBconfig [file] : This parameter allows the path to the 'orb.config' to be specified. The switch accepts absolute paths, relative paths, or just the file name. The default location of this file is '[baseDir]/conf/orb.config'.
-n, --serverName [name_of_server] : This servername will appear at the bottom of the GUI window on the clients machine. The default value is an empty string.
-D, --noDynStationsFlag : Specified to disable the "dynamic" creation of station entries in the NSI server. If this flag is not specified and the NSI server receives an update for a station that was not in its "stations_info.ini" file, a new "dynamically-created" station entry is created. If this flag is specified then the update is ignored (and a 'debug' log entry is written).
-H, --generalHelpString [help_string] : The General Help String will normally be a URL or some other similar pointer to where the user can find help information at. The default value is an empty string.
-u, --sameStatusSubsets = "subsetName",... : Specifies one or more names of subsets to be tracked for when all of the member stations of any of the possible subsets have the same status level. An empty string specifies that no subsets will be tracked. The default value is an empty string.
-U, --sameStatusPollDelay = 'seconds' : Specifies the delay to be used between polls of the subsets tracked for having the same status level. The default value is 2 (seconds).
-v, --version : Displays the version information for the program.
--ignoreUnknownFlag : If specified then station detail items with the performance level "Unknown" will be ignored when determining the performance level for the station. This will prevent "Unknown"-performance-level items from hiding "Bad"-performance-level items, but may allow "Unknown"-performance-level items to go unnoticed.
--archiveDirectoryName [file] : This parameter allows the path to the archive to be specified. If an absolute pathname (starting with '/') is not given then the file is placed in the '[baseDir]' directory. The default location of the archive files is '[baseDir]/history'.
--keepArchiveFilesOpenFlag : Specified to keep archive files open until the archive is closed. The default is to open and close the files each time an item is archived.
--archiveNonVotingParamsFlag : Specified to archive non-voting parameters. The default is to only archive voting parameters.
--archivePollTime = 'seconds' : Specifies the delay to be used between polls of the archive thread or 0 to use thread interrupts. The default value is 0.
Use Agent Locations:
--useAgentLocationsFlag: If specified the agent locations should be used, otherwise only the locations in the stations file should be used.


The NSI.conf file

All the options the user can change on the command line can also be changed in the file 'NSI.conf', except for the option to specify where the file is. The format of the file goes like this: Each item has the format 'name = value'; string values must be enclosed in quotes (""); 'special' characters must be 'quoted' using a backslash (\), including \n \r \t\ \" \#; and comments begin with '#', '//' or are C-style comments. Following is a list of accepted names. They mirror the command line switches and use the same values as well.

     baseDir = "[path]"
     staticParamsNap = 'seconds'
     gatherSPTimeout = 'seconds'
     inactivityTimeout = 'seconds'
     historyLengthHours = 'hours'
     consoleRedirectFileName = "[filename]"
     globalLogFileName = "[filename]"
     logFilesMaxAgeDays = 'days'
     logfileLogLevel = "[level]"
     consoleLogLevel = "[level]"
     configFileParsingLogFlag = 'true/false'
     configFileParsingLogfile = "[logfile name]"
     daemon = 'true/false'
     rulesetFileName = "[filename]"
     stationsFileName = "[filename]"
     guiAcceptorIORFile = "[filename]"
     hostIPAddress = 'address'
     orbPortNum = 'number'
     orbConfig = "[filename]"
     serverName = "serverName"
     noDynStationsFlag = 'true/false'
     generalHelpString = "HelpPointer"
     sameStatusSubsets = "subsetName",...
     sameStatusPollDelay = 'seconds'
     archiveDirectoryName = "[filename]"
     keepArchiveFilesOpenFlag = 'true/false'
     archiveNonVotingParamsFlag = 'true/false'
     archivePollTime = 'seconds'
     threadLogIntervalSecs = 'seconds'
     memoryLogIntervalSecs = 'seconds'
     useAgentLocationsFlag = 'true/false'
 



Field Summary
static java.lang.String ACK_SERVER_MSG
           
static int ControlAckTimeout
           
static int maxStationNameLen
           
static int minCtrlResultMsgLength
           
static int minEanDpMsgLength
           
static int minEanSpMsgLength
           
static int minStationNameLen
           
static java.lang.String TERM_ALL_MSG
           
static java.lang.String TERM_SERVER_MSG
           
 
Constructor Summary
Server()
          Creates an instance of the NSI Server object.
 
Method Summary
 void addStationCtrlThread(java.lang.String stationName, CTA_Msg_Manager ctrlThread)
          Registers CTA_Msg_Manager objects that are run as threads.
 CTA_Msg_Manager deleteStationCtrlThread(java.lang.String ctrledStationName)
          Removes (or unregisters) a CTA_Msg_Manager Thread object.
static java.lang.String doesFileExist(java.lang.String fileName)
          This method checks to see if the file 'fileName' exists.
 int gatherSPTimeout()
          Returns the total length of time GatherParameters should search for static parameters for the stations.
 GroupTable getAgentsTable()
          Returns a handle to the GroupTable of agents.
 java.lang.String getArchiveDirectoryName()
          Gets the archive directory name.
 boolean getArchiveNonVotingParamsFlag()
          Gets the value of the archive non-voting params flag (archiveNonVotingParamsFlag.)
 long getArchivePollTime()
          Gets the archive poll time.
 S2CTA_impl getCTARequestObj()
          Returns a handle to the S2CTA_impl object.
 RuleSet getDefRuleSetObj()
          Returns a handle to the "default" rule set object.
 java.lang.String getGeneralHelpString()
          Returns the general help string.
 GroupTable getGroupsTable()
          Returns the handle to the GroupTable of station groups.
 int getHighestUsageLev()
          Returns highest usage level
 long getHistoryLengthSeconds()
          Returns the length of time (in seconds) that dynamic parameters are saved in the history buffer.
 boolean getKeepArchiveFilesOpenFlag()
          Gets the value of the keep archive files open flag (keepArchiveFilesOpenFlag.)
 LogFile getLogFileObj()
          Returns a handle to the log file object used by the server.
 int getLowestUsageLev()
          Returns lowest usage level
 GroupTable getNetworksTable()
          Returns the handle to the GroupTable of station networks.
 boolean getNoDynStationsFlag()
          Returns the 'noDynStationsFlag' value.
 com.ooc.CORBA.ORB getORB()
          Returns a handle to the ORB.
 java.lang.String getOrbCfgFilePath()
          Returns the path to the orb configuration file.
 java.lang.String getParamHelpString(java.lang.String paramName)
          Returns the help string for the given parameter name, or null if no help string is available.
 RuleSetTable getRuleSetTable()
          Returns a handle to the table of rule set objects.
 boolean getSameStatusThreadFlag()
          Returns true if the thread was started that tracks when all the stations in a group have the same status level.
 java.lang.String getServerName()
          Returns the server name for this NSI server.
 java.lang.String getServerStartTimeString()
          Returns the local start time of the server as a string.
 boolean getServerTerminatingFlag()
          Returns true if the shutdown of the server has been initiated.
 int getSPNapLength()
          Returns the time the GatherParameters will sleep for.
 CTA_Msg_Manager getStationCtrlThread(java.lang.String stationName)
          Returns a handle for the control manager thread for the given station name.
 java.util.Enumeration getStationCtrlThreadsEnum()
          Returns an enumeration of Threads of type CTA_Msg_Manager that are currently running and have been registered.
 StationInfoParser getStationInfoParser()
          Returns the station information parser.
 StationTable getStationsTable()
          Returns a handle to the table of stations.
 StatusLevelTable getStatusLevelTable()
          Returns a handle to the table of status levels.
 FifoHashtable getSubsetPropTable()
          Returns the table of subset-of-station property info blocks.
 UsageLevelTable getUsageLevelTable()
          Returns a handle to the table of usage levels.
static java.lang.String getVersion()
          Returns the version string for the server.
static void main(java.lang.String[] args)
          Program entry point.
static int propLogLevel(CfgPropItem tmpProp)
          This method looks at the string value of the given property item and returns the integer for the loging level that string represents.
 boolean readConfigFiles(java.lang.String ruleSetFileName, java.lang.String stationInfoFileName, boolean logParsingFlag)
          Reads and processes configuration files for usage and status level information, station information and rule-set information.
 boolean requestStationSPs(java.lang.String stationName)
          Sends a message to the collection agents requesting the static parameters for one particular station.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TERM_ALL_MSG

public static final java.lang.String TERM_ALL_MSG
See Also:
Constant Field Values

TERM_SERVER_MSG

public static final java.lang.String TERM_SERVER_MSG
See Also:
Constant Field Values

ACK_SERVER_MSG

public static final java.lang.String ACK_SERVER_MSG
See Also:
Constant Field Values

maxStationNameLen

public static final int maxStationNameLen
See Also:
Constant Field Values

minStationNameLen

public static final int minStationNameLen
See Also:
Constant Field Values

ControlAckTimeout

public static final int ControlAckTimeout
See Also:
Constant Field Values

minEanDpMsgLength

public static final int minEanDpMsgLength
See Also:
Constant Field Values

minEanSpMsgLength

public static final int minEanSpMsgLength
See Also:
Constant Field Values

minCtrlResultMsgLength

public static final int minCtrlResultMsgLength
See Also:
Constant Field Values
Constructor Detail

Server

public Server()
Creates an instance of the NSI Server object.

Method Detail

readConfigFiles

public boolean readConfigFiles(java.lang.String ruleSetFileName,
                               java.lang.String stationInfoFileName,
                               boolean logParsingFlag)
Reads and processes configuration files for usage and status level information, station information and rule-set information.

Parameters:
ruleSetFileName - the name of the rule-set file.
stationInfoFileName - the name of the stations information file.
logParsingFlag - if true then debug messages from the rule-set and station parsers are sent to an "NSIparsing.log" log file.
Returns:
true if successful, false if an error was detected (messages will be sent to the log file object specified in the constructor).

getORB

public com.ooc.CORBA.ORB getORB()
Returns a handle to the ORB.


getStationInfoParser

public StationInfoParser getStationInfoParser()
Returns the station information parser.


getGroupsTable

public GroupTable getGroupsTable()
Returns the handle to the GroupTable of station groups.


getNetworksTable

public GroupTable getNetworksTable()
Returns the handle to the GroupTable of station networks.


getAgentsTable

public GroupTable getAgentsTable()
Returns a handle to the GroupTable of agents.


getSubsetPropTable

public FifoHashtable getSubsetPropTable()
Returns the table of subset-of-station property info blocks.


getSameStatusThreadFlag

public boolean getSameStatusThreadFlag()
Returns true if the thread was started that tracks when all the stations in a group have the same status level.


getStationsTable

public StationTable getStationsTable()
Returns a handle to the table of stations.


getUsageLevelTable

public UsageLevelTable getUsageLevelTable()
Returns a handle to the table of usage levels.


getStatusLevelTable

public StatusLevelTable getStatusLevelTable()
Returns a handle to the table of status levels.


getRuleSetTable

public RuleSetTable getRuleSetTable()
Returns a handle to the table of rule set objects.


getDefRuleSetObj

public RuleSet getDefRuleSetObj()
Returns a handle to the "default" rule set object.


getLogFileObj

public LogFile getLogFileObj()
Returns a handle to the log file object used by the server.


getLowestUsageLev

public int getLowestUsageLev()
Returns lowest usage level


getHighestUsageLev

public int getHighestUsageLev()
Returns highest usage level


getCTARequestObj

public S2CTA_impl getCTARequestObj()
Returns a handle to the S2CTA_impl object.


getSPNapLength

public int getSPNapLength()
Returns the time the GatherParameters will sleep for.


gatherSPTimeout

public int gatherSPTimeout()
Returns the total length of time GatherParameters should search for static parameters for the stations.


getHistoryLengthSeconds

public long getHistoryLengthSeconds()
Returns the length of time (in seconds) that dynamic parameters are saved in the history buffer.

Specified by:
getHistoryLengthSeconds in interface ParamValues
Returns:
the length of time (in seconds) that dynamic parameters are saved in the history buffer.

getGeneralHelpString

public java.lang.String getGeneralHelpString()
Returns the general help string.


getServerName

public java.lang.String getServerName()
Returns the server name for this NSI server.


getNoDynStationsFlag

public boolean getNoDynStationsFlag()
Returns the 'noDynStationsFlag' value.


requestStationSPs

public boolean requestStationSPs(java.lang.String stationName)
Sends a message to the collection agents requesting the static parameters for one particular station.

Parameters:
stationName - a string containing the name of the station whose static parameters are desired.
Returns:
true if the message was sent successfully, otherwise false.

getServerTerminatingFlag

public boolean getServerTerminatingFlag()
Returns true if the shutdown of the server has been initiated.

Returns:
true if the shutdown of the server has been initiated; false if not.

addStationCtrlThread

public void addStationCtrlThread(java.lang.String stationName,
                                 CTA_Msg_Manager ctrlThread)
Registers CTA_Msg_Manager objects that are run as threads.

Parameters:
stationName - a string containing the name of the station associated with this thread.
ctrlThread - a handle to the CTA_Msg_Manager object that is to be registered.

getStationCtrlThreadsEnum

public java.util.Enumeration getStationCtrlThreadsEnum()
Returns an enumeration of Threads of type CTA_Msg_Manager that are currently running and have been registered.


getStationCtrlThread

public CTA_Msg_Manager getStationCtrlThread(java.lang.String stationName)
Returns a handle for the control manager thread for the given station name.

Parameters:
stationName - the name of the station which is being controled.
Returns:
If there exists an object of type CTA_Msg_Manager and it has been added through addStationCtrlThread then a handle for the object will be returned, otherwise null will be returned.

deleteStationCtrlThread

public CTA_Msg_Manager deleteStationCtrlThread(java.lang.String ctrledStationName)
Removes (or unregisters) a CTA_Msg_Manager Thread object.

Returns:
A handle to the removed CTA_Msg_Manager object if it existed, null otherwise.

getOrbCfgFilePath

public java.lang.String getOrbCfgFilePath()
Returns the path to the orb configuration file.


getServerStartTimeString

public java.lang.String getServerStartTimeString()
Returns the local start time of the server as a string.

Returns:
A string representation of the start time, using the following format: "Mmm dd, yyyy hh:mm:ss AM/PM".

getParamHelpString

public java.lang.String getParamHelpString(java.lang.String paramName)
Returns the help string for the given parameter name, or null if no help string is available.


getVersion

public static java.lang.String getVersion()
Returns the version string for the server.


getArchiveDirectoryName

public java.lang.String getArchiveDirectoryName()
Gets the archive directory name.

Specified by:
getArchiveDirectoryName in interface ParamValues
Returns:
the archive directory name.

getKeepArchiveFilesOpenFlag

public boolean getKeepArchiveFilesOpenFlag()
Gets the value of the keep archive files open flag (keepArchiveFilesOpenFlag.)

Specified by:
getKeepArchiveFilesOpenFlag in interface ParamValues
Returns:
true if archive files are kept open, false otherwise.

getArchiveNonVotingParamsFlag

public boolean getArchiveNonVotingParamsFlag()
Gets the value of the archive non-voting params flag (archiveNonVotingParamsFlag.)

Specified by:
getArchiveNonVotingParamsFlag in interface ParamValues
Returns:
true if non-voting parameters are archived, false otherwise.

getArchivePollTime

public long getArchivePollTime()
Gets the archive poll time.

Specified by:
getArchivePollTime in interface ParamValues
Returns:
the archive poll time in milliseconds or 0 for interrupts.

propLogLevel

public static int propLogLevel(CfgPropItem tmpProp)
This method looks at the string value of the given property item and returns the integer for the loging level that string represents.

Parameters:
tmpProp - A CfgPropItem who's string value data represents a logging level.
Returns:
The integer of the log level asscoiated with the string value in the configuration property.

doesFileExist

public static java.lang.String doesFileExist(java.lang.String fileName)
This method checks to see if the file 'fileName' exists. 'fileName' can be either a relative path or a full bath to the file.

Parameters:
fileName - The relative path or full path to a file.
Returns:
If the file was found the path (relative or full) to the file is returned, otherwise an empty string is returned.

main

public static void main(java.lang.String[] args)
Program entry point.