Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjmisinco2013-11-22 20:29:46 +0000
committerjmisinco2013-11-22 20:46:36 +0000
commit6c1e3e8ade724f4436fc979afbfed56ebcaebb60 (patch)
tree245c50728aac5f77f7d06bd8bee57c908bbf4798
parent56937887f66cadd6cd7bac5b7ecdbbf6d8282dd2 (diff)
downloadorg.eclipse.osee-6c1e3e8ade724f4436fc979afbfed56ebcaebb60.tar.gz
org.eclipse.osee-6c1e3e8ade724f4436fc979afbfed56ebcaebb60.tar.xz
org.eclipse.osee-6c1e3e8ade724f4436fc979afbfed56ebcaebb60.zip
bug[ats_5PR0D]: Request the server to refresh branch cache
This is a temporary fix for the issue of server branch caches being out of date. This was put specifically on the Branch Manager widget's refresh button to limit its use. Change-Id: If91b94141856ef4546119728729f6fe0b654f642
-rw-r--r--plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/Function.java3
-rw-r--r--plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/BranchManagerServlet.java13
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/XBranchWidget.java12
3 files changed, 23 insertions, 5 deletions
diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/Function.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/Function.java
index 7be905bdba4..aef8689e4e2 100644
--- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/Function.java
+++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/Function.java
@@ -23,7 +23,8 @@ public enum Function {
PURGE_BRANCH,
UPDATE_BRANCH_TYPE,
UPDATE_BRANCH_STATE,
- UPDATE_ARCHIVE_STATE;
+ UPDATE_ARCHIVE_STATE,
+ RELOAD_BRANCH_CACHE;
public static Function fromString(String toMatch) throws OseeCoreException {
for (Function function : Function.values()) {
diff --git a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/BranchManagerServlet.java b/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/BranchManagerServlet.java
index bd1347869b5..7e83a863365 100644
--- a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/BranchManagerServlet.java
+++ b/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/BranchManagerServlet.java
@@ -13,9 +13,9 @@ package org.eclipse.osee.framework.manager.servlet;
import java.io.IOException;
import java.net.HttpURLConnection;
+import java.util.concurrent.Callable;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import org.eclipse.osee.executor.admin.CancellableCallable;
import org.eclipse.osee.framework.core.enums.Function;
import org.eclipse.osee.framework.core.server.ISessionManager;
import org.eclipse.osee.framework.core.server.SecureOseeHttpServlet;
@@ -53,8 +53,10 @@ public class BranchManagerServlet extends SecureOseeHttpServlet {
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
try {
- CancellableCallable<?> callable = createCallable(req, resp);
- callable.call();
+ Callable<?> callable = createCallable(req, resp);
+ if (callable != null) {
+ callable.call();
+ }
} catch (Exception ex) {
getLogger().error(ex, "Branch servlet request error: [%s]", req.toString());
resp.setStatus(HttpURLConnection.HTTP_INTERNAL_ERROR);
@@ -69,7 +71,7 @@ public class BranchManagerServlet extends SecureOseeHttpServlet {
return ApplicationContextFactory.createContext(getSessionId(req));
}
- private AbstractBranchCallable<?, ?> createCallable(HttpServletRequest req, HttpServletResponse resp) throws Exception {
+ private Callable<?> createCallable(HttpServletRequest req, HttpServletResponse resp) throws Exception {
String rawFunction = req.getParameter("function");
Function function = Function.fromString(rawFunction);
@@ -98,6 +100,9 @@ public class BranchManagerServlet extends SecureOseeHttpServlet {
case UPDATE_BRANCH_STATE:
callable = new ChangeBranchStateCallable(applicationContext, req, resp, translationService, orcsApi);
break;
+ case RELOAD_BRANCH_CACHE:
+ orcsApi.getBranchCache().reloadCache();
+ break;
default:
throw new UnsupportedOperationException();
}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/XBranchWidget.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/XBranchWidget.java
index aec1cc22888..a3cd41acde3 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/XBranchWidget.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/XBranchWidget.java
@@ -12,8 +12,10 @@
package org.eclipse.osee.framework.ui.skynet.widgets.xBranch;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
+import java.util.Map;
import java.util.concurrent.CopyOnWriteArrayList;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
@@ -23,6 +25,8 @@ import org.eclipse.jface.action.ActionContributionItem;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.osee.framework.core.data.IOseeBranch;
+import org.eclipse.osee.framework.core.data.OseeServerContext;
+import org.eclipse.osee.framework.core.enums.Function;
import org.eclipse.osee.framework.core.model.Branch;
import org.eclipse.osee.framework.core.model.TransactionRecord;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
@@ -31,6 +35,7 @@ import org.eclipse.osee.framework.logging.OseeLevel;
import org.eclipse.osee.framework.logging.OseeLog;
import org.eclipse.osee.framework.plugin.core.util.Jobs;
import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
+import org.eclipse.osee.framework.skynet.core.artifact.HttpClientMessage;
import org.eclipse.osee.framework.ui.plugin.PluginUiImage;
import org.eclipse.osee.framework.ui.skynet.internal.Activator;
import org.eclipse.osee.framework.ui.skynet.widgets.GenericXWidget;
@@ -188,6 +193,7 @@ public class XBranchWidget extends GenericXWidget {
@Override
public void widgetSelected(SelectionEvent e) {
try {
+ refreshServerBranchCache();
BranchManager.refreshBranches();
} catch (OseeCoreException ex) {
OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
@@ -198,6 +204,12 @@ public class XBranchWidget extends GenericXWidget {
}
+ private void refreshServerBranchCache() {
+ Map<String, String> parameters = new HashMap<String, String>();
+ parameters.put("function", Function.RELOAD_BRANCH_CACHE.name());
+ HttpClientMessage.send(OseeServerContext.BRANCH_CONTEXT, parameters, null, null, null);
+ }
+
public ArrayList<Branch> getSelectedBranches() {
ArrayList<Branch> items = new ArrayList<Branch>();
if (branchXViewer == null || branchXViewer.getSelection().isEmpty()) {

Back to the top