tmf remote: clean up RemoteSystemProxy class
authorBernd Hufmann <Bernd.Hufmann@ericsson.com>
Mon, 30 Mar 2015 20:36:03 +0000 (16:36 -0400)
committerBernd Hufmann <bernd.hufmann@ericsson.com>
Tue, 31 Mar 2015 15:02:00 +0000 (11:02 -0400)
Remove pass-through methods to IRemoteConnection instance. Users
can get the connection from the proxy and act directly on it.

This avoids duplication of methods.

Change-Id: I0cdd8a9ceb698ebdb6f7404f07d449e5bdaa7bee
Signed-off-by: Bernd Hufmann <Bernd.Hufmann@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/44877
Reviewed-by: Hudson CI
Reviewed-by: Patrick Tasse <patrick.tasse@gmail.com>
Tested-by: Patrick Tasse <patrick.tasse@gmail.com>
org.eclipse.tracecompass.lttng2.control.ui.tests/stubs/org/eclipse/tracecompass/internal/lttng2/control/stubs/service/TestRemoteSystemProxy.java
org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/dialogs/CreateSessionDialog.java
org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/dialogs/ImportDialog.java
org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/model/impl/TargetNodeComponent.java
org.eclipse.tracecompass.tmf.remote.core/src/org/eclipse/tracecompass/tmf/remote/core/proxy/RemoteSystemProxy.java
org.eclipse.tracecompass.tmf.remote.ui/src/org/eclipse/tracecompass/internal/tmf/remote/ui/wizards/fetch/model/RemoteGenerateManifestOperation.java

index 1d9b4a5b91cd13be12d16209c2c024bf0ca8bf77..4b7c501f2bc4b6a77950ad73d449c8ff162509a0 100644 (file)
@@ -17,9 +17,6 @@ import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
 import org.eclipse.core.commands.ExecutionException;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.remote.core.IRemoteConnection;
-import org.eclipse.remote.core.IRemoteConnectionChangeListener;
-import org.eclipse.remote.core.IRemoteFileService;
-import org.eclipse.remote.core.IRemoteProcessService;
 import org.eclipse.tracecompass.internal.lttng2.control.stubs.shells.LTTngToolsFileShell;
 import org.eclipse.tracecompass.tmf.remote.core.proxy.RemoteSystemProxy;
 import org.eclipse.tracecompass.tmf.remote.core.shell.ICommandShell;
