Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew M Finkbeiner2013-03-22 16:21:46 +0000
committerGerrit Code Review @ Eclipse.org2013-03-27 20:08:57 +0000
commit6779e93d504a8a542b01361de4e7ea19a88337c3 (patch)
tree9153a21d343abe062736a1171ddd34db172cd8d5 /plugins/org.eclipse.osee.ote.server
parentefc2a587ad3585880e35a65b446ecafc122955de (diff)
downloadorg.eclipse.osee-6779e93d504a8a542b01361de4e7ea19a88337c3.tar.gz
org.eclipse.osee-6779e93d504a8a542b01361de4e7ea19a88337c3.tar.xz
org.eclipse.osee-6779e93d504a8a542b01361de4e7ea19a88337c3.zip
feature[ats_5Z6FP]: Add OTE SessionManager
Move the session management out of the TestEnvironment and into it's own service. This also involves removing the UserSessionKey and replacing it with a UUID to identify the client session. Change-Id: I2dc09c96031f3c0670081f4bf158d62912140506
Diffstat (limited to 'plugins/org.eclipse.osee.ote.server')
-rw-r--r--plugins/org.eclipse.osee.ote.server/OSGI-INF/ote.service.starter.xml13
-rw-r--r--plugins/org.eclipse.osee.ote.server/build.properties3
-rw-r--r--plugins/org.eclipse.osee.ote.server/src/org/eclipse/osee/ote/server/internal/Activator.java4
-rw-r--r--plugins/org.eclipse.osee.ote.server/src/org/eclipse/osee/ote/server/internal/OteService.java68
-rw-r--r--plugins/org.eclipse.osee.ote.server/src/org/eclipse/osee/ote/server/internal/OteServiceStarterCreationHandler.java68
-rw-r--r--plugins/org.eclipse.osee.ote.server/src/org/eclipse/osee/ote/server/internal/OteServiceStarterImpl.java70
-rw-r--r--plugins/org.eclipse.osee.ote.server/src/org/eclipse/osee/ote/server/internal/RemoteTestEnvironment.java36
7 files changed, 124 insertions, 138 deletions
diff --git a/plugins/org.eclipse.osee.ote.server/OSGI-INF/ote.service.starter.xml b/plugins/org.eclipse.osee.ote.server/OSGI-INF/ote.service.starter.xml
new file mode 100644
index 00000000000..14ca1a34150
--- /dev/null
+++ b/plugins/org.eclipse.osee.ote.server/OSGI-INF/ote.service.starter.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.osee.ote.server">
+ <implementation class="org.eclipse.osee.ote.server.internal.OteServiceStarterImpl"/>
+ <service>
+ <provide interface="org.eclipse.osee.ote.server.OteServiceStarter"/>
+ </service>
+ <reference unbind="unbindIRuntimeLibraryManager" bind="bindIRuntimeLibraryManager" cardinality="1..1" interface="org.eclipse.osee.ote.core.environment.interfaces.IRuntimeLibraryManager" name="IRuntimeLibraryManager" policy="static"/>
+ <reference unbind="unbindRemoteServiceRegistrar" bind="bindRemoteServiceRegistrar" cardinality="1..1" interface="org.eclipse.osee.framework.messaging.services.RemoteServiceRegistrar" name="RemoteServiceRegistrar" policy="static"/>
+ <reference unbind="unbindMessageService" bind="bindMessageService" cardinality="1..1" interface="org.eclipse.osee.framework.messaging.MessageService" name="MessageService" policy="static"/>
+ <reference unbind="unbindIConnectionService" bind="bindIConnectionService" cardinality="1..1" interface="org.eclipse.osee.connection.service.IConnectionService" name="IConnectionService" policy="static"/>
+ <reference unbind="unbindPackageAdmin" bind="bindPackageAdmin" cardinality="1..1" interface="org.osgi.service.packageadmin.PackageAdmin" name="PackageAdmin" policy="static"/>
+ <reference bind="bindOTESessionManager" cardinality="1..1" interface="org.eclipse.osee.ote.core.OTESessionManager" name="OTESessionManager" policy="static" unbind="unbindOTESessionManager"/>
+</scr:component>
diff --git a/plugins/org.eclipse.osee.ote.server/build.properties b/plugins/org.eclipse.osee.ote.server/build.properties
index 6210e849b59..28c3ad0353c 100644
--- a/plugins/org.eclipse.osee.ote.server/build.properties
+++ b/plugins/org.eclipse.osee.ote.server/build.properties
@@ -1,5 +1,6 @@
output.. = bin/
bin.includes = META-INF/,\
.,\
- OSGI-INF/
+ OSGI-INF/,\
+ OSGI-INF/ote.service.starter.xml
source.. = src/
diff --git a/plugins/org.eclipse.osee.ote.server/src/org/eclipse/osee/ote/server/internal/Activator.java b/plugins/org.eclipse.osee.ote.server/src/org/eclipse/osee/ote/server/internal/Activator.java
index 2355a164bd0..6ea0cdf9477 100644
--- a/plugins/org.eclipse.osee.ote.server/src/org/eclipse/osee/ote/server/internal/Activator.java
+++ b/plugins/org.eclipse.osee.ote.server/src/org/eclipse/osee/ote/server/internal/Activator.java
@@ -13,6 +13,7 @@ package org.eclipse.osee.ote.server.internal;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.logging.Level;
+
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.util.ServiceDependencyTracker;
import org.eclipse.osee.framework.logging.OseeLog;
@@ -49,9 +50,6 @@ public class Activator implements BundleActivator {
runtimeManagerHandler = new ServiceDependencyTracker(context, new RuntimeManagerHandler());
runtimeManagerHandler.open();
- oteServiceStarterHandler = new ServiceDependencyTracker(context, new OteServiceStarterCreationHandler());
- oteServiceStarterHandler.open();
-
startServer();
}
diff --git a/plugins/org.eclipse.osee.ote.server/src/org/eclipse/osee/ote/server/internal/OteService.java b/plugins/org.eclipse.osee.ote.server/src/org/eclipse/osee/ote/server/internal/OteService.java
index 12da398a683..9af1ae0716f 100644
--- a/plugins/org.eclipse.osee.ote.server/src/org/eclipse/osee/ote/server/internal/OteService.java
+++ b/plugins/org.eclipse.osee.ote.server/src/org/eclipse/osee/ote/server/internal/OteService.java
@@ -10,12 +10,12 @@
*******************************************************************************/
package org.eclipse.osee.ote.server.internal;
-import java.io.Serializable;
import java.net.InetAddress;
import java.rmi.RemoteException;
import java.util.Collection;
import java.util.Date;
import java.util.LinkedList;
+import java.util.UUID;
import java.util.logging.Level;
import net.jini.core.lookup.ServiceID;
@@ -29,12 +29,13 @@ import org.eclipse.osee.framework.messaging.NodeInfo;
import org.eclipse.osee.framework.messaging.services.RegisteredServiceReference;
import org.eclipse.osee.ote.core.ConnectionRequestResult;
import org.eclipse.osee.ote.core.IRemoteUserSession;
+import org.eclipse.osee.ote.core.IUserSession;
import org.eclipse.osee.ote.core.OSEEPerson1_4;
+import org.eclipse.osee.ote.core.OTESessionManager;
import org.eclipse.osee.ote.core.ReturnStatus;
import org.eclipse.osee.ote.core.environment.BundleConfigurationReport;
import org.eclipse.osee.ote.core.environment.BundleDescription;
import org.eclipse.osee.ote.core.environment.TestEnvironmentConfig;
-import org.eclipse.osee.ote.core.environment.UserTestSessionKey;
import org.eclipse.osee.ote.core.environment.interfaces.IHostTestEnvironment;
import org.eclipse.osee.ote.core.environment.interfaces.IRuntimeLibraryManager;
import org.eclipse.osee.ote.core.environment.interfaces.ITestEnvironment;
@@ -50,10 +51,13 @@ public class OteService implements IHostTestEnvironment, IService {
private final EnvironmentCreationParameter environmentCreation;
private final IRuntimeLibraryManager runtimeLibraryManager;
private RegisteredServiceReference registeredServiceReference;
-
- public OteService(IRuntimeLibraryManager runtimeLibraryManager, EnvironmentCreationParameter environmentCreation, PropertyParamter parameterObject, EnhancedProperties properties) {
+ private OTESessionManager oteSessions;
+
+
+ public OteService(IRuntimeLibraryManager runtimeLibraryManager, EnvironmentCreationParameter environmentCreation, OTESessionManager oteSessions, PropertyParamter parameterObject, EnhancedProperties properties) {
this.runtimeLibraryManager = runtimeLibraryManager;
this.environmentCreation = environmentCreation;
+ this.oteSessions = oteSessions;
Uuid uuid = UuidFactory.generate();
Long lsb = Long.valueOf(uuid.getLeastSignificantBits());
@@ -89,7 +93,7 @@ public class OteService implements IHostTestEnvironment, IService {
}
@Override
- public ConnectionRequestResult requestEnvironment(IRemoteUserSession session, TestEnvironmentConfig config) throws RemoteException {
+ public ConnectionRequestResult requestEnvironment(IRemoteUserSession session, UUID sessionId, TestEnvironmentConfig config) throws RemoteException {
try {
OseeLog.log(OteService.class, Level.INFO,
"received request for test environment from user " + session.getUser().getName());
@@ -97,9 +101,10 @@ public class OteService implements IHostTestEnvironment, IService {
createEnvironment();
}
- UserTestSessionKey key = currentEnvironment.addUser(session);
+
+ oteSessions.add(sessionId, session);
updateDynamicInfo();
- return new ConnectionRequestResult(remoteEnvironment, key, new ReturnStatus("Success", true));
+ return new ConnectionRequestResult(remoteEnvironment, sessionId, new ReturnStatus("Success", true));
} catch (Throwable ex) {
OseeLog.log(OteService.class, Level.SEVERE,
"Exception while requesting environment for user " + session.getUser().getName(), ex);
@@ -121,15 +126,14 @@ public class OteService implements IHostTestEnvironment, IService {
Collection<OSEEPerson1_4> userList = new LinkedList<OSEEPerson1_4>();
StringBuilder sb = new StringBuilder();
if (isEnvironmentAvailable()) {
- for (Serializable serializable : currentEnvironment.getUserList()) {
- if (serializable instanceof UserTestSessionKey) {
- try {
- userList.add(((UserTestSessionKey) serializable).getUser());
- } catch (Exception ex) {
- OseeLog.log(RemoteTestEnvironment.class, Level.SEVERE, "exception while getting user list", ex);
- }
- }
- }
+ for(UUID sessionId:oteSessions.get()){
+ IUserSession session = oteSessions.get(sessionId);
+ try {
+ userList.add(session.getUser());
+ } catch (Exception e) {
+ OseeLog.log(OteService.class, Level.SEVERE, e);
+ }
+ }
}
for (OSEEPerson1_4 person : userList) {
sb.append(person.getName());
@@ -185,27 +189,27 @@ public class OteService implements IHostTestEnvironment, IService {
}
@Override
- public void disconnect(UserTestSessionKey key) throws RemoteException {
+ public void disconnect(UUID sessionId) throws RemoteException {
if (currentEnvironment != null) {
- currentEnvironment.disconnect(key);
+ oteSessions.remove(sessionId);
updateDynamicInfo();
- if (currentEnvironment.getUserList().isEmpty() && !environmentCreation.isKeepAliveWithNoUsers()) {
- remoteEnvironment.disconnectAll();
- remoteEnvironment = null;
- }
+// if (oteSessions.get().isEmpty() && !environmentCreation.isKeepAliveWithNoUsers()) {
+// remoteEnvironment.disconnectAll();
+// remoteEnvironment = null;
+// }
}
}
- @Override
- public void disconnectAll() throws RemoteException {
- if (remoteEnvironment != null) {
- remoteEnvironment.disconnectAll();
- updateDynamicInfo();
- if (!environmentCreation.isKeepAliveWithNoUsers()) {
- remoteEnvironment = null;
- }
- }
- }
+// @Override
+// public void disconnectAll() throws RemoteException {
+// if (remoteEnvironment != null) {
+// oteSessions.removeAll();
+// updateDynamicInfo();
+//// if (!environmentCreation.isKeepAliveWithNoUsers()) {
+//// remoteEnvironment = null;
+//// }
+// }
+// }
@Override
public BundleConfigurationReport checkBundleConfiguration(Collection<BundleDescription> bundles) throws RemoteException {
diff --git a/plugins/org.eclipse.osee.ote.server/src/org/eclipse/osee/ote/server/internal/OteServiceStarterCreationHandler.java b/plugins/org.eclipse.osee.ote.server/src/org/eclipse/osee/ote/server/internal/OteServiceStarterCreationHandler.java
deleted file mode 100644
index b9077d4ec37..00000000000
--- a/plugins/org.eclipse.osee.ote.server/src/org/eclipse/osee/ote/server/internal/OteServiceStarterCreationHandler.java
+++ /dev/null
@@ -1,68 +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.ote.server.internal;
-
-import java.util.Map;
-import java.util.logging.Level;
-import org.eclipse.osee.connection.service.IConnectionService;
-import org.eclipse.osee.framework.core.util.AbstractTrackingHandler;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.messaging.MessageService;
-import org.eclipse.osee.framework.messaging.services.RemoteServiceRegistrar;
-import org.eclipse.osee.ote.core.environment.interfaces.IRuntimeLibraryManager;
-import org.eclipse.osee.ote.server.OteServiceStarter;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceRegistration;
-import org.osgi.service.packageadmin.PackageAdmin;
-
-/**
- * @author Andrew M. Finkbeiner
- */
-public class OteServiceStarterCreationHandler extends AbstractTrackingHandler {
-
- private final static Class<?>[] SERVICE_DEPENDENCIES = new Class<?>[] {
- IRuntimeLibraryManager.class,
- RemoteServiceRegistrar.class,
- MessageService.class,
- IConnectionService.class,
- PackageAdmin.class};
- private ServiceRegistration registration;
-
- OteServiceStarterCreationHandler() {
- }
-
- @Override
- public Class<?>[] getDependencies() {
- return SERVICE_DEPENDENCIES;
- }
-
- @Override
- public void onActivate(BundleContext context, Map<Class<?>, Object> services) {
- RemoteServiceRegistrar remoteServiceRegistrar = getService(RemoteServiceRegistrar.class, services);
- MessageService messageService = getService(MessageService.class, services);
- IConnectionService connectionService = getService(IConnectionService.class, services);
- IRuntimeLibraryManager runtimeLibraryManager = getService(IRuntimeLibraryManager.class, services);
- PackageAdmin packateAdmin = getService(PackageAdmin.class, services);
- try {
- OteServiceStarterImpl oteServiceStarterImpl =
- new OteServiceStarterImpl(packateAdmin, runtimeLibraryManager, connectionService, remoteServiceRegistrar,
- messageService);
- registration = context.registerService(OteServiceStarter.class.getName(), oteServiceStarterImpl, null);
- } catch (Exception ex) {
- OseeLog.log(Activator.class, Level.SEVERE, ex);
- }
- }
-
- @Override
- public void onDeActivate() {
- registration.unregister();
- }
-}
diff --git a/plugins/org.eclipse.osee.ote.server/src/org/eclipse/osee/ote/server/internal/OteServiceStarterImpl.java b/plugins/org.eclipse.osee.ote.server/src/org/eclipse/osee/ote/server/internal/OteServiceStarterImpl.java
index 0cf2515bfe0..a373e132b9c 100644
--- a/plugins/org.eclipse.osee.ote.server/src/org/eclipse/osee/ote/server/internal/OteServiceStarterImpl.java
+++ b/plugins/org.eclipse.osee.ote.server/src/org/eclipse/osee/ote/server/internal/OteServiceStarterImpl.java
@@ -40,6 +40,7 @@ import org.eclipse.osee.framework.messaging.services.RegisteredServiceReference;
import org.eclipse.osee.framework.messaging.services.RemoteServiceRegistrar;
import org.eclipse.osee.framework.messaging.services.ServiceInfoPopulator;
import org.eclipse.osee.framework.messaging.services.messages.ServiceDescriptionPair;
+import org.eclipse.osee.ote.core.OTESessionManager;
import org.eclipse.osee.ote.core.OteBaseMessages;
import org.eclipse.osee.ote.core.environment.interfaces.IHostTestEnvironment;
import org.eclipse.osee.ote.core.environment.interfaces.IRuntimeLibraryManager;
@@ -54,24 +55,69 @@ import org.osgi.service.packageadmin.PackageAdmin;
*/
public class OteServiceStarterImpl implements OteServiceStarter, ServiceInfoPopulator, OseeMessagingStatusCallback {
- private final PackageAdmin packageAdmin;
- private final IRuntimeLibraryManager runtimeLibraryManager;
- private final IConnectionService connectionService;
- private final RemoteServiceRegistrar remoteServiceRegistrar;
- private final MessageService messageService;
+ private PackageAdmin packageAdmin;
+ private IRuntimeLibraryManager runtimeLibraryManager;
+ private IConnectionService connectionService;
+ private RemoteServiceRegistrar remoteServiceRegistrar;
+ private MessageService messageService;
private BrokerService brokerService;
private OteService service;
private final ListenForHostRequest listenForHostRequest;
private IServiceConnector serviceSideConnector;
+ private OTESessionManager oteSessions;
- OteServiceStarterImpl(PackageAdmin packageAdmin, IRuntimeLibraryManager runtimeLibraryManager, IConnectionService connectionService, RemoteServiceRegistrar remoteServiceRegistrar, MessageService messageService) {
- this.packageAdmin = packageAdmin;
- this.runtimeLibraryManager = runtimeLibraryManager;
- this.connectionService = connectionService;
- this.remoteServiceRegistrar = remoteServiceRegistrar;
- this.messageService = messageService;
+
+ public void bindOTESessionManager(OTESessionManager oteSessions){
+ this.oteSessions = oteSessions;
+ }
+
+ public void unbindOTESessionManager(OTESessionManager oteSessions){
+ this.oteSessions = null;
+ }
+
+ public void bindIRuntimeLibraryManager(IRuntimeLibraryManager runtimeLibraryManager){
+ this.runtimeLibraryManager = runtimeLibraryManager;
+ }
+
+ public void unbindIRuntimeLibraryManager(IRuntimeLibraryManager runtimeLibraryManager){
+ this.runtimeLibraryManager = null;
+ }
+
+ public void bindRemoteServiceRegistrar(RemoteServiceRegistrar remoteServiceRegistrar){
+ this.remoteServiceRegistrar = remoteServiceRegistrar;
+ }
+
+ public void unbindRemoteServiceRegistrar(RemoteServiceRegistrar remoteServiceRegistrar){
+ this.remoteServiceRegistrar = null;
+ }
+
+ public void bindMessageService(MessageService messageService){
+ this.messageService = messageService;
+ }
+
+ public void unbindMessageService(MessageService messageService){
+ this.messageService = null;
+ }
+
+ public void bindIConnectionService(IConnectionService connectionService){
+ this.connectionService = connectionService;
+ }
+
+ public void unbindIConnectionService(IConnectionService connectionService){
+ this.connectionService = null;
+ }
+
+ public void bindPackageAdmin(PackageAdmin packageAdmin){
+ this.packageAdmin = packageAdmin;
+ }
+
+ public void unbindPackageAdmin(PackageAdmin packageAdmin){
+ this.packageAdmin = null;
+ }
+
+ OteServiceStarterImpl() {
listenForHostRequest = new ListenForHostRequest();
}
@@ -124,7 +170,7 @@ public class OteServiceStarterImpl implements OteServiceStarter, ServiceInfoPopu
environmentFactoryClass, packageAdmin);
service =
- new OteService(runtimeLibraryManager, environmentCreationParameter, propertyParameter,
+ new OteService(runtimeLibraryManager, environmentCreationParameter, oteSessions, propertyParameter,
serviceSideConnector.getProperties());
serviceSideConnector.init(service);
diff --git a/plugins/org.eclipse.osee.ote.server/src/org/eclipse/osee/ote/server/internal/RemoteTestEnvironment.java b/plugins/org.eclipse.osee.ote.server/src/org/eclipse/osee/ote/server/internal/RemoteTestEnvironment.java
index 34f6041e27f..1220fec1a49 100644
--- a/plugins/org.eclipse.osee.ote.server/src/org/eclipse/osee/ote/server/internal/RemoteTestEnvironment.java
+++ b/plugins/org.eclipse.osee.ote.server/src/org/eclipse/osee/ote/server/internal/RemoteTestEnvironment.java
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.osee.ote.server.internal;
-import java.io.Serializable;
import java.rmi.Remote;
import java.rmi.RemoteException;
import java.util.HashMap;
@@ -22,11 +21,8 @@ import java.util.logging.Level;
import org.eclipse.osee.connection.service.IServiceConnector;
import org.eclipse.osee.framework.logging.OseeLog;
import org.eclipse.osee.framework.messaging.Message;
-import org.eclipse.osee.ote.core.IUserSession;
-import org.eclipse.osee.ote.core.OSEEPerson1_4;
import org.eclipse.osee.ote.core.ReturnStatus;
import org.eclipse.osee.ote.core.cmd.Command;
-import org.eclipse.osee.ote.core.environment.UserTestSessionKey;
import org.eclipse.osee.ote.core.environment.interfaces.IRemoteCommandConsole;
import org.eclipse.osee.ote.core.framework.command.ICommandHandle;
import org.eclipse.osee.ote.core.framework.command.ITestServerCommand;
@@ -98,10 +94,6 @@ public class RemoteTestEnvironment implements ITestEnvironmentMessageSystem {
}
}
- public void removeUser(OSEEPerson1_4 user) {
- env.removeUser(user);
- }
-
public ReturnStatus isRunningJarVersions(String[] jarVersions) {
return env.getRuntimeManager().isRunningJarVersions(jarVersions);
}
@@ -188,9 +180,9 @@ public class RemoteTestEnvironment implements ITestEnvironmentMessageSystem {
return env.getUniqueId();
}
- public IUserSession getUserSession(UserTestSessionKey key) {
- return env.getUserSession(key);
- }
+// public IUserSession getUserSession(UserTestSessionKey key) {
+// return env.getUserSession(key);
+// }
private class RemoteModelManager implements IModelManagerRemote {
@@ -283,15 +275,15 @@ public class RemoteTestEnvironment implements ITestEnvironmentMessageSystem {
env.sendMessageToServer(message);
}
- @Override
- public void disconnectAll() throws RemoteException {
- for (Serializable session : env.getSessionKeys()) {
- env.disconnect((UserTestSessionKey) session);
- }
- if (!keepEnvAliveWithNoUsers) {
- messageToolServiceTracker.close();
- closeAllConsoles();
- env.shutdown();
- }
- }
+// @Override
+// public void disconnectAll() throws RemoteException {
+// for (Serializable session : env.getSessionKeys()) {
+// env.disconnect((UserTestSessionKey) session);
+// }
+// if (!keepEnvAliveWithNoUsers) {
+// messageToolServiceTracker.close();
+// closeAllConsoles();
+// env.shutdown();
+// }
+// }
}

Back to the top