|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.rmi.server.RemoteObject java.rmi.server.RemoteServer java.rmi.server.UnicastRemoteObject com.sun.faban.harness.agent.CmdAgentImpl
public class CmdAgentImpl
CmdAgentImpl is the class that runs remote commands for the CmdService This implementation provides a robust means of running remote commands. All error messages from the remote commands are logged to the error log, which should help in debugging. The user is encouraged not to run huge shell scripts using this interface as the debugging advantages will be lost. Rather, try and break up the task to running Java/native apps as far as possible and use shell scripts sparingly. If the shell scripts spit out periodic status messages indicating the position in its execution cycle, this will aid in debugging.
CmdAgent
,
CmdService
,
Serialized FormField Summary |
---|
Fields inherited from class java.rmi.server.RemoteObject |
---|
ref |
Method Summary | ||
---|---|---|
List<String> |
checkCommand(List<String> cmd,
Map<String,List<String>> extMap)
Checks and completes the command list, if possible. |
|
List<String> |
checkJavaCommand(List<String> cmd,
List<String> extClassPath)
Checks and completes the java command, if possible. |
|
void |
downloadServices(List<String> pathList)
Downloads the files used by services and tools to the remote agent system. |
|
|
exec(RemoteCallable<V> callable,
String contextLocation)
Executes the RemoteCallable on the target instance. |
|
CommandHandle |
execute(Command c,
String svcPath)
Executes a command from the remote command agent. |
|
static CmdAgentImpl |
getHandle()
Only Other Agents should access the command agent using this method. |
|
static String |
getHost()
Obtains the hostname. |
|
String |
getHostName()
Return the hostname of this machine as known to this machine itself. |
|
static String |
getMaster()
Obtains the master hostname. |
|
static Registry |
getRegistry()
Obtains the registry. |
|
long |
getTime()
Gets the time on the agent host, in millis. |
|
Timer |
getTimer()
Obtains the timer associated with this command agent. |
|
String |
getTmpDir()
Obtains the tmp directory of a remote host. |
|
CommandHandle |
java(Command c,
String svcPath)
Executes a java command from the remote command agent. |
|
void |
kill()
Kill off all processes started. |
|
void |
setLogLevel(String name,
Level level)
Set the logging level of the specified logger. |
|
void |
setTime(String gmtTimeString)
Sets the time on the agent host, in GMT. |
|
boolean |
startAgent(Class agentClass,
String identifier)
Registers and starts agent. |
|
void |
unreferenced()
When this instance is unreferenced the application must exit. |
|
void |
updatePaths(List<String> pathList)
Updates the paths, usually in the local command agent. |
Methods inherited from class java.rmi.server.UnicastRemoteObject |
---|
clone, exportObject, exportObject, exportObject, unexportObject |
Methods inherited from class java.rmi.server.RemoteServer |
---|
getClientHost, getLog, setLog |
Methods inherited from class java.rmi.server.RemoteObject |
---|
equals, getRef, hashCode, toString, toStub |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public String getHostName()
getHostName
in interface CmdAgent
public static CmdAgentImpl getHandle()
public String getTmpDir()
getTmpDir
in interface CmdAgent
public void setLogLevel(String name, Level level)
setLogLevel
in interface CmdAgent
name
- Name of the logger. If "" is passed the root logger level will be set.level
- The Log level to setpublic void updatePaths(List<String> pathList)
updatePaths
in interface CmdAgent
pathList
- The list of paths to downloadpublic void downloadServices(List<String> pathList)
downloadServices
in interface CmdAgent
pathList
- The list of service bundle pathspublic CommandHandle execute(Command c, String svcPath) throws IOException, InterruptedException
execute
in interface CmdAgent
c
- The command to be executedsvcPath
- The service location, if any
IOException
- Error communicating with resulting process
InterruptedException
- Thread got interrupted waitingpublic CommandHandle java(Command c, String svcPath) throws IOException, InterruptedException
java
in interface CmdAgent
c
- The command containing the main classsvcPath
-
IOException
- Error communicating with resulting process
InterruptedException
- Thread got interrupted waitingpublic <V extends Serializable> V exec(RemoteCallable<V> callable, String contextLocation) throws Exception
exec
in interface CmdAgent
callable
- The callable to executecontextLocation
- The context location of the invoker
Exception
- Any exception from the callablepublic boolean startAgent(Class agentClass, String identifier) throws Exception
startAgent
in interface CmdAgent
agentClass
- The agent classidentifier
- The agent id
Exception
- If an error occurs in registering the classpublic void kill()
kill
in interface CmdAgent
public void unreferenced()
unreferenced
in interface Unreferenced
Unreferenced
public static Registry getRegistry()
public static String getHost()
public static String getMaster()
public List<String> checkCommand(List<String> cmd, Map<String,List<String>> extMap)
checkCommand
in interface CommandChecker
cmd
- The command and arg listextMap
- The external map, if any
public List<String> checkJavaCommand(List<String> cmd, List<String> extClassPath)
checkJavaCommand
in interface CommandChecker
cmd
- The original commandextClassPath
- The extended classpath, if any
public void setTime(String gmtTimeString) throws IOException
setTime
in interface CmdAgent
gmtTimeString
- Time string in format
IOException
- An I/O error occurredpublic long getTime()
getTime
in interface CmdAgent
public Timer getTimer()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |