public class ControlAgentSim
extends java.lang.Object
-c, --ctaSimConfig [path] : The file to use as the configuration file for the Control Agent Simulator. The default file is [baseDir]/conf/CTASim.conf
-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 executables 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 '/usr/local/TSOI'.
-d, --daemon : puts the CTASim in daemon mode (run forever). Default is to accept a terminate command on the keyboard to shutdown.
-l, --globalLogFileName [file] : The Control Agent Sim logs much information. It is all put into a single global log file. The default name of the file is "CTASim.log" and it is placed in the directory '[baseDir]/log/'. The option accepts absolute paths, relative paths or just the file name.
-o, --logfileLogLevel [level] :There are six (6) different levels at which logging can be done. They are: 'NO_MSGS', 'INFO', 'WARNING', 'ERROR', 'DEBUG', and 'ALL_MSGS'. One of these must be used as the argument. The default level is ERROR.
-O, --consoleLogLevel [level] : Log messages are also printed to the terminal. This switch tells the Control Agent Sim what level of messages to print to the console. The levels are the same as for logfileLogLevel. The default level is ERROR.
-C, --controlFileName [file] : The control file is a file which holds information about how the Control Agent Sim will treat requests for usage level changes for different stations. The switch accepts absolute paths, relative paths, or just the file name. The default location of this file is '[baseDir]/conf/controlSim.ini'.
-ORBconfig [file] : The orb.conf file is needed to correctly set up CORBA communications. The switch accepts absolute paths, relative paths, or just the file name. The default location of this file is '[baseDir]/conf/orb.config'.
-n, --ctaSimName {name_of_server] : This is where the name of the Control Agent Sim is entered. The default value is an empty string.
baseDir = "[path]" globalLogFileName = "[filename]" logfileLogLevel = "[level]" consoleLogLevel = "[level]" controlFileName = "[filename]" orbConfig = "[filename]" ctaSimName = "{serverName}" daemon = 'true or false'
Constructor and Description |
---|
ControlAgentSim(LogFile log,
CfgProperties cfgPropObj)
Creates an instance of ControlAgentSim.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
agentName()
Returns the name of the control agent.
|
static java.lang.String |
doesFileExist(java.lang.String fileName)
This method checks to see if the file 'fileName' exists.
|
static java.lang.String |
doesFileExist(java.lang.String fileName,
java.lang.String baseDir,
java.lang.String specialDir)
This method checks to see if the given file exists.
|
java.util.Vector |
getCurrentControlVec()
Returns a vector of the stations that are currently being
controled.
|
LevChange_provider |
getLevChangeChan()
Returns a handle to the event channel used to inform the
collection agent about a successful change in usage level for a given
station.
|
LevChangeUpdate |
getLevChUpdate()
Returns a handle to the event channel used to send a message
to the NSI server with an update for the new usage level for a given
station.
|
java.lang.String |
getOrbCfgFilePath()
Returns the path to the orb configuration file.
|
CtaSimToS_provider |
getResultChan()
Returns a handle to the CTRL_RESULT event channel.
|
java.lang.Runtime |
getRuntime()
Returns the runtime object for this program.
|
java.lang.String |
getScriptPath(java.lang.String stationName,
int level)
Returns the path to the script file used to change a given station to
a new usage level.
|
java.lang.Integer |
getTimeout(java.lang.String stationName,
int level)
Returns the maximum length of time (timeout) a station should
take to complete to change to a given usage level.
|
static java.lang.String |
getVersion()
Returns the version of this agent.
|
boolean |
initCORBAservices(java.lang.String[] args,
boolean daemonFlag)
Initializes CORBA services and connects to the CORBA event channels.
|
static void |
main(java.lang.String[] args)
The method executed to begin the simulated control agent.
|
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 controlFileName)
Reads in the necessary configuration file(s).
|
public ControlAgentSim(LogFile log, CfgProperties cfgPropObj)
log
- a log file object.cfgPropObj
- the configuration properties object.public boolean readConfigFiles(java.lang.String controlFileName)
controlFileName
- a string containing the filename of the
'controlSim.ini' file.public boolean initCORBAservices(java.lang.String[] args, boolean daemonFlag)
args
- array of command line argument strings.daemonFlag
- true if "daemon" mode is enabled, false if not.public java.lang.Runtime getRuntime()
public java.lang.String getScriptPath(java.lang.String stationName, int level)
stationName
- a string with the name of the station whose level
will be changed.level
- an integer representing the level to which the station
will be changed.public java.lang.Integer getTimeout(java.lang.String stationName, int level)
stationName
- the name of the station whose usage level is to be
changed.level
- the integer value of the usage level the station is being
changed to.public java.util.Vector getCurrentControlVec()
public LevChangeUpdate getLevChUpdate()
public LevChange_provider getLevChangeChan()
public CtaSimToS_provider getResultChan()
public java.lang.String getOrbCfgFilePath()
public java.lang.String agentName()
public static java.lang.String getVersion()
public static int propLogLevel(CfgPropItem tmpProp)
tmpProp
- A CfgPropItem who's string value data represents a
logging level.public static java.lang.String doesFileExist(java.lang.String fileName)
fileName
- The relative path or full path to a file.public static java.lang.String doesFileExist(java.lang.String fileName, java.lang.String baseDir, java.lang.String specialDir)
1) use just 'fileName' to search for file existence in the current directory (can be a sub-directory path) or from the root directory as a full pathname (must begin with a '/').
2) if searching for 'fileName' fails to find an existing file then the path '[baseDir][specialDir][fileName]' is used to attempt to find an existing file.If there is no file found by this procedure then an empty string is returned.
fileName
- The relative path or full path to a file.baseDir
- A base directory to fall back upon if 'fileName' is a
relative path and does not point directly to a file somewhere in the
current directory.specialDir
- The special (sub) directory of [baseDir] in which the
file should reside. It can be either 'bin', 'class', 'conf', or 'log'.public static void main(java.lang.String[] args)
args
- a string containing the command line arguments.