tmf remote: consolidate remote connection access methods
authorBernd Hufmann <Bernd.Hufmann@ericsson.com>
Tue, 31 Mar 2015 00:11:34 +0000 (20:11 -0400)
committerBernd Hufmann <bernd.hufmann@ericsson.com>
Tue, 31 Mar 2015 16:45:51 +0000 (12:45 -0400)
Change-Id: I9abd058d37f71d6df5e9774a11a09f750e22f363
Signed-off-by: Bernd Hufmann <Bernd.Hufmann@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/44882
Reviewed-by: Patrick Tasse <patrick.tasse@gmail.com>
Tested-by: Patrick Tasse <patrick.tasse@gmail.com>
Reviewed-by: Hudson CI
19 files changed:
org.eclipse.tracecompass.lttng2.control.ui.tests/src/org/eclipse/tracecompass/lttng2/control/ui/tests/model/component/TraceControlComponentTest.java
org.eclipse.tracecompass.lttng2.control.ui.tests/src/org/eclipse/tracecompass/lttng2/control/ui/tests/model/component/TraceControlCreateSessionTests.java
org.eclipse.tracecompass.lttng2.control.ui.tests/src/org/eclipse/tracecompass/lttng2/control/ui/tests/model/component/TraceControlKernelProviderTests.java
org.eclipse.tracecompass.lttng2.control.ui.tests/src/org/eclipse/tracecompass/lttng2/control/ui/tests/model/component/TraceControlKernelSessionTests.java
org.eclipse.tracecompass.lttng2.control.ui.tests/src/org/eclipse/tracecompass/lttng2/control/ui/tests/model/component/TraceControlPropertiesTest.java
org.eclipse.tracecompass.lttng2.control.ui.tests/src/org/eclipse/tracecompass/lttng2/control/ui/tests/model/component/TraceControlSnapshotSessionTests.java
org.eclipse.tracecompass.lttng2.control.ui.tests/src/org/eclipse/tracecompass/lttng2/control/ui/tests/model/component/TraceControlTreeModelNoProvidersTest.java
org.eclipse.tracecompass.lttng2.control.ui.tests/src/org/eclipse/tracecompass/lttng2/control/ui/tests/model/component/TraceControlTreeModelTest.java
org.eclipse.tracecompass.lttng2.control.ui.tests/src/org/eclipse/tracecompass/lttng2/control/ui/tests/model/component/TraceControlUstProviderTests.java
org.eclipse.tracecompass.lttng2.control.ui.tests/src/org/eclipse/tracecompass/lttng2/control/ui/tests/model/component/TraceControlUstSessionTests.java
org.eclipse.tracecompass.lttng2.control.ui.tests/src/org/eclipse/tracecompass/lttng2/control/ui/tests/model/component/TraceControlUstSessionTests2.java
org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/ControlView.java
org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/dialogs/NewConnectionDialog.java
org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/handlers/NewConnectionHandler.java
org.eclipse.tracecompass.tmf.remote.core.tests/src/org/eclipse/tracecompass/tmf/remote/core/tests/shell/CommandShellTest.java
org.eclipse.tracecompass.tmf.remote.core/src/org/eclipse/tracecompass/tmf/remote/core/proxy/IConnectionFactory.java
org.eclipse.tracecompass.tmf.remote.core/src/org/eclipse/tracecompass/tmf/remote/core/proxy/RemoteSystemProxy.java
org.eclipse.tracecompass.tmf.remote.core/src/org/eclipse/tracecompass/tmf/remote/core/proxy/TmfRemoteConnectionFactory.java
org.eclipse.tracecompass.tmf.remote.ui/src/org/eclipse/tracecompass/internal/tmf/remote/ui/wizards/fetch/preferences/RemoteProfilesPreferencePage.java

index fd83877ead207069cfb521b409511fdb832f1696..2ddb6e988b6f2887bf347394ed6298b405439e39 100644 (file)
@@ -35,7 +35,7 @@ import org.eclipse.tracecompass.internal.lttng2.control.ui.views.service.ILttngC
 import org.eclipse.tracecompass.internal.lttng2.control.ui.views.service.LTTngControlService;
 import org.eclipse.tracecompass.internal.lttng2.control.ui.views.service.LTTngControlServiceConstants;
 import org.eclipse.tracecompass.internal.lttng2.control.ui.views.service.LTTngControlServiceMI;
-import org.eclipse.tracecompass.tmf.remote.core.proxy.RemoteSystemProxy;
+import org.eclipse.tracecompass.tmf.remote.core.proxy.TmfRemoteConnectionFactory;
 import org.eclipse.ui.ISharedImages;
 import org.eclipse.ui.PlatformUI;
 import org.junit.Test;
@@ -46,7 +46,7 @@ import org.junit.Test;
  */
 public class TraceControlComponentTest {
 
-    private IRemoteConnection fHost = RemoteSystemProxy.getLocalConnection();
+    private IRemoteConnection fHost = TmfRemoteConnectionFactory.getLocalConnection();
 
     /**
      * Run the TraceControlComponent(String) constructor test.
index 51db1920caae3a28f5314a9e06be569ccaf48332..787684d1c3394504821a5d1c75e12ad812edd89f 100644 (file)
@@ -35,7 +35,7 @@ import org.eclipse.tracecompass.internal.lttng2.control.ui.views.model.ITraceCon
 import org.eclipse.tracecompass.internal.lttng2.control.ui.views.model.impl.TargetNodeComponent;
 import org.eclipse.tracecompass.internal.lttng2.control.ui.views.model.impl.TraceSessionComponent;
 import org.eclipse.tracecompass.internal.lttng2.control.ui.views.service.ILttngControlService;
-import org.eclipse.tracecompass.tmf.remote.core.proxy.RemoteSystemProxy;
+import org.eclipse.tracecompass.tmf.remote.core.proxy.TmfRemoteConnectionFactory;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -62,7 +62,7 @@ public class TraceControlCreateSessionTests {
     // Test data
     // ------------------------------------------------------------------------
     private TraceControlTestFacility fFacility;
-    private IRemoteConnection fHost = RemoteSystemProxy.getLocalConnection();
+    private IRemoteConnection fHost = TmfRemoteConnectionFactory.getLocalConnection();
     private @NonNull TestRemoteSystemProxy fProxy = new TestRemoteSystemProxy(fHost);
     private String fTestFile;
 
index a43fd86b05f9c9852e2648ef282a2066075d28eb..7cb7a0474e0837fd5aca9b6feb2ae9051e4bcfa1 100644 (file)
@@ -44,7 +44,7 @@ import org.eclipse.tracecompass.internal.lttng2.control.ui.views.model.impl.Trac
 import org.eclipse.tracecompass.internal.lttng2.control.ui.views.model.impl.TraceEventComponent;
 import org.eclipse.tracecompass.internal.lttng2.control.ui.views.model.impl.TraceProviderGroup;
 import org.eclipse.tracecompass.internal.lttng2.control.ui.views.model.impl.TraceSessionComponent;
-import org.eclipse.tracecompass.tmf.remote.core.proxy.RemoteSystemProxy;
+import org.eclipse.tracecompass.tmf.remote.core.proxy.TmfRemoteConnectionFactory;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -68,7 +68,7 @@ public class TraceControlKernelProviderTests {
     // ------------------------------------------------------------------------
 
     private TraceControlTestFacility fFacility;
-    private IRemoteConnection fHost = RemoteSystemProxy.getLocalConnection();
+    private IRemoteConnection fHost = TmfRemoteConnectionFactory.getLocalConnection();
     private @NonNull TestRemoteSystemProxy fProxy = new TestRemoteSystemProxy(fHost);
     private String fTestFile;
 
index f5b378d01263059a24956d6fc01c041d3ebe2cae..71b8bb7c7908a6c0cba6da0851da3bb0283e153d 100644 (file)
@@ -50,7 +50,7 @@ import org.eclipse.tracecompass.internal.lttng2.control.ui.views.model.impl.Trac
 import org.eclipse.tracecompass.internal.lttng2.control.ui.views.model.impl.TraceEventComponent;
 import org.eclipse.tracecompass.internal.lttng2.control.ui.views.model.impl.TraceProbeEventComponent;
 import org.eclipse.tracecompass.internal.lttng2.control.ui.views.model.impl.TraceSessionComponent;
-import org.eclipse.tracecompass.tmf.remote.core.proxy.RemoteSystemProxy;
+import org.eclipse.tracecompass.tmf.remote.core.proxy.TmfRemoteConnectionFactory;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -74,7 +74,7 @@ public class TraceControlKernelSessionTests {
     // ------------------------------------------------------------------------
 
     private TraceControlTestFacility fFacility;
-    private IRemoteConnection fHost = RemoteSystemProxy.getLocalConnection();
+    private IRemoteConnection fHost = TmfRemoteConnectionFactory.getLocalConnection();
     private @NonNull TestRemoteSystemProxy fProxy = new TestRemoteSystemProxy(fHost);
     private String fTestFile;
 
index a33f2ea9f9572b12d66496eb881b3d7b85cb865b..3498feff8bf5113b531c24547cd81d419a1e0ee4 100644 (file)
@@ -53,7 +53,7 @@ import org.eclipse.tracecompass.internal.lttng2.control.ui.views.property.TraceE
 import org.eclipse.tracecompass.internal.lttng2.control.ui.views.property.TraceProbeEventPropertySource;
 import org.eclipse.tracecompass.internal.lttng2.control.ui.views.property.TraceSessionPropertySource;
 import org.eclipse.tracecompass.internal.lttng2.control.ui.views.property.UstProviderPropertySource;
-import org.eclipse.tracecompass.tmf.remote.core.proxy.RemoteSystemProxy;
+import org.eclipse.tracecompass.tmf.remote.core.proxy.TmfRemoteConnectionFactory;
 import org.eclipse.ui.views.properties.IPropertySource;
 import org.junit.After;
 import org.junit.Test;
@@ -93,7 +93,7 @@ public class TraceControlPropertiesTest {
      */
     @Test
     public void testComponentProperties() throws Exception {
-        IRemoteConnection host = RemoteSystemProxy.getLocalConnection();
+        IRemoteConnection host = TmfRemoteConnectionFactory.getLocalConnection();
         TestRemoteSystemProxy proxy = new TestRemoteSystemProxy(host);
 
         URL location = FileLocator.find(FrameworkUtil.getBundle(this.getClass()), new Path(DIRECTORY + File.separator + TEST_STREAM), null);
index aa67dd9a68ded25fd56bc88ad872c1837c8636cc..ed588a8d9190655b22f2cc433e68c623d4ed0e91 100644 (file)
@@ -37,7 +37,7 @@ import org.eclipse.tracecompass.internal.lttng2.control.ui.views.model.ITraceCon
 import org.eclipse.tracecompass.internal.lttng2.control.ui.views.model.impl.TargetNodeComponent;
 import org.eclipse.tracecompass.internal.lttng2.control.ui.views.model.impl.TraceSessionComponent;
 import org.eclipse.tracecompass.internal.lttng2.control.ui.views.property.TraceSessionPropertySource;
-import org.eclipse.tracecompass.tmf.remote.core.proxy.RemoteSystemProxy;
+import org.eclipse.tracecompass.tmf.remote.core.proxy.TmfRemoteConnectionFactory;
 import org.eclipse.ui.views.properties.IPropertyDescriptor;
 import org.eclipse.ui.views.properties.IPropertySource;
 import org.junit.After;
@@ -63,7 +63,7 @@ public class TraceControlSnapshotSessionTests {
     // ------------------------------------------------------------------------
 
     private TraceControlTestFacility fFacility;
-    private IRemoteConnection fHost = RemoteSystemProxy.getLocalConnection();
+    private IRemoteConnection fHost = TmfRemoteConnectionFactory.getLocalConnection();
     private @NonNull TestRemoteSystemProxy fProxy = new TestRemoteSystemProxy(fHost);
     private String fTestFile;
 
index f5acda6ebf282af3925ea651815cc1827c2287a1..b1acdedc1300971a23552e0c6e239b16b820fcf6 100644 (file)
@@ -37,7 +37,7 @@ import org.eclipse.tracecompass.internal.lttng2.control.ui.views.model.impl.Trac
 import org.eclipse.tracecompass.internal.lttng2.control.ui.views.model.impl.UstProviderComponent;
 import org.eclipse.tracecompass.internal.lttng2.control.ui.views.service.ILttngControlService;
 import org.eclipse.tracecompass.internal.lttng2.control.ui.views.service.LTTngControlService;
-import org.eclipse.tracecompass.tmf.remote.core.proxy.RemoteSystemProxy;
+import org.eclipse.tracecompass.tmf.remote.core.proxy.TmfRemoteConnectionFactory;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -62,7 +62,7 @@ public class TraceControlTreeModelNoProvidersTest {
     // Test data
     // ------------------------------------------------------------------------
 
-    private IRemoteConnection fHost = RemoteSystemProxy.getLocalConnection();
+    private IRemoteConnection fHost = TmfRemoteConnectionFactory.getLocalConnection();
     private @NonNull TestRemoteSystemProxy fProxy = new TestRemoteSystemProxy(fHost);
     private String fTestFile;
 
index c0ac2f688ac8ec91d2c8d3a213b123cb64943821..e323130098321816fc0ab474d06aa2ba84f91e70 100644 (file)
@@ -51,7 +51,7 @@ import org.eclipse.tracecompass.internal.lttng2.control.ui.views.model.impl.Trac
 import org.eclipse.tracecompass.internal.lttng2.control.ui.views.model.impl.UstProviderComponent;
 import org.eclipse.tracecompass.internal.lttng2.control.ui.views.service.ILttngControlService;
 import org.eclipse.tracecompass.internal.lttng2.control.ui.views.service.LTTngControlService;
-import org.eclipse.tracecompass.tmf.remote.core.proxy.RemoteSystemProxy;
+import org.eclipse.tracecompass.tmf.remote.core.proxy.TmfRemoteConnectionFactory;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -75,7 +75,7 @@ public class TraceControlTreeModelTest {
     // Test data
     // ------------------------------------------------------------------------
 
-    private IRemoteConnection fHost = RemoteSystemProxy.getLocalConnection();
+    private IRemoteConnection fHost = TmfRemoteConnectionFactory.getLocalConnection();
     private @NonNull TestRemoteSystemProxy fProxy = new TestRemoteSystemProxy(fHost);
     private String fTestFile;
 
index b2d87291bb0d55c03ccadb39313114fa609ca3eb..47a878c81744af972a9190615a4bcee280761f87 100644 (file)
@@ -45,7 +45,7 @@ import org.eclipse.tracecompass.internal.lttng2.control.ui.views.model.impl.Trac
 import org.eclipse.tracecompass.internal.lttng2.control.ui.views.model.impl.TraceEventComponent;
 import org.eclipse.tracecompass.internal.lttng2.control.ui.views.model.impl.TraceSessionComponent;
 import org.eclipse.tracecompass.internal.lttng2.control.ui.views.model.impl.UstProviderComponent;
-import org.eclipse.tracecompass.tmf.remote.core.proxy.RemoteSystemProxy;
+import org.eclipse.tracecompass.tmf.remote.core.proxy.TmfRemoteConnectionFactory;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -67,7 +67,7 @@ public class TraceControlUstProviderTests {
     // ------------------------------------------------------------------------
     // Test data
     // ------------------------------------------------------------------------
-    private IRemoteConnection fHost = RemoteSystemProxy.getLocalConnection();
+    private IRemoteConnection fHost = TmfRemoteConnectionFactory.getLocalConnection();
     private TraceControlTestFacility fFacility;
     private @NonNull TestRemoteSystemProxy fProxy = new TestRemoteSystemProxy(fHost);
     private String fTestFile;
index 7146f56006ac8068d56f620acd884391aafdec68..00e929efbed79c38d53253155abf5381afc44e93 100644 (file)
@@ -49,7 +49,7 @@ import org.eclipse.tracecompass.internal.lttng2.control.ui.views.model.impl.Trac
 import org.eclipse.tracecompass.internal.lttng2.control.ui.views.model.impl.TraceDomainComponent;
 import org.eclipse.tracecompass.internal.lttng2.control.ui.views.model.impl.TraceEventComponent;
 import org.eclipse.tracecompass.internal.lttng2.control.ui.views.model.impl.TraceSessionComponent;
-import org.eclipse.tracecompass.tmf.remote.core.proxy.RemoteSystemProxy;
+import org.eclipse.tracecompass.tmf.remote.core.proxy.TmfRemoteConnectionFactory;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -71,7 +71,7 @@ public class TraceControlUstSessionTests {
     // ------------------------------------------------------------------------
     // Test data
     // ------------------------------------------------------------------------
-    private IRemoteConnection fHost = RemoteSystemProxy.getLocalConnection();
+    private IRemoteConnection fHost = TmfRemoteConnectionFactory.getLocalConnection();
     private TraceControlTestFacility fFacility;
     private @NonNull TestRemoteSystemProxy fProxy = new TestRemoteSystemProxy(fHost);
     private String fTestFile;
index a05c6ee4a360bb04eeb482e3fca3d03c2754b8be..b4b0d56f71cc46e463a81dec898d79b0301407d6 100644 (file)
@@ -38,7 +38,7 @@ import org.eclipse.tracecompass.internal.lttng2.control.ui.views.model.impl.Targ
 import org.eclipse.tracecompass.internal.lttng2.control.ui.views.model.impl.TraceChannelComponent;
 import org.eclipse.tracecompass.internal.lttng2.control.ui.views.model.impl.TraceDomainComponent;
 import org.eclipse.tracecompass.internal.lttng2.control.ui.views.model.impl.TraceSessionComponent;
-import org.eclipse.tracecompass.tmf.remote.core.proxy.RemoteSystemProxy;
+import org.eclipse.tracecompass.tmf.remote.core.proxy.TmfRemoteConnectionFactory;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -64,7 +64,7 @@ public class TraceControlUstSessionTests2 {
     // ------------------------------------------------------------------------
 
     private TraceControlTestFacility fFacility;
-    private IRemoteConnection fHost = RemoteSystemProxy.getLocalConnection();
+    private IRemoteConnection fHost = TmfRemoteConnectionFactory.getLocalConnection();
     private @NonNull TestRemoteSystemProxy fProxy = new TestRemoteSystemProxy(fHost);
     private String fTestFile;
 
index 8a32281a2ef8dbc8a7a1cb05d10f8bcefaf3d6f6..a25d4cf7ae951784f697b0708d9ed64e6b710117 100644 (file)
@@ -35,7 +35,7 @@ import org.eclipse.tracecompass.internal.lttng2.control.ui.views.model.impl.Targ
 import org.eclipse.tracecompass.internal.lttng2.control.ui.views.model.impl.TraceControlContentProvider;
 import org.eclipse.tracecompass.internal.lttng2.control.ui.views.model.impl.TraceControlLabelProvider;
 import org.eclipse.tracecompass.internal.lttng2.control.ui.views.model.impl.TraceControlRoot;
-import org.eclipse.tracecompass.tmf.remote.core.proxy.RemoteSystemProxy;
+import org.eclipse.tracecompass.tmf.remote.core.proxy.TmfRemoteConnectionFactory;
 import org.eclipse.ui.IMemento;
 import org.eclipse.ui.IViewSite;
 import org.eclipse.ui.PartInitException;
@@ -149,7 +149,7 @@ public class ControlView extends ViewPart implements ITraceControlComponentChang
                 if ((id == null) || (name == null)) {
                     break;
                 }
-                IRemoteConnection conn = RemoteSystemProxy.getRemoteConnection(id, name);
+                IRemoteConnection conn = TmfRemoteConnectionFactory.getRemoteConnection(id, name);
                 if (conn != null) {
                     fInitialConnections.add(conn);
                 }
index bc655c200b1ff6f4e87592f97e9584e7dd833d08..3eae286ff6c5fcb6209739030a3c5df56453e0e7 100644 (file)
@@ -52,7 +52,7 @@ import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.Shell;
 import org.eclipse.tracecompass.internal.lttng2.control.ui.Activator;
 import org.eclipse.tracecompass.internal.lttng2.control.ui.views.messages.Messages;
-import org.eclipse.tracecompass.tmf.remote.core.proxy.RemoteSystemProxy;
+import org.eclipse.tracecompass.tmf.remote.core.proxy.TmfRemoteConnectionFactory;
 
 /**
  * <p>
@@ -110,7 +110,7 @@ public class NewConnectionDialog extends Dialog implements INewConnectionDialog
         @Override
         public Object[] getElements(Object inputElement) {
             List<Object> children = new ArrayList<>();
-            IRemoteServicesManager manager = RemoteSystemProxy.getService(IRemoteServicesManager.class);
+            IRemoteServicesManager manager = TmfRemoteConnectionFactory.getService(IRemoteServicesManager.class);
             if (manager != null) {
                 children.addAll(manager.getAllConnectionTypes());
             }
@@ -201,7 +201,7 @@ public class NewConnectionDialog extends Dialog implements INewConnectionDialog
         fConnectionTree.setAutoExpandLevel(2);
         fConnectionTree.setInput(this);
 
-        IRemoteServicesManager manager = RemoteSystemProxy.getService(IRemoteServicesManager.class);
+        IRemoteServicesManager manager = TmfRemoteConnectionFactory.getService(IRemoteServicesManager.class);
         if (manager == null) {
             return result;
         }
index 9c1b117ee6bd1e3da1057e8565fa211595b2ed79..79dfdef8b70ff9e42338cf340858ff3a1e1bda81 100644 (file)
@@ -27,7 +27,7 @@ import org.eclipse.tracecompass.internal.lttng2.control.ui.views.dialogs.INewCon
 import org.eclipse.tracecompass.internal.lttng2.control.ui.views.dialogs.TraceControlDialogFactory;
 import org.eclipse.tracecompass.internal.lttng2.control.ui.views.model.ITraceControlComponent;
 import org.eclipse.tracecompass.internal.lttng2.control.ui.views.model.impl.TargetNodeComponent;
-import org.eclipse.tracecompass.tmf.remote.core.proxy.RemoteSystemProxy;
+import org.eclipse.tracecompass.tmf.remote.core.proxy.TmfRemoteConnectionFactory;
 import org.eclipse.ui.IWorkbenchPage;
 import org.eclipse.ui.IWorkbenchPart;
 import org.eclipse.ui.IWorkbenchWindow;
@@ -103,7 +103,7 @@ public class NewConnectionHandler extends BaseControlViewHandler {
         Object remoteServicesId = parameters.get(PARAMETER_REMOTE_SERVICES_ID);
         Object connectionName = parameters.get(PARAMETER_CONNECTION_NAME);
         if ((remoteServicesId != null) && (connectionName != null)) {
-            return RemoteSystemProxy.getRemoteConnection(
+            return TmfRemoteConnectionFactory.getRemoteConnection(
                     checkNotNull(remoteServicesId.toString()),
                     checkNotNull(connectionName.toString()));
         }
index ffbdfec1e14036c80487dbf073154fe7fd21dc46..925d4b29eaebcb81f0d2371ca6db6c0f24ada810 100644 (file)
@@ -25,6 +25,7 @@ import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.remote.core.IRemoteConnection;
 import org.eclipse.tracecompass.internal.tmf.remote.core.shell.CommandShell;
 import org.eclipse.tracecompass.tmf.remote.core.proxy.RemoteSystemProxy;
+import org.eclipse.tracecompass.tmf.remote.core.proxy.TmfRemoteConnectionFactory;
 import org.eclipse.tracecompass.tmf.remote.core.shell.ICommandInput;
 import org.eclipse.tracecompass.tmf.remote.core.shell.ICommandResult;
 import org.eclipse.tracecompass.tmf.remote.core.shell.ICommandShell;
@@ -41,7 +42,7 @@ public class CommandShellTest {
     private static final @NonNull String[] CMD_ERROR_INPUT_LINUX = { "ls", "blablablabla" };
     private static final @NonNull String[] CMD_UNKNOWN_COMMAND_LINUX = { "blablablabla" };
 
-    private static final IRemoteConnection LOCAL_CONNECTION = RemoteSystemProxy.getLocalConnection();
+    private static final IRemoteConnection LOCAL_CONNECTION = TmfRemoteConnectionFactory.getLocalConnection();
     private static final RemoteSystemProxy LOCAL_PROXY = new RemoteSystemProxy(checkNotNull(LOCAL_CONNECTION));
 
     /**
index 3806235ec5900243cb3e53f1d3501201a3e34e9f..6ec387271c3eed7c2a162e00be820efc0b4ca4d0 100644 (file)
@@ -15,7 +15,6 @@ import java.net.URI;
 
 import org.eclipse.jdt.annotation.NonNullByDefault;
 import org.eclipse.remote.core.IRemoteConnection;
-import org.eclipse.remote.core.IRemoteConnectionType;
 import org.eclipse.remote.core.exception.RemoteConnectionException;
 
 /**
@@ -29,8 +28,6 @@ import org.eclipse.remote.core.exception.RemoteConnectionException;
 public interface IConnectionFactory {
     /**
      * Creates an {@link IRemoteConnection} for the given URI.
-     * @param remoteConnectionType
-     *                the remote connection type
      * @param hostUri
      *                the host URI to connect to
      * @param hostName
@@ -39,5 +36,5 @@ public interface IConnectionFactory {
      *
      * @throws RemoteConnectionException in case of an error
      */
-    IRemoteConnection createConnection(IRemoteConnectionType remoteConnectionType, URI hostUri, String hostName) throws RemoteConnectionException;
+    IRemoteConnection createConnection(URI hostUri, String hostName) throws RemoteConnectionException;
 }
index fbffc7db9b4fd444f8ec4b82f3e3f23a554f4872..092e77e5c80329acfc7d1bf34f9ae617027ea419 100644 (file)
@@ -19,18 +19,11 @@ import org.eclipse.jdt.annotation.NonNullByDefault;
 import org.eclipse.jdt.annotation.Nullable;
 import org.eclipse.remote.core.IRemoteConnection;
 import org.eclipse.remote.core.IRemoteConnectionChangeListener;
-import org.eclipse.remote.core.IRemoteConnectionType;
-import org.eclipse.remote.core.IRemoteServicesManager;
 import org.eclipse.remote.core.RemoteConnectionChangeEvent;
 import org.eclipse.remote.core.exception.RemoteConnectionException;
-import org.eclipse.tracecompass.internal.tmf.remote.core.Activator;
 import org.eclipse.tracecompass.internal.tmf.remote.core.shell.CommandShell;
 import org.eclipse.tracecompass.tmf.remote.core.shell.ICommandShell;
 
-import com.google.common.base.Optional;
-import com.google.common.base.Predicate;
-import com.google.common.collect.FluentIterable;
-
 /**
  * <p>
  * RemoteSystemProxy implementation.
@@ -41,9 +34,6 @@ import com.google.common.collect.FluentIterable;
 @NonNullByDefault
 public class RemoteSystemProxy implements IRemoteConnectionChangeListener {
 
-    /** Name of a local connection */
-    public static final String LOCAL_CONNECTION_NAME = "Local"; //$NON-NLS-1$
-
     // ------------------------------------------------------------------------
     // Attributes
     // ------------------------------------------------------------------------
@@ -144,52 +134,4 @@ public class RemoteSystemProxy implements IRemoteConnectionChangeListener {
         }
     }
 
-    /**
-     * Return the OSGi service with the given service interface.
-     *
-     * @param service
-     *            service interface
-     * @return the specified service or null if it's not registered
-     */
-    public static @Nullable <T> T getService(Class<T> service) {
-        return Activator.getService(service);
-    }
-
-    /**
-     * Return a remote connection using OSGI service.
-     *
-     * @param remoteServicesId
-     *            ID of remote service
-     * @param name
-     *            name of connection
-     * @return the corresponding remote connection or null
-     */
-    public static @Nullable IRemoteConnection getRemoteConnection(final String remoteServicesId, final String name) {
-        IRemoteServicesManager manager = Activator.getService(IRemoteServicesManager.class);
-        if (manager == null) {
-            return null;
-        }
-        FluentIterable<IRemoteConnection> connections = FluentIterable.from(manager.getAllRemoteConnections());
-        Optional<IRemoteConnection> ret = connections.firstMatch(new Predicate<IRemoteConnection>() {
-            @Override
-            public boolean apply(@Nullable IRemoteConnection input) {
-                return ((input != null) && input.getConnectionType().getId().equals(remoteServicesId.toString()) && input.getName().equals(name.toString()));
-            }
-        });
-        return ret.orNull();
-    }
-
-    /**
-     * Return a Local connection.
-     *
-     * @return the local connection
-     */
-    public static @Nullable IRemoteConnection getLocalConnection() {
-        IRemoteServicesManager manager = Activator.getService(IRemoteServicesManager.class);
-        if (manager != null) {
-            IRemoteConnectionType type = manager.getLocalConnectionType();
-            return type.getConnection(LOCAL_CONNECTION_NAME);
-        }
-        return null;
-    }
 }
index 4f0b48552a440f6d4ce37791a5212910e3258ad9..7de35b5d8bdfe6ccf628584564a0d824b90d5c78 100644 (file)
@@ -18,6 +18,7 @@ import java.util.HashMap;
 import java.util.Map;
 
 import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
 import org.eclipse.remote.core.IRemoteConnection;
 import org.eclipse.remote.core.IRemoteConnectionHostService;
 import org.eclipse.remote.core.IRemoteConnectionType;
@@ -25,8 +26,13 @@ import org.eclipse.remote.core.IRemoteConnectionWorkingCopy;
 import org.eclipse.remote.core.IRemoteServicesManager;
 import org.eclipse.remote.core.exception.RemoteConnectionException;
 import org.eclipse.remote.internal.jsch.core.JSchConnection;
+import org.eclipse.tracecompass.internal.tmf.remote.core.Activator;
 import org.eclipse.tracecompass.internal.tmf.remote.core.messages.Messages;
 
+import com.google.common.base.Optional;
+import com.google.common.base.Predicate;
+import com.google.common.collect.FluentIterable;
+
 /**
  * Factory for creation of remote connections programmatically.
  *
@@ -41,12 +47,15 @@ public class TmfRemoteConnectionFactory {
     // ------------------------------------------------------------------------
     // Attributes
     // ------------------------------------------------------------------------
+    /** Name of a local connection */
+    public static final String LOCAL_CONNECTION_NAME = "Local"; //$NON-NLS-1$
+
     private static final Map<String, IConnectionFactory> CONNECTION_FACTORIES = new HashMap<>();
     private static final DefaultConnectionFactory DEFAULT_CONNECTION_FACTORY = new DefaultConnectionFactory();
 
     static {
         // Add local services
-        IRemoteServicesManager manager = RemoteSystemProxy.getService(IRemoteServicesManager.class);
+        IRemoteServicesManager manager = getService(IRemoteServicesManager.class);
         if (manager != null) {
             CONNECTION_FACTORIES.put(manager.getLocalConnectionType().getId(), new LocalConnectionFactory());
         }
@@ -82,25 +91,13 @@ public class TmfRemoteConnectionFactory {
      */
     public static IRemoteConnection createConnection(URI hostUri, String hostName) throws RemoteConnectionException {
 
-        IRemoteConnection connection = null;
-        IRemoteServicesManager manager = RemoteSystemProxy.getService(IRemoteServicesManager.class);
-        if (manager == null) {
-            throw new RemoteConnectionException(MessageFormat.format(Messages.RemoteConnection_ConnectionError, hostUri));
-        }
-        IRemoteConnectionType connectionType = manager.getConnectionType(hostUri);
-        if (connectionType == null) {
-            throw new RemoteConnectionException(MessageFormat.format(Messages.RemoteConnection_ConnectionError, hostUri));
-        }
-
+        IRemoteConnectionType connectionType = getConnectionType(hostUri);
         IConnectionFactory connectionFactory = CONNECTION_FACTORIES.get(connectionType.getId());
-        // Create a new connection
-        if (connectionFactory != null) {
-            connection = connectionFactory.createConnection(connectionType, hostUri, hostName);
-        } else {
-            connection = DEFAULT_CONNECTION_FACTORY.createConnection(connectionType, hostUri, hostName);
+        if (connectionFactory == null) {
+            connectionFactory = DEFAULT_CONNECTION_FACTORY;
         }
-
-        return connection;
+        // Create and return a new connection
+        return connectionFactory.createConnection(hostUri, hostName);
     }
 
     // ------------------------------------------------------------------------
@@ -113,8 +110,12 @@ public class TmfRemoteConnectionFactory {
     public static class DefaultConnectionFactory implements IConnectionFactory {
 
         @Override
-        public IRemoteConnection createConnection(IRemoteConnectionType connectionType, URI hostUri, String hostName) throws RemoteConnectionException {
+        public IRemoteConnection createConnection(URI hostUri, String hostName) throws RemoteConnectionException {
+
+            IRemoteConnectionType connectionType = getConnectionType(hostUri);
+
             IRemoteConnection connection = null;
+
             // Look for existing connections
             for (IRemoteConnection conn : connectionType.getConnections()) {
                 if (conn.getName().equals(hostName)) {
@@ -166,8 +167,8 @@ public class TmfRemoteConnectionFactory {
      */
     public static class LocalConnectionFactory implements IConnectionFactory {
         @Override
-        public IRemoteConnection createConnection(IRemoteConnectionType connectionType, URI hostUri, String hostName) throws RemoteConnectionException {
-            IRemoteConnection connection = RemoteSystemProxy.getLocalConnection();
+        public IRemoteConnection createConnection(URI hostUri, String hostName) throws RemoteConnectionException {
+            IRemoteConnection connection = getLocalConnection();
             if (connection == null) {
                 throw new RemoteConnectionException(MessageFormat.format(Messages.RemoteConnection_ConnectionError, hostUri));
             }
@@ -175,4 +176,71 @@ public class TmfRemoteConnectionFactory {
         }
     }
 
+    // ------------------------------------------------------------------------
+    // Helper method(s)
+    // ------------------------------------------------------------------------
+    private static IRemoteConnectionType getConnectionType(URI hostUri) throws RemoteConnectionException {
+        IRemoteServicesManager manager = getService(IRemoteServicesManager.class);
+        if (manager == null) {
+            throw new RemoteConnectionException(MessageFormat.format(Messages.RemoteConnection_ConnectionError, hostUri));
+        }
+        IRemoteConnectionType connectionType = manager.getConnectionType(hostUri);
+        if (connectionType == null) {
+            throw new RemoteConnectionException(MessageFormat.format(Messages.RemoteConnection_ConnectionError, hostUri));
+        }
+        return connectionType;
+    }
+
+    // ------------------------------------------------------------------------
+    // Helper methods using OSGI service
+    // ------------------------------------------------------------------------
+    /**
+     * Return the OSGi service with the given service interface.
+     *
+     * @param service
+     *            service interface
+     * @return the specified service or null if it's not registered
+     */
+    public static @Nullable <T> T getService(Class<T> service) {
+        return Activator.getService(service);
+    }
+
+    /**
+     * Return a remote connection using OSGI service.
+     *
+     * @param remoteServicesId
+     *            ID of remote service
+     * @param name
+     *            name of connection
+     * @return the corresponding remote connection or null
+     */
+    public static @Nullable IRemoteConnection getRemoteConnection(final String remoteServicesId, final String name) {
+        IRemoteServicesManager manager = Activator.getService(IRemoteServicesManager.class);
+        if (manager == null) {
+            return null;
+        }
+        FluentIterable<IRemoteConnection> connections = FluentIterable.from(manager.getAllRemoteConnections());
+        Optional<IRemoteConnection> ret = connections.firstMatch(new Predicate<IRemoteConnection>() {
+            @Override
+            public boolean apply(@Nullable IRemoteConnection input) {
+                return ((input != null) && input.getConnectionType().getId().equals(remoteServicesId.toString()) && input.getName().equals(name.toString()));
+            }
+        });
+        return ret.orNull();
+    }
+
+    /**
+     * Return a Local connection.
+     *
+     * @return the local connection
+     */
+    public static @Nullable IRemoteConnection getLocalConnection() {
+        IRemoteServicesManager manager = Activator.getService(IRemoteServicesManager.class);
+        if (manager != null) {
+            IRemoteConnectionType type = manager.getLocalConnectionType();
+            return type.getConnection(LOCAL_CONNECTION_NAME);
+        }
+        return null;
+    }
+
 }
index 8ef962a17ec0b2f89fb6825b9b8219c6eb3e6a14..4e7f7f7087140ecd2281f414a6dc12ef7259be63 100644 (file)
@@ -88,7 +88,7 @@ import org.eclipse.tracecompass.internal.tmf.ui.project.wizards.tracepkg.TracePa
 import org.eclipse.tracecompass.internal.tmf.ui.project.wizards.tracepkg.TracePackageFilesElement;
 import org.eclipse.tracecompass.internal.tmf.ui.project.wizards.tracepkg.TracePackageTraceElement;
 import org.eclipse.tracecompass.tmf.core.project.model.TmfTraceType;
-import org.eclipse.tracecompass.tmf.remote.core.proxy.RemoteSystemProxy;
+import org.eclipse.tracecompass.tmf.remote.core.proxy.TmfRemoteConnectionFactory;
 import org.eclipse.ui.ISharedImages;
 import org.eclipse.ui.IWorkbench;
 import org.eclipse.ui.IWorkbenchCommandConstants;
@@ -1081,7 +1081,7 @@ public class RemoteProfilesPreferencePage extends PreferencePage implements IWor
                     }
                     try {
                         URI uri = URIUtil.fromString(node.getURI());
-                        IRemoteServicesManager manager = RemoteSystemProxy.getService(IRemoteServicesManager.class);
+                        IRemoteServicesManager manager = TmfRemoteConnectionFactory.getService(IRemoteServicesManager.class);
                         if (manager == null || manager.getConnectionType(uri) == null) {
                             setErrorMessage(prefix + RemoteMessages.RemoteProfilesPreferencePage_UnsupportedURISchemeError);
                             return;
This page took 0.052565 seconds and 5 git commands to generate.