| 1 | /********************************************************************** |
| 2 | * Copyright (c) 2012, 2013 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 | **********************************************************************/ |
| 12 | package org.eclipse.linuxtools.internal.lttng2.ui.views.control.remote; |
| 13 | |
| 14 | import org.eclipse.core.commands.ExecutionException; |
| 15 | import org.eclipse.rse.core.model.IRSECallback; |
| 16 | import org.eclipse.rse.core.subsystems.ICommunicationsListener; |
| 17 | import org.eclipse.rse.core.subsystems.ISubSystem; |
| 18 | import org.eclipse.rse.services.shells.IShellService; |
| 19 | import org.eclipse.rse.services.terminals.ITerminalService; |
| 20 | import org.eclipse.rse.subsystems.files.core.servicesubsystem.IFileServiceSubSystem; |
| 21 | |
| 22 | /** |
| 23 | * <p> |
| 24 | * Remote System Proxy interface. |
| 25 | * </p> |
| 26 | * |
| 27 | * @author Bernd Hufmann |
| 28 | */ |
| 29 | public interface IRemoteSystemProxy { |
| 30 | |
| 31 | // ------------------------------------------------------------------------ |
| 32 | // Constants |
| 33 | // ------------------------------------------------------------------------ |
| 34 | /** |
| 35 | * Invalid port number for IP based connections. |
| 36 | */ |
| 37 | public final static int INVALID_PORT_NUMBER = -1; |
| 38 | |
| 39 | // ------------------------------------------------------------------------ |
| 40 | // Operations |
| 41 | // ------------------------------------------------------------------------ |
| 42 | /** |
| 43 | * Find the first shell service. |
| 44 | * |
| 45 | * @return shell service object, or <code>null</code> if not found. |
| 46 | */ |
| 47 | IShellService getShellService(); |
| 48 | |
| 49 | /** |
| 50 | * Find the first terminal service. |
| 51 | * |
| 52 | * @return shell service object, or <code>null</code> if not found. |
| 53 | */ |
| 54 | ITerminalService getTerminalService(); |
| 55 | |
| 56 | /** |
| 57 | * Find the first IShellServiceSubSystem service. |
| 58 | * |
| 59 | * @return shell service subsystem, or <code>null</code> if not found. |
| 60 | */ |
| 61 | ISubSystem getShellServiceSubSystem(); |
| 62 | |
| 63 | /** |
| 64 | * Find the first ITerminalServiceSubSystem service. |
| 65 | * |
| 66 | * @return shell service subsystem, or <code>null</code> if not found. |
| 67 | */ |
| 68 | ISubSystem getTerminalServiceSubSystem(); |
| 69 | |
| 70 | /** |
| 71 | * Finds the File Service Subsystem. |
| 72 | * |
| 73 | * @return file service subsystem, or <code>null</code> if not found. |
| 74 | */ |
| 75 | IFileServiceSubSystem getFileServiceSubSystem(); |
| 76 | |
| 77 | /** |
| 78 | * @return port of IP connection to be used |
| 79 | */ |
| 80 | int getPort(); |
| 81 | |
| 82 | /** |
| 83 | * Sets the port of the IP connection. |
| 84 | * @param port - the IP port to set |
| 85 | */ |
| 86 | void setPort(int port); |
| 87 | |
| 88 | /** |
| 89 | * Connects the shell service sub system. |
| 90 | * |
| 91 | * @param callback |
| 92 | * - call-back method being called when connection was finished |
| 93 | * @throws ExecutionException |
| 94 | * If the connection fails |
| 95 | */ |
| 96 | void connect(IRSECallback callback) throws ExecutionException; |
| 97 | |
| 98 | /** |
| 99 | * Disconnects from the shell service sub system. |
| 100 | * |
| 101 | * @throws ExecutionException |
| 102 | * If the disconnect command fails |
| 103 | */ |
| 104 | void disconnect() throws ExecutionException; |
| 105 | |
| 106 | /** |
| 107 | * Creates a command shell. |
| 108 | * |
| 109 | * @return the command shell implementation |
| 110 | * @throws ExecutionException |
| 111 | * If the command fails |
| 112 | */ |
| 113 | ICommandShell createCommandShell() throws ExecutionException; |
| 114 | |
| 115 | /** |
| 116 | * Method to add a communication listener to the connector service defined |
| 117 | * for the given connection. |
| 118 | * |
| 119 | * @param listener |
| 120 | * - listener to add |
| 121 | */ |
| 122 | void addCommunicationListener(ICommunicationsListener listener); |
| 123 | |
| 124 | /** |
| 125 | * Method to remove a communication listener from the connector service |
| 126 | * defined for the given connection. |
| 127 | * |
| 128 | * @param listener |
| 129 | * - listener to remove |
| 130 | */ |
| 131 | void removeCommunicationListener(ICommunicationsListener listener); |
| 132 | |
| 133 | } |