Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew M. Finkbeiner2015-03-25 22:39:14 +0000
committerAndrew Finkbeiner2015-04-01 23:02:23 +0000
commitdd4882f80ca8a3140b829dd1d04f4e8eb793a467 (patch)
treed6b3c4ecc2b72453fc790c2c921ad53c981c35a6 /plugins/org.eclipse.osee.ote.client
parent6bf2d821135ab0ae0afd78a2c4a167a4f4bd79b2 (diff)
downloadorg.eclipse.osee-dd4882f80ca8a3140b829dd1d04f4e8eb793a467.tar.gz
org.eclipse.osee-dd4882f80ca8a3140b829dd1d04f4e8eb793a467.tar.xz
org.eclipse.osee-dd4882f80ca8a3140b829dd1d04f4e8eb793a467.zip
feature[ats_ATS62328]: Update connection logic
Added the oteendpoint for communication with client to server. this is in preperation for removing rest/activemq from the default test server so that we can reduce thread usage and dependencies. Also added the ability to configure and connect to a server from the client using EventMessages. feature[ats_ATS107238]: Remove default rest server Updated some logging and added some more command handlers. Also cleaned up some server output. feature[ATS_ATS122200]: Add IO redirect Change-Id: If5a39333c1e0362f2c36cffe9f2c3e142881beea
Diffstat (limited to 'plugins/org.eclipse.osee.ote.client')
-rw-r--r--plugins/org.eclipse.osee.ote.client/.classpath4
-rw-r--r--plugins/org.eclipse.osee.ote.client/META-INF/MANIFEST.MF2
-rw-r--r--plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/IEnvironmentConfigurer.java3
-rw-r--r--plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/IOteClientService.java4
-rw-r--r--plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/JmsToJiniBridgeConnector.java9
-rw-r--r--plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/JmsToJiniBridgeConnectorLite.java9
-rw-r--r--plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/core/ClientSession.java11
-rw-r--r--plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/core/TestClientServiceImpl.java41
8 files changed, 55 insertions, 28 deletions
diff --git a/plugins/org.eclipse.osee.ote.client/.classpath b/plugins/org.eclipse.osee.ote.client/.classpath
index 751c8f2e504..ad32c83a788 100644
--- a/plugins/org.eclipse.osee.ote.client/.classpath
+++ b/plugins/org.eclipse.osee.ote.client/.classpath
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/plugins/org.eclipse.osee.ote.client/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.ote.client/META-INF/MANIFEST.MF
index a78ecb32b49..7d01c9f5617 100644
--- a/plugins/org.eclipse.osee.ote.client/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.ote.client/META-INF/MANIFEST.MF
@@ -50,10 +50,10 @@ Import-Package: net.jini.activation,
org.eclipse.osee.framework.core.exception,
org.eclipse.osee.framework.jdk.core.type,
org.eclipse.osee.framework.jdk.core.util,
- org.eclipse.osee.framework.jini.service.interfaces,
org.eclipse.osee.framework.messaging,
org.eclipse.osee.framework.messaging.id,
org.eclipse.osee.framework.plugin.core.util,
+ org.eclipse.osee.ote,
org.eclipse.osee.ote.connection.jini,
org.eclipse.osee.ote.core,
org.eclipse.osee.ote.core.enums,
diff --git a/plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/IEnvironmentConfigurer.java b/plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/IEnvironmentConfigurer.java
index 6eb79cfb8dd..5950b16117f 100644
--- a/plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/IEnvironmentConfigurer.java
+++ b/plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/IEnvironmentConfigurer.java
@@ -10,11 +10,12 @@
*******************************************************************************/
package org.eclipse.osee.ote.service;
+import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.osee.ote.core.environment.interfaces.IHostTestEnvironment;
/**
* @author Ken J. Aguilar
*/
public interface IEnvironmentConfigurer {
- void configure(IHostTestEnvironment event) throws Exception;
+ boolean configure(IHostTestEnvironment event, SubProgressMonitor subProgressMonitor) throws Exception;
}
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 586d0672741..d29a224c2f5 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
@@ -14,6 +14,7 @@ import java.net.InetAddress;
import java.util.List;
import java.util.UUID;
+import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.osee.connection.service.IServiceConnector;
import org.eclipse.osee.ote.core.OSEEPerson1_4;
import org.eclipse.osee.ote.core.environment.TestEnvironmentConfig;
@@ -61,10 +62,11 @@ public interface IOteClientService {
/**
* creates a connection to a test server. <B>NOTE: </B><I>A user must be logged in prior to calling this method.>/I>
+ * @param monitor
*
* @see #setUser(OSEEPerson1_4, InetAddress)
*/
- ConnectionEvent connect(IHostTestEnvironment env, IEnvironmentConfigurer configurer, TestEnvironmentConfig config) throws TestSessionException;
+ ConnectionEvent connect(IHostTestEnvironment env, IEnvironmentConfigurer configurer, TestEnvironmentConfig config, IProgressMonitor monitor) throws TestSessionException;
/**
* breaks the current connection to a test server. This will call the
diff --git a/plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/JmsToJiniBridgeConnector.java b/plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/JmsToJiniBridgeConnector.java
index ec5b9c2469e..faf3abdd158 100644
--- a/plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/JmsToJiniBridgeConnector.java
+++ b/plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/JmsToJiniBridgeConnector.java
@@ -55,6 +55,7 @@ public class JmsToJiniBridgeConnector implements IServiceConnector {
private final List<IServicePropertyChangeListener> propertyChangeListeners =
new CopyOnWriteArrayList<IServicePropertyChangeListener>();
private final String uniqueServerId;
+ private boolean connected = false;
public JmsToJiniBridgeConnector(ExportClassLoader exportClassLoader, Object service, String id) {
this.uniqueServerId = id;
@@ -179,5 +180,13 @@ public class JmsToJiniBridgeConnector implements IServiceConnector {
public void init(Object service) throws UnknownHostException, ExportException {
}
+
+ public void setConnected(boolean connected){
+ this.connected = connected;
+ }
+
+ public boolean isConnected() {
+ return this.connected;
+ }
}
diff --git a/plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/JmsToJiniBridgeConnectorLite.java b/plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/JmsToJiniBridgeConnectorLite.java
index 30d6a0e021f..375492cc6b1 100644
--- a/plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/JmsToJiniBridgeConnectorLite.java
+++ b/plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/JmsToJiniBridgeConnectorLite.java
@@ -75,6 +75,7 @@ public class JmsToJiniBridgeConnectorLite implements IServiceConnector, OseeMess
public Object service;
Object myLock = new Object();
+ private boolean connected = false;
public JmsToJiniBridgeConnectorLite(ServiceHealth serviceHealth, MessageService messageService) {
this.serviceHealth = serviceHealth;
@@ -265,5 +266,13 @@ public class JmsToJiniBridgeConnectorLite implements IServiceConnector, OseeMess
public void fail(Throwable th) {
OseeLog.log(Activator.class, Level.SEVERE, th);
}
+
+ public void setConnected(boolean connected){
+ this.connected = connected;
+ }
+
+ public boolean isConnected() {
+ return this.connected;
+ }
}
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 7363287137f..7d25b9694f2 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
@@ -45,11 +45,13 @@ public class ClientSession extends AbstractRemoteSession {
private SessionDelegate sessionDelegate = null;
private final ReentrantLock lock = new ReentrantLock();
private final OteClientEndpointReceive receive;
+ private UUID id;
public ClientSession(OSEEPerson1_4 user, InetAddress address, OteClientEndpointReceive receive) {
super(user);
this.address = address;
this.receive = receive;
+ this.id = UUID.randomUUID();
Activator.log(Level.INFO,
String.format("Created OTE session for %s. Address=%s\n ", user.getName(), address.toString()));
}
@@ -172,7 +174,8 @@ public class ClientSession extends AbstractRemoteSession {
UUID id = UUID.randomUUID();
Thread.currentThread().setContextClassLoader(ExportClassLoader.getInstance());
ConnectionRequestResult result = testHost.requestEnvironment(exportedSession, id, config);
- if (result.getStatus().getStatus()) {
+ if (result != null && result.getStatus().getStatus()) {
+ connector.setConnected(true);
return new TestHostConnection(connector, testHost, result.getEnvironment(), result.getSessionKey());
} else {
OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, "Error Connecting to the OTE Test Server.",
@@ -191,6 +194,7 @@ public class ClientSession extends AbstractRemoteSession {
// intentionally package-private
if (lock.tryLock(TIMEOUT, TimeUnit.MINUTES)) {
try {
+ connection.getServiceConnector().setConnected(false);
connection.endConnection();
return;
} finally {
@@ -214,4 +218,9 @@ public class ClientSession extends AbstractRemoteSession {
throw new RemoteException("exception initiating prompt", ex);
}
}
+
+ @Override
+ public UUID getUserId() throws Exception {
+ return id;
+ }
}
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 7024cf2a6da..442c658b100 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
@@ -23,6 +23,8 @@ import java.util.Set;
import java.util.UUID;
import java.util.logging.Level;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.osee.connection.service.IConnectionService;
import org.eclipse.osee.connection.service.IConnectorListener;
import org.eclipse.osee.connection.service.IServiceConnector;
@@ -85,7 +87,7 @@ public class TestClientServiceImpl implements IOteClientService, IConnectorListe
}
@Override
- public ConnectionEvent connect(IHostTestEnvironment testHost, IEnvironmentConfigurer configurer, TestEnvironmentConfig config) throws IllegalArgumentException, TestSessionException {
+ public ConnectionEvent connect(IHostTestEnvironment testHost, IEnvironmentConfigurer configurer, TestEnvironmentConfig config, IProgressMonitor monitor) throws IllegalArgumentException, TestSessionException {
checkState();
final IServiceConnector connector;
final ClientSession localSession;
@@ -93,11 +95,9 @@ public class TestClientServiceImpl implements IOteClientService, IConnectorListe
if (session == null) {
throw new IllegalArgumentException("a user has not been set");
}
-
if (testConnection != null) {
throw new IllegalStateException("already connected");
}
-
if (testHost == null) {
throw new IllegalArgumentException("test host cannot be null");
}
@@ -105,22 +105,17 @@ public class TestClientServiceImpl implements IOteClientService, IConnectorListe
localSession = session;
}
try {
-
-
if (connector == null) {
throw new IllegalStateException("Unable to find a connection.");
}
-
- configurer.configure(testHost);
-
- testConnection = localSession.connect(connector, testHost, config);
- if (testConnection != null) {
- // success
- ConnectionEvent event =
- new ConnectionEvent(testHost, connector, testConnection.getConnectEnvironment(),
- testConnection.getSessionKey());
- listenerNotifier.notifyPostConnection(event);
- return event;
+ if(configurer.configure(testHost, new SubProgressMonitor(monitor, 95)) && !monitor.isCanceled()){
+ testConnection = localSession.connect(connector, testHost, config);
+ if (testConnection != null) {
+ // success
+ ConnectionEvent event = new ConnectionEvent(testHost, connector, testConnection.getConnectEnvironment(), testConnection.getSessionKey());
+ listenerNotifier.notifyPostConnection(event);
+ return event;
+ }
}
} catch (Exception e) {
Activator.log(Level.SEVERE, "failed to establish connection", e);
@@ -133,12 +128,14 @@ public class TestClientServiceImpl implements IOteClientService, IConnectorListe
public IServiceConnector getConnector(IHostTestEnvironment host) {
try {
EnhancedProperties properties = host.getProperties();
- String passedInId = (String) properties.getProperty("id");
- for (IServiceConnector connector : testHosts.values()) {
- String loopId = (String) connector.getProperty("id", "no");
- if (passedInId != null && loopId != null && loopId.equals(passedInId)) {
- return connector;
- }
+ if(properties != null){
+ String passedInId = (String) properties.getProperty("id");
+ for (IServiceConnector connector : testHosts.values()) {
+ String loopId = (String) connector.getProperty("id", "no");
+ if (passedInId != null && loopId != null && loopId.equals(passedInId)) {
+ return connector;
+ }
+ }
}
} catch (RemoteException ex) {
ex.printStackTrace();

Back to the top