@@ -35,16 +32,6 @@ public class TestRemoteSystemProxy extends RemoteSystemProxy {
     private String fTestFile = null;
     private String fScenario = null;
 
-    @Override
-    public IRemoteProcessService getProcessService() {
-        return null;
-    }
-
-    @Override
-    public IRemoteFileService getRemoteFileService() {
-        return null;
-    }
-
     @Override
     public void connect(IProgressMonitor monitor) throws ExecutionException {
     }
@@ -73,14 +60,6 @@ public class TestRemoteSystemProxy extends RemoteSystemProxy {
         return shell;
     }
 
-    @Override
-    public void addConnectionChangeListener(IRemoteConnectionChangeListener listener) {
-    }
-
-    @Override
-    public void removeConnectionChangeListener(IRemoteConnectionChangeListener listener) {
-    }
-
     public void setTestFile(String testFile) {
         fTestFile = testFile;
     }
index edd80fc35c1021e0271828ed094c3bb436ad3b46..39b0c8a863ea14c7e3f01c20ea28cb5a9b3e70aa 100644 (file)
@@ -817,7 +817,7 @@ public class CreateSessionDialog extends TitleAreaDialog implements ICreateSessi
             if (!fIsAdvancedEnabled && !fIsLive) {
                 TargetNodeComponent node = (TargetNodeComponent)fParent.getParent();
                 RemoteSystemProxy proxy = node.getRemoteSystemProxy();
-                IRemoteFileService fsss = proxy.getRemoteFileService();
+                IRemoteFileService fsss = proxy.getRemoteConnection().getService(IRemoteFileService.class);
                 if (fsss != null) {
                     IFileStore remoteFolder = fsss.getResource(fSessionPath);
                     if (remoteFolder == null) {
index a7cb277c3e10a0147cf5e308d962f13195084cd4..9562d06ebc4edf2817b657e12172eceb30e879b5 100644 (file)
@@ -410,7 +410,7 @@ public class ImportDialog extends Dialog implements IImportDialog {
 
         RemoteSystemProxy proxy = fSession.getTargetNode().getRemoteSystemProxy();
 
-        IRemoteFileService fsss = proxy.getRemoteFileService();
+        IRemoteFileService fsss = proxy.getRemoteConnection().getService(IRemoteFileService.class);
 
         if (fsss == null) {
             return;
index 9cd28c123c9e7cee920ebbc618218b0d28420551..8991cde3c9ab6152ae9674248e601d1c4c5d83cb 100644 (file)
@@ -113,7 +113,7 @@ public class TargetNodeComponent extends TraceControlComponent implements IRemot
         setImage(TARGET_NODE_CONNECTED_ICON_FILE);
         fDisconnectedImage = Activator.getDefault().loadIcon(TARGET_NODE_DISCONNECTED_ICON_FILE);
         fRemoteProxy = proxy;
-        fRemoteProxy.addConnectionChangeListener(this);
+        fRemoteProxy.getRemoteConnection().addConnectionChangeListener(this);
         setToolTip(fRemoteProxy.getRemoteConnection().getName());
     }
 
@@ -133,7 +133,7 @@ public class TargetNodeComponent extends TraceControlComponent implements IRemot
 
     @Override
     public void dispose() {
-        fRemoteProxy.removeConnectionChangeListener(this);
+        fRemoteProxy.getRemoteConnection().removeConnectionChangeListener(this);
         fRemoteProxy.dispose();
         disposeControlService();
     }
index 7f02dcf4b86e346cc41c063c9fd1788ee9375de6..fbffc7db9b4fd444f8ec4b82f3e3f23a554f4872 100644 (file)
@@ -20,8 +20,6 @@ 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.IRemoteFileService;
-import org.eclipse.remote.core.IRemoteProcessService;
 import org.eclipse.remote.core.IRemoteServicesManager;
 import org.eclipse.remote.core.RemoteConnectionChangeEvent;
 import org.eclipse.remote.core.exception.RemoteConnectionException;
@@ -80,25 +78,6 @@ public class RemoteSystemProxy implements IRemoteConnectionChangeListener {
     // Operations
     // ------------------------------------------------------------------------
 
-    /**
-     * Finds the remote file system service.
-     *
-     * @return file service subsystem, or <code>null</code> if not found.
-     */
-    public @Nullable IRemoteFileService getRemoteFileService() {
-        return fHost.getService(IRemoteFileService.class);
-    }
-
-    /**
-     * Returns a remote process service.
-     *
-     * @return the remote process service ({@link IRemoteProcessService}, or
-     *         <code>null</code> if not found.
-     */
-    public @Nullable IRemoteProcessService getProcessService() {
-        return fHost.getService(IRemoteProcessService.class);
-    }
-
     /**
      * Connects the remote connection.
      *
@@ -145,28 +124,6 @@ public class RemoteSystemProxy implements IRemoteConnectionChangeListener {
         return new CommandShell(fHost);
     }
 
-    /**
-     * Method to add a communication listener to the connector service defined
-     * for the given connection.
-     *
-     * @param listener
-     *            listener to add
-     */
-    public void addConnectionChangeListener(IRemoteConnectionChangeListener listener) {
-        fHost.addConnectionChangeListener(listener);
-    }
-
-    /**
-     * Method to remove a communication listener from the connector service
-     * defined for the given connection.
-     *
-     * @param listener
-     *            listener to remove
-     */
-    public void removeConnectionChangeListener(IRemoteConnectionChangeListener listener) {
-        fHost.removeConnectionChangeListener(listener);
-    }
-
     /**
      * Returns the connection state.
      *
index bb1221d3212a3ab4ec5d7b6f489c3140cdf27bd8..30de6d03da4c82a4072e2606fa574cb1d818e591 100644 (file)
@@ -93,7 +93,7 @@ public class RemoteGenerateManifestOperation extends AbstractGenerateManifestOpe
                         root = traceGroup.getRootImportPath();
                         TracePackageElement[] traceElements = traceGroup.getChildren();
                         fTemplatePatternsToTraceElements = generatePatterns(traceElements);
-                        IRemoteFileService fs = proxy.getRemoteFileService();
+                        IRemoteFileService fs = proxy.getRemoteConnection().getService(IRemoteFileService.class);
                         if (fs == null) {
                             continue;
                         }
This page took 0.038552 seconds and 5 git commands to generate.