lttng: Allow local host connection (non SSH) for LTTng control
authorBernd Hufmann <Bernd.Hufmann@ericsson.com>
Fri, 4 Apr 2014 13:39:23 +0000 (09:39 -0400)
committerBernd Hufmann <bernd.hufmann@ericsson.com>
Fri, 9 May 2014 19:03:14 +0000 (15:03 -0400)
Change-Id: I937c76141195f02d5c3694327e4e085764cd00c4
Signed-off-by: Bernd Hufmann <Bernd.Hufmann@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/26300
Tested-by: Hudson CI
Reviewed-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
Tested-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
org.eclipse.linuxtools.lttng2.control.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/control/stubs/service/TestRemoteSystemProxy.java
org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/handlers/NewConnectionHandler.java
org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/model/impl/TargetNodeComponent.java
org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/remote/CommandShell.java
org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/remote/IRemoteSystemProxy.java
org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/remote/RemoteSystemProxy.java

index e4125a985ca4f24f8d9e13500889851737abb756..19de1fcd39bfceb7707fe76570b823a07b507192 100644 (file)
@@ -110,4 +110,9 @@ public class TestRemoteSystemProxy implements IRemoteSystemProxy {
     @Override
     public void setPort(int port) {
     }
+
+    @Override
+    public boolean isLocal() {
+        return false;
+    }
 }
index 41271b40ddf22a400bb88e5da7b13659bc7ec758..04bfccea7ad41d8cd930089d8c9abce2943a784c 100644 (file)
@@ -153,13 +153,11 @@ public class NewConnectionHandler extends BaseControlViewHandler {
                         .getHostsBySubSystemConfigurationCategory("shells"))); //$NON-NLS-1$
 
         for (IHost connection : shellConnections) {
-            if (!connection.getSystemType().isLocal()) {
-                ISubSystem[] subSystems = connection.getSubSystems();
-                for (int i = 0; i < subSystems.length; i++) {
-                    if (subSystems[i] instanceof IFileServiceSubSystem) {
-                        result.add(connection);
-                        break;
-                    }
+            ISubSystem[] subSystems = connection.getSubSystems();
+            for (int i = 0; i < subSystems.length; i++) {
+                if (subSystems[i] instanceof IFileServiceSubSystem) {
+                    result.add(connection);
+                    break;
                 }
             }
         }
index f100ca0faf022fe324951333d0bf083056830564..a8df138e10d9464e2288163964ed7e9a14573339 100644 (file)
@@ -383,7 +383,11 @@ public class TargetNodeComponent extends TraceControlComponent implements ICommu
      */
     public void deregister() {
         ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
-        registry.deleteHost(fHost);
+        // Don't remove local host because it cannot be recreated by
+        // LTTng NewConnection Dialog
+        if (!fRemoteProxy.isLocal()) {
+            registry.deleteHost(fHost);
+        }
     }
 
     // ------------------------------------------------------------------------
index f13d20e7977e7c72116923b012024d900bd29c1e..2a94a9c1f1c4dd7c90835c68156ac230481acd87 100644 (file)
@@ -98,7 +98,13 @@ public class CommandShell implements ICommandShell {
         IShellService shellService = fProxy.getShellService();
         Process p = null;
         try {
-            fHostShell = shellService.launchShell("", new String[0], new NullProgressMonitor()); //$NON-NLS-1$
+            String[] env = new String[0];
+
+            if (fProxy.isLocal()) {
+                env = shellService.getHostEnvironment();
+            }
+
+            fHostShell = shellService.launchShell("", env, new NullProgressMonitor()); //$NON-NLS-1$
             p = new HostShellProcessAdapter(fHostShell);
         } catch (Exception e) {
             throw new ExecutionException(Messages.TraceControl_CommandShellError, e);
index 56ad98623c5510c62be0bb3e4ce547112bc5a58f..c91d82a0060cabacb43769027329e7a2854441fd 100644 (file)
@@ -130,4 +130,11 @@ public interface IRemoteSystemProxy {
      */
     void removeCommunicationListener(ICommunicationsListener listener);
 
+    /**
+     * Checks whether the local host connector service is used or not.
+     *
+     * @return <code>true</code> if local connection else <false>
+     *
+     */
+    public boolean isLocal();
 }
\ No newline at end of file
index 5686c3661e754ba7f7bfc99770f2ade03439d12b..8ddc210ea509ff10ecb45f0249e0be072e1dd49a 100644 (file)
@@ -195,4 +195,9 @@ public class RemoteSystemProxy implements IRemoteSystemProxy {
             cs.removeCommunicationsListener(listener);
         }
     }
+
+    @Override
+    public boolean isLocal() {
+        return fHost.getSystemType().isLocal();
+    }
 }
This page took 0.029095 seconds and 5 git commands to generate.