| | |
| | | |
| | | import org.apache.sshd.server.Environment; |
| | | |
| | | public abstract class SshCommand extends BaseCommand { |
| | | protected PrintWriter stdout; |
| | | protected PrintWriter stderr; |
| | | import ro.fortsoft.pf4j.ExtensionPoint; |
| | | |
| | | @Override |
| | | public void start(Environment env) throws IOException { |
| | | startThread(new CommandRunnable() { |
| | | @Override |
| | | public void run() throws Exception { |
| | | parseCommandLine(); |
| | | stdout = toPrintWriter(out); |
| | | stderr = toPrintWriter(err); |
| | | try { |
| | | SshCommand.this.run(); |
| | | } finally { |
| | | stdout.flush(); |
| | | stderr.flush(); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | public abstract class SshCommand extends BaseCommand implements ExtensionPoint { |
| | | protected PrintWriter stdout; |
| | | protected PrintWriter stderr; |
| | | |
| | | protected abstract void run() throws UnloggedFailure, Failure, Exception; |
| | | @Override |
| | | public void start(Environment env) throws IOException { |
| | | startThread(new CommandRunnable() { |
| | | @Override |
| | | public void run() throws Exception { |
| | | parseCommandLine(); |
| | | stdout = toPrintWriter(out); |
| | | stderr = toPrintWriter(err); |
| | | try { |
| | | SshCommand.this.run(); |
| | | } finally { |
| | | stdout.flush(); |
| | | stderr.flush(); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | |
| | | protected abstract void run() throws UnloggedFailure, Failure, Exception; |
| | | } |