SSH: Inherit some commands from SshCommand
Some SSH command classes were unnecessary inherited from BaseCommand and were doing stdout/stderr initialization on their own. That's what SshCommand class is for. Change-Id: Ia31f1dedbc46b0e19019c905d6b3fad1d87ba7a0
This commit is contained in:
		| @@ -26,11 +26,10 @@ import com.google.gerrit.server.account.GroupCache; | ||||
| import com.google.gerrit.server.account.GroupDetailFactory.Factory; | ||||
| import com.google.gerrit.server.group.ListMembers; | ||||
| import com.google.gerrit.server.ioutil.ColumnFormatter; | ||||
| import com.google.gerrit.sshd.BaseCommand; | ||||
| import com.google.gerrit.sshd.CommandMetaData; | ||||
| import com.google.gerrit.sshd.SshCommand; | ||||
| import com.google.gwtorm.server.OrmException; | ||||
|  | ||||
| import org.apache.sshd.server.Environment; | ||||
| import org.kohsuke.args4j.Argument; | ||||
|  | ||||
| import java.io.PrintWriter; | ||||
| @@ -43,24 +42,18 @@ import javax.inject.Inject; | ||||
|  */ | ||||
| @CommandMetaData(name = "ls-members", description = "List the members of a given group", | ||||
|   runsAt = MASTER_OR_SLAVE) | ||||
| public class ListMembersCommand extends BaseCommand { | ||||
| public class ListMembersCommand extends SshCommand { | ||||
|   @Inject | ||||
|   ListMembersCommandImpl impl; | ||||
|  | ||||
|   @Override | ||||
|   public void start(Environment env) { | ||||
|     startThread(new CommandRunnable() { | ||||
|       @Override | ||||
|       public void run() throws Exception { | ||||
|         parseCommandLine(impl); | ||||
|         final PrintWriter stdout = toPrintWriter(out); | ||||
|         try { | ||||
|           impl.display(stdout); | ||||
|         } finally { | ||||
|           stdout.flush(); | ||||
|         } | ||||
|       } | ||||
|     }); | ||||
|   public void run() throws Exception { | ||||
|     impl.display(stdout); | ||||
|   } | ||||
|  | ||||
|   @Override | ||||
|   protected void parseCommandLine() throws UnloggedFailure { | ||||
|     parseCommandLine(impl); | ||||
|   } | ||||
|  | ||||
|   private static class ListMembersCommandImpl extends ListMembers { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 David Ostrovsky
					David Ostrovsky