rcCommand
Class rcCmd

java.lang.Object
  |
  +--rcCommand.rcCmd
Direct Known Subclasses:
rcCmdAutoRun, rcCmdConfigure, rcCmdDownload, rcCmdEndRun, rcCmdExit, rcCmdInfo, rcCmdIsPaused, rcCmdIsRunning, rcCmdNoop, rcCmdPause, rcCmdProgress, rcCmdPrstInfo, rcCmdResume, rcCmdStartRun, rcCmdStatus

public abstract class rcCmd
extends java.lang.Object

rcCmd sends a command to the PHENIX RunControl server. The class is implemented following the command design pattern. That means that rcCmd the abstract supertype for all rcCmds that send the actual commands to the CORBA run control server. The class is designed such that after the first time an command was sent to the run control, it "remembers" which run control received the event. So if we keep talking to the same run control, it will remember the CORBA connection and no time is lost with setting up the communication channel to the server.

Version:
1.0
Author:
C.Witzig - Dec 2, 1999

Field Summary
private static boolean bConnected
           
protected static boolean bDebug
           
private  IE.Iona.OrbixWeb.CORBA.ORB itOrbRef
           
protected static rcCommand.nameserv refNameServer
           
private static java.lang.String sNameServer
           
private static java.lang.String sNameServerHost
           
protected static java.lang.String sPartitionId
           
private static java.lang.String sPartitionNamePrefix
           
private static java.lang.String sRunControlNamePrefix
           
protected static rcCommand.Objmgr theObjmgr
           
protected static rcCommand.Partition thePartition
           
 
Constructor Summary
rcCmd()
          Constructor of parent rcCmd.
 
Method Summary
static rcCmd createCmd(java.lang.String theArg)
          Creates a command with one String as argument.
static rcCmd createCmd(java.lang.String[] argv)
          Creates a run control command.
static rcCmd createCmd(java.lang.String arg1, java.lang.String arg2)
          Creates a command with two strings as argument.
abstract  int execute()
          Executes the command (i.e.
 java.lang.String execute(java.lang.String strOfWhat, rcStringHolder names, rcStringHolder values)
          An execute function that takes a string as argument and returns a set of strings as return values.
static java.lang.String getPartitionId()
          Returns the identifier of the partition we are currently talking to.
 boolean isConnected()
          Returns true if there is a valid connection to a run control server
static boolean isServerRunning(int nMaxWaitSec)
          Returns true if the server is running.
static void main(java.lang.String[] argv)
          Main that allows to execute individual commands from the shell
private static void printHelp()
          Prints a list of supported commands to System.out.
static void selectPartition(java.lang.String thePartitionId)
          Selects the partition by its identifier.
 void setDebug(boolean bDebug)
          Turns on/off the debug flag, which allows to dump into to System.out
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

sNameServer

private static final java.lang.String sNameServer

sNameServerHost

private static final java.lang.String sNameServerHost

sRunControlNamePrefix

private static final java.lang.String sRunControlNamePrefix

sPartitionNamePrefix

private static final java.lang.String sPartitionNamePrefix

sPartitionId

protected static java.lang.String sPartitionId

refNameServer

protected static rcCommand.nameserv refNameServer

theObjmgr

protected static rcCommand.Objmgr theObjmgr

thePartition

protected static rcCommand.Partition thePartition

itOrbRef

private IE.Iona.OrbixWeb.CORBA.ORB itOrbRef

bDebug

protected static boolean bDebug

bConnected

private static boolean bConnected
Constructor Detail

rcCmd

public rcCmd()
Constructor of parent rcCmd. The constructor makes sure that the static members are set the first time an instance of the class is instantiated. Subsequent commands then only have to extract these fields in order to talk to the run control server.

Note that the current implementation only talks to one run control server. This can be expanded in the future.

Method Detail

setDebug

public void setDebug(boolean bDebug)
Turns on/off the debug flag, which allows to dump into to System.out

isConnected

public boolean isConnected()
Returns true if there is a valid connection to a run control server

selectPartition

public static void selectPartition(java.lang.String thePartitionId)
Selects the partition by its identifier.

getPartitionId

public static java.lang.String getPartitionId()
Returns the identifier of the partition we are currently talking to.

execute

public abstract int execute()
Executes the command (i.e. sends it to the server). This member function must be implemented by the subtype.
Returns:
0 if success.

execute

public java.lang.String execute(java.lang.String strOfWhat,
                                rcStringHolder names,
                                rcStringHolder values)
An execute function that takes a string as argument and returns a set of strings as return values. Note that this function is only used by a small set of commands, namely those which have to return parameters.

createCmd

public static rcCmd createCmd(java.lang.String[] argv)
Creates a run control command. The first argument determines which subtype of the rcCmd is to be instantiated. The other argumetns are the parameters to the command.

createCmd

public static rcCmd createCmd(java.lang.String theArg)
Creates a command with one String as argument.

createCmd

public static rcCmd createCmd(java.lang.String arg1,
                              java.lang.String arg2)
Creates a command with two strings as argument.

printHelp

private static void printHelp()
Prints a list of supported commands to System.out.

isServerRunning

public static boolean isServerRunning(int nMaxWaitSec)
Returns true if the server is running.
Parameters:
nMaxWaitSec - maximum number of seconds to wait if the server is not running

main

public static void main(java.lang.String[] argv)
Main that allows to execute individual commands from the shell