BugFix: Add the BeanReceiver plumbing to the top-level query commands
An earlier change made ChangeQueryProcessor implement the BeanReceiver interface, but that's not sufficient to support the real use cases. In order for the ChangeQueryProcessor to get the DynamicBeans invoked with a query, the Query and QueryChanges commands need to set the DynamicBeans on the ChangeQueryProcessor. Change-Id: I087cde95a109fda8b4ca879b293e3586041c3a77
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
|
||||
package com.google.gerrit.sshd.commands;
|
||||
|
||||
import com.google.gerrit.server.DynamicOptions;
|
||||
import com.google.gerrit.server.query.change.OutputStreamQuery;
|
||||
import com.google.gerrit.server.query.change.OutputStreamQuery.OutputFormat;
|
||||
import com.google.gerrit.sshd.CommandMetaData;
|
||||
@@ -24,7 +25,7 @@ import org.kohsuke.args4j.Argument;
|
||||
import org.kohsuke.args4j.Option;
|
||||
|
||||
@CommandMetaData(name = "query", description = "Query the change database")
|
||||
public class Query extends SshCommand {
|
||||
public class Query extends SshCommand implements DynamicOptions.BeanReceiver {
|
||||
@Inject private OutputStreamQuery processor;
|
||||
|
||||
@Option(name = "--format", metaVar = "FMT", usage = "Output display format")
|
||||
@@ -103,6 +104,10 @@ public class Query extends SshCommand {
|
||||
processor.query(join(query, " "));
|
||||
}
|
||||
|
||||
public void setDynamicBean(String plugin, DynamicOptions.DynamicBean dynamicBean) {
|
||||
processor.setDynamicBean(plugin, dynamicBean);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void parseCommandLine() throws UnloggedFailure {
|
||||
processor.setOutput(out, OutputFormat.TEXT);
|
||||
|
||||
Reference in New Issue
Block a user