e3172b349659790861311e71849f465f08b97b84
Exposing getName() to the derived SSH command implementation class allows us to
implement generic SSH commands.
For example Gerrit Shell plugin can now bind multiple commands to the same
class, which retrieves the shell command passed and executes it:
public class SshShellModule extends PluginCommandModule {
@Override
protected void configureCommands() {
command("ls").to(ShellCommand.class);
command("ps").to(ShellCommand.class);
[...]
}
}
With the possible implementation:
public class ShellCommand extends SshCommand {
@Override
protected void run() throws UnloggedFailure {
String cmd = getName().substring(getPluginName().length() + 1);
ProcessBuilder proc = new ProcessBuilder(cmd);
Process cmd = proc.start();
[...]
}
}
And the call:
davido@wizball:>ssh gerrit shell ls
davido@wizball:>ssh gerrit shell ps
Change-Id: I43be66a99340e839b70c07e93752278cee5f039d
Description
RETIRED, Gerrit as used by OpenStack