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.ui
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.ui')
-rw-r--r--plugins/org.eclipse.osee.ote.ui/META-INF/MANIFEST.MF5
-rw-r--r--plugins/org.eclipse.osee.ote.ui/src/org/eclipse/osee/ote/ui/internal/OteServerConsole.java86
-rw-r--r--plugins/org.eclipse.osee.ote.ui/src/org/eclipse/osee/ote/ui/internal/TestCoreGuiPlugin.java3
3 files changed, 94 insertions, 0 deletions
diff --git a/plugins/org.eclipse.osee.ote.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.ote.ui/META-INF/MANIFEST.MF
index 237b55c1cc..e0f7bc45fc 100644
--- a/plugins/org.eclipse.osee.ote.ui/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.ote.ui/META-INF/MANIFEST.MF
@@ -28,10 +28,15 @@ Import-Package: org.eclipse.core.resources,
org.eclipse.osee.framework.ui.plugin.workspace,
org.eclipse.osee.framework.ui.plugin.xnavigate,
org.eclipse.osee.framework.ui.swt,
+ org.eclipse.osee.ote.core,
org.eclipse.osee.ote.core.environment.interfaces,
+ org.eclipse.osee.ote.message,
+ org.eclipse.osee.ote.message.event,
+ org.eclipse.osee.ote.remote.messages,
org.eclipse.osee.ote.service,
org.eclipse.swt,
org.eclipse.swt.widgets,
org.osgi.framework,
+ org.osgi.service.event;version="1.3.0",
org.osgi.util.tracker
Require-Bundle: org.eclipse.ui
diff --git a/plugins/org.eclipse.osee.ote.ui/src/org/eclipse/osee/ote/ui/internal/OteServerConsole.java b/plugins/org.eclipse.osee.ote.ui/src/org/eclipse/osee/ote/ui/internal/OteServerConsole.java
new file mode 100644
index 0000000000..9290154d21
--- /dev/null
+++ b/plugins/org.eclipse.osee.ote.ui/src/org/eclipse/osee/ote/ui/internal/OteServerConsole.java
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * 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.ui.internal;
+
+import java.io.IOException;
+
+import org.eclipse.osee.framework.jdk.core.util.IConsoleInputListener;
+import org.eclipse.osee.framework.ui.plugin.util.OseeConsole;
+import org.eclipse.osee.ote.message.event.OteEventMessageUtil;
+import org.eclipse.osee.ote.remote.messages.ConsoleInputMessage;
+import org.eclipse.osee.ote.remote.messages.ConsoleOutputMessage;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.service.event.Event;
+import org.osgi.service.event.EventHandler;
+
+public class OteServerConsole {
+
+ private final OseeConsole console = new OseeConsole("OTE Server", false, false);
+ private ServiceRegistration<EventHandler> registration;
+
+ public OteServerConsole() {
+ console.addInputListener(new OTEServerConsoleInputListener());
+ registration = OteEventMessageUtil.subscribe(ConsoleOutputMessage.TOPIC, new ConsoleOutputHandler(console));
+ }
+
+ private OseeConsole getConsole() {
+ return console;
+ }
+
+ public void close() {
+ getConsole().shutdown();
+ if(registration != null){
+ registration.unregister();
+ registration = null;
+ }
+ }
+
+ private static class ConsoleOutputHandler implements EventHandler {
+
+ private OseeConsole console;
+ private ConsoleOutputMessage output;
+
+ public ConsoleOutputHandler(OseeConsole console) {
+ this.console = console;
+ this.output = new ConsoleOutputMessage();
+ }
+
+ @Override
+ public void handleEvent(Event arg0) {
+ output.setBackingBuffer(OteEventMessageUtil.getBytes(arg0));
+ try {
+ console.write(output.getString());
+ } catch (IOException e) {
+ e.printStackTrace();
+ } catch (ClassNotFoundException e) {
+ e.printStackTrace();
+ }
+
+ }
+
+ }
+
+ private static class OTEServerConsoleInputListener implements IConsoleInputListener {
+
+ private ConsoleInputMessage input = new ConsoleInputMessage();
+
+ @Override
+ public void lineRead(String line) {
+ try {
+ input.setString(line);
+ OteEventMessageUtil.sendEvent(input);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ }
+}
diff --git a/plugins/org.eclipse.osee.ote.ui/src/org/eclipse/osee/ote/ui/internal/TestCoreGuiPlugin.java b/plugins/org.eclipse.osee.ote.ui/src/org/eclipse/osee/ote/ui/internal/TestCoreGuiPlugin.java
index ca976631f8..19ff552b3a 100644
--- a/plugins/org.eclipse.osee.ote.ui/src/org/eclipse/osee/ote/ui/internal/TestCoreGuiPlugin.java
+++ b/plugins/org.eclipse.osee.ote.ui/src/org/eclipse/osee/ote/ui/internal/TestCoreGuiPlugin.java
@@ -43,6 +43,8 @@ public class TestCoreGuiPlugin implements BundleActivator {
private OteConsoleServiceImpl oteConsoleService;
private BundleContext context;
+ protected OteServerConsole oteServerConsole;
+
@Override
public void start(final BundleContext context) throws Exception {
this.context = context;
@@ -80,6 +82,7 @@ public class TestCoreGuiPlugin implements BundleActivator {
@Override
public Object addingService(ServiceReference reference) {
oteConsoleService = new OteConsoleServiceImpl();
+ oteServerConsole = new OteServerConsole();
oteConsoleServiceRegistration =
context.registerService(IOteConsoleService.class.getName(), oteConsoleService, null);
if (System.getProperty("NO_OTE_REMOTE_CONSOLE") == null) {

Back to the top