Expose some BaseCommand's methods to support generic SSH commands

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
2 files changed