aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Padgett2012-01-31 14:13:43 (EST)
committerMichael Fiedler2012-01-31 14:23:23 (EST)
commitdd745573663b6d5ef85a7551849a0992e91fd57d (patch)
treef3863235b754aadc3fd9693cb91e3dd323a0ce76
parent7c6ba67d79251dc6821f96ddf2f494d9eb592525 (diff)
downloadorg.eclipse.lyo.server-dd745573663b6d5ef85a7551849a0992e91fd57d.zip
org.eclipse.lyo.server-dd745573663b6d5ef85a7551849a0992e91fd57d.tar.gz
org.eclipse.lyo.server-dd745573663b6d5ef85a7551849a0992e91fd57d.tar.bz2
Bug 370264 - Bugzilla adapter: Poor performance in selection dialog
Use a limiter on the number of search results and request only some fields (through the Bug.search include_fields parameter).
-rw-r--r--org.eclipse.lyo.samples.bugzilla/README.txt15
-rw-r--r--org.eclipse.lyo.samples.bugzilla/src/main/java/org/eclipse/lyo/samples/bugzilla/ChangeRequestSelectorService.java14
-rw-r--r--org.eclipse.lyo.samples.bugzilla/src/main/webapp/bugzilla.js4
3 files changed, 20 insertions, 13 deletions
diff --git a/org.eclipse.lyo.samples.bugzilla/README.txt b/org.eclipse.lyo.samples.bugzilla/README.txt
index b19698e..8e11984 100644
--- a/org.eclipse.lyo.samples.bugzilla/README.txt
+++ b/org.eclipse.lyo.samples.bugzilla/README.txt
@@ -1,21 +1,18 @@
-You must have Bugzilla 3.4 to run this sample. You can connect to the
-Bugzilla Landfull <http://landfill.bugzilla.org/> or use a VM image
-such as the ALMWorks Bugzilla 3.4 VMWare image.
-
- http://almworks.com/vbs/download.html
+You must have Bugzilla 4.0 to run this sample. Simplest is to
+connect to the Bugzilla Landfull <http://landfill.bugzilla.org/>.
This project also relies on j2bugzilla, a Java API for Bugzilla.
-
-Download j2bugzilla 1.0 from Google Code.
+Download j2bugzilla 1.0 from Google Code,
http://j2bugzilla.googlecode.com/files/j2bugzilla-1.0.jar
-Install j2bugzilla into your local repository with the command,
+Then install j2bugzilla into your local repository with the command,
mvn install:install-file -Dfile=j2bugzilla-1.0.jar -DgroupId=j2bugzilla -DartifactId=j2bugzilla -Dversion=1.0 -Dpackaging=jar
To run the Bugzilla adapter, edit src/main/resources/bugz.properties to
-point to your Bugzilla server. Then from the project root directory,
+point to your Bugzilla server (or use the default, Bugzilla Landfill).
+Then from the project root directory,
mvn install
mvn jetty:run
diff --git a/org.eclipse.lyo.samples.bugzilla/src/main/java/org/eclipse/lyo/samples/bugzilla/ChangeRequestSelectorService.java b/org.eclipse.lyo.samples.bugzilla/src/main/java/org/eclipse/lyo/samples/bugzilla/ChangeRequestSelectorService.java
index 4e1bd6f..e1af9fb 100644
--- a/org.eclipse.lyo.samples.bugzilla/src/main/java/org/eclipse/lyo/samples/bugzilla/ChangeRequestSelectorService.java
+++ b/org.eclipse.lyo.samples.bugzilla/src/main/java/org/eclipse/lyo/samples/bugzilla/ChangeRequestSelectorService.java
@@ -27,6 +27,7 @@ import javax.servlet.http.HttpServletResponse;
import org.eclipse.lyo.samples.bugzilla.exception.UnauthroziedException;
import org.eclipse.lyo.samples.bugzilla.jbugzx.rpc.ExtendedBugSearch;
+import org.eclipse.lyo.samples.bugzilla.jbugzx.rpc.ExtendedBugSearch.ExtendedSearchLimiter;
import org.eclipse.lyo.samples.bugzilla.utils.HttpUtils;
import com.j2bugzilla.base.Bug;
@@ -78,6 +79,17 @@ public class ChangeRequestSelectorService extends HttpServlet {
try {
BugzillaConnector bc = BugzillaInitializer.getBugzillaConnector(request);
ExtendedBugSearch bugSearch = new ExtendedBugSearch(BugSearch.SearchLimiter.SUMMARY, terms);
+ bugSearch.addQueryParam(ExtendedSearchLimiter.LIMIT, "50");
+
+ /*
+ * Specific to 4.0, but improves performance. You have to minimally
+ * include Bug.requiredFields ("product", "component", "summary",
+ * "version").
+ */
+ bugSearch.getParameterMap().put(
+ "include_fields",
+ new String[] { "id", "product", "component", "summary",
+ "version" });
bc.executeMethod(bugSearch);
List<Bug> results = bugSearch.getSearchResults();
request.setAttribute("results", results);
@@ -89,6 +101,6 @@ public class ChangeRequestSelectorService extends HttpServlet {
HttpUtils.sendUnauthorizedResponse(response, e);
} catch (Exception e) {
throw new ServletException(e);
- }
+ }
}
}
diff --git a/org.eclipse.lyo.samples.bugzilla/src/main/webapp/bugzilla.js b/org.eclipse.lyo.samples.bugzilla/src/main/webapp/bugzilla.js
index 3c0f8f9..9769329 100644
--- a/org.eclipse.lyo.samples.bugzilla/src/main/webapp/bugzilla.js
+++ b/org.eclipse.lyo.samples.bugzilla/src/main/webapp/bugzilla.js
@@ -36,8 +36,7 @@ function search(baseUrl){
}
};
terms = document.getElementById("searchTerms").value;
- xmlhttp.open("GET", baseUrl + "&terms=" + escape(terms), true);
- xmlhttp.setRequestHeader("Connection","close");
+ xmlhttp.open("GET", baseUrl + "&terms=" + escape(terms), true);
xmlhttp.send();
}
@@ -71,7 +70,6 @@ function create(baseUrl){
}
xmlhttp.open("POST", postData, true);
xmlhttp.setRequestHeader("Content-type","application/x-www-from-urlencoded");
- xmlhttp.setRequestHeader("Connection","close");
xmlhttp.send(postData);
}