public class CmdAgentImpl extends UnicastRemoteObject implements CmdAgent, CommandChecker, Unreferenced
CmdAgent
,
CmdService
,
Serialized Formref
Modifier and Type | Method and Description |
---|---|
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.
|
<V extends Serializable> |
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.
|
String |
which(String cmd,
String svcPath)
Similar to the which shell command, 'which' returns the actual path
to the given command.
|
clone, exportObject, exportObject, exportObject, unexportObject
getClientHost, getLog, setLog
public String getHostName()
getHostName
in interface CmdAgent
public static CmdAgentImpl getHandle()
public String getTmpDir()
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 String which(String cmd, String svcPath)
public CommandHandle execute(Command c, String svcPath) throws IOException, InterruptedException
execute
in interface CmdAgent
c
- The command to be executedsvcPath
- The service location, if anyIOException
- Error communicating with resulting processInterruptedException
- 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 processInterruptedException
- Thread got interrupted waitingpublic <V extends Serializable> V exec(RemoteCallable<V> callable, String contextLocation) throws Exception
public boolean startAgent(Class agentClass, String identifier) throws Exception
startAgent
in interface CmdAgent
agentClass
- The agent classidentifier
- The agent idException
- If an error occurs in registering the classpublic 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 anypublic List<String> checkJavaCommand(List<String> cmd, List<String> extClassPath)
checkJavaCommand
in interface CommandChecker
cmd
- The original commandextClassPath
- The extended classpath, if anypublic void setTime(String gmtTimeString) throws IOException
setTime
in interface CmdAgent
gmtTimeString
- Time string in formatIOException
- An I/O error occurredpublic long getTime()
public Timer getTimer()