Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoberto E. Escobar2014-11-11 02:34:26 +0000
committerRoberto E. Escobar2014-11-11 18:39:12 +0000
commit31c8329340e79d55102e8acfab092becd01bc48b (patch)
tree32e434b46e29f97e46cd9b132928a8326e93e790 /plugins/org.eclipse.osee.framework.manager.servlet
parent4e9ca0e5f2696e84f52db7342ec59983b168057c (diff)
downloadorg.eclipse.osee-31c8329340e79d55102e8acfab092becd01bc48b.tar.gz
org.eclipse.osee-31c8329340e79d55102e8acfab092becd01bc48b.tar.xz
org.eclipse.osee-31c8329340e79d55102e8acfab092becd01bc48b.zip
refactor: Remove uses of ConnectionHandler from server-side
Diffstat (limited to 'plugins/org.eclipse.osee.framework.manager.servlet')
-rw-r--r--plugins/org.eclipse.osee.framework.manager.servlet/META-INF/MANIFEST.MF1
-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/src/org/eclipse/osee/framework/manager/servlet/ArtifactFileServlet.java7
-rw-r--r--plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/AtsServlet.java5
-rw-r--r--plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/DataServlet.java11
-rw-r--r--plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/ats/AtsService.java7
-rw-r--r--plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/data/ArtifactUtil.java8
-rw-r--r--plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/internal/ServletRegistrationHandler.java16
8 files changed, 37 insertions, 19 deletions
diff --git a/plugins/org.eclipse.osee.framework.manager.servlet/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.framework.manager.servlet/META-INF/MANIFEST.MF
index 12b7892da01..4b46c011ad1 100644
--- a/plugins/org.eclipse.osee.framework.manager.servlet/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.framework.manager.servlet/META-INF/MANIFEST.MF
@@ -28,6 +28,7 @@ Import-Package: com.google.common.base;version="[11.0.0,15.0.0)",
org.eclipse.osee.framework.core.services,
org.eclipse.osee.framework.core.translation,
org.eclipse.osee.framework.core.util,
+ org.eclipse.osee.framework.database,
org.eclipse.osee.framework.database.core,
org.eclipse.osee.framework.jdk.core.type,
org.eclipse.osee.framework.jdk.core.util,
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 8bd8a7db2c4..b0a73110053 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
@@ -11,5 +11,6 @@
<reference bind="setResourceManager" cardinality="1..1" interface="org.eclipse.osee.framework.resource.management.IResourceManager" name="IResourceManager" policy="static"/>
<reference bind="setOrcsApi" cardinality="1..1" interface="org.eclipse.osee.orcs.OrcsApi" name="OrcsApi" policy="static"/>
<reference bind="setActivityLog" cardinality="1..1" interface="org.eclipse.osee.activity.api.ActivityLog" name="ActivityLog" policy="static"/>
+ <reference bind="setDatabaseService" cardinality="1..1" interface="org.eclipse.osee.framework.database.IOseeDatabaseService" name="IOseeDatabaseService" policy="static"/>
</scr:component>
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 2503a5a26e2..4c4f1dd73e2 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
@@ -19,6 +19,7 @@ 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.server.UnsecuredOseeHttpServlet;
+import org.eclipse.osee.framework.database.IOseeDatabaseService;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.type.Pair;
import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
@@ -52,11 +53,13 @@ public class ArtifactFileServlet extends UnsecuredOseeHttpServlet {
private final IResourceManager resourceManager;
private final OrcsApi orcs;
+ private final IOseeDatabaseService dbService;
- public ArtifactFileServlet(Log logger, IResourceManager resourceManager, OrcsApi orcs) {
+ public ArtifactFileServlet(Log logger, IResourceManager resourceManager, OrcsApi orcs, IOseeDatabaseService dbService) {
super(logger);
this.resourceManager = resourceManager;
this.orcs = orcs;
+ this.dbService = dbService;
}
@Override
@@ -95,7 +98,7 @@ public class ArtifactFileServlet extends UnsecuredOseeHttpServlet {
}
BranchReadable branch = query.getResults().getExactlyOne();
Conditions.checkNotNull(branch, "branch", "Unable to determine branch");
- uri = ArtifactUtil.getUri(artifactGuid, branch);
+ uri = ArtifactUtil.getUri(dbService, artifactGuid, branch);
handleArtifactUri(resourceManager, request.getQueryString(), uri, response);
} catch (NumberFormatException ex) {
handleError(response, HttpServletResponse.SC_BAD_REQUEST,
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 3814d76af7e..6ca56f9ee99 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,6 +15,7 @@ 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.database.IOseeDatabaseService;
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;
@@ -39,13 +40,13 @@ public class AtsServlet extends UnsecuredOseeHttpServlet {
private final IResourceManager resourceManager;
- public AtsServlet(Log logger, IResourceManager resourceManager, OrcsApi orcsApi) {
+ public AtsServlet(Log logger, IResourceManager resourceManager, OrcsApi orcsApi, IOseeDatabaseService dbService) {
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, orcsApi);
+ this.atsService = new AtsService(provider, xmlSearch, messages, resourceManager, orcsApi, dbService);
}
@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 f390b4e6ba0..aaeb621a913 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
@@ -18,6 +18,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.eclipse.osee.framework.core.exception.OseeNotFoundException;
import org.eclipse.osee.framework.core.server.UnsecuredOseeHttpServlet;
+import org.eclipse.osee.framework.database.IOseeDatabaseService;
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;
@@ -35,18 +36,20 @@ public class DataServlet extends UnsecuredOseeHttpServlet {
private final IResourceManager resourceManager;
private final OrcsApi orcsApi;
+ private final IOseeDatabaseService dbService;
- public DataServlet(Log logger, IResourceManager resourceManager, OrcsApi orcsApi) {
+ public DataServlet(Log logger, IResourceManager resourceManager, OrcsApi orcsApi, IOseeDatabaseService dbService) {
super(logger);
this.resourceManager = resourceManager;
this.orcsApi = orcsApi;
+ this.dbService = dbService;
}
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
String urlRequest = request.getRequestURI();
try {
- handleUriRequest(resourceManager, urlRequest, response, orcsApi);
+ handleUriRequest(dbService, resourceManager, urlRequest, response, orcsApi);
} catch (OseeCoreException ex) {
handleError(response, HttpURLConnection.HTTP_INTERNAL_ERROR, "", ex);
}
@@ -58,7 +61,7 @@ public class DataServlet extends UnsecuredOseeHttpServlet {
response.sendError(status, Lib.exceptionToString(ex));
}
- public static void handleUriRequest(IResourceManager resourceManager, String urlRequest, HttpServletResponse response, OrcsApi orcsApi) throws OseeCoreException {
+ public static void handleUriRequest(IOseeDatabaseService dbService, IResourceManager resourceManager, String urlRequest, HttpServletResponse response, OrcsApi orcsApi) throws OseeCoreException {
UrlParser parser = new UrlParser();
parser.parse(urlRequest);
Long branchUuid = Long.valueOf(parser.getAttribute("branch"));
@@ -66,7 +69,7 @@ public class DataServlet extends UnsecuredOseeHttpServlet {
BranchQuery query = orcsApi.getQueryFactory(null).branchQuery();
BranchReadable branch = query.andUuids(branchUuid).getResults().getExactlyOne();
- String uri = ArtifactUtil.getUri(artifactGuid, branch);
+ String uri = ArtifactUtil.getUri(dbService, 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/ats/AtsService.java b/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/ats/AtsService.java
index 900dbb90747..30ddc459c7f 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,6 +13,7 @@ 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.database.IOseeDatabaseService;
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;
@@ -45,13 +46,15 @@ public class AtsService {
private final AtsXmlMessages messages;
private final IResourceManager resourceManager;
private final OrcsApi orcsApi;
+ private final IOseeDatabaseService dbService;
- public AtsService(IResourceProvider resourceProvider, AtsXmlSearch xmlSearch, AtsXmlMessages messages, IResourceManager resourceManager, OrcsApi orcsApi) {
+ public AtsService(IResourceProvider resourceProvider, AtsXmlSearch xmlSearch, AtsXmlMessages messages, IResourceManager resourceManager, OrcsApi orcsApi, IOseeDatabaseService dbService) {
this.xmlSearch = xmlSearch;
this.messages = messages;
this.resourceProvider = resourceProvider;
this.resourceManager = resourceManager;
this.orcsApi = orcsApi;
+ this.dbService = dbService;
}
public void performOperation(IResource resource, HttpServletResponse response) {
@@ -134,7 +137,7 @@ public class AtsService {
urlPath = request.getRequestURI().replace(servletPath, "");
if (urlPath.contains("osee/data")) {
- DataServlet.handleUriRequest(resourceManager, urlPath, response, orcsApi);
+ DataServlet.handleUriRequest(dbService, 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 7bf293529a7..5fe268249db 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,7 +11,7 @@
package org.eclipse.osee.framework.manager.servlet.data;
import org.eclipse.osee.framework.core.enums.TxChange;
-import org.eclipse.osee.framework.database.core.ConnectionHandler;
+import org.eclipse.osee.framework.database.IOseeDatabaseService;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.orcs.data.BranchReadable;
@@ -22,10 +22,10 @@ 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, BranchReadable branch) throws OseeCoreException {
+ @SuppressWarnings("unchecked")
+ public static String getUri(IOseeDatabaseService dbService, 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());
+ return dbService.runPreparedQueryFetchObject("", sql, artifactGuid, branch.getUuid(), TxChange.CURRENT.getValue());
}
private static String getTransactionTable(BranchReadable branch) {
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 099e84683ea..e3b53a74414 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
@@ -19,6 +19,7 @@ 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.translation.IDataTranslationService;
+import org.eclipse.osee.framework.database.IOseeDatabaseService;
import org.eclipse.osee.framework.manager.servlet.AdminServlet;
import org.eclipse.osee.framework.manager.servlet.ArtifactFileServlet;
import org.eclipse.osee.framework.manager.servlet.AtsServlet;
@@ -52,6 +53,7 @@ public class ServletRegistrationHandler {
private IAuthenticationManager authenticationManager;
private IResourceManager resourceManager;
private OrcsApi orcsApi;
+ private IOseeDatabaseService dbService;
private ActivityLog activityLog;
private final Set<String> contexts = new HashSet<String>();
@@ -80,6 +82,10 @@ public class ServletRegistrationHandler {
this.orcsApi = orcsApi;
}
+ public void setDatabaseService(IOseeDatabaseService dbService) {
+ this.dbService = dbService;
+ }
+
public void setLogger(Log logger) {
this.logger = logger;
}
@@ -106,9 +112,9 @@ public class ServletRegistrationHandler {
contexts.clear();
register(new SystemManagerServlet(logger, sessionManager), OseeServerContext.MANAGER_CONTEXT);
register(new ResourceManagerServlet(logger, sessionManager, resourceManager), OseeServerContext.RESOURCE_CONTEXT);
- 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 ArtifactFileServlet(logger, resourceManager, orcsApi, dbService), OseeServerContext.PROCESS_CONTEXT);
+ register(new ArtifactFileServlet(logger, resourceManager, orcsApi, dbService), OseeServerContext.ARTIFACT_CONTEXT);
+ register(new ArtifactFileServlet(logger, resourceManager, orcsApi, dbService), "index");
register(new BranchExchangeServlet(logger, sessionManager, resourceManager, orcsApi),
OseeServerContext.BRANCH_EXCHANGE_CONTEXT);
register(new BranchManagerServlet(logger, sessionManager, translationService, orcsApi),
@@ -121,9 +127,9 @@ public class ServletRegistrationHandler {
register(new OseeModelServlet(logger, sessionManager, translationService, orcsApi),
OseeServerContext.OSEE_MODEL_CONTEXT);
- register(new AtsServlet(logger, resourceManager, orcsApi), "osee/ats");
+ register(new AtsServlet(logger, resourceManager, orcsApi, dbService), "osee/ats");
register(new ConfigurationServlet(logger, translationService, orcsApi), OseeServerContext.OSEE_CONFIGURE_CONTEXT);
- register(new DataServlet(logger, resourceManager, orcsApi), "osee/data");
+ register(new DataServlet(logger, resourceManager, orcsApi, dbService), "osee/data");
register(new AdminServlet(logger, context), "osee/console");
}

Back to the top