Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyan D. Brooks2011-08-19 16:32:51 +0000
committerRyan D. Brooks2011-08-19 16:32:51 +0000
commit590ec58662abf12c08a1de0c5cd3616c960f04cb (patch)
treea70e3253f6181f0c7b4eb494152dd07a8f2f648c
parent9c7e2850d4872a2821e0698ab53f886a0c4bc363 (diff)
downloadorg.eclipse.osee-590ec58662abf12c08a1de0c5cd3616c960f04cb.tar.gz
org.eclipse.osee-590ec58662abf12c08a1de0c5cd3616c960f04cb.tar.xz
org.eclipse.osee-590ec58662abf12c08a1de0c5cd3616c960f04cb.zip
refinement: Improve performance of session creation
-rw-r--r--plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/AbstractOseeCache.java4
-rw-r--r--plugins/org.eclipse.osee.framework.core.server/META-INF/MANIFEST.MF8
-rw-r--r--plugins/org.eclipse.osee.framework.core.server/OSGI-INF/service.provider.xml5
-rw-r--r--plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/UserDataStore.java13
-rw-r--r--plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/ServiceProvider.java37
5 files changed, 59 insertions, 8 deletions
diff --git a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/AbstractOseeCache.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/AbstractOseeCache.java
index 447fd71f3bd..78242798818 100644
--- a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/AbstractOseeCache.java
+++ b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/AbstractOseeCache.java
@@ -325,4 +325,8 @@ public abstract class AbstractOseeCache<T extends AbstractOseeType> implements I
}
}
}
+
+ public final int getLocalId(Identity token) throws OseeCoreException {
+ return get(token).getId();
+ }
}
diff --git a/plugins/org.eclipse.osee.framework.core.server/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.framework.core.server/META-INF/MANIFEST.MF
index fdf32d68545..696599db2e8 100644
--- a/plugins/org.eclipse.osee.framework.core.server/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.framework.core.server/META-INF/MANIFEST.MF
@@ -16,6 +16,7 @@ Import-Package: javax.servlet,
org.eclipse.osee.framework.core.model,
org.eclipse.osee.framework.core.model.cache,
org.eclipse.osee.framework.core.operation,
+ org.eclipse.osee.framework.core.services,
org.eclipse.osee.framework.core.util,
org.eclipse.osee.framework.database,
org.eclipse.osee.framework.database.core,
@@ -29,10 +30,5 @@ Import-Package: javax.servlet,
Eclipse-ExtensibleAPI: true
Export-Package: org.eclipse.osee.framework.core.server
Bundle-ActivationPolicy: lazy
-Service-Component: OSGI-INF/authentication.manager.xml,
- OSGI-INF/authentication.provider.xml,
- OSGI-INF/authentication.provider.demo.xml,
- OSGI-INF/application.lookup.server.manager.xml,
- OSGI-INF/server.task.scheduler.xml,
- OSGI-INF/join.cleanup.task.provider.xml
+Service-Component: OSGI-INF/*.xml
Bundle-Activator: org.eclipse.osee.framework.core.server.internal.ServerActivator
diff --git a/plugins/org.eclipse.osee.framework.core.server/OSGI-INF/service.provider.xml b/plugins/org.eclipse.osee.framework.core.server/OSGI-INF/service.provider.xml
new file mode 100644
index 00000000000..10026e70eca
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.server/OSGI-INF/service.provider.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" activate="start" deactivate="stop" name="org.eclipse.osee.framework.core.server.internal.ServiceProvider">
+ <implementation class="org.eclipse.osee.framework.core.server.internal.ServiceProvider"/>
+ <reference bind="setCachingService" cardinality="1..1" interface="org.eclipse.osee.framework.core.services.IOseeCachingService" name="IOseeCachingService" policy="dynamic"/>
+</scr:component>
diff --git a/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/UserDataStore.java b/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/UserDataStore.java
index b1b4762e73a..6c775f1ead7 100644
--- a/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/UserDataStore.java
+++ b/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/UserDataStore.java
@@ -13,8 +13,13 @@ package org.eclipse.osee.framework.core.server;
import java.util.logging.Level;
import org.eclipse.osee.framework.core.data.IUserToken;
import org.eclipse.osee.framework.core.data.TokenFactory;
+import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
+import org.eclipse.osee.framework.core.enums.CoreBranches;
+import org.eclipse.osee.framework.core.enums.TxChange;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.server.internal.ServerActivator;
+import org.eclipse.osee.framework.core.server.internal.ServiceProvider;
+import org.eclipse.osee.framework.core.services.IOseeCachingService;
import org.eclipse.osee.framework.database.core.ConnectionHandler;
import org.eclipse.osee.framework.database.core.IOseeStatement;
import org.eclipse.osee.framework.logging.OseeLog;
@@ -24,7 +29,7 @@ import org.eclipse.osee.framework.logging.OseeLog;
*/
public final class UserDataStore {
private static final String LOAD_OSEE_USER =
- "select oa.value as user_id from osee_attribute_type oat, osee_attribute oa, osee_txs txs where oat.name = 'User Id' and oat.attr_type_id = oa.attr_type_id and oa.gamma_id = txs.gamma_id and txs.tx_current = 1 and oa.value = ?";
+ "select att.value as user_id from osee_attribute att, osee_txs txs where att.attr_type_id = ? and txs.branch_id = ? and att.gamma_id = txs.gamma_id and txs.tx_current = ? and att.value = ?";
private UserDataStore() {
// private constructor
@@ -33,9 +38,13 @@ public final class UserDataStore {
public static IUserToken getUserTokenFromOseeDb(String userId) {
IUserToken toReturn = null;
IOseeStatement chStmt = null;
+ IOseeCachingService cachingService = ServiceProvider.getCachingService();
try {
+ int attributeTypeId = cachingService.getAttributeTypeCache().getLocalId(CoreAttributeTypes.UserId);
+ int branchId = cachingService.getBranchCache().get(CoreBranches.COMMON).getId();
+
chStmt = ConnectionHandler.getStatement();
- chStmt.runPreparedQuery(LOAD_OSEE_USER, userId);
+ chStmt.runPreparedQuery(LOAD_OSEE_USER, attributeTypeId, branchId, TxChange.CURRENT.getValue(), userId);
if (chStmt.next()) {
// Only need the userId all other fields will be loaded by the client
toReturn = TokenFactory.createUserToken(null, "-", "-", chStmt.getString("user_id"), true, false, false);
diff --git a/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/ServiceProvider.java b/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/ServiceProvider.java
new file mode 100644
index 00000000000..afa3914a334
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/ServiceProvider.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.core.server.internal;
+
+import org.eclipse.osee.framework.core.services.IOseeCachingService;
+
+/**
+ * @author Ryan D. Brooks
+ */
+public class ServiceProvider {
+ private IOseeCachingService service;
+ private static ServiceProvider instance;
+
+ public void setCachingService(IOseeCachingService service) {
+ this.service = service;
+ }
+
+ public static IOseeCachingService getCachingService() {
+ return instance.service;
+ }
+
+ public void start() {
+ instance = this;
+ }
+
+ public void stop() {
+ instance = null;
+ }
+} \ No newline at end of file

Back to the top