Move stream-based QueryProcessor output to its own class

QueryProcessor now has a much more reasonable scope of just turning
lists of queries into QueryResults.

Change-Id: I306b72264b5d9398a12a22f26d4e5397b0dd8a11
This commit is contained in:
Dave Borowitz
2014-12-22 09:20:30 -08:00
parent e47c255f28
commit 6c69f8435a
4 changed files with 422 additions and 374 deletions

View File

@@ -14,8 +14,8 @@
package com.google.gerrit.httpd.rpc.change;
import com.google.gerrit.server.query.change.QueryProcessor;
import com.google.gerrit.server.query.change.QueryProcessor.OutputFormat;
import com.google.gerrit.server.query.change.OutputStreamQuery;
import com.google.gerrit.server.query.change.OutputStreamQuery.OutputFormat;
import com.google.gson.Gson;
import com.google.inject.Inject;
import com.google.inject.Provider;
@@ -31,11 +31,11 @@ import javax.servlet.http.HttpServletResponse;
@Singleton
public class DeprecatedChangeQueryServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
private final Provider<QueryProcessor> processor;
private final Provider<OutputStreamQuery> queryProvider;
@Inject
DeprecatedChangeQueryServlet(Provider<QueryProcessor> processor) {
this.processor = processor;
DeprecatedChangeQueryServlet(Provider<OutputStreamQuery> queryProvider) {
this.queryProvider = queryProvider;
}
@Override
@@ -44,7 +44,7 @@ public class DeprecatedChangeQueryServlet extends HttpServlet {
rsp.setContentType("text/json");
rsp.setCharacterEncoding("UTF-8");
QueryProcessor p = processor.get();
OutputStreamQuery p = queryProvider.get();
OutputFormat format = OutputFormat.JSON;
try {
format = OutputFormat.valueOf(get(req, "format", format.toString()));