|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.ourgrid.common.executor.SWANExecutor
public class SWANExecutor
This class is the concrete implementation of Executor interface that provides the platform dependent command execution. The reationale behind this implementation is to use SWAN / XEN 's mechanisms to involke Linux native commands. Unlike Regular Linux implementation of executor, SWANExecutor has a couple of limitations: i) dirName on execute() must be the playpen. ii) only one command can be executed per time. SWANExecutor may run a little slow. It's the trade-off for security.
Constructor Summary | |
---|---|
protected |
SWANExecutor()
A protected constructor to be accessible only by the ExecutorFactory . |
protected |
SWANExecutor(LinuxExecutor testLinuxExecutor,
java.io.File stdOutput,
java.io.File errorOutput,
java.io.File exitValue)
A protected constructor to be used only by tests. |
Method Summary | |
---|---|
void |
chmod(java.io.File file,
java.lang.String modeStr)
Changes the permissions of an especifc file |
protected java.io.File |
createExecutionScript(java.io.File script,
java.lang.String dirName)
The createExecutionScript will create a script to execute the script with the remote command. |
protected java.io.File |
createScript(java.lang.String command,
java.lang.String dirName)
Creates an auxiliary file (script) containing the command to be executed. |
protected java.io.File |
createScript(java.lang.String command,
java.lang.String dirName,
java.util.Map envVars)
Creates an auxiliary file (script) containing the command to be executed. |
ExecutorHandle |
execute(java.lang.String dirName,
java.lang.String command)
This method implements the command execution feature for SWAN environment. |
ExecutorHandle |
execute(java.lang.String dirName,
java.lang.String command,
java.util.Map envVars)
This method implements the command execution feature for SWAN environment. |
ExecutorResult |
getResult(ExecutorHandle handle)
Returns the result of a execution especified by a handle. |
void |
kill(ExecutorHandle handle)
Kills command that was issued via an execute method |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected SWANExecutor()
ExecutorFactory
.
protected SWANExecutor(LinuxExecutor testLinuxExecutor, java.io.File stdOutput, java.io.File errorOutput, java.io.File exitValue)
Method Detail |
---|
public ExecutorHandle execute(java.lang.String dirName, java.lang.String command) throws ExecutorException
execute
in interface Executor
command
- The command must be executeddirName
- The execution root directory following the Linux name
convention. It must be the playpen.
ExecutorException
- If the command could not be executed.public ExecutorHandle execute(java.lang.String dirName, java.lang.String command, java.util.Map envVars) throws ExecutorException
execute
in interface Executor
dirName
- The execution root directory following the Linux name
convention. It must be the playpen.command
- The command must be executedenvVars
- A map (var name, value) with the environment variables
used by the command
ExecutorException
- If the command could not be executed.public ExecutorResult getResult(ExecutorHandle handle) throws ExecutorException
getResult
in interface Executor
handle
- the command handle
ExecutorException
- when there is a problem while obtaining the
result of an execution.public void kill(ExecutorHandle handle) throws ExecutorException
kill
in interface Executor
handle
- the command handle
ExecutorException
- when there is a problem while changing .the
permissions of a file.public void chmod(java.io.File file, java.lang.String modeStr) throws ExecutorException
chmod
in interface Executor
file
- The file which permissions will be changedmodeStr
- The new permitions.ExecutorException
- error changing the permissionsprotected java.io.File createScript(java.lang.String command, java.lang.String dirName) throws ExecutorException
command
- The command to be rundirName
- The path of the directory where the file will be created.
ExecutorException
protected java.io.File createScript(java.lang.String command, java.lang.String dirName, java.util.Map envVars) throws ExecutorException
command
- The command to be rundirName
- The path of the directory where the file will be created.envVars
- A map (var name, value) with the environment variables
used by the command
ExecutorException
protected java.io.File createExecutionScript(java.io.File script, java.lang.String dirName) throws ExecutorException
script
- Script with remote execution commmand.dirName
- Directory of execution script.
ExecutorException
- If its not possible to create the execution
script.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |