Go to file
Shawn Pearce e4f35357ef Add support for plugin root level command
Completely generic plugins can be now created:

  @RequiresCapability(
      value = GlobalCapability.ADMINISTRATE_SERVER,
      scope = CapabilityScope.CORE)
  public class ShellCommand extends SshCommand {
    @Override
    protected void parseCommandLine(Object options) throws UnloggedFailure {
      // No op: turn off parsing utility
    }

    @Override
    protected void run() throws UnloggedFailure, IOException {
      String command = getName().substring(getPluginName().length() + 1);
      List<String> c = Lists.newArrayListWithCapacity(getArguments().length + 1);
      c.add(command);
      c.addAll(Arrays.asList(getArguments()));
      ProcessBuilder proc = new ProcessBuilder(c);
      proc.start();
      [...]
    }
  }

SSH module is bound as:

  public class SshModule extends SingleCommandPluginModule {
    @Override
    protected void configure(LinkedBindingBuilder<Command> b) {
      b.to(ShellCommand.class);
    }
  }

If the plugin above is deployed under sh.jar file in $site/plugins
directory, generic commands can be called without specifing the
actually SSH command:

  $ ssh gerrit sh ls -all -R
  $ ssh gerrit sh ps -a -ef

Inspired-by: David Ostrovsky <david@ostrovsky.org>
Change-Id: If0bdce5db82b436723090e17088923c44b5e11eb
2013-11-09 05:03:59 +01:00
2013-11-08 16:13:55 -08:00
2013-05-21 20:28:56 -07:00
2013-11-07 11:26:10 -08:00
2013-11-07 11:26:10 -08:00
2013-05-21 20:28:56 -07:00
2013-11-08 16:13:55 -08:00
2013-09-26 23:12:55 -07:00
2013-05-21 20:28:56 -07:00
2013-11-08 21:59:31 +01:00
2013-09-20 19:41:26 -07:00
2013-11-05 21:38:53 +00:00
2013-11-07 19:52:15 +01:00
2008-11-14 16:59:34 -08:00
2009-03-27 20:20:10 -07:00
Description
RETIRED, Gerrit as used by OpenStack
120 MiB