diff options
36 files changed, 408 insertions, 355 deletions
diff --git a/plugins/org.eclipse.osee.ote.client.msg/src/org/eclipse/osee/ote/client/msg/core/internal/MessageSubscriptionService.java b/plugins/org.eclipse.osee.ote.client.msg/src/org/eclipse/osee/ote/client/msg/core/internal/MessageSubscriptionService.java index fe6e42004c6..605b8a33707 100644 --- a/plugins/org.eclipse.osee.ote.client.msg/src/org/eclipse/osee/ote/client/msg/core/internal/MessageSubscriptionService.java +++ b/plugins/org.eclipse.osee.ote.client.msg/src/org/eclipse/osee/ote/client/msg/core/internal/MessageSubscriptionService.java @@ -18,6 +18,7 @@ import java.nio.channels.DatagramChannel; import java.rmi.RemoteException; import java.util.List; import java.util.Set; +import java.util.UUID; import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @@ -32,7 +33,6 @@ import org.eclipse.osee.framework.plugin.core.util.ExportClassLoader; import org.eclipse.osee.ote.client.msg.IOteMessageService; import org.eclipse.osee.ote.client.msg.core.IMessageSubscription; import org.eclipse.osee.ote.client.msg.core.db.AbstractMessageDataBase; -import org.eclipse.osee.ote.core.environment.UserTestSessionKey; import org.eclipse.osee.ote.message.Message; import org.eclipse.osee.ote.message.MessageDefinitionProvider; import org.eclipse.osee.ote.message.commands.RecordCommand; @@ -261,7 +261,7 @@ public class MessageSubscriptionService implements IOteMessageService, ITestConn } @Override - public UserTestSessionKey getTestSessionKey() throws RemoteException { + public UUID getTestSessionKey() throws RemoteException { return clientService.getSessionKey(); } diff --git a/plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/ConnectionEvent.java b/plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/ConnectionEvent.java index 30414eb0657..f9f2f179e6c 100644 --- a/plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/ConnectionEvent.java +++ b/plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/ConnectionEvent.java @@ -10,8 +10,9 @@ *******************************************************************************/ package org.eclipse.osee.ote.service; +import java.util.UUID; + import org.eclipse.osee.connection.service.IServiceConnector; -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.ITestEnvironment; @@ -24,11 +25,11 @@ public final class ConnectionEvent { private final ITestEnvironment environment; private final IServiceConnector connector; - private final UserTestSessionKey sessionKey; + private final UUID sessionKey; private final OteServiceProperties props; private final IHostTestEnvironment hostTestEnvironment; - public ConnectionEvent(IHostTestEnvironment hostTestEnvironment, IServiceConnector connector, ITestEnvironment environment, UserTestSessionKey sessionKey) { + public ConnectionEvent(IHostTestEnvironment hostTestEnvironment, IServiceConnector connector, ITestEnvironment environment, UUID sessionKey) { if (connector == null) { throw new NullPointerException("connector cannot be null"); } @@ -62,7 +63,7 @@ public final class ConnectionEvent { * * @return the sessionKey */ - public UserTestSessionKey getSessionKey() { + public UUID getSessionKey() { return sessionKey; } diff --git a/plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/IOteClientService.java b/plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/IOteClientService.java index a7690f80b35..586d0672741 100644 --- a/plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/IOteClientService.java +++ b/plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/IOteClientService.java @@ -12,11 +12,11 @@ package org.eclipse.osee.ote.service; import java.net.InetAddress; import java.util.List; +import java.util.UUID; import org.eclipse.osee.connection.service.IServiceConnector; import org.eclipse.osee.ote.core.OSEEPerson1_4; 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.ITestEnvironment; @@ -104,5 +104,5 @@ public interface IOteClientService { IServiceConnector getConnector(IHostTestEnvironment host); - UserTestSessionKey getSessionKey(); + UUID getSessionKey(); } diff --git a/plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/core/ClientSession.java b/plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/core/ClientSession.java index 3aa6eaf61ff..cc1d415d46a 100644 --- a/plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/core/ClientSession.java +++ b/plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/core/ClientSession.java @@ -12,9 +12,11 @@ package org.eclipse.osee.ote.service.core; import java.net.InetAddress; import java.rmi.RemoteException; +import java.util.UUID; import java.util.concurrent.TimeUnit; import java.util.concurrent.locks.ReentrantLock; import java.util.logging.Level; + import org.eclipse.osee.connection.service.IServiceConnector; import org.eclipse.osee.framework.logging.OseeLevel; import org.eclipse.osee.framework.logging.OseeLog; @@ -167,8 +169,9 @@ public class ClientSession extends AbstractRemoteSession { if (lock.tryLock(TIMEOUT, TimeUnit.MINUTES)) { try { IRemoteUserSession exportedSession = (IRemoteUserSession) connector.export(this); + UUID id = UUID.randomUUID(); Thread.currentThread().setContextClassLoader(ExportClassLoader.getInstance()); - ConnectionRequestResult result = testHost.requestEnvironment(exportedSession, config); + ConnectionRequestResult result = testHost.requestEnvironment(exportedSession, id, config); if (result.getStatus().getStatus()) { return new TestHostConnection(connector, testHost, result.getEnvironment(), result.getSessionKey()); } else { diff --git a/plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/core/TestClientServiceImpl.java b/plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/core/TestClientServiceImpl.java index df44c701157..7024cf2a6da 100644 --- a/plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/core/TestClientServiceImpl.java +++ b/plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/core/TestClientServiceImpl.java @@ -20,6 +20,7 @@ import java.util.HashSet; import java.util.List; import java.util.Map.Entry; import java.util.Set; +import java.util.UUID; import java.util.logging.Level; import org.eclipse.osee.connection.service.IConnectionService; @@ -28,7 +29,6 @@ import org.eclipse.osee.connection.service.IServiceConnector; import org.eclipse.osee.framework.jdk.core.util.EnhancedProperties; import org.eclipse.osee.ote.core.OSEEPerson1_4; 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.ITestEnvironment; import org.eclipse.osee.ote.service.Activator; @@ -268,7 +268,7 @@ public class TestClientServiceImpl implements IOteClientService, IConnectorListe } @Override - public synchronized UserTestSessionKey getSessionKey() { + public synchronized UUID getSessionKey() { return testConnection != null ? testConnection.getSessionKey() : null; } diff --git a/plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/core/TestHostConnection.java b/plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/core/TestHostConnection.java index f5948cecb62..6680b6b0f5f 100644 --- a/plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/core/TestHostConnection.java +++ b/plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/core/TestHostConnection.java @@ -11,9 +11,9 @@ package org.eclipse.osee.ote.service.core; import java.rmi.RemoteException; +import java.util.UUID; import org.eclipse.osee.connection.service.IServiceConnector; -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.ITestEnvironment; @@ -27,11 +27,11 @@ class TestHostConnection { private final IServiceConnector serviceConnector; private final ITestEnvironment connectEnvironment; - private final UserTestSessionKey sessionKey; + private final UUID sessionKey; private final IHostTestEnvironment host; private String serverId; - TestHostConnection(IServiceConnector connector, IHostTestEnvironment host, ITestEnvironment connectEnvironment, UserTestSessionKey sessionKey) { + TestHostConnection(IServiceConnector connector, IHostTestEnvironment host, ITestEnvironment connectEnvironment, UUID uuid) { // intentionally package-private if (connector == null) { throw new NullPointerException("service connector cannot be null"); @@ -39,13 +39,13 @@ class TestHostConnection { if (connectEnvironment == null) { throw new NullPointerException("test environment cannot be null"); } - if (sessionKey == null) { + if (uuid == null) { throw new NullPointerException("session key cannot be null"); } this.serviceConnector = connector; this.host = host; this.connectEnvironment = connectEnvironment; - this.sessionKey = sessionKey; + this.sessionKey = uuid; try { this.serverId = (String) host.getProperties().getProperty("id"); } catch (RemoteException e) { @@ -70,7 +70,7 @@ class TestHostConnection { /** * @return the sessionKey */ - public UserTestSessionKey getSessionKey() { + public UUID getSessionKey() { return sessionKey; } diff --git a/plugins/org.eclipse.osee.ote.core/OSGI-INF/MessageToolServiceComponent.xml b/plugins/org.eclipse.osee.ote.core/OSGI-INF/MessageToolServiceComponent.xml index 33d062c9541..212fbc4a2e9 100644 --- a/plugins/org.eclipse.osee.ote.core/OSGI-INF/MessageToolServiceComponent.xml +++ b/plugins/org.eclipse.osee.ote.core/OSGI-INF/MessageToolServiceComponent.xml @@ -5,4 +5,5 @@ <provide interface="org.eclipse.osee.ote.message.interfaces.IRemoteMessageService"/> </service> <reference bind="bindMessageManager" cardinality="1..1" interface="org.eclipse.osee.ote.message.interfaces.IMessageManager" name="IMessageManager" policy="static" unbind="unbindMessageManager"/> + <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.core/OSGI-INF/ote.sessions.xml b/plugins/org.eclipse.osee.ote.core/OSGI-INF/ote.sessions.xml new file mode 100644 index 00000000000..3ec872fd864 --- /dev/null +++ b/plugins/org.eclipse.osee.ote.core/OSGI-INF/ote.sessions.xml @@ -0,0 +1,12 @@ +<?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.core.OTESessionManager"> + <implementation class="org.eclipse.osee.ote.core.internal.OTESessionManagerImpl"/> + <service> + <provide interface="org.eclipse.osee.ote.core.OTESessionManager"/> + </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"/> +</scr:component> diff --git a/plugins/org.eclipse.osee.ote.core/build.properties b/plugins/org.eclipse.osee.ote.core/build.properties index f497f235f2c..51f7206af4d 100644 --- a/plugins/org.eclipse.osee.ote.core/build.properties +++ b/plugins/org.eclipse.osee.ote.core/build.properties @@ -3,5 +3,6 @@ bin.includes = plugin.xml,\ META-INF/,\ images/,\ .,\ - OSGI-INF/ + OSGI-INF/,\ + OSGI-INF/ote.sessions.xml source.. = src/ diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/ConnectionRequestResult.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/ConnectionRequestResult.java index 02e3da2b256..ba38789b770 100644 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/ConnectionRequestResult.java +++ b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/ConnectionRequestResult.java @@ -11,7 +11,8 @@ package org.eclipse.osee.ote.core; import java.io.Serializable; -import org.eclipse.osee.ote.core.environment.UserTestSessionKey; +import java.util.UUID; + import org.eclipse.osee.ote.core.environment.interfaces.ITestEnvironment; /** @@ -20,12 +21,12 @@ import org.eclipse.osee.ote.core.environment.interfaces.ITestEnvironment; public class ConnectionRequestResult implements Serializable { private static final long serialVersionUID = -2269465634573908989L; private final ITestEnvironment environment; - private final UserTestSessionKey sessionKey; + private final UUID sessionKey; private final ReturnStatus status; - public ConnectionRequestResult(ITestEnvironment environment, UserTestSessionKey sessionKey, ReturnStatus status) { + public ConnectionRequestResult(ITestEnvironment environment, UUID sessionId, ReturnStatus status) { this.environment = environment; - this.sessionKey = sessionKey; + this.sessionKey = sessionId; this.status = status; } @@ -39,7 +40,7 @@ public class ConnectionRequestResult implements Serializable { /** * @return the sessionKey */ - public UserTestSessionKey getSessionKey() { + public UUID getSessionKey() { return sessionKey; } diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/OTESessionManager.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/OTESessionManager.java new file mode 100644 index 00000000000..51dbdae9b2f --- /dev/null +++ b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/OTESessionManager.java @@ -0,0 +1,13 @@ +package org.eclipse.osee.ote.core; + +import java.util.Set; +import java.util.UUID; + +public interface OTESessionManager { + void add(UUID sessionId, IUserSession session); + void remove(UUID sessionId); + IUserSession get(UUID sessionId); + Set<UUID> get(); + IUserSession getActiveUser();//?? + void setActiveUser(UUID sessionId);//?? +} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/TestScript.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/TestScript.java index bda4c40ffc1..d2e217c41d2 100644 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/TestScript.java +++ b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/TestScript.java @@ -48,6 +48,7 @@ import org.eclipse.osee.ote.core.framework.prompt.YesNoPromptImpl; import org.eclipse.osee.ote.core.framework.prompt.YesNoPromptResult; import org.eclipse.osee.ote.core.framework.testrun.ITestRunListener; import org.eclipse.osee.ote.core.framework.testrun.ITestRunListenerProvider; +import org.eclipse.osee.ote.core.internal.ServiceUtility; import org.eclipse.osee.ote.core.log.ITestPointTally; import org.eclipse.osee.ote.core.log.record.AttentionRecord; import org.eclipse.osee.ote.core.log.record.ScriptResultRecord; @@ -196,7 +197,7 @@ public abstract class TestScript implements ITimeout { public TestScript(TestEnvironment environment, IUserSession callback, ScriptTypeEnum scriptType, boolean isBatchable) { constructed.incrementAndGet(); this.scriptType = scriptType; - this.userSession = callback; + this.userSession = ServiceUtility.getService(OTESessionManager.class).getActiveUser(); this.isBatchable = isBatchable; this.isMpLevel = false; diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/OteServerSideEndpointSender.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/OteServerSideEndpointSender.java index 0f72c7cb222..72675b45b2c 100644 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/OteServerSideEndpointSender.java +++ b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/OteServerSideEndpointSender.java @@ -11,6 +11,8 @@ package org.eclipse.osee.ote.core.environment; import java.util.Properties; +import java.util.UUID; + import org.eclipse.osee.framework.messaging.EndpointSend; import org.eclipse.osee.framework.messaging.ExceptionHandler; import org.eclipse.osee.framework.messaging.Message; @@ -18,7 +20,8 @@ import org.eclipse.osee.framework.messaging.id.ProtocolId; import org.eclipse.osee.framework.messaging.id.StringName; import org.eclipse.osee.framework.messaging.id.StringNamespace; import org.eclipse.osee.framework.messaging.id.StringProtocolId; -import org.eclipse.osee.ote.core.IUserSession; +import org.eclipse.osee.ote.core.OTESessionManager; +import org.eclipse.osee.ote.core.internal.ServiceUtility; /** * @author Andrew M. Finkbeiner @@ -37,8 +40,9 @@ public class OteServerSideEndpointSender implements EndpointSend { @Override public void send(Message message, ExceptionHandler exceptionHandler) { try { - for (IUserSession session : testEnvironment.getUserSessions()) { - session.sendMessageToClient(message); + OTESessionManager sessionManager = ServiceUtility.getService(OTESessionManager.class); + for(UUID id:sessionManager.get()){ + sessionManager.get(id).sendMessageToClient(message); } } catch (Throwable th) { exceptionHandler.handleException(th); diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/ReportDataControl.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/ReportDataControl.java index 2595e995f7a..c88b60cd4b2 100644 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/ReportDataControl.java +++ b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/ReportDataControl.java @@ -14,6 +14,7 @@ import java.rmi.RemoteException; import java.util.ArrayList; import java.util.List; import java.util.logging.Level; + import org.eclipse.osee.framework.jdk.core.reportdata.ReportData; import org.eclipse.osee.framework.jdk.core.reportdata.ReportDataListener; import org.eclipse.osee.framework.logging.OseeLog; @@ -70,7 +71,7 @@ public class ReportDataControl implements IReportData { for (int i = 0; i < cmds.size(); i++) { TestEnvironmentCommand cmd = cmds.get(i); values = new ArrayList<String>(); - values.add(cmd.getUser() == null ? "unknown" : cmd.getUser().getName()); +// values.add(cmd.getUser() == null ? "unknown" : cmd.getUser().getName()); values.add(cmd.getDescription().getDescription()); queueData.addItem(cmd.getDescription().getGuid(), values); } diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/TestEnvironment.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/TestEnvironment.java index fc4ccfb9466..3b174098c17 100644 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/TestEnvironment.java +++ b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/TestEnvironment.java @@ -14,7 +14,6 @@ import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; -import java.io.Serializable; import java.net.InetAddress; import java.net.URI; import java.net.URISyntaxException; @@ -49,8 +48,6 @@ import org.eclipse.osee.framework.messaging.Message; import org.eclipse.osee.framework.messaging.MessagingGateway; import org.eclipse.osee.framework.messaging.NodeInfo; import org.eclipse.osee.ote.core.GCHelper; -import org.eclipse.osee.ote.core.IUserSession; -import org.eclipse.osee.ote.core.OSEEPerson1_4; import org.eclipse.osee.ote.core.OseeTestThread; import org.eclipse.osee.ote.core.OteProperties; import org.eclipse.osee.ote.core.TestScript; @@ -87,8 +84,6 @@ public abstract class TestEnvironment implements TestEnvironmentInterface, ITest private File outDir = null; private final ITestStation testStation; - private final HashMap<Serializable, Object> users; - private volatile IUserSession activeUser = null; private boolean batchMode = false; private final HashMap<String, Remote> controlInterfaces = new HashMap<String, Remote>(); private final IEnvironmentFactory factory; @@ -130,10 +125,8 @@ public abstract class TestEnvironment implements TestEnvironmentInterface, ITest this.associatedObjectListeners = new HashMap<Class<?>, ArrayList<IAssociatedObjectListener>>(); this.associatedObjects = new HashMap<Class<?>, Object>(100); this.batchMode = OteProperties.isOseeOteInBatchModeEnabled(); - this.users = new HashMap<Serializable, Object>(32); messagingServiceTracker = setupOteMessagingSenderAndReceiver(); - } public void init(IServiceConnector connector) { @@ -248,13 +241,6 @@ public abstract class TestEnvironment implements TestEnvironmentInterface, ITest return true; } - @Override - public UserTestSessionKey addUser(IUserSession user) throws Exception { - UserTestSessionKey key = new UserTestSessionKey(user.getUser()); - users.put(key, user); - return key; - } - public boolean equals(ITestEnvironment testEnvironment) throws RemoteException { if (testEnvironment.getUniqueId() == getUniqueId()) { return true; @@ -288,11 +274,6 @@ public abstract class TestEnvironment implements TestEnvironmentInterface, ITest @Override public abstract Object getModel(String modelClassName); - /* - * public Remote getRemoteModel(String modelClassName) throws RemoteException { return getRemoteModel(modelClassName, - * new Class[] {}, new Object[] {}); } - */ - @Override public IScriptControl getScriptCtrl() { return factory.getScriptControl(); @@ -334,46 +315,11 @@ public abstract class TestEnvironment implements TestEnvironmentInterface, ITest return this.hashCode(); } - @Override - public ArrayList<Serializable> getUserList() { - return new ArrayList<Serializable>(getSessionKeys()); - } - - @Override - public void disconnect(final UserTestSessionKey key) throws RemoteException { - try { - OseeLog.log(TestEnvironment.class, Level.INFO, "Disconnecting user " + getUserSession(key).getUser().getName()); - } catch (Exception ex) { - OseeLog.log(TestEnvironment.class, Level.INFO, "problem with accessing user name from the useer session"); - } - users.remove(key); - } - - @Override - public Set<Serializable> getSessionKeys() { - return users.keySet(); - } - - @Override - public IUserSession getUserSession(final UserTestSessionKey key) { - return (IUserSession) users.get(key); - } - private final void removeAllTasks() { factory.getTimerControl().cancelAllTasks(); } @Override - public void removeUser(OSEEPerson1_4 user) { - if (users.containsKey(user)) { - users.put(user, Integer.valueOf(((Integer) users.get(user)).intValue() - 1)); - if (((Integer) users.get(user)).intValue() == 0) { - users.remove(user); - } - } - } - - @Override public URL setBatchLibJar(byte[] batchJar) throws IOException { String path = System.getProperty("user.home") + File.separator + TestEnvironment.class.getName(); @@ -441,8 +387,6 @@ public abstract class TestEnvironment implements TestEnvironmentInterface, ITest if (getRunManager() != null) { getRunManager().clearAllListeners(); } - users.clear(); - } protected abstract void loadExternalDrivers(); @@ -459,16 +403,6 @@ public abstract class TestEnvironment implements TestEnvironmentInterface, ITest } - @Override - public IUserSession getActiveUser() { - return activeUser; - } - - @Override - public void setActiveUser(UserTestSessionKey key) { - activeUser = (IUserSession) users.get(key); - } - protected void cleanupClassReferences() { OseeLog.log(TestEnvironment.class, Level.FINE, "cleanupreferences"); @@ -497,17 +431,6 @@ public abstract class TestEnvironment implements TestEnvironmentInterface, ITest } @Override - public List<IUserSession> getUserSessions() { - List<IUserSession> people = new ArrayList<IUserSession>(); - for (Object user : users.values()) { - if (user instanceof IUserSession) { - people.add((IUserSession) user); - } - } - return people; - } - - @Override public Remote getControlInterface(String id) { return controlInterfaces.get(id); } diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/TestEnvironmentInterface.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/TestEnvironmentInterface.java index 9a6f04e8722..f34edf3424b 100644 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/TestEnvironmentInterface.java +++ b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/TestEnvironmentInterface.java @@ -12,19 +12,14 @@ package org.eclipse.osee.ote.core.environment; import java.io.File; import java.io.IOException; -import java.io.Serializable; import java.net.URL; import java.rmi.Remote; import java.rmi.RemoteException; import java.rmi.server.ExportException; -import java.util.ArrayList; import java.util.List; -import java.util.Set; import java.util.concurrent.Callable; import org.eclipse.osee.connection.service.IServiceConnector; -import org.eclipse.osee.ote.core.IUserSession; -import org.eclipse.osee.ote.core.OSEEPerson1_4; import org.eclipse.osee.ote.core.environment.interfaces.ICancelTimer; import org.eclipse.osee.ote.core.environment.interfaces.IEnvironmentFactory; import org.eclipse.osee.ote.core.environment.interfaces.IExecutionUnitManagement; @@ -60,8 +55,6 @@ public interface TestEnvironmentInterface { public boolean addTask(EnvironmentTask task); - public UserTestSessionKey addUser(IUserSession user) throws Exception; - public long getEnvTime(); public IExecutionUnitManagement getExecutionUnitManagement(); @@ -82,30 +75,14 @@ public interface TestEnvironmentInterface { public int getUniqueId(); - public ArrayList<Serializable> getUserList(); - - public void disconnect(final UserTestSessionKey key) throws RemoteException; - - public Set<Serializable> getSessionKeys(); - - public IUserSession getUserSession(final UserTestSessionKey key); - - public void removeUser(OSEEPerson1_4 user); - public URL setBatchLibJar(byte[] batchJar) throws IOException; public ICancelTimer setTimerFor(ITimeout listener, int time); public void shutdown(); - public IUserSession getActiveUser(); - - public void setActiveUser(UserTestSessionKey key); - public File getOutDir(); - public List<IUserSession> getUserSessions(); - public Remote getControlInterface(String id); public void registerControlInterface(String id, Remote controlInterface); diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/UserTestSessionKey.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/UserTestSessionKey.java deleted file mode 100644 index f5a0ec7dd0c..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/UserTestSessionKey.java +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 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.core.environment; - -import java.io.Serializable; -import org.eclipse.osee.ote.core.OSEEPerson1_4; - -public final class UserTestSessionKey implements Serializable { - - private static final long serialVersionUID = -1445868944158880309L; - - private final long value; - private final OSEEPerson1_4 user; - - public UserTestSessionKey(OSEEPerson1_4 user) { - this.user = user; - value = System.nanoTime(); - } - - long getKeyValue() { - return value; - } - - @Override - public boolean equals(Object obj) { - if (obj instanceof UserTestSessionKey) { - final UserTestSessionKey other = (UserTestSessionKey) obj; - return other.value == this.value; - } else { - return false; - } - } - - @Override - public int hashCode() { - return (int) (value ^ value >>> 32); - } - - public OSEEPerson1_4 getUser() { - return user; - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/command/TestEnvironmentCommand.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/command/TestEnvironmentCommand.java index fd07c79b591..5fcef4eeeb0 100644 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/command/TestEnvironmentCommand.java +++ b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/command/TestEnvironmentCommand.java @@ -11,10 +11,10 @@ package org.eclipse.osee.ote.core.environment.command; import java.io.Serializable; -import org.eclipse.osee.ote.core.OSEEPerson1_4; +import java.util.UUID; + import org.eclipse.osee.ote.core.TestException; import org.eclipse.osee.ote.core.environment.TestEnvironment; -import org.eclipse.osee.ote.core.environment.UserTestSessionKey; import org.eclipse.osee.ote.core.environment.interfaces.IServiceCommand; /** @@ -23,15 +23,15 @@ import org.eclipse.osee.ote.core.environment.interfaces.IServiceCommand; */ public abstract class TestEnvironmentCommand implements Serializable, IServiceCommand { private static final long serialVersionUID = -921447917279635626L; - private final UserTestSessionKey key; + private final UUID key; private final CommandDescription commandDescription; - public TestEnvironmentCommand(UserTestSessionKey key, CommandDescription commandDescription) { + public TestEnvironmentCommand(UUID key, CommandDescription commandDescription) { this.key = key; this.commandDescription = commandDescription; } - public UserTestSessionKey getUserKey() { + public UUID getUserKey() { return key; } @@ -46,8 +46,4 @@ public abstract class TestEnvironmentCommand implements Serializable, IServiceCo return commandDescription; } - public OSEEPerson1_4 getUser() { - return key.getUser(); - } - }
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/IHostTestEnvironment.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/IHostTestEnvironment.java index eb7a67111bd..98cc4518579 100644 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/IHostTestEnvironment.java +++ b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/IHostTestEnvironment.java @@ -13,6 +13,7 @@ package org.eclipse.osee.ote.core.environment.interfaces; import java.rmi.Remote; import java.rmi.RemoteException; import java.util.Collection; +import java.util.UUID; import org.eclipse.osee.framework.jdk.core.util.EnhancedProperties; import org.eclipse.osee.framework.messaging.NodeInfo; @@ -21,7 +22,6 @@ import org.eclipse.osee.ote.core.IRemoteUserSession; 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; /** * @author Andrew M. Finkbeiner @@ -29,9 +29,8 @@ import org.eclipse.osee.ote.core.environment.UserTestSessionKey; public interface IHostTestEnvironment extends Remote { EnhancedProperties getProperties() throws RemoteException; - ConnectionRequestResult requestEnvironment(IRemoteUserSession session, TestEnvironmentConfig config) throws RemoteException; - void disconnect(UserTestSessionKey key) throws RemoteException; - void disconnectAll() throws RemoteException; + ConnectionRequestResult requestEnvironment(IRemoteUserSession session, UUID id, TestEnvironmentConfig config) throws RemoteException; + void disconnect(UUID sessionId) throws RemoteException; BundleConfigurationReport checkBundleConfiguration(Collection<BundleDescription> bundles) throws RemoteException; void sendRuntimeBundle(Collection<BundleDescription> bundles) throws RemoteException; diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/ITestEnvironment.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/ITestEnvironment.java index d947fc9d93f..d927e3d0370 100644 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/ITestEnvironment.java +++ b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/ITestEnvironment.java @@ -43,5 +43,5 @@ public interface ITestEnvironment extends Remote { public void sendMessage(Message message) throws RemoteException; - void disconnectAll() throws RemoteException; +// void disconnectAll() throws RemoteException; }
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/BaseCommandManager.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/BaseCommandManager.java index 0fbc3016ee7..a74bc3e9a64 100644 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/BaseCommandManager.java +++ b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/BaseCommandManager.java @@ -17,23 +17,19 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; +import org.eclipse.osee.ote.core.OTESessionManager; import org.eclipse.osee.ote.core.environment.TestEnvironment; import org.eclipse.osee.ote.core.environment.status.OTEStatusBoard; import org.eclipse.osee.ote.core.framework.thread.OteThreadManager; -import org.osgi.framework.FrameworkUtil; -import org.osgi.util.tracker.ServiceTracker; +import org.eclipse.osee.ote.core.internal.ServiceUtility; public class BaseCommandManager implements ICommandManager { private final ExecutorService commands; private final ExecutorService commandResponse; private final Map<ITestServerCommand, Future<ITestCommandResult>> cmdMap; - private OTEStatusBoard oteStatusBoard; public BaseCommandManager() { - ServiceTracker<OTEStatusBoard, OTEStatusBoard> tracker = new ServiceTracker<OTEStatusBoard, OTEStatusBoard>(FrameworkUtil.getBundle(getClass()).getBundleContext(), OTEStatusBoard.class, null); - tracker.open(true); - oteStatusBoard = tracker.getService(); OteThreadManager threadManager = OteThreadManager.getInstance(); commands = Executors.newSingleThreadExecutor(threadManager.createNewFactory("ote.command")); commandResponse = Executors.newSingleThreadExecutor(threadManager.createNewFactory("ote.command.response")); @@ -42,8 +38,11 @@ public class BaseCommandManager implements ICommandManager { @Override public ICommandHandle addCommand(ITestServerCommand cmd, TestEnvironment context) throws ExportException { + OTEStatusBoard statusBoard = ServiceUtility.getService(OTEStatusBoard.class); + OTESessionManager sessionManager = ServiceUtility.getService(OTESessionManager.class); + Future<ITestCommandResult> result = - commands.submit(new TestCallableWrapper(this, cmd, context,oteStatusBoard)); + commands.submit(new TestCallableWrapper(this, cmd, context,statusBoard, sessionManager)); cmdMap.put(cmd, result); return cmd.createCommandHandle(result, context); } diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/ITestContext.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/ITestContext.java index 1cf9907bc7f..3d4f4032e9e 100644 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/ITestContext.java +++ b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/ITestContext.java @@ -11,15 +11,13 @@ package org.eclipse.osee.ote.core.framework.command; import java.io.File; + import org.eclipse.osee.connection.service.IServiceConnector; -import org.eclipse.osee.ote.core.environment.UserTestSessionKey; import org.eclipse.osee.ote.core.framework.IRunManager; public interface ITestContext { IRunManager getRunManager(); - void setActiveUser(UserTestSessionKey key); - File getOutDir(); IServiceConnector getConnector(); diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/ITestServerCommand.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/ITestServerCommand.java index 05ada01254d..ffd304a9764 100644 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/ITestServerCommand.java +++ b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/ITestServerCommand.java @@ -11,14 +11,15 @@ package org.eclipse.osee.ote.core.framework.command; import java.rmi.server.ExportException; +import java.util.UUID; import java.util.concurrent.Future; + import org.eclipse.osee.ote.core.environment.TestEnvironment; -import org.eclipse.osee.ote.core.environment.UserTestSessionKey; import org.eclipse.osee.ote.core.environment.status.OTEStatusBoard; public interface ITestServerCommand { - UserTestSessionKey getUserSessionKey(); + UUID getUserSessionKey(); ICommandHandle createCommandHandle(Future<ITestCommandResult> result, ITestContext context) throws ExportException; diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/TestCallableWrapper.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/TestCallableWrapper.java index c6f20f3ed9f..70ca276bac2 100644 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/TestCallableWrapper.java +++ b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/TestCallableWrapper.java @@ -12,7 +12,9 @@ package org.eclipse.osee.ote.core.framework.command; import java.util.concurrent.Callable; import java.util.logging.Level; + import org.eclipse.osee.framework.logging.OseeLog; +import org.eclipse.osee.ote.core.OTESessionManager; import org.eclipse.osee.ote.core.environment.TestEnvironment; import org.eclipse.osee.ote.core.environment.status.OTEStatusBoard; @@ -22,19 +24,21 @@ public class TestCallableWrapper implements Callable<ITestCommandResult> { private final TestEnvironment context; private final BaseCommandManager cmdManager; private final OTEStatusBoard statusBoard; + private final OTESessionManager sessionManager; - public TestCallableWrapper(BaseCommandManager cmdManager, ITestServerCommand cmd, TestEnvironment context, OTEStatusBoard statusBoard) { + public TestCallableWrapper(BaseCommandManager cmdManager, ITestServerCommand cmd, TestEnvironment context, OTEStatusBoard statusBoard, OTESessionManager sessionManager) { this.cmd = cmd; this.context = context; this.cmdManager = cmdManager; this.statusBoard = statusBoard; + this.sessionManager = sessionManager; } @Override public ITestCommandResult call() throws Exception { ITestCommandResult result; try { - context.setActiveUser(cmd.getUserSessionKey()); + sessionManager.setActiveUser(cmd.getUserSessionKey()); result = cmd.execute(context, statusBoard); if (result.getThrowable() != null) { OseeLog.log(TestCallableWrapper.class, Level.SEVERE, result.getThrowable()); diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/internal/OTESessionManagerImpl.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/internal/OTESessionManagerImpl.java new file mode 100644 index 00000000000..b28a212cd6c --- /dev/null +++ b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/internal/OTESessionManagerImpl.java @@ -0,0 +1,51 @@ +package org.eclipse.osee.ote.core.internal; + +import java.util.Map; +import java.util.Set; +import java.util.UUID; +import java.util.concurrent.ConcurrentHashMap; + +import org.eclipse.osee.ote.core.IUserSession; +import org.eclipse.osee.ote.core.OTESessionManager; + +public class OTESessionManagerImpl implements OTESessionManager { + + private Map<UUID, IUserSession> userMap; + + public OTESessionManagerImpl(){ + userMap = new ConcurrentHashMap<UUID, IUserSession>(); + } + + @Override + public void add(UUID sessionId, IUserSession session) { + userMap.put(sessionId, session); + } + + @Override + public void remove(UUID sessionId) { + userMap.remove(sessionId); + } + + @Override + public IUserSession get(UUID sessionId) { + return userMap.get(sessionId); + } + + @Override + public Set<UUID> get() { + return userMap.keySet(); + } + + @Override + public IUserSession getActiveUser() { + // TODO Auto-generated method stub + return null; + } + + @Override + public void setActiveUser(UUID sessionId) { + // TODO Auto-generated method stub + + } + +} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/internal/ServiceUtility.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/internal/ServiceUtility.java new file mode 100644 index 00000000000..061e3e5e15d --- /dev/null +++ b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/internal/ServiceUtility.java @@ -0,0 +1,112 @@ +/******************************************************************************* + * Copyright (c) 2013 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.core.internal; + +import java.util.logging.Level; + +import org.eclipse.osee.framework.logging.OseeLog; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.FrameworkUtil; +import org.osgi.framework.InvalidSyntaxException; +import org.osgi.framework.ServiceReference; +/** + * @author Michael P. Masterson + */ +public class ServiceUtility { + public static Class<ServiceUtility> getClazz(){ + return ServiceUtility.class; + } + + public static <T> T getService(Class<T> clazz){ + return getService(clazz, true); + } + + @SuppressWarnings({ "rawtypes", "unchecked" }) + public static <T> T[] getServices(Class<T> clazz) throws InvalidSyntaxException{ + ServiceReference[] serviceReferences = getContext().getServiceReferences(clazz.getName(), null); + T[] data = (T[])new Object[serviceReferences.length]; + for(int i = 0; i < serviceReferences.length; i ++){ + data[i] = (T)getContext().getService(serviceReferences[i]); + } + return data; + } + + public static BundleContext getContext(){ + Bundle bundle = FrameworkUtil.getBundle(getClazz()); + if(bundle == null){ + return null; + } + return bundle.getBundleContext(); + } + + @SuppressWarnings({ "rawtypes", "unchecked" }) + public static Object getService(String clazz) { + BundleContext context = getContext(); + if(context == null){ + OseeLog.log(ServiceUtility.class, Level.SEVERE, "Unable to get service " + clazz); + return null; + } + ServiceReference serviceReference = context.getServiceReference(clazz); + if(serviceReference == null){ + OseeLog.log(ServiceUtility.class, Level.SEVERE, "Unable to get service " + clazz); + return null; + } + Object obj = getContext().getService(serviceReference); + if(obj == null){ + OseeLog.log(ServiceUtility.class, Level.SEVERE, "Unable to get service " + clazz); + } + return obj; + } + + @SuppressWarnings({ "rawtypes", "unchecked" }) + private static <T> T getService(Class<T> clazz, boolean logit) { + BundleContext context = getContext(); + if(context == null){ + if(logit){ + OseeLog.log(ServiceUtility.class, Level.SEVERE, "Unable to get service " + clazz.getName()); + } + return null; + } + ServiceReference serviceReference = context.getServiceReference(clazz.getName()); + if(serviceReference == null){ + if(logit){ + OseeLog.log(ServiceUtility.class, Level.SEVERE, "Unable to get service " + clazz.getName()); + } + return null; + } + T obj = (T)getContext().getService(serviceReference); + if(obj == null && logit){ + OseeLog.log(ServiceUtility.class, Level.SEVERE, "Unable to get service " + clazz.getName()); + } + return obj; + } + + public static <T> T getService(Class<T> clazz, int waitTimeMs) { + int count = 1; + if(waitTimeMs > 50){ + count = waitTimeMs/50; + } + + T obj = getService(clazz, false); + if(obj == null){ + for(int i = 0; i < count && obj == null; i++){ + try{ + Thread.sleep(50); + } catch (InterruptedException ex){ + } + obj = getService(clazz, false); + } + } + return obj; + } +} + diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/interfaces/IMsgToolServiceClient.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/interfaces/IMsgToolServiceClient.java index 8792a981362..57790937f75 100644 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/interfaces/IMsgToolServiceClient.java +++ b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/interfaces/IMsgToolServiceClient.java @@ -13,7 +13,8 @@ package org.eclipse.osee.ote.message.interfaces; import java.net.InetSocketAddress; import java.rmi.Remote; import java.rmi.RemoteException; -import org.eclipse.osee.ote.core.environment.UserTestSessionKey; +import java.util.UUID; + import org.eclipse.osee.ote.message.enums.DataType; public interface IMsgToolServiceClient extends Remote { @@ -23,5 +24,5 @@ public interface IMsgToolServiceClient extends Remote { void changeIsScheduled(String msgName, boolean isScheduled) throws RemoteException; - UserTestSessionKey getTestSessionKey() throws RemoteException; + UUID getTestSessionKey() throws RemoteException; } diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/AbstractMessageToolService.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/AbstractMessageToolService.java index 0a4991d680e..a1334c70135 100644 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/AbstractMessageToolService.java +++ b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/AbstractMessageToolService.java @@ -30,12 +30,14 @@ import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Set; +import java.util.UUID; import java.util.concurrent.atomic.AtomicInteger; import java.util.logging.Level; import org.eclipse.osee.framework.jdk.core.util.network.PortUtil; import org.eclipse.osee.framework.logging.OseeLog; -import org.eclipse.osee.ote.core.environment.UserTestSessionKey; +import org.eclipse.osee.ote.core.IUserSession; +import org.eclipse.osee.ote.core.OTESessionManager; import org.eclipse.osee.ote.core.environment.interfaces.ITestEnvironmentAccessor; import org.eclipse.osee.ote.core.internal.Activator; import org.eclipse.osee.ote.message.Message; @@ -86,6 +88,8 @@ public class AbstractMessageToolService implements IRemoteMessageService { private final AtomicInteger idCounter = new AtomicInteger(0x0DEF0000); private InetSocketAddress xmitAddress; + + private OTESessionManager sessionManager; private static final class ClientInfo { private final IMsgToolServiceClient remoteReference; @@ -368,6 +372,13 @@ public class AbstractMessageToolService implements IRemoteMessageService { this.messageManager = null; } + public void bindOTESessionManager(OTESessionManager sessionManager){ + this.sessionManager = sessionManager; + } + + public void unbindOTESessionManager(OTESessionManager sessionManager){ + this.sessionManager = null; + } private void openXmitChannel() throws IOException { channel = DatagramChannel.open(); @@ -499,8 +510,9 @@ public class AbstractMessageToolService implements IRemoteMessageService { if (terminated) { throw new IllegalStateException("tool service has been terminated"); } + String userName = "N/A"; final String name = cmd.getMessage(); - UserTestSessionKey key = null; + UUID key = null; Class<?> msgClass; try { @@ -527,12 +539,16 @@ public class AbstractMessageToolService implements IRemoteMessageService { key = reference.getTestSessionKey(); final InetSocketAddress address = reference.getAddressByType(msgInstance.getMessageName(), type); + IUserSession user = sessionManager.get(key); + if(user != null){ + userName = user.getUser().getName(); + } if (address == null) { throw new Exception( - "client callback for user " + key.getUser().getName() + " returned a null address when subscribing to " + name); + "client callback for user " + userName + " returned a null address when subscribing to " + name); } OseeLog.logf(MessageSystemTestEnvironment.class, Level.INFO, - "Client %s at %s is subscribing to message %s: current mem=%s", key.getUser().getName(), + "Client %s at %s is subscribing to message %s: current mem=%s",userName, address.toString(), name, type); Map<DataType, EnumMap<MessageMode, SubscriptionRecord>> memToModeMap = messageMap.get(name); @@ -577,7 +593,7 @@ public class AbstractMessageToolService implements IRemoteMessageService { OseeLog.log(MessageSystemTestEnvironment.class, Level.WARNING, "Exception occurred when subscribing to " + name, ex); if (key != null) { - throw new RemoteException("User " + key.getUser().getName() + "Could not subscribe to message " + name, ex); + throw new RemoteException("User " + userName + "Could not subscribe to message " + name, ex); } else { throw new RemoteException("Could not subscribe to message " + name, ex); } @@ -708,7 +724,9 @@ public class AbstractMessageToolService implements IRemoteMessageService { } String user; try { - user = cmd.getClient().getTestSessionKey().getUser().getName(); + UUID key = cmd.getClient().getTestSessionKey(); + IUserSession userSession = sessionManager.get(key); + user = userSession.getUser().getName(); } catch (Exception ex) { OseeLog.log(MessageSystemTestEnvironment.class, Level.WARNING, "Problems retrieving the active user", ex); user = "N.A."; 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(); +// } +// } } diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/connection/ScriptManager.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/connection/ScriptManager.java index dfed62baf3c..b88d097862a 100644 --- a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/connection/ScriptManager.java +++ b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/connection/ScriptManager.java @@ -16,6 +16,7 @@ import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; +import java.util.UUID; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ThreadFactory; @@ -26,7 +27,6 @@ import org.eclipse.core.runtime.jobs.Job; import org.eclipse.jface.viewers.StructuredViewer; import org.eclipse.osee.framework.jdk.core.util.GUID; import org.eclipse.osee.framework.ui.swt.Displays; -import org.eclipse.osee.ote.core.environment.UserTestSessionKey; import org.eclipse.osee.ote.core.environment.interfaces.ITestEnvironment; import org.eclipse.osee.ote.core.environment.status.TestComplete; import org.eclipse.osee.ote.service.ConnectionEvent; @@ -50,7 +50,7 @@ public abstract class ScriptManager implements Runnable { private ScheduledExecutorService updater; private Set<ScriptTask> tasksToUpdate; private ITestEnvironment connectedEnv; - private UserTestSessionKey sessionKey; + private UUID sessionKey; public ScriptManager(TestManagerEditor testManager, StructuredViewer stv) { this.testManager = testManager; @@ -203,7 +203,7 @@ public abstract class ScriptManager implements Runnable { } } - protected UserTestSessionKey getSessionKey() { + protected UUID getSessionKey() { return sessionKey; } }
\ No newline at end of file |