Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjmisinco2014-08-29 16:22:59 +0000
committerRoberto E. Escobar2014-10-01 21:03:23 +0000
commit6d9632667faafd9d14930175e45d67bbe1272ef8 (patch)
tree8929d30a4294594085a8123005233b8592703c4c /plugins/org.eclipse.osee.framework.manager.servlet
parent1e8d8d173767d8eddbbfb7d7faf7953a43e47592 (diff)
downloadorg.eclipse.osee-6d9632667faafd9d14930175e45d67bbe1272ef8.tar.gz
org.eclipse.osee-6d9632667faafd9d14930175e45d67bbe1272ef8.tar.xz
org.eclipse.osee-6d9632667faafd9d14930175e45d67bbe1272ef8.zip
refactor[ats_ATS46139]: Remove branch cache from servlets
Diffstat (limited to 'plugins/org.eclipse.osee.framework.manager.servlet')
-rw-r--r--plugins/org.eclipse.osee.framework.manager.servlet/OSGI-INF/branch.update.event.handler.xml13
-rw-r--r--plugins/org.eclipse.osee.framework.manager.servlet/OSGI-INF/legacy.servlets.xml1
-rw-r--r--plugins/org.eclipse.osee.framework.manager.servlet/build.properties4
-rw-r--r--plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/ArtifactFileServlet.java15
-rw-r--r--plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/AtsServlet.java6
-rw-r--r--plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/DataServlet.java20
-rw-r--r--plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/OseeCacheServlet.java76
-rw-r--r--plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/ats/AtsService.java11
-rw-r--r--plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/data/ArtifactUtil.java6
-rw-r--r--plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/internal/BranchUpdateEventHandler.java96
-rw-r--r--plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/internal/ServerBranchUpdateNotifier.java117
-rw-r--r--plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/internal/ServletRegistrationHandler.java29
12 files changed, 38 insertions, 356 deletions
diff --git a/plugins/org.eclipse.osee.framework.manager.servlet/OSGI-INF/branch.update.event.handler.xml b/plugins/org.eclipse.osee.framework.manager.servlet/OSGI-INF/branch.update.event.handler.xml
deleted file mode 100644
index e595b384cbb..00000000000
--- a/plugins/org.eclipse.osee.framework.manager.servlet/OSGI-INF/branch.update.event.handler.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.osee.framework.manager.servlet.internal.BranchUpdateEventHandler">
- <implementation class="org.eclipse.osee.framework.manager.servlet.internal.BranchUpdateEventHandler"/>
- <service>
- <provide interface="org.eclipse.osee.event.EventHandler"/>
- </service>
- <reference bind="setLogger" cardinality="1..1" interface="org.eclipse.osee.logger.Log" name="Log" policy="static"/>
- <reference bind="setTranslationService" cardinality="1..1" interface="org.eclipse.osee.framework.core.translation.IDataTranslationService" name="IDataTranslationService" policy="static"/>
- <reference bind="setServerLookup" cardinality="1..1" interface="org.eclipse.osee.framework.core.server.IApplicationServerLookup" name="IApplicationServerLookup" policy="static"/>
- <reference bind="setAppServerManager" cardinality="1..1" interface="org.eclipse.osee.framework.core.server.IApplicationServerManager" name="IApplicationServerManager" policy="static"/>
- <property name="event.topics" type="String" value="org/eclipse/osee/orcs/event/branch/MODIFIED"/>
- <reference bind="setExecutor" cardinality="1..1" interface="org.eclipse.osee.executor.admin.ExecutorAdmin" name="ExecutorAdmin" policy="static"/>
-</scr:component>
diff --git a/plugins/org.eclipse.osee.framework.manager.servlet/OSGI-INF/legacy.servlets.xml b/plugins/org.eclipse.osee.framework.manager.servlet/OSGI-INF/legacy.servlets.xml
index 89a972f4a23..7248ab8dd45 100644
--- a/plugins/org.eclipse.osee.framework.manager.servlet/OSGI-INF/legacy.servlets.xml
+++ b/plugins/org.eclipse.osee.framework.manager.servlet/OSGI-INF/legacy.servlets.xml
@@ -7,7 +7,6 @@
<reference bind="setSessionManager" cardinality="1..1" interface="org.eclipse.osee.framework.core.server.ISessionManager" name="ISessionManager" policy="static"/>
<reference bind="setAppServerManager" cardinality="1..1" interface="org.eclipse.osee.framework.core.server.IApplicationServerManager" name="IApplicationServerManager" policy="static"/>
<reference bind="setTranslationService" cardinality="1..1" interface="org.eclipse.osee.framework.core.translation.IDataTranslationService" name="IDataTranslationService" policy="static"/>
- <reference bind="setCaching" cardinality="1..1" interface="org.eclipse.osee.framework.core.services.TempCachingService" name="TempCachingService" policy="static"/>
<reference bind="setAuthenticationManager" cardinality="1..1" interface="org.eclipse.osee.framework.core.server.IAuthenticationManager" name="IAuthenticationManager" policy="static"/>
<reference bind="setFactoryService" cardinality="1..1" interface="org.eclipse.osee.framework.core.services.IOseeModelFactoryService" name="IOseeModelFactoryService" policy="static"/>
<reference bind="setResourceManager" cardinality="1..1" interface="org.eclipse.osee.framework.resource.management.IResourceManager" name="IResourceManager" policy="static"/>
diff --git a/plugins/org.eclipse.osee.framework.manager.servlet/build.properties b/plugins/org.eclipse.osee.framework.manager.servlet/build.properties
index c79412ce3f1..6210e849b59 100644
--- a/plugins/org.eclipse.osee.framework.manager.servlet/build.properties
+++ b/plugins/org.eclipse.osee.framework.manager.servlet/build.properties
@@ -1,7 +1,5 @@
output.. = bin/
bin.includes = META-INF/,\
.,\
- OSGI-INF/,\
- OSGI-INF/legacy.servlets.xml,\
- OSGI-INF/branch.update.event.handler.xml
+ OSGI-INF/
source.. = src/
diff --git a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/ArtifactFileServlet.java b/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/ArtifactFileServlet.java
index dc038b34c57..2503a5a26e2 100644
--- a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/ArtifactFileServlet.java
+++ b/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/ArtifactFileServlet.java
@@ -18,8 +18,6 @@ import javax.servlet.http.HttpServletResponse;
import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
import org.eclipse.osee.framework.core.enums.CoreBranches;
import org.eclipse.osee.framework.core.exception.OseeExceptions;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.core.model.cache.BranchCache;
import org.eclipse.osee.framework.core.server.UnsecuredOseeHttpServlet;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.type.Pair;
@@ -36,6 +34,8 @@ import org.eclipse.osee.framework.resource.management.StandardOptions;
import org.eclipse.osee.logger.Log;
import org.eclipse.osee.orcs.OrcsApi;
import org.eclipse.osee.orcs.data.ArtifactReadable;
+import org.eclipse.osee.orcs.data.BranchReadable;
+import org.eclipse.osee.orcs.search.BranchQuery;
/**
* @author Roberto E. Escobar
@@ -51,13 +51,11 @@ public class ArtifactFileServlet extends UnsecuredOseeHttpServlet {
private static final String MAPPING_ART = "ABKY9QDQLSaHQBiRC7wA";
private final IResourceManager resourceManager;
- private final BranchCache branchCache;
private final OrcsApi orcs;
- public ArtifactFileServlet(Log logger, IResourceManager resourceManager, BranchCache branchCache, OrcsApi orcs) {
+ public ArtifactFileServlet(Log logger, IResourceManager resourceManager, OrcsApi orcs) {
super(logger);
this.resourceManager = resourceManager;
- this.branchCache = branchCache;
this.orcs = orcs;
}
@@ -89,12 +87,13 @@ public class ArtifactFileServlet extends UnsecuredOseeHttpServlet {
}
String uri = null;
- Branch branch = null;
+ BranchQuery query = orcs.getQueryFactory(null).branchQuery();
if (branchName != null) {
- branch = branchCache.getBySoleName(branchName);
+ query.andNameEquals(branchName);
} else if (branchUuid != null) {
- branch = branchCache.getByGuid(branchUuid);
+ query.andUuids(branchUuid);
}
+ BranchReadable branch = query.getResults().getExactlyOne();
Conditions.checkNotNull(branch, "branch", "Unable to determine branch");
uri = ArtifactUtil.getUri(artifactGuid, branch);
handleArtifactUri(resourceManager, request.getQueryString(), uri, response);
diff --git a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/AtsServlet.java b/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/AtsServlet.java
index 9122b008a73..3814d76af7e 100644
--- a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/AtsServlet.java
+++ b/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/AtsServlet.java
@@ -15,7 +15,6 @@ import java.net.URL;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.eclipse.osee.framework.core.server.UnsecuredOseeHttpServlet;
-import org.eclipse.osee.framework.core.services.TempCachingService;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
import org.eclipse.osee.framework.manager.servlet.ats.AtsService;
@@ -27,6 +26,7 @@ import org.eclipse.osee.framework.resource.management.IResource;
import org.eclipse.osee.framework.resource.management.IResourceLocator;
import org.eclipse.osee.framework.resource.management.IResourceManager;
import org.eclipse.osee.logger.Log;
+import org.eclipse.osee.orcs.OrcsApi;
/**
* @author Roberto E. Escobar
@@ -39,13 +39,13 @@ public class AtsServlet extends UnsecuredOseeHttpServlet {
private final IResourceManager resourceManager;
- public AtsServlet(Log logger, IResourceManager resourceManager, TempCachingService cacheService) {
+ public AtsServlet(Log logger, IResourceManager resourceManager, OrcsApi orcsApi) {
super(logger);
this.resourceManager = resourceManager;
AtsService.IResourceProvider provider = new ResourceProvider();
AtsXmlSearch xmlSearch = new AtsXmlSearch();
AtsXmlMessages messages = new AtsXmlMessages(new XmlMessage(getLogger()));
- this.atsService = new AtsService(provider, xmlSearch, messages, resourceManager, cacheService);
+ this.atsService = new AtsService(provider, xmlSearch, messages, resourceManager, orcsApi);
}
@Override
diff --git a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/DataServlet.java b/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/DataServlet.java
index 78f1ddb2ff3..f390b4e6ba0 100644
--- a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/DataServlet.java
+++ b/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/DataServlet.java
@@ -17,9 +17,7 @@ import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.eclipse.osee.framework.core.exception.OseeNotFoundException;
-import org.eclipse.osee.framework.core.model.cache.BranchCache;
import org.eclipse.osee.framework.core.server.UnsecuredOseeHttpServlet;
-import org.eclipse.osee.framework.core.services.TempCachingService;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.util.Conditions;
import org.eclipse.osee.framework.jdk.core.util.Lib;
@@ -27,25 +25,28 @@ import org.eclipse.osee.framework.jdk.core.util.Strings;
import org.eclipse.osee.framework.manager.servlet.data.ArtifactUtil;
import org.eclipse.osee.framework.resource.management.IResourceManager;
import org.eclipse.osee.logger.Log;
+import org.eclipse.osee.orcs.OrcsApi;
+import org.eclipse.osee.orcs.data.BranchReadable;
+import org.eclipse.osee.orcs.search.BranchQuery;
public class DataServlet extends UnsecuredOseeHttpServlet {
private static final long serialVersionUID = -1399699606153734250L;
private final IResourceManager resourceManager;
- private final BranchCache branchCache;
+ private final OrcsApi orcsApi;
- public DataServlet(Log logger, IResourceManager resourceManager, TempCachingService cacheService) {
+ public DataServlet(Log logger, IResourceManager resourceManager, OrcsApi orcsApi) {
super(logger);
this.resourceManager = resourceManager;
- branchCache = cacheService.getBranchCache();
+ this.orcsApi = orcsApi;
}
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
String urlRequest = request.getRequestURI();
try {
- handleUriRequest(resourceManager, urlRequest, response, branchCache);
+ handleUriRequest(resourceManager, urlRequest, response, orcsApi);
} catch (OseeCoreException ex) {
handleError(response, HttpURLConnection.HTTP_INTERNAL_ERROR, "", ex);
}
@@ -57,12 +58,15 @@ public class DataServlet extends UnsecuredOseeHttpServlet {
response.sendError(status, Lib.exceptionToString(ex));
}
- public static void handleUriRequest(IResourceManager resourceManager, String urlRequest, HttpServletResponse response, BranchCache branchCache) throws OseeCoreException {
+ public static void handleUriRequest(IResourceManager resourceManager, String urlRequest, HttpServletResponse response, OrcsApi orcsApi) throws OseeCoreException {
UrlParser parser = new UrlParser();
parser.parse(urlRequest);
Long branchUuid = Long.valueOf(parser.getAttribute("branch"));
String artifactGuid = parser.getAttribute("artifact");
- String uri = ArtifactUtil.getUri(artifactGuid, branchCache.getByGuid(branchUuid));
+ BranchQuery query = orcsApi.getQueryFactory(null).branchQuery();
+ BranchReadable branch = query.andUuids(branchUuid).getResults().getExactlyOne();
+
+ String uri = ArtifactUtil.getUri(artifactGuid, branch);
ArtifactFileServlet.handleArtifactUri(resourceManager, urlRequest, uri, response);
}
diff --git a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/OseeCacheServlet.java b/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/OseeCacheServlet.java
index 5f896508984..b60d4884344 100644
--- a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/OseeCacheServlet.java
+++ b/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/OseeCacheServlet.java
@@ -34,21 +34,12 @@ import org.eclipse.osee.framework.core.exception.OseeExceptions;
import org.eclipse.osee.framework.core.message.ArtifactTypeCacheUpdateResponse;
import org.eclipse.osee.framework.core.message.ArtifactTypeCacheUpdateResponse.ArtifactTypeRow;
import org.eclipse.osee.framework.core.message.AttributeTypeCacheUpdateResponse;
-import org.eclipse.osee.framework.core.message.BranchCacheStoreRequest;
-import org.eclipse.osee.framework.core.message.BranchCacheUpdateResponse;
-import org.eclipse.osee.framework.core.message.BranchCacheUpdateUtil;
import org.eclipse.osee.framework.core.message.CacheUpdateRequest;
import org.eclipse.osee.framework.core.message.OseeEnumTypeCacheUpdateResponse;
import org.eclipse.osee.framework.core.message.RelationTypeCacheUpdateResponse;
import org.eclipse.osee.framework.core.message.RelationTypeCacheUpdateResponse.RelationTypeRow;
-import org.eclipse.osee.framework.core.message.TransactionCacheUpdateResponse;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.core.model.TransactionRecord;
-import org.eclipse.osee.framework.core.model.cache.BranchCache;
import org.eclipse.osee.framework.core.model.type.AttributeType;
import org.eclipse.osee.framework.core.server.UnsecuredOseeHttpServlet;
-import org.eclipse.osee.framework.core.services.IOseeModelFactoryService;
-import org.eclipse.osee.framework.core.services.TempCachingService;
import org.eclipse.osee.framework.core.translation.IDataTranslationService;
import org.eclipse.osee.framework.core.translation.ITranslatorId;
import org.eclipse.osee.framework.jdk.core.type.OseeArgumentException;
@@ -75,17 +66,13 @@ public class OseeCacheServlet extends UnsecuredOseeHttpServlet {
private static final long serialVersionUID = 6693534844874109524L;
private final IDataTranslationService translationService;
- private final IOseeModelFactoryService factoryService;
- private final BranchCache branchCache;
private final OrcsApi orcsApi;
private static final StorageState DEFAULT_STORAGE_STATE = StorageState.CREATED;
- public OseeCacheServlet(Log logger, IDataTranslationService translationService, TempCachingService cachingService, OrcsApi orcsApi, IOseeModelFactoryService factoryService) {
+ public OseeCacheServlet(Log logger, IDataTranslationService translationService, OrcsApi orcsApi) {
super(logger);
this.translationService = translationService;
- this.branchCache = cachingService.getBranchCache();
this.orcsApi = orcsApi;
- this.factoryService = factoryService;
}
public IDataTranslationService getTranslationService() {
@@ -121,9 +108,6 @@ public class OseeCacheServlet extends UnsecuredOseeHttpServlet {
OrcsTypes orcsTypes = orcsApi.getOrcsTypes(context);
sendUpdates(req, resp, orcsTypes);
break;
- case STORE:
- storeUpdates(req, resp);
- break;
default:
throw new UnsupportedOperationException();
}
@@ -146,45 +130,6 @@ public class OseeCacheServlet extends UnsecuredOseeHttpServlet {
resp.getWriter().close();
}
- private void storeUpdates(HttpServletRequest req, HttpServletResponse resp) throws OseeCoreException {
- IDataTranslationService service = getTranslationService();
-
- BranchCacheStoreRequest updateRequest = null;
- InputStream inputStream = null;
- try {
- inputStream = req.getInputStream();
- updateRequest = service.convert(inputStream, CoreTranslatorId.BRANCH_CACHE_STORE_REQUEST);
- } catch (IOException ex) {
- OseeExceptions.wrapAndThrow(ex);
- } finally {
- Lib.close(inputStream);
- }
- Collection<Branch> updated =
- new BranchCacheUpdateUtil(factoryService.getBranchFactory(), branchCache).updateCache(updateRequest);
-
- if (updateRequest.isServerUpdateMessage()) {
- for (Branch branch : updated) {
- if (branch.isCreated()) {
- branch.setStorageState(StorageState.MODIFIED);
- }
- branch.clearDirty();
- if (branch.isPurged()) {
- branchCache.decache(branch);
- }
- }
- } else {
- branchCache.storeItems(updated);
- }
- try {
- resp.setStatus(HttpServletResponse.SC_ACCEPTED);
- resp.setContentType("text/plain");
- resp.setCharacterEncoding("UTF-8");
- resp.getWriter().write("Branch Store Successful");
- } catch (IOException ex) {
- OseeExceptions.wrapAndThrow(ex);
- }
- }
-
private void sendUpdates(HttpServletRequest req, HttpServletResponse resp, OrcsTypes orcsTypes) throws OseeCoreException {
IDataTranslationService service = getTranslationService();
@@ -219,25 +164,6 @@ public class OseeCacheServlet extends UnsecuredOseeHttpServlet {
Object response = null;
ITranslatorId transalatorId = null;
switch (updateRequest.getCacheId()) {
- case BRANCH_CACHE:
- response = BranchCacheUpdateResponse.fromCache(branchCache, branchCache.getAll());
- transalatorId = CoreTranslatorId.BRANCH_CACHE_UPDATE_RESPONSE;
- break;
- case TRANSACTION_CACHE:
- Collection<TransactionRecord> record;
-
- if (updateRequest.getItemsIds().isEmpty()) {
- record = branchCache.getAllTx();
- } else {
- record = new ArrayList<TransactionRecord>();
- branchCache.loadTransactions(updateRequest.getItemsIds());
- for (Integer item : updateRequest.getItemsIds()) {
- record.add(branchCache.getByTxId(item));
- }
- }
- response = TransactionCacheUpdateResponse.fromCache(factoryService.getTransactionFactory(), record);
- transalatorId = CoreTranslatorId.TX_CACHE_UPDATE_RESPONSE;
- break;
case ARTIFACT_TYPE_CACHE:
response = createArtifactTypeCacheUpdateResponse(orcsTypes);
transalatorId = CoreTranslatorId.ARTIFACT_TYPE_CACHE_UPDATE_RESPONSE;
diff --git a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/ats/AtsService.java b/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/ats/AtsService.java
index 0d66a8e9bb6..900dbb90747 100644
--- a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/ats/AtsService.java
+++ b/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/ats/AtsService.java
@@ -13,13 +13,12 @@ package org.eclipse.osee.framework.manager.servlet.ats;
import java.util.Collection;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import org.eclipse.osee.framework.core.model.cache.BranchCache;
-import org.eclipse.osee.framework.core.services.TempCachingService;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.util.Strings;
import org.eclipse.osee.framework.manager.servlet.DataServlet;
import org.eclipse.osee.framework.resource.management.IResource;
import org.eclipse.osee.framework.resource.management.IResourceManager;
+import org.eclipse.osee.orcs.OrcsApi;
import org.w3c.dom.Node;
/**
@@ -45,14 +44,14 @@ public class AtsService {
private final AtsXmlSearch xmlSearch;
private final AtsXmlMessages messages;
private final IResourceManager resourceManager;
- private final BranchCache branchCache;
+ private final OrcsApi orcsApi;
- public AtsService(IResourceProvider resourceProvider, AtsXmlSearch xmlSearch, AtsXmlMessages messages, IResourceManager resourceManager, TempCachingService cacheService) {
+ public AtsService(IResourceProvider resourceProvider, AtsXmlSearch xmlSearch, AtsXmlMessages messages, IResourceManager resourceManager, OrcsApi orcsApi) {
this.xmlSearch = xmlSearch;
this.messages = messages;
this.resourceProvider = resourceProvider;
this.resourceManager = resourceManager;
- branchCache = cacheService.getBranchCache();
+ this.orcsApi = orcsApi;
}
public void performOperation(IResource resource, HttpServletResponse response) {
@@ -135,7 +134,7 @@ public class AtsService {
urlPath = request.getRequestURI().replace(servletPath, "");
if (urlPath.contains("osee/data")) {
- DataServlet.handleUriRequest(resourceManager, urlPath, response, branchCache);
+ DataServlet.handleUriRequest(resourceManager, urlPath, response, orcsApi);
return;
} else {
resource = getResource(urlPath);
diff --git a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/data/ArtifactUtil.java b/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/data/ArtifactUtil.java
index 49702d4ec3c..7bf293529a7 100644
--- a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/data/ArtifactUtil.java
+++ b/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/data/ArtifactUtil.java
@@ -11,9 +11,9 @@
package org.eclipse.osee.framework.manager.servlet.data;
import org.eclipse.osee.framework.core.enums.TxChange;
-import org.eclipse.osee.framework.core.model.Branch;
import org.eclipse.osee.framework.database.core.ConnectionHandler;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
+import org.eclipse.osee.orcs.data.BranchReadable;
/**
* @author Roberto E. Escobar
@@ -22,13 +22,13 @@ public class ArtifactUtil {
private static final String URI_BY_GUID =
"SELECT att.uri FROM osee_artifact art, osee_attribute att, %s txs where art.guid = ? and art.art_id = att.art_id and att.uri is not null and att.gamma_id = txs.gamma_id and txs.branch_id = ? and txs.tx_current = ?";
- public static String getUri(String artifactGuid, Branch branch) throws OseeCoreException {
+ public static String getUri(String artifactGuid, BranchReadable branch) throws OseeCoreException {
String sql = String.format(URI_BY_GUID, getTransactionTable(branch));
return ConnectionHandler.runPreparedQueryFetchString("", sql, artifactGuid, branch.getUuid(),
TxChange.CURRENT.getValue());
}
- private static String getTransactionTable(Branch branch) {
+ private static String getTransactionTable(BranchReadable branch) {
return branch.getArchiveState().isArchived() ? "osee_txs_archived" : "osee_txs";
}
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/internal/BranchUpdateEventHandler.java b/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/internal/BranchUpdateEventHandler.java
deleted file mode 100644
index d206edc8b86..00000000000
--- a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/internal/BranchUpdateEventHandler.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.manager.servlet.internal;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import org.eclipse.osee.event.Event;
-import org.eclipse.osee.event.EventHandler;
-import org.eclipse.osee.executor.admin.ExecutorAdmin;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.core.server.IApplicationServerLookup;
-import org.eclipse.osee.framework.core.server.IApplicationServerManager;
-import org.eclipse.osee.framework.core.translation.IDataTranslationService;
-import org.eclipse.osee.logger.Log;
-import org.eclipse.osee.orcs.OrcsConstants;
-
-/**
- * @author Roberto E. Escobar
- */
-public class BranchUpdateEventHandler implements EventHandler {
-
- private Log logger;
- private IDataTranslationService translationService;
- private IApplicationServerLookup lookupService;
- private IApplicationServerManager manager;
- private ExecutorAdmin executor;
-
- public void setExecutor(ExecutorAdmin executor) {
- this.executor = executor;
- }
-
- public void setLogger(Log logger) {
- this.logger = logger;
- }
-
- public void setTranslationService(IDataTranslationService translationService) {
- this.translationService = translationService;
- }
-
- public void setServerLookup(IApplicationServerLookup lookupService) {
- this.lookupService = lookupService;
- }
-
- public void setAppServerManager(IApplicationServerManager manager) {
- this.manager = manager;
- }
-
- private boolean isReady() {
- return logger != null && translationService != null && lookupService != null && manager != null;
- }
-
- @Override
- public void onEvent(Event event) {
- if (isReady()) {
- Collection<Branch> branches = getEventData(event);
- List<Branch> branchToUpdate = new ArrayList<Branch>();
- for (Branch branch : branches) {
- if (!branch.isDirty()) {
- branchToUpdate.add(branch);
- }
- }
- if (!branchToUpdate.isEmpty()) {
- ServerBranchUpdateNotifier notifier =
- new ServerBranchUpdateNotifier(logger, translationService, manager, lookupService, branchToUpdate,
- executor);
- try {
- notifier.notifyServers();
- } catch (Exception ex) {
- logger.error(ex, "Error notifying other servers");
- }
- }
- }
- }
-
- @SuppressWarnings("unchecked")
- private Collection<Branch> getEventData(Event event) {
- Object object = event.getValue(OrcsConstants.ORCS_BRANCH_EVENT_DATA);
- Collection<Branch> branches = null;
- if (object instanceof Collection) {
- branches = (Collection<Branch>) object;
- } else {
- branches = Collections.emptyList();
- }
- return branches;
- }
-}
diff --git a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/internal/ServerBranchUpdateNotifier.java b/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/internal/ServerBranchUpdateNotifier.java
deleted file mode 100644
index 2f6dcdae34d..00000000000
--- a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/internal/ServerBranchUpdateNotifier.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.manager.servlet.internal;
-
-import java.net.URI;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.Callable;
-import java.util.concurrent.Future;
-import org.eclipse.osee.executor.admin.ExecutorAdmin;
-import org.eclipse.osee.framework.core.data.OseeServerContext;
-import org.eclipse.osee.framework.core.enums.CacheOperation;
-import org.eclipse.osee.framework.core.enums.CoreTranslatorId;
-import org.eclipse.osee.framework.core.message.BranchCacheStoreRequest;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.core.server.IApplicationServerLookup;
-import org.eclipse.osee.framework.core.server.IApplicationServerManager;
-import org.eclipse.osee.framework.core.translation.IDataTranslationService;
-import org.eclipse.osee.framework.core.util.HttpMessage;
-import org.eclipse.osee.framework.core.util.HttpProcessor;
-import org.eclipse.osee.framework.core.util.HttpProcessor.AcquireResult;
-import org.eclipse.osee.framework.jdk.core.util.HttpUrlBuilder;
-import org.eclipse.osee.logger.Log;
-
-/**
- * TODO: Temporary class used for backward server compatibility need to remove this and update servers using either
- * distributed cache or JMS
- *
- * @author Roberto E. Escobar
- */
-public class ServerBranchUpdateNotifier {
-
- private final Log logger;
- private final IDataTranslationService translationService;
- private final IApplicationServerLookup lookupService;
- private final IApplicationServerManager manager;
- private final ExecutorAdmin executor;
-
- private final Collection<Branch> branches;
-
- public ServerBranchUpdateNotifier(Log logger, IDataTranslationService translationService, IApplicationServerManager manager, IApplicationServerLookup lookUpProvider, Collection<Branch> branches, ExecutorAdmin executor) {
- this.logger = logger;
- this.translationService = translationService;
- this.lookupService = lookUpProvider;
- this.manager = manager;
- this.branches = branches;
- this.executor = executor;
- }
-
- public void notifyServers() throws Exception {
- logger.trace("Sending server update event for [%s]", branches);
-
- BranchCacheStoreRequest request = BranchCacheStoreRequest.fromCache(branches);
- request.setServerUpdateMessage(true);
-
- Map<String, String> parameters = new HashMap<String, String>();
- parameters.put("function", CacheOperation.STORE.name());
-
- List<Future<Void>> futures = new LinkedList<Future<Void>>();
-
- for (URI serverUri : lookupService.getAvailableServerUris()) {
- if (!manager.getServerUri().equals(serverUri)) {
- ServerUpdateWorker worker = new ServerUpdateWorker(serverUri, parameters, request);
- Future<Void> future = executor.schedule(worker);
- futures.add(future);
- }
- }
-
- // wait for all requests to finish
- for (Future<Void> future : futures) {
- future.get();
- }
- }
-
- private final class ServerUpdateWorker implements Callable<Void> {
-
- private final URI serverUri;
- private final Map<String, String> parameters;
- private final BranchCacheStoreRequest request;
-
- public ServerUpdateWorker(URI serverUri, Map<String, String> parameters, BranchCacheStoreRequest request) {
- this.serverUri = serverUri;
- this.parameters = parameters;
- this.request = request;
- }
-
- @Override
- public Void call() throws Exception {
- if (HttpProcessor.isAlive(serverUri)) {
- try {
- String urlString = HttpUrlBuilder.createURL(serverUri, OseeServerContext.CACHE_CONTEXT, parameters);
-
- AcquireResult updateResponse =
- HttpMessage.send(urlString, translationService, CoreTranslatorId.BRANCH_CACHE_STORE_REQUEST, request,
- null);
- if (!updateResponse.wasSuccessful()) {
- logger.error("Unsuccessful response when relaying branch updates to %s", serverUri);
- }
- } catch (Exception ex) {
- logger.error(ex, "Error relaying branch updates to %s", serverUri);
- }
- }
- return null;
- }
- }
-}
diff --git a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/internal/ServletRegistrationHandler.java b/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/internal/ServletRegistrationHandler.java
index b9f07ebec15..f666fad2b8f 100644
--- a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/internal/ServletRegistrationHandler.java
+++ b/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/internal/ServletRegistrationHandler.java
@@ -13,13 +13,10 @@ package org.eclipse.osee.framework.manager.servlet.internal;
import java.util.HashSet;
import java.util.Set;
import org.eclipse.osee.framework.core.data.OseeServerContext;
-import org.eclipse.osee.framework.core.model.cache.BranchCache;
import org.eclipse.osee.framework.core.server.IApplicationServerManager;
import org.eclipse.osee.framework.core.server.IAuthenticationManager;
import org.eclipse.osee.framework.core.server.ISessionManager;
import org.eclipse.osee.framework.core.server.OseeHttpServlet;
-import org.eclipse.osee.framework.core.services.IOseeModelFactoryService;
-import org.eclipse.osee.framework.core.services.TempCachingService;
import org.eclipse.osee.framework.core.translation.IDataTranslationService;
import org.eclipse.osee.framework.manager.servlet.AdminServlet;
import org.eclipse.osee.framework.manager.servlet.ArtifactFileServlet;
@@ -51,9 +48,7 @@ public class ServletRegistrationHandler {
private ISessionManager sessionManager;
private IApplicationServerManager appServerManager;
private IDataTranslationService translationService;
- private TempCachingService caching;
private IAuthenticationManager authenticationManager;
- private IOseeModelFactoryService factoryService;
private IResourceManager resourceManager;
private OrcsApi orcsApi;
@@ -71,18 +66,10 @@ public class ServletRegistrationHandler {
this.translationService = translationService;
}
- public void setCaching(TempCachingService caching) {
- this.caching = caching;
- }
-
public void setAuthenticationManager(IAuthenticationManager authenticationManager) {
this.authenticationManager = authenticationManager;
}
- public void setFactoryService(IOseeModelFactoryService factoryService) {
- this.factoryService = factoryService;
- }
-
public void setResourceManager(IResourceManager resourceManager) {
this.resourceManager = resourceManager;
}
@@ -115,14 +102,11 @@ public class ServletRegistrationHandler {
private void registerServices(BundleContext context) {
contexts.clear();
- BranchCache branchCache = caching.getBranchCache();
register(new SystemManagerServlet(logger, sessionManager), OseeServerContext.MANAGER_CONTEXT);
register(new ResourceManagerServlet(logger, sessionManager, resourceManager), OseeServerContext.RESOURCE_CONTEXT);
- register(new ArtifactFileServlet(logger, resourceManager, branchCache, orcsApi),
- OseeServerContext.PROCESS_CONTEXT);
- register(new ArtifactFileServlet(logger, resourceManager, branchCache, orcsApi),
- OseeServerContext.ARTIFACT_CONTEXT);
- register(new ArtifactFileServlet(logger, resourceManager, branchCache, orcsApi), "index");
+ register(new ArtifactFileServlet(logger, resourceManager, orcsApi), OseeServerContext.PROCESS_CONTEXT);
+ register(new ArtifactFileServlet(logger, resourceManager, orcsApi), OseeServerContext.ARTIFACT_CONTEXT);
+ register(new ArtifactFileServlet(logger, resourceManager, orcsApi), "index");
register(new BranchExchangeServlet(logger, sessionManager, resourceManager, orcsApi),
OseeServerContext.BRANCH_EXCHANGE_CONTEXT);
register(new BranchManagerServlet(logger, sessionManager, translationService, orcsApi),
@@ -131,14 +115,13 @@ public class ServletRegistrationHandler {
register(new SessionManagementServlet(logger, sessionManager, authenticationManager),
OseeServerContext.SESSION_CONTEXT);
register(new SessionClientLoopbackServlet(logger, sessionManager), OseeServerContext.CLIENT_LOOPBACK_CONTEXT);
- register(new OseeCacheServlet(logger, translationService, caching, orcsApi, factoryService),
- OseeServerContext.CACHE_CONTEXT);
+ register(new OseeCacheServlet(logger, translationService, orcsApi), OseeServerContext.CACHE_CONTEXT);
register(new OseeModelServlet(logger, sessionManager, translationService, orcsApi),
OseeServerContext.OSEE_MODEL_CONTEXT);
- register(new AtsServlet(logger, resourceManager, caching), "osee/ats");
+ register(new AtsServlet(logger, resourceManager, orcsApi), "osee/ats");
register(new ConfigurationServlet(logger, translationService, orcsApi), OseeServerContext.OSEE_CONFIGURE_CONTEXT);
- register(new DataServlet(logger, resourceManager, caching), "osee/data");
+ register(new DataServlet(logger, resourceManager, orcsApi), "osee/data");
register(new AdminServlet(logger, context), "osee/console");
}

Back to the top