From 33d432d527110f482a3457f8affa6e3012546f54 Mon Sep 17 00:00:00 2001 From: Bernd Hufmann Date: Mon, 30 Mar 2015 16:36:03 -0400 Subject: [PATCH] tmf remote: clean up RemoteSystemProxy class 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 Reviewed-on: https://git.eclipse.org/r/44877 Reviewed-by: Hudson CI Reviewed-by: Patrick Tasse Tested-by: Patrick Tasse --- .../stubs/service/TestRemoteSystemProxy.java | 21 --------- .../ui/views/dialogs/CreateSessionDialog.java | 2 +- .../ui/views/dialogs/ImportDialog.java | 2 +- .../views/model/impl/TargetNodeComponent.java | 4 +- .../remote/core/proxy/RemoteSystemProxy.java | 43 ------------------- .../RemoteGenerateManifestOperation.java | 2 +- 6 files changed, 5 insertions(+), 69 deletions(-) diff --git a/org.eclipse.tracecompass.lttng2.control.ui.tests/stubs/org/eclipse/tracecompass/internal/lttng2/control/stubs/service/TestRemoteSystemProxy.java b/org.eclipse.tracecompass.lttng2.control.ui.tests/stubs/org/eclipse/tracecompass/internal/lttng2/control/stubs/service/TestRemoteSystemProxy.java index 1d9b4a5b91..4b7c501f2b 100644 --- a/org.eclipse.tracecompass.lttng2.control.ui.tests/stubs/org/eclipse/tracecompass/internal/lttng2/control/stubs/service/TestRemoteSystemProxy.java +++ b/org.eclipse.tracecompass.lttng2.control.ui.tests/stubs/org/eclipse/tracecompass/internal/lttng2/control/stubs/service/TestRemoteSystemProxy.java @@ -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; } diff --git a/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/dialogs/CreateSessionDialog.java b/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/dialogs/CreateSessionDialog.java index edd80fc35c..39b0c8a863 100644 --- a/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/dialogs/CreateSessionDialog.java +++ b/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/dialogs/CreateSessionDialog.java @@ -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) { diff --git a/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/dialogs/ImportDialog.java b/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/dialogs/ImportDialog.java index a7cb277c3e..9562d06ebc 100644 --- a/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/dialogs/ImportDialog.java +++ b/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/dialogs/ImportDialog.java @@ -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; diff --git a/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/model/impl/TargetNodeComponent.java b/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/model/impl/TargetNodeComponent.java index 9cd28c123c..8991cde3c9 100644 --- a/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/model/impl/TargetNodeComponent.java +++ b/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/model/impl/TargetNodeComponent.java @@ -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(); } diff --git a/org.eclipse.tracecompass.tmf.remote.core/src/org/eclipse/tracecompass/tmf/remote/core/proxy/RemoteSystemProxy.java b/org.eclipse.tracecompass.tmf.remote.core/src/org/eclipse/tracecompass/tmf/remote/core/proxy/RemoteSystemProxy.java index 7f02dcf4b8..fbffc7db9b 100644 --- a/org.eclipse.tracecompass.tmf.remote.core/src/org/eclipse/tracecompass/tmf/remote/core/proxy/RemoteSystemProxy.java +++ b/org.eclipse.tracecompass.tmf.remote.core/src/org/eclipse/tracecompass/tmf/remote/core/proxy/RemoteSystemProxy.java @@ -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 null 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 - * null 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. * diff --git a/org.eclipse.tracecompass.tmf.remote.ui/src/org/eclipse/tracecompass/internal/tmf/remote/ui/wizards/fetch/model/RemoteGenerateManifestOperation.java b/org.eclipse.tracecompass.tmf.remote.ui/src/org/eclipse/tracecompass/internal/tmf/remote/ui/wizards/fetch/model/RemoteGenerateManifestOperation.java index bb1221d321..30de6d03da 100644 --- a/org.eclipse.tracecompass.tmf.remote.ui/src/org/eclipse/tracecompass/internal/tmf/remote/ui/wizards/fetch/model/RemoteGenerateManifestOperation.java +++ b/org.eclipse.tracecompass.tmf.remote.ui/src/org/eclipse/tracecompass/internal/tmf/remote/ui/wizards/fetch/model/RemoteGenerateManifestOperation.java @@ -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; } -- 2.34.1