| 1 | /********************************************************************** |
| 2 | * Copyright (c) 2012, 2015 Ericsson |
| 3 | * |
| 4 | * All rights reserved. This program and the accompanying materials are |
| 5 | * made available under the terms of the Eclipse Public License v1.0 which |
| 6 | * accompanies this distribution, and is available at |
| 7 | * http://www.eclipse.org/legal/epl-v10.html |
| 8 | * |
| 9 | * Contributors: |
| 10 | * Bernd Hufmann - Initial API and implementation |
| 11 | * Markus Schorn - Bug 448058: Use org.eclipse.remote in favor of RSE |
| 12 | * Bernd Hufmann - Update to org.eclipse.remote API 2.0 |
| 13 | **********************************************************************/ |
| 14 | package org.eclipse.tracecompass.internal.lttng2.control.ui.views.remote; |
| 15 | |
| 16 | import org.eclipse.core.commands.ExecutionException; |
| 17 | import org.eclipse.core.runtime.IProgressMonitor; |
| 18 | import org.eclipse.remote.core.IRemoteConnectionChangeListener; |
| 19 | import org.eclipse.remote.core.IRemoteFileService; |
| 20 | import org.eclipse.remote.core.IRemoteProcessBuilder; |
| 21 | |
| 22 | /** |
| 23 | * <p> |
| 24 | * Remote System Proxy interface. |
| 25 | * </p> |
| 26 | * |
| 27 | * @author Bernd Hufmann |
| 28 | */ |
| 29 | public interface IRemoteSystemProxy { |
| 30 | |
| 31 | /** |
| 32 | * Invalid port number for IP based connections. |
| 33 | */ |
| 34 | int INVALID_PORT_NUMBER = -1; |
| 35 | |
| 36 | // ------------------------------------------------------------------------ |
| 37 | // Operations |
| 38 | // ------------------------------------------------------------------------ |
| 39 | |
| 40 | /** |
| 41 | * Finds the File Service Subsystem. |
| 42 | * |
| 43 | * @return file service subsystem, or <code>null</code> if not found. |
| 44 | */ |
| 45 | IRemoteFileService getRemoteFileService(); |
| 46 | |
| 47 | /** |
| 48 | * Returns a remote process builder for remote launching a process. |
| 49 | * @param command the command to be executed. |
| 50 | * @return the builder, or <code>null</code> if not possible. |
| 51 | */ |
| 52 | IRemoteProcessBuilder getProcessBuilder(String...command); |
| 53 | |
| 54 | /** |
| 55 | * Connects the shell service sub system. |
| 56 | * @param monitor a monitor to report progress. |
| 57 | * |
| 58 | * @param callback |
| 59 | * - call-back method being called when connection was finished |
| 60 | * @throws ExecutionException |
| 61 | * If the connection fails |
| 62 | */ |
| 63 | void connect(IProgressMonitor monitor) throws ExecutionException; |
| 64 | |
| 65 | /** |
| 66 | * Disconnects from the shell service sub system. |
| 67 | * |
| 68 | * @throws ExecutionException |
| 69 | * If the disconnect command fails |
| 70 | */ |
| 71 | void disconnect() throws ExecutionException; |
| 72 | |
| 73 | /** |
| 74 | * Disposes the proxy, may close the connection. |
| 75 | */ |
| 76 | void dispose(); |
| 77 | |
| 78 | /** |
| 79 | * Creates a command shell. |
| 80 | * |
| 81 | * @return the command shell implementation |
| 82 | * @throws ExecutionException |
| 83 | * If the command fails |
| 84 | */ |
| 85 | ICommandShell createCommandShell() throws ExecutionException; |
| 86 | |
| 87 | /** |
| 88 | * Method to add a communication listener to the connector service defined |
| 89 | * for the given connection. |
| 90 | * |
| 91 | * @param listener |
| 92 | * - listener to add |
| 93 | */ |
| 94 | void addConnectionChangeListener(IRemoteConnectionChangeListener listener); |
| 95 | |
| 96 | /** |
| 97 | * Method to remove a communication listener from the connector service |
| 98 | * defined for the given connection. |
| 99 | * |
| 100 | * @param listener |
| 101 | * - listener to remove |
| 102 | */ |
| 103 | void removeConnectionChangeListener(IRemoteConnectionChangeListener listener); |
| 104 | |
| 105 | /** |
| 106 | * @return whether the remote host is currently connected. |
| 107 | */ |
| 108 | boolean isConnected(); |
| 109 | } |