1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-03-28 14:56:28 +01:00

Bug 577097: Format all o.e.remote code to CDT standard

This is applying the per-project code formatting rules that would
be applied on save in the JDT editor

See also Bug 540373

Change-Id: Ie93f9b640d0f0cfce8711e72fabc87f6a89634fa
This commit is contained in:
Jonah Graham 2021-12-14 13:49:04 -05:00
parent 8980b1f104
commit 3e9dadd642
178 changed files with 2219 additions and 2134 deletions

View file

@ -19,7 +19,7 @@ import org.eclipse.ui.console.IConsole;
/**
* A collection of public API utility methods to open consoles to
* IRemoteConnection objects
*
*
* @since 1.1
*/
public class TerminalConsoleUtility {
@ -33,7 +33,7 @@ public class TerminalConsoleUtility {
/**
* Open a specific IRemoteConnection and encoding combination.
*
*
* @param connection
* @param encoding
*/
@ -43,7 +43,7 @@ public class TerminalConsoleUtility {
/**
* Find an existing console for the given IRemoteConnection
*
*
* @param connection
* @return
*/

View file

@ -23,7 +23,7 @@ public abstract class ConsoleAction extends Action {
/**
* @param id
* The action id
* The action id
*/
public ConsoleAction(String id) {
this(id, 0);
@ -31,9 +31,9 @@ public abstract class ConsoleAction extends Action {
/**
* @param id
* The action id
* The action id
* @param style
* one of AS_PUSH_BUTTON, AS_CHECK_BOX, AS_DROP_DOWN_MENU, AS_RADIO_BUTTON,
* one of AS_PUSH_BUTTON, AS_CHECK_BOX, AS_DROP_DOWN_MENU, AS_RADIO_BUTTON,
* and AS_UNSPECIFIED
*/
public ConsoleAction(String id, int style) {
@ -55,8 +55,7 @@ public abstract class ConsoleAction extends Action {
* @param enabled
* the enabled state for this action
*/
protected void setupAction(String text, String tooltip,
String image, String enabledImage, String disabledImage,
protected void setupAction(String text, String tooltip, String image, String enabledImage, String disabledImage,
boolean enabled) {
ImageRegistry imageRegistry = Activator.getDefault().getImageRegistry();
setupAction(text, tooltip, image, enabledImage, disabledImage, enabled, imageRegistry);
@ -78,15 +77,10 @@ public abstract class ConsoleAction extends Action {
* @param imageRegistry
* the ImageRegistry to retrieve ImageDescriptor for the keys provided
*/
protected void setupAction(String text, String tooltip,
String hoverImage, String enabledImage, String disabledImage,
boolean enabled, ImageRegistry imageRegistry) {
setupAction(text,
tooltip,
imageRegistry.getDescriptor(hoverImage),
imageRegistry.getDescriptor(enabledImage),
imageRegistry.getDescriptor(disabledImage),
enabled);
protected void setupAction(String text, String tooltip, String hoverImage, String enabledImage,
String disabledImage, boolean enabled, ImageRegistry imageRegistry) {
setupAction(text, tooltip, imageRegistry.getDescriptor(hoverImage), imageRegistry.getDescriptor(enabledImage),
imageRegistry.getDescriptor(disabledImage), enabled);
}
/**
@ -103,9 +97,8 @@ public abstract class ConsoleAction extends Action {
* @param enabled
* the enabled state for this action
*/
protected void setupAction(String text, String tooltip,
ImageDescriptor hoverImage, ImageDescriptor enabledImage, ImageDescriptor disabledImage,
boolean enabled) {
protected void setupAction(String text, String tooltip, ImageDescriptor hoverImage, ImageDescriptor enabledImage,
ImageDescriptor disabledImage, boolean enabled) {
setText(text);
setToolTipText(tooltip);
setEnabled(enabled);

View file

@ -16,15 +16,15 @@ import org.eclipse.core.runtime.IAdaptable;
* @since 1.1
*/
public interface IConsoleActionFactory {
/**
/**
* Returns an implementation of ConsoleAction
*
*
* @param actionId
* The id of the action being requested
* The id of the action being requested
* @param connectionType
* The connection type of the terminal console
* @param adapter
* An adapter to get relevant objects for use by the ConsoleAction being created (eg. IRemoteConnection)
* An adapter to get relevant objects for use by the ConsoleAction being created (eg. IRemoteConnection)
* @return an implementation of ConsoleAction
*/
public ConsoleAction createAction(String actionId, String connectionType, IAdaptable adapter);

View file

@ -23,7 +23,7 @@ public class Activator extends AbstractUIPlugin {
// The shared instance
private static Activator plugin;
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
@ -102,10 +102,10 @@ public class Activator extends AbstractUIPlugin {
imageRegistry.put(entry.getKey(), imageDescriptor);
}
}
/**
* Create log entry from an IStatus
*
*
* @param status
* status to log
*/
@ -115,7 +115,7 @@ public class Activator extends AbstractUIPlugin {
/**
* Create log entry from a string
*
*
* @param msg
* message to log
*/
@ -125,7 +125,7 @@ public class Activator extends AbstractUIPlugin {
/**
* Create log entry from a Throwable
*
*
* @param e
* throwable to log
*/

View file

@ -19,34 +19,33 @@
*******************************************************************************/
package org.eclipse.remote.internal.console;
public interface ImageConsts
{
public final static String IMAGE_DIR_ROOT = "icons/"; //$NON-NLS-1$
public final static String IMAGE_DIR_LOCALTOOL = "clcl16/"; // basic colors - size 16x16 //$NON-NLS-1$
public final static String IMAGE_DIR_DLCL = "dlcl16/"; // disabled - size 16x16 //$NON-NLS-1$
public final static String IMAGE_DIR_ELCL = "elcl16/"; // enabled - size 16x16 //$NON-NLS-1$
public final static String IMAGE_DIR_VIEW = "cview16/"; // views //$NON-NLS-1$
public final static String IMAGE_DIR_EVIEW = "eview16/"; // views //$NON-NLS-1$
public interface ImageConsts {
public final static String IMAGE_DIR_ROOT = "icons/"; //$NON-NLS-1$
public final static String IMAGE_DIR_LOCALTOOL = "clcl16/"; // basic colors - size 16x16 //$NON-NLS-1$
public final static String IMAGE_DIR_DLCL = "dlcl16/"; // disabled - size 16x16 //$NON-NLS-1$
public final static String IMAGE_DIR_ELCL = "elcl16/"; // enabled - size 16x16 //$NON-NLS-1$
public final static String IMAGE_DIR_VIEW = "cview16/"; // views //$NON-NLS-1$
public final static String IMAGE_DIR_EVIEW = "eview16/"; // views //$NON-NLS-1$
public static final String IMAGE_NEW_TERMINAL = "TerminalViewNewTerminal"; //$NON-NLS-1$
public static final String IMAGE_TERMINAL_VIEW = "TerminalView"; //$NON-NLS-1$
public static final String IMAGE_CLCL_CONNECT = "ImageClclConnect"; //$NON-NLS-1$
public static final String IMAGE_CLCL_DISCONNECT = "ImageClclDisconnect"; //$NON-NLS-1$
public static final String IMAGE_CLCL_SETTINGS = "ImageClclSettings"; //$NON-NLS-1$
public static final String IMAGE_CLCL_SCROLL_LOCK = "ImageClclScrollLock"; //$NON-NLS-1$
public static final String IMAGE_NEW_TERMINAL = "TerminalViewNewTerminal"; //$NON-NLS-1$
public static final String IMAGE_TERMINAL_VIEW = "TerminalView"; //$NON-NLS-1$
public static final String IMAGE_CLCL_CONNECT = "ImageClclConnect"; //$NON-NLS-1$
public static final String IMAGE_CLCL_DISCONNECT = "ImageClclDisconnect"; //$NON-NLS-1$
public static final String IMAGE_CLCL_SETTINGS = "ImageClclSettings"; //$NON-NLS-1$
public static final String IMAGE_CLCL_SCROLL_LOCK = "ImageClclScrollLock"; //$NON-NLS-1$
public static final String IMAGE_DLCL_CONNECT = "ImageDlclConnect"; //$NON-NLS-1$
public static final String IMAGE_DLCL_DISCONNECT = "ImageDlclDisconnect"; //$NON-NLS-1$
public static final String IMAGE_DLCL_SETTINGS = "ImageDlclSettings"; //$NON-NLS-1$
public static final String IMAGE_DLCL_SCROLL_LOCK = "ImageDlclScrollLock"; //$NON-NLS-1$
public static final String IMAGE_DLCL_REMOVE = "ImageDlclRemove"; //$NON-NLS-1$
public static final String IMAGE_DLCL_CONNECT = "ImageDlclConnect"; //$NON-NLS-1$
public static final String IMAGE_DLCL_DISCONNECT = "ImageDlclDisconnect"; //$NON-NLS-1$
public static final String IMAGE_DLCL_SETTINGS = "ImageDlclSettings"; //$NON-NLS-1$
public static final String IMAGE_DLCL_SCROLL_LOCK = "ImageDlclScrollLock"; //$NON-NLS-1$
public static final String IMAGE_DLCL_REMOVE = "ImageDlclRemove"; //$NON-NLS-1$
public static final String IMAGE_ELCL_CONNECT = "ImageElclConnect"; //$NON-NLS-1$
public static final String IMAGE_ELCL_DISCONNECT = "ImageElclDisconnect"; //$NON-NLS-1$
public static final String IMAGE_ELCL_SETTINGS = "ImageElclSettings"; //$NON-NLS-1$
public static final String IMAGE_ELCL_SCROLL_LOCK = "ImageElclScrollLock"; //$NON-NLS-1$
public static final String IMAGE_ELCL_REMOVE = "ImageElclRemove"; //$NON-NLS-1$
public static final String IMAGE_CLCL_COMMAND_INPUT_FIELD = "ImageClclCommandInputField";//$NON-NLS-1$
public static final String IMAGE_ELCL_COMMAND_INPUT_FIELD = "ImageDlclCommandInputField";//$NON-NLS-1$
public static final String IMAGE_DLCL_COMMAND_INPUT_FIELD = "ImageDlclCommandInputField";//$NON-NLS-1$
}
public static final String IMAGE_ELCL_CONNECT = "ImageElclConnect"; //$NON-NLS-1$
public static final String IMAGE_ELCL_DISCONNECT = "ImageElclDisconnect"; //$NON-NLS-1$
public static final String IMAGE_ELCL_SETTINGS = "ImageElclSettings"; //$NON-NLS-1$
public static final String IMAGE_ELCL_SCROLL_LOCK = "ImageElclScrollLock"; //$NON-NLS-1$
public static final String IMAGE_ELCL_REMOVE = "ImageElclRemove"; //$NON-NLS-1$
public static final String IMAGE_CLCL_COMMAND_INPUT_FIELD = "ImageClclCommandInputField";//$NON-NLS-1$
public static final String IMAGE_ELCL_COMMAND_INPUT_FIELD = "ImageDlclCommandInputField";//$NON-NLS-1$
public static final String IMAGE_DLCL_COMMAND_INPUT_FIELD = "ImageDlclCommandInputField";//$NON-NLS-1$
}

View file

@ -27,7 +27,8 @@ public class TerminalConsole extends AbstractConsole implements ITerminalConsole
private final int index;
public TerminalConsole(IRemoteConnection connection, int index, String encoding) {
super(connection.getName(), Activator.getDefault().getImageRegistry().getDescriptor(ImageConsts.IMAGE_TERMINAL_VIEW));
super(connection.getName(),
Activator.getDefault().getImageRegistry().getDescriptor(ImageConsts.IMAGE_TERMINAL_VIEW));
this.encoding = encoding;
this.terminalConnector = new TerminalConsoleConnector(connection);
this.index = index;
@ -45,7 +46,7 @@ public class TerminalConsole extends AbstractConsole implements ITerminalConsole
public int getIndex() {
return index;
}
public synchronized void setState(TerminalState terminalState) {
StringBuffer nameBuff = new StringBuffer(getConnection().getName());
if (index > 0) {

View file

@ -140,14 +140,16 @@ public class TerminalConsoleConnector {
return new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getLocalizedMessage(), e);
}
}
if (remoteProcess == null) {
disconnect();
return new Status(IStatus.ERROR, Activator.PLUGIN_ID, ConsoleMessages.TerminalConsoleConnector_0);
return new Status(IStatus.ERROR, Activator.PLUGIN_ID,
ConsoleMessages.TerminalConsoleConnector_0);
}
if (width > 0 || height > 0) {
IRemoteProcessTerminalService termService = remoteProcess.getService(IRemoteProcessTerminalService.class);
IRemoteProcessTerminalService termService = remoteProcess
.getService(IRemoteProcessTerminalService.class);
if (termService != null) {
termService.setTerminalSize(width, height, 8 * width, 8 * height);
}
@ -202,7 +204,8 @@ public class TerminalConsoleConnector {
height = minHeight;
synchronized (this) {
if (remoteProcess != null) {
IRemoteProcessTerminalService termService = remoteProcess.getService(IRemoteProcessTerminalService.class);
IRemoteProcessTerminalService termService = remoteProcess
.getService(IRemoteProcessTerminalService.class);
if (termService != null) {
termService.setTerminalSize(width, height, 8 * width, 8 * height);
}

View file

@ -45,7 +45,7 @@ public class TerminalConsoleExtensionManager {
List<String> list = actions.get(id);
return list == null ? new ArrayList<String>() : list;
}
public IConsoleActionFactory getFactory(String id) {
return factories.get(id);
}

View file

@ -99,9 +99,9 @@ public class TerminalConsolePage extends Page implements IAdaptable {
toolBarManager.appendToGroup(TOOLBAR_GROUP_ID, disconnectAction);
toolBarManager.appendToGroup(TOOLBAR_GROUP_ID, new ConsoleActionScrollLock(this));
toolBarManager.appendToGroup(TOOLBAR_GROUP_ID, new CloseConsoleAction(terminalConsole));
toolBarManager.insertAfter(TOOLBAR_GROUP_ID, new GroupMarker(CONTRIBUTIONS_GROUP_ID));
addToolbarContributions(toolBarManager);
}
@ -125,9 +125,7 @@ public class TerminalConsolePage extends Page implements IAdaptable {
mainComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
mainComposite.setLayout(new FillLayout());
tViewCtrl = TerminalViewControlFactory.makeControl(listener,
mainComposite,
new ITerminalConnector[] {});
tViewCtrl = TerminalViewControlFactory.makeControl(listener, mainComposite, new ITerminalConnector[] {});
tViewCtrl.setConnector(terminalConsole.getTerminalConnector().newPageConnector());
try {
@ -137,9 +135,7 @@ public class TerminalConsolePage extends Page implements IAdaptable {
NLS.bind(ConsoleMessages.ENCODING_UNAVAILABLE_1, encoding));
Activator.log(status);
ErrorDialog.openError(PlatformUI.getWorkbench().getDisplay().getActiveShell(),
ConsoleMessages.OPEN_CONSOLE_ERROR,
ConsoleMessages.ENCODING_UNAVAILABLE_0,
status);
ConsoleMessages.OPEN_CONSOLE_ERROR, ConsoleMessages.ENCODING_UNAVAILABLE_0, status);
}
connectTerminalJob.schedule();
}

View file

@ -40,7 +40,7 @@ public class TerminalConsoleSettingsDialog extends Dialog {
private static final String CONNECTION_TYPE = "connectionType"; //$NON-NLS-1$
private static final String CONNECTION_NAME = "connectionName"; //$NON-NLS-1$
private static final String ENCODING = "encoding"; //$NON-NLS-1$
private RemoteConnectionWidget remoteConnWidget;
private Combo encodingCombo;
private String selectedEncoding;
@ -60,11 +60,12 @@ public class TerminalConsoleSettingsDialog extends Dialog {
IRemoteServicesManager manager = Activator.getService(IRemoteServicesManager.class);
// TODO remove the remote process service once we get command shell available with ssh and local
@SuppressWarnings("unchecked") List<IRemoteConnectionType> connTypes = manager.getConnectionTypesSupporting(
IRemoteCommandShellService.class, IRemoteProcessService.class);
@SuppressWarnings("unchecked")
List<IRemoteConnectionType> connTypes = manager.getConnectionTypesSupporting(IRemoteCommandShellService.class,
IRemoteProcessService.class);
remoteConnWidget = new RemoteConnectionWidget(composite, SWT.NONE, null, 0, connTypes);
IDialogSettings settings = getDialogSettings();
String initialId = settings.get(CONNECTION_TYPE);
String initialName = settings.get(CONNECTION_NAME);
@ -100,7 +101,7 @@ public class TerminalConsoleSettingsDialog extends Dialog {
return composite;
}
private List<String> getEncodings(){
private List<String> getEncodings() {
List<String> encodings = new ArrayList<>(2);
encodings.add("ISO-8859-1"); //$NON-NLS-1$
encodings.add("UTF-8"); //$NON-NLS-1$
@ -159,18 +160,20 @@ public class TerminalConsoleSettingsDialog extends Dialog {
validateDialog();
}
}
private IDialogSettings getDialogSettings() {
IDialogSettings result = Activator.getDefault().getDialogSettings().getSection(TerminalConsoleSettingsDialog.class.getName());
IDialogSettings result = Activator.getDefault().getDialogSettings()
.getSection(TerminalConsoleSettingsDialog.class.getName());
if (result == null) {
result = Activator.getDefault().getDialogSettings().addNewSection(TerminalConsoleSettingsDialog.class.getName());
result = Activator.getDefault().getDialogSettings()
.addNewSection(TerminalConsoleSettingsDialog.class.getName());
}
return result;
}
@Override
public int open() {
int rc = super.open();
@ -184,5 +187,5 @@ public class TerminalConsoleSettingsDialog extends Dialog {
}
return rc;
}
}

View file

@ -22,12 +22,8 @@ public class ConsoleActionConnect extends ConsoleAction {
this.console = console;
setupAction(ActionMessages.CONNECT,
ActionMessages.CONNECT,
ImageConsts.IMAGE_CLCL_CONNECT,
ImageConsts.IMAGE_ELCL_CONNECT,
ImageConsts.IMAGE_DLCL_CONNECT,
true);
setupAction(ActionMessages.CONNECT, ActionMessages.CONNECT, ImageConsts.IMAGE_CLCL_CONNECT,
ImageConsts.IMAGE_ELCL_CONNECT, ImageConsts.IMAGE_DLCL_CONNECT, true);
}
@Override

View file

@ -16,19 +16,14 @@ import org.eclipse.remote.internal.console.TerminalConsole;
public class ConsoleActionDisconnect extends ConsoleAction {
private final TerminalConsole console;
public ConsoleActionDisconnect(TerminalConsole console)
{
public ConsoleActionDisconnect(TerminalConsole console) {
super(ConsoleActionDisconnect.class.getName());
this.console = console;
setupAction(ActionMessages.DISCONNECT,
ActionMessages.DISCONNECT,
ImageConsts.IMAGE_CLCL_DISCONNECT,
ImageConsts.IMAGE_ELCL_DISCONNECT,
ImageConsts.IMAGE_DLCL_DISCONNECT,
false);
setupAction(ActionMessages.DISCONNECT, ActionMessages.DISCONNECT, ImageConsts.IMAGE_CLCL_DISCONNECT,
ImageConsts.IMAGE_ELCL_DISCONNECT, ImageConsts.IMAGE_DLCL_DISCONNECT, false);
}
@Override

View file

@ -18,18 +18,13 @@ import org.eclipse.remote.internal.console.TerminalConsolePage;
public class ConsoleActionScrollLock extends ConsoleAction {
private final TerminalConsolePage page;
public ConsoleActionScrollLock(TerminalConsolePage page)
{
public ConsoleActionScrollLock(TerminalConsolePage page) {
super(ConsoleActionScrollLock.class.getName(), IAction.AS_RADIO_BUTTON);
this.page = page;
setupAction(ActionMessages.SCROLL_LOCK,
ActionMessages.SCROLL_LOCK,
ImageConsts.IMAGE_CLCL_SCROLL_LOCK,
ImageConsts.IMAGE_ELCL_SCROLL_LOCK,
ImageConsts.IMAGE_DLCL_SCROLL_LOCK,
true);
setupAction(ActionMessages.SCROLL_LOCK, ActionMessages.SCROLL_LOCK, ImageConsts.IMAGE_CLCL_SCROLL_LOCK,
ImageConsts.IMAGE_ELCL_SCROLL_LOCK, ImageConsts.IMAGE_DLCL_SCROLL_LOCK, true);
}
@Override

View file

@ -21,7 +21,7 @@ import org.eclipse.remote.internal.core.RemoteProcess;
/**
* Abstract base class for remote process builders. Implementors can use this class to provide a default implementation of a remote
* process builder.
*
*
* @since 5.0
*/
public abstract class AbstractRemoteProcessBuilder implements IRemoteProcessBuilder {
@ -122,7 +122,7 @@ public abstract class AbstractRemoteProcessBuilder implements IRemoteProcessBuil
public IRemoteConnection getRemoteConnection() {
return fConnection;
}
/**
* @since 4.0
*/

View file

@ -15,7 +15,7 @@ import java.io.IOException;
/**
* A service that provides a command shell on a remote. This is mainly used by
* Terminal views.
*
*
* @since 2.0
*/
public interface IRemoteCommandShellService extends IRemoteConnection.Service {
@ -25,14 +25,14 @@ public interface IRemoteCommandShellService extends IRemoteConnection.Service {
* system. The flags may be used to modify behavior of the remote process. These flags may only be supported by specific types
* of remote service providers. Clients can use {@link IRemoteProcessBuilder#getSupportedFlags()} to find out the flags
* supported by the service provider.
*
*
* <pre>
* Current flags are:
* {@link IRemoteProcessBuilder#NONE} - disable any flags
* {@link IRemoteProcessBuilder#ALLOCATE_PTY} - allocate a pseudo-terminal for the process (RFC-4254 Sec. 6.2)
* {@link IRemoteProcessBuilder#FORWARD_X11} - enable X11 forwarding (RFC-4254 Sec. 6.3)
* </pre>
*
*
* @param flags
* bitwise-or of flags
* @return remote process object

View file

@ -20,13 +20,13 @@ import org.eclipse.remote.core.exception.RemoteConnectionException;
* open in which case the close does nothing. Connections have properties which are values that
* describe the connection and are discovered. Connections also have attributes which are
* client specified values that control the connection.
*
*
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IRemoteConnection {
/**
* The interface that is extend by services provided for this remote connection.
*
*
* @since 2.0
*/
interface Service {
@ -52,7 +52,7 @@ public interface IRemoteConnection {
/**
* Get the connection type of this connection
*
*
* @return connection type
* @since 2.0
*/
@ -60,14 +60,14 @@ public interface IRemoteConnection {
/**
* Get unique name for this connection.
*
*
* @return connection name
*/
public String getName();
/**
* Get the service for this remote connection that implements the given interface.
*
*
* @param service
* the interface the required service must implements
* @return the desired service or null if there is no such service available
@ -78,7 +78,7 @@ public interface IRemoteConnection {
/**
* Does this connection support the given service.
*
*
* @param service
* The service to be tested
* @return true if this connection supports the service
@ -88,7 +88,7 @@ public interface IRemoteConnection {
/**
* Open the connection. Must be called before the connection can be used.
*
*
* @param monitor
* the progress monitor to use for reporting progress to the user. It is the caller's responsibility to call done()
* on the given monitor. Accepts null, indicating that no progress should be reported and that the operation cannot
@ -104,14 +104,14 @@ public interface IRemoteConnection {
/**
* Test if the connection is open.
*
*
* @return true if connection is open.
*/
public boolean isOpen();
/**
* Gets the remote system property indicated by the specified key. The connection must be open prior to calling this method.
*
*
* @param key
* the name of the property
* @return the string value of the property, or null if no property has that key
@ -120,9 +120,9 @@ public interface IRemoteConnection {
/**
* Get an attribute for a connection.
*
*
* NOTE: the attributes do not include any security related information (e.g. passwords, keys, etc.)
*
*
* @param key
* @return the attribute value, or empty string if not defined.
* @since 2.0
@ -131,7 +131,7 @@ public interface IRemoteConnection {
/**
* Get an attribute that is stored in secure storage, such as passwords.
*
*
* @param key
* @return the attribute value, or empty string if not defined.
* @since 2.0
@ -140,21 +140,21 @@ public interface IRemoteConnection {
/**
* Return a working copy to allow setting and changing of attributes.
*
*
* @return working copy of remote
*/
public IRemoteConnectionWorkingCopy getWorkingCopy();
/**
* Register a listener that will be notified when this connection's status changes.
*
*
* @param listener
*/
public void addConnectionChangeListener(IRemoteConnectionChangeListener listener);
/**
* Remove a listener that will be notified when this connection's status changes.
*
*
* @param listener
*/
public void removeConnectionChangeListener(IRemoteConnectionChangeListener listener);
@ -162,7 +162,7 @@ public interface IRemoteConnection {
/**
* Notify all listeners when this connection's status changes. See {{@link RemoteConnectionChangeEvent} for a list of event
* types.
*
*
* @param event
* event type indicating the nature of the event
*/

View file

@ -23,7 +23,7 @@ public interface IRemoteConnectionChangeListener extends EventListener {
/**
* Notifies this listener that the status of a connection has changed.
*
*
* @param event
* the connection change event
* @since 2.0

View file

@ -16,14 +16,14 @@ import org.eclipse.remote.core.exception.RemoteConnectionException;
/**
* A service to control and report on the state of a connection, open or closed.
* Connections that do not provide this service are always assumed to be opened.
*
*
* @since 2.0
*/
public interface IRemoteConnectionControlService extends IRemoteConnection.Service {
/**
* Open the connection. Must be called before the connection can be used.
*
*
* @param monitor
* the progress monitor to use for reporting progress to the user. It is the caller's responsibility to call done()
* on the given monitor. Accepts null, indicating that no progress should be reported and that the operation cannot
@ -39,7 +39,7 @@ public interface IRemoteConnectionControlService extends IRemoteConnection.Servi
/**
* Test if the connection is open.
*
*
* @return true if connection is open.
*/
public boolean isOpen();

View file

@ -12,43 +12,43 @@ package org.eclipse.remote.core;
/**
* A service to obtain host specific information.
*
*
* @since 2.0
*/
public interface IRemoteConnectionHostService extends IRemoteConnection.Service {
/**
* Obtain the hostname associated with this connection.
*
*
* @return hostname
*/
String getHostname();
/**
* Obtain the port associated with this connection
*
*
* @return port
*/
int getPort();
/**
* Obtain the timeout used when establishing the connection.
*
*
* @return timeout
*/
int getTimeout();
/**
* Get the pass phrase associated with this connection.
*
*
* @return pass phrase
* @since 3.0
*/
String getPassphrase();
/**
* Get the password associated with this connection.
*
*
* @return password
* @since 3.0
*/
@ -56,22 +56,22 @@ public interface IRemoteConnectionHostService extends IRemoteConnection.Service
/**
* Get the value of the use password authentication flag. If true, the connection will try using a password first.
*
*
* @return use password authentication flag
* @since 3.0
*/
boolean usePassword();
/**
* Obtain the flag that indicates a login shell should be started once the connection is established
*
*
* @return login shell flag
*/
boolean useLoginShell();
/**
* Obtain the username associated with this connection.
*
*
* @return
*/
String getUsername();
@ -79,7 +79,7 @@ public interface IRemoteConnectionHostService extends IRemoteConnection.Service
/**
* Set the hostname associated with this connection. Note, this method can only be used for an
* IRemoteConnectionWorkingCopy and will have no effect otherwise.
*
*
* @param hostname
* new hostname for connection
*/
@ -88,7 +88,7 @@ public interface IRemoteConnectionHostService extends IRemoteConnection.Service
/**
* Set the pass phrase associated with this connection. Note, this method can only be used for an
* IRemoteConnectionWorkingCopy and will have no effect otherwise.
*
*
* @param passphrase
*/
void setPassphrase(String passphrase);
@ -96,7 +96,7 @@ public interface IRemoteConnectionHostService extends IRemoteConnection.Service
/**
* Set the password associated with this connection. Note, this method can only be used for an
* IRemoteConnectionWorkingCopy and will have no effect otherwise.
*
*
* @param password
* new password for connection
*/
@ -105,7 +105,7 @@ public interface IRemoteConnectionHostService extends IRemoteConnection.Service
/**
* Set the port used for the connection. Note, this method can only be used forh an
* IRemoteConnectionWorkingCopy and will have no effect otherwise.
*
*
* @param port
* new port for connection
*/
@ -114,7 +114,7 @@ public interface IRemoteConnectionHostService extends IRemoteConnection.Service
/**
* Set the timeout used when establishing the connection. A timeout of 0 means infinite. Note, this method can only be used
* for an IRemoteConnectionWorkingCopy and will have no effect otherwise.
*
*
* @param timeout
* new timeout value
*/
@ -123,7 +123,7 @@ public interface IRemoteConnectionHostService extends IRemoteConnection.Service
/**
* Set the flag indicating a login shell should be stated for this connection. Note, this method can only be used
* for an IRemoteConnectionWorkingCopy and will have no effect otherwise.
*
*
* @param useLogingShell
* true to start a login shell
*/
@ -132,7 +132,7 @@ public interface IRemoteConnectionHostService extends IRemoteConnection.Service
/**
* Set the connection to try password authentication first. Note, this method can only be used for an
* IRemoteConnectionWorkingCopy and will have no effect otherwise.
*
*
* @param usePassword
* use password authentication
*/
@ -141,7 +141,7 @@ public interface IRemoteConnectionHostService extends IRemoteConnection.Service
/**
* Set the username associated with this connection. Note, this method can only be used for an
* IRemoteConnectionWorkingCopy and will have no effect otherwise.
*
*
* @param username
* new username for connection
*/

View file

@ -13,10 +13,10 @@ package org.eclipse.remote.core;
/**
* A connection property is some descriptive information that's discovered about the connection.
* This service provides property values for a connection.
*
*
* Examples include:
* <pre>
* os.name Operating system name
* os.name Operating system name
* os.arch Operating system architecture
* os.version Operating system version
* file.separator File separator ("/" on UNIX)
@ -24,14 +24,14 @@ package org.eclipse.remote.core;
* line.separator Line separator ("\n" on UNIX)
* user.home Home directory
* </pre>
*
*
* @since 2.0
*/
public interface IRemoteConnectionPropertyService extends IRemoteConnection.Service {
/**
* Gets the remote system property indicated by the specified key. The connection must be open prior to calling this method.
*
*
* @param key
* the name of the property
* @return the string value of the property, or null if no property has that key

View file

@ -15,7 +15,7 @@ package org.eclipse.remote.core;
* and removing services. For example, the Local connection type needs to be able
* to ensure the Local connection is created, or adapters to other target management
* systems may prefer to let those systems manage the connections.
*
*
* @since 2.0
*/
public interface IRemoteConnectionProviderService extends IRemoteConnectionType.Service {

View file

@ -20,14 +20,14 @@ import org.eclipse.remote.core.exception.RemoteConnectionException;
* A remote connection type manages a list of connections that implement the same services.
* Services may be registered on the individual connections, or at the connection type level
* for service that apply to all connections of this type.
*
*
* @noimplement This interface is not intended to be implemented by clients.
* @since 2.0
*/
public interface IRemoteConnectionType {
/**
* The interface that is extend by services provided for this remote services implementation.
*
*
* @since 2.0
*/
interface Service {
@ -41,56 +41,56 @@ public interface IRemoteConnectionType {
/**
* Get the remote services manager. This is a convenient way to get back
* to the root.
*
*
* @return remote services manager
*/
IRemoteServicesManager getRemoteServicesManager();
/**
* Get unique ID of this service. Can be used as a lookup key.
*
*
* @return unique ID
*/
String getId();
/**
* Get display name of this service.
*
*
* @return display name
*/
String getName();
/**
* Get the EFS scheme provided by this service.
*
*
* @return display name
*/
String getScheme();
/**
* Can you add new connections of this type using the API.
*
*
* @return can add
*/
boolean canAdd();
/**
* Can you edit connections of this type, i.e. create working copies.
*
*
* @return can edit
*/
boolean canEdit();
/**
* Can you remove connections of this type using the API.
*
*
* @return can remove
*/
boolean canRemove();
/**
* Get the service for this remote services implementation that implements the given interface.
*
*
* @param service
* the interface the required service must implements
* @return the desired service or null if there is no such service available
@ -101,7 +101,7 @@ public interface IRemoteConnectionType {
/**
* Does this connection type support the given service.
*
*
* @param service
* the service to be tested
* @return true if this connection type supports this service
@ -110,14 +110,14 @@ public interface IRemoteConnectionType {
/**
* Return the list of connection type services supported by this type.
*
*
* @return connection type services
*/
List<String> getServices();
/**
* Do connections created by this connection type support the given service.
*
*
* @param service
* the service to be tested
* @return true if connections created by this connection type support this service
@ -126,14 +126,14 @@ public interface IRemoteConnectionType {
/**
* Return the list of connection services supported by connections of this type.
*
*
* @return connection services
*/
List<String> getConnectionServices();
/**
* Do processes created by this connection type support the given service.
*
*
* @param service
* the service to be tested
* @return true if processes created by this connection type support this service
@ -142,14 +142,14 @@ public interface IRemoteConnectionType {
/**
* Return the list of process services supported by connections of this type.
*
*
* @return process services
*/
List<String> getProcessServices();
/**
* Gets the remote connection corresponding to the supplied name.
*
*
* @param name
* name of the connection (as returned by {@link IRemoteConnection#getName()})
* @return remote connection or null if no connection exists
@ -158,7 +158,7 @@ public interface IRemoteConnectionType {
/**
* Gets the remote connection corresponding to the supplied URI.
*
*
* @param uri
* URI containing a schema for this remote connection
* @return remote connection or null if no connection exists or the schema
@ -169,7 +169,7 @@ public interface IRemoteConnectionType {
/**
* Get all the connections for this service provider.
*
*
* @return connections that we know about
*/
List<IRemoteConnection> getConnections();
@ -177,10 +177,10 @@ public interface IRemoteConnectionType {
/**
* Creates a new remote connection named with supplied name. The connection attributes will be the default for the
* implementation.
*
*
* Returns a working copy of the remote connection. Callers must call {@link IRemoteConnectionWorkingCopy#save()} before the
* connection can be used.
*
*
* @param name
* name of the connection
* @return a new connection working copy with the supplied name
@ -192,7 +192,7 @@ public interface IRemoteConnectionType {
/**
* Remove a connection and all resources associated with it.
*
*
* @param connection
* connection to remove
* @throws RemoteConnectionException

View file

@ -22,14 +22,14 @@ public interface IRemoteConnectionWorkingCopy extends IRemoteConnection {
/**
* Returns the original connection this working copy was created from.
* Returns null if this is a new connection.
*
*
* @return original connection
*/
public IRemoteConnection getOriginal();
/**
* Returns whether this connection has been modified since it was last saved or created.
*
*
* @return true if the connection has been modified
*/
public boolean isDirty();
@ -37,15 +37,15 @@ public interface IRemoteConnectionWorkingCopy extends IRemoteConnection {
/**
* Saves this working copy to its original connection and returns a handle to the resulting connection. Has no effect if this
* connection does not need saving.
*
*
* @return saved connection
* @throws RemoteConnectionException
* @throws RemoteConnectionException
*/
public IRemoteConnection save() throws RemoteConnectionException;
/**
* Set the name for this connection
*
*
* @param name
*/
public void setName(String name);
@ -53,7 +53,7 @@ public interface IRemoteConnectionWorkingCopy extends IRemoteConnection {
/**
* Set an implementation dependent attribute for the connection. Attributes keys supported by the connection can be obtained
* using {@link #getAttributes()}. Attributes are persisted along with connection information.
*
*
* @param key
* attribute key
* @param value
@ -63,7 +63,7 @@ public interface IRemoteConnectionWorkingCopy extends IRemoteConnection {
/**
* Set an attribute such as a password that's stored in secure storage.
*
*
* @param key
* @param value
* @since 2.0

View file

@ -17,7 +17,7 @@ import org.eclipse.core.runtime.IPath;
/**
* Interface for managing files on a remote system.
*
*
* @since 2.0
*/
public interface IRemoteFileService extends IRemoteConnection.Service {
@ -25,11 +25,11 @@ public interface IRemoteFileService extends IRemoteConnection.Service {
/**
* Get the resource associated with path. IFileStore can then be used to
* perform operations on the file.
*
*
* The remote connection does not need to be open to use this method, but
* subsequent operations on the IFileStore that access the underlying remote
* filesystem may require the connection to be open.
*
*
* @param path
* path to resource
* @return the file store representing the remote path
@ -38,21 +38,21 @@ public interface IRemoteFileService extends IRemoteConnection.Service {
/**
* Get the base directory to be used for relative paths.
*
*
* @return base directory
*/
String getBaseDirectory();
/**
* Set the base directory to be used for relative paths..
*
*
* @param path new base directory
*/
void setBaseDirectory(String path);
/**
* Gets the directory separator on the target system.
*
*
* @return String
*/
String getDirectorySeparator();
@ -60,9 +60,9 @@ public interface IRemoteFileService extends IRemoteConnection.Service {
/**
* Convert URI to a remote path. This path is suitable for direct file
* operations <i>on the remote system</i>.
*
*
* The remote connection does not need to be open to use this method.
*
*
* @return IPath representing the remote path
*/
String toPath(URI uri);
@ -70,9 +70,9 @@ public interface IRemoteFileService extends IRemoteConnection.Service {
/**
* Convert remote path to equivalent URI. This URI is suitable for EFS
* operations <i>on the local system</i>.
*
*
* The remote connection does not need to be open to use this method.
*
*
* @param path
* path on remote system
* @return URI representing path on remote system, or null if the path is
@ -83,9 +83,9 @@ public interface IRemoteFileService extends IRemoteConnection.Service {
/**
* Convert string representation of a remote path to equivalent URI. This
* URI is suitable for EFS operations <i>on the local system</i>.
*
*
* The remote connection does not need to be open to use this method.
*
*
* @param path
* path on remote system
* @return URI representing path on remote system, or null if the path is

View file

@ -16,7 +16,7 @@ import org.eclipse.remote.core.exception.RemoteConnectionException;
/**
* A connection service for setting up port forwarding between the host and the remote.
* This is a feature provided by SSH.
*
*
* @since 2.0
*/
public interface IRemotePortForwardingService extends IRemoteConnection.Service {
@ -24,7 +24,7 @@ public interface IRemotePortForwardingService extends IRemoteConnection.Service
/**
* Forward local port localPort to remote port fwdPort on remote machine fwdAddress. If this IRemoteConnection is not to
* fwdAddress, the port will be routed via the connection machine to fwdAddress.
*
*
* @param localPort
* local port to forward
* @param fwdAddress
@ -39,19 +39,20 @@ public interface IRemotePortForwardingService extends IRemoteConnection.Service
* Forward a local port to remote port fwdPort on remote machine fwdAddress. The local port is chosen dynamically and returned
* by the method. If this IRemoteConnection is not to fwdAddress, the port will be routed via the connection machine to
* fwdAddress.
*
*
* @param fwdAddress
* @param fwdPort
* @param monitor
* @return local port number
* @throws RemoteConnectionException
*/
public int forwardLocalPort(String fwdAddress, int fwdPort, IProgressMonitor monitor) throws RemoteConnectionException;
public int forwardLocalPort(String fwdAddress, int fwdPort, IProgressMonitor monitor)
throws RemoteConnectionException;
/**
* Forward remote port remotePort to port fwdPort on machine fwdAddress. When a connection is made to remotePort on the remote
* machine, it is forwarded via this IRemoteConnection to fwdPort on machine fwdAddress.
*
*
* @param remotePort
* remote port to forward
* @param fwdAddress
@ -66,21 +67,22 @@ public interface IRemotePortForwardingService extends IRemoteConnection.Service
* Forward a remote port to port fwdPort on remote machine fwdAddress. The remote port is chosen dynamically and returned by the
* method. When a connection is made to this port on the remote machine, it is forwarded via this IRemoteConnection to fwdPort
* on machine fwdAddress.
*
*
* If fwdAddress is the empty string ("") then the fwdPort will be bound to any address on all interfaces. Note that this
* requires enabling the GatewayPort sshd option on some systems.
*
*
* @param fwdAddress
* @param fwdPort
* @param monitor
* @return remote port number
* @throws RemoteConnectionException
*/
public int forwardRemotePort(String fwdAddress, int fwdPort, IProgressMonitor monitor) throws RemoteConnectionException;
public int forwardRemotePort(String fwdAddress, int fwdPort, IProgressMonitor monitor)
throws RemoteConnectionException;
/**
* Remove the local port forwarding associated with the given port.
*
*
* @param port
* forwarded port
* @throws RemoteConnectionException
@ -90,7 +92,7 @@ public interface IRemotePortForwardingService extends IRemoteConnection.Service
/**
* Remove the remote port forwarding associated with the given port.
*
*
* @param port
* forwarded port
* @throws RemoteConnectionException

View file

@ -12,14 +12,14 @@ package org.eclipse.remote.core;
/**
* Preference constants that can be used to check the default remote service provider preference.
*
*
* @since 6.0
*/
public interface IRemotePreferenceConstants {
/**
* Preference setting for the default connection type. Clients can check this preference to see if a default provider
* has been set, and if so, what the provider ID is.
*
*
* @since 2.0
*/
public static final String PREF_CONNECTION_TYPE_ID = "connectionTypeId"; //$NON-NLS-1$

View file

@ -19,7 +19,7 @@ import java.io.OutputStream;
public interface IRemoteProcess {
/**
* The interface that is extend by services provided for this remote connection.
*
*
* @since 2.0
*/
interface Service {
@ -37,17 +37,17 @@ public interface IRemoteProcess {
/**
* Returns the exit value for the process
*
*
* @return the exit value
*/
int exitValue();
/**
* Gets the error output stream of the process
*
*
* Note: some implementations (e.g. JSch) will not work correctly if the remote process generates stdout or stderr but the
* calling thread does not read the corresponding output or error streams.
*
*
* @return the output stream connected to the standard
* error of the process
*/
@ -55,10 +55,10 @@ public interface IRemoteProcess {
/**
* Gets an InputStream which can be used to read the standard output stream of the process
*
*
* Note: some implementations (e.g. JSch) will not work correctly if the remote process generates stdout or stderr but the
* calling thread does not read the corresponding input or error streams.
*
*
* @return the input stream connected to the standard
* output of the process
*/
@ -66,7 +66,7 @@ public interface IRemoteProcess {
/**
* Gets an output stream which can be used to write to the standard input stream of the process
*
*
* @return the output stream connected to the standard
* input of the process
*/
@ -74,7 +74,7 @@ public interface IRemoteProcess {
/**
* Get the service for this remote process that implements the given interface.
*
*
* @param service
* the interface the required service must implements
* @return the desired service or null if there is no such service available
@ -84,7 +84,7 @@ public interface IRemoteProcess {
/**
* Does this remote process support the given service.
*
*
* @param service
* The service to be tested
* @return true if this connection supports the service
@ -94,10 +94,10 @@ public interface IRemoteProcess {
/**
* Wait until the process has terminated
*
*
* Note: some implementations (e.g. JSch) will not work correctly if the remote process generates stdout or stderr but the
* calling thread does not read the corresponding input or error streams.
*
*
* @return the exit value of the process
* @throws InterruptedException
* if the current thread is
@ -107,17 +107,17 @@ public interface IRemoteProcess {
/**
* Check if the remote process has completed.
*
*
* Note: some implementations (e.g. JSch) will not work correctly if the remote process generates stdout or stderr but the
* calling thread does not read the corresponding input or error streams.
*
*
* @return true if remote process has completed
*/
boolean isCompleted();
/**
* Get the connection that is used by this process
*
*
* @return connection used by this process
* @since 2.0
*/
@ -125,7 +125,7 @@ public interface IRemoteProcess {
/**
* Get the process builder used to create this process
*
*
* @return process builder used to create this process
* @since 2.0
*/

View file

@ -29,14 +29,14 @@ public interface IRemoteProcessBuilder {
/**
* Flag to request allocation of a pseudo-terminal for the process (RFC-4254
* Sec. 6.2)
*
*
* @since 5.0
*/
public static int ALLOCATE_PTY = 0x01;
/**
* Flag to request X11 forwarding (RFC-4254 Sec. 6.3)
*
*
* @since 5.0
*/
public static int FORWARD_X11 = 0x02;
@ -47,17 +47,17 @@ public interface IRemoteProcessBuilder {
* @since 3.0
*/
public static int APPEND_ENVIRONMENT = 0x03;
/**
* Returns this process builder's operating system program and arguments.
*
*
* @return a list containing the program and arguments
*/
List<String> command();
/**
* Sets this process builder's operating system program and arguments.
*
*
* @param command
* @return This process builder
*/
@ -65,7 +65,7 @@ public interface IRemoteProcessBuilder {
/**
* Sets this process builder's operating system program and arguments.
*
*
* @param command
* @return this process builder
*/
@ -73,14 +73,14 @@ public interface IRemoteProcessBuilder {
/**
* Returns this process builder's working directory.
*
*
* @return an IFileStore reference to the working directory
*/
IFileStore directory();
/**
* Sets this process builder's working directory.
*
*
* @param directory
* @return This process builder
*/
@ -89,14 +89,14 @@ public interface IRemoteProcessBuilder {
/**
* Returns a string map view of this process builder's environment. The
* returned map behaves in the same manner as described in {@link java.lang.ProcessBuilder#environment()}.
*
*
* @return the process builder's environment
*/
Map<String, String> environment();
/**
* Get the flags that are supported by this process builder.
*
*
* @return bitwise-or of the supported flags
* @since 5.0
*/
@ -105,14 +105,14 @@ public interface IRemoteProcessBuilder {
/**
* Tells whether this process builder merges standard error and standard
* output.
*
*
* @return true if standard error and standard output will be merged
*/
boolean redirectErrorStream();
/**
* Sets this process builder's redirectErrorStream property.
*
*
* @param redirectErrorStream
* @return This process builder
*/
@ -120,7 +120,7 @@ public interface IRemoteProcessBuilder {
/**
* Starts a new process using the attributes of this process builder.
*
*
* @return remote process object
* @throws IOException
*/
@ -132,14 +132,14 @@ public interface IRemoteProcessBuilder {
* may only be supported by specific types of remote service providers.
* Clients can use {@link #getSupportedFlags()} to find out the flags
* supported by the service provider.
*
*
* <pre>
* Current flags are:
* NONE - disable any flags
* ALLOCATE_PTY - allocate a pseudo-terminal for the process (RFC-4254 Sec. 6.2)
* FORWARD_X11 - enable X11 forwarding (RFC-4254 Sec. 6.3)
* </pre>
*
*
* @param flags
* bitwise-or of flags to use when starting process
* @return remote process object
@ -150,7 +150,7 @@ public interface IRemoteProcessBuilder {
/**
* Get the connection that will be used by this process builder to create remote processes.
*
*
* @return connection used to create remote processes
* @since 2.0
*/

View file

@ -15,7 +15,7 @@ import java.io.OutputStream;
/**
* A service to control and report on the state of a process.
*
*
* @since 2.0
*/
public interface IRemoteProcessControlService extends IRemoteProcess.Service {
@ -26,14 +26,14 @@ public interface IRemoteProcessControlService extends IRemoteProcess.Service {
/**
* Returns the exit value for the process
*
*
* @return the exit value
*/
public int exitValue();
/**
* Gets the error output stream of the process
*
*
* @return the output stream connected to the standard
* error of the process
*/
@ -41,7 +41,7 @@ public interface IRemoteProcessControlService extends IRemoteProcess.Service {
/**
* Gets an InputStream which can be used to read the standard output stream of the process
*
*
* @return the input stream connected to the standard
* output of the process
*/
@ -49,7 +49,7 @@ public interface IRemoteProcessControlService extends IRemoteProcess.Service {
/**
* Gets an output stream which can be used to write to the standard input stream of the process
*
*
* @return the output stream connected to the standard
* input of the process
*/
@ -57,7 +57,7 @@ public interface IRemoteProcessControlService extends IRemoteProcess.Service {
/**
* Wait until the process has terminated
*
*
* @return the exit value of the process
* @throws InterruptedException
* if the current thread is
@ -67,7 +67,7 @@ public interface IRemoteProcessControlService extends IRemoteProcess.Service {
/**
* Check if the remote process has completed
*
*
* @return true if remote process has completed
*/
public boolean isCompleted();

View file

@ -15,21 +15,21 @@ import java.util.Map;
/**
* A connection service for starting up processes on a remote.
*
*
* @since 2.0
*/
public interface IRemoteProcessService extends IRemoteConnection.Service {
/**
* Returns an unmodifiable string map view of the remote environment. The connection must be open prior to calling this method.
*
*
* @return the remote environment
*/
public Map<String, String> getEnv();
/**
* Returns the value of an environment variable. The connection must be open prior to calling this method.
*
*
* @param name
* name of the environment variable
* @return value of the environment variable or null if the variable is not defined
@ -38,24 +38,24 @@ public interface IRemoteProcessService extends IRemoteConnection.Service {
/**
* Get a process builder for creating remote processes
*
*
* @return process builder or null if connection is not open
*/
public IRemoteProcessBuilder getProcessBuilder(List<String> command);
/**
* Get a process builder for creating remote processes
*
*
* @return process builder or null if connection is not open
*/
public IRemoteProcessBuilder getProcessBuilder(String... command);
/**
* Get the working directory. Relative paths will be resolved using this path.
*
*
* The remote connection does not need to be open to use this method, however a default directory path, rather than the actual
* working directory, may be returned in this case.
*
*
* @return String representing the current working directory
*/
public String getWorkingDirectory();
@ -63,9 +63,9 @@ public interface IRemoteProcessService extends IRemoteConnection.Service {
/**
* Set the working directory while the connection is open. The working directory will revert to the default when the connection
* is closed then subsequently reopened.
*
*
* Relative paths will be resolved using this path. The path must be valid and absolute for any changes to be made.
*
*
* @param path
* String representing the current working directory
* @since 4.0

View file

@ -14,7 +14,7 @@ import org.eclipse.remote.core.exception.RemoteConnectionException;
/**
* A service abstraction for signals.
*
*
* @since 2.0
*/
public interface IRemoteProcessSignalService extends IRemoteProcess.Service {
@ -37,7 +37,7 @@ public interface IRemoteProcessSignalService extends IRemoteProcess.Service {
/**
* Send a signal to the remote process.
*
*
* @param signal
* signal to send.
* @throws RemoteConnectionException

View file

@ -12,14 +12,14 @@ package org.eclipse.remote.core;
/**
* A service abstraction for remote terminals.
*
*
* @since 2.0
*/
public interface IRemoteProcessTerminalService extends IRemoteProcess.Service {
/**
* Change the terminal window dimension interactively. Refer to RFC 4254 6.7. Window Dimension Change Message. The character/row
* dimensions override the pixel dimensions (when nonzero). Pixel dimensions refer to the drawable area of the window.
*
*
* @param cols
* terminal width in characters
* @param rows

View file

@ -19,9 +19,9 @@ import org.eclipse.core.runtime.IProgressMonitor;
/**
* Abstraction of a remote resource. There are currently two types of remote resources: fully remote and synchronized. This
* interface provides a common mechanism for accessing resource information from either type.
*
*
* Usage:
*
*
* <code>
* IRemoteResource remoteRes = (IRemoteResource)resource.getAdapter(IRemoteResource.class);
* if (remoteRes != null) {
@ -29,26 +29,26 @@ import org.eclipse.core.runtime.IProgressMonitor;
* ...
* }
* </code>
*
*
* @author greg
* @since 6.0
*
*
*/
public interface IRemoteResource {
/**
* Get the active location URI of the resource in the remote project. Returns null if the URI can't be obtained (@see
* {@link IResource#getLocationURI()}).
*
*
* For fully remote projects, this is just the URI of the remote resource. For synchronized projects, this is the URI of the
* resource from the active synchronization target.
*
*
* @return URI or null if URI can't be obtained
*/
public URI getActiveLocationURI();
/**
* Get the platform resource corresponding to the remote resource
*
*
* @return IResource
*/
public IResource getResource();
@ -57,7 +57,7 @@ public interface IRemoteResource {
* Synchronize the resource with the underlying filesystem. Performs a refresh for local and remote projects, but causes
* synchronized projects to attempt to synchronize with their remote files. May synchronize more than just the single resource.
* Blocks until the refresh has completed, so callers should use a job if necessary.
*
*
* @param monitor
* progress monitor to cancel refresh
* @throws CoreException
@ -67,7 +67,7 @@ public interface IRemoteResource {
/**
* Set the platform resource
*
*
* @param resource
* platform resource corresponding to this remote resource
*/

View file

@ -17,7 +17,7 @@ import java.util.List;
* The main entry point into the remote services system. The remote services manager
* is an OSGi service. It provides a list of connection types and the global
* list of all connections.
*
*
* @noimplement This interface is not intended to be implemented by clients.
* @since 2.0
*/
@ -25,7 +25,7 @@ public interface IRemoteServicesManager {
/**
* Get the connection type identified by the id
*
*
* @param id
* id of the connection type
* @return connection type or null if the service can not be found
@ -35,7 +35,7 @@ public interface IRemoteServicesManager {
/**
* Get the connection type that provides connections to locations identified by
* the URI.
*
*
* @param uri
* uri of locations to be accessed
* @return the connection type that can be used to access the locations
@ -45,14 +45,14 @@ public interface IRemoteServicesManager {
/**
* Return the connection type used to access local resources.
*
*
* @return the local services
*/
IRemoteConnectionType getLocalConnectionType();
/**
* Returns the list of all connection types including the local services.
*
*
* @return all connection types
*/
List<IRemoteConnectionType> getAllConnectionTypes();
@ -61,7 +61,7 @@ public interface IRemoteServicesManager {
* Returns the list of all connection types that support connections that provide specific services. The connections
* can provide additional services that are not included in the list, so this just guarantees the minimum set of services that
* will be supported.
*
*
* @param services
* services provided by connections supported by this connection type
* @return compatible connection types
@ -72,7 +72,7 @@ public interface IRemoteServicesManager {
/**
* Returns the list of all connection types that provide specific services. The connection types can provide additional services
* that are not included in the list, so this just guarantees the minimum set of services that will be supported.
*
*
* @param services
* services provided by this connection type
* @return compatible connection types
@ -82,21 +82,21 @@ public interface IRemoteServicesManager {
/**
* Returns the list of connection types except for the local connection type.
*
*
* @return all connection types that are really remote
*/
List<IRemoteConnectionType> getRemoteConnectionTypes();
/**
* Returns the list of all known remote connections.
*
*
* @return all remote connections
*/
List<IRemoteConnection> getAllRemoteConnections();
/**
* Add a global connection change listener that receives events for all connections.
*
*
* @param listener
* global connection change listener to be added
*/
@ -104,7 +104,7 @@ public interface IRemoteServicesManager {
/**
* Remove the global connection change listener.
*
*
* @param listener
* global connection change listener to be removed
*/
@ -113,7 +113,7 @@ public interface IRemoteServicesManager {
/**
* Used by connections and other components to notify the global connection
* change listeners of events.
*
*
* @param event
* connection change event
*/

View file

@ -17,7 +17,7 @@ import java.net.PasswordAuthentication;
/**
* Allow clients to provide their own user interface for connection authentication.
*
*
* @since 2.0
*/
public interface IUserAuthenticatorService extends IRemoteConnection.Service {
@ -73,7 +73,7 @@ public interface IUserAuthenticatorService extends IRemoteConnection.Service {
* into returned object. Implementors are allowed to
* save user names and passwords. The user should be prompted for
* user name and password if there is no saved one.
*
*
* @param username
* The initial username, or null if there is no initial username
* @param message
@ -85,7 +85,7 @@ public interface IUserAuthenticatorService extends IRemoteConnection.Service {
* Prompts the user for a number values using text fields. The labels are provided in
* the <core>prompt</code> array. Implementors will return the entered values, or null if
* the user cancels the prompt.
*
*
* @param destination
* the destination in the format like username@hostname:port
* @param name
@ -104,7 +104,7 @@ public interface IUserAuthenticatorService extends IRemoteConnection.Service {
* Prompts for additional information regarding this authentication
* request. A default implementation of this method should return the <code>defaultResponse</code>,
* whereas alternate implementations could prompt the user with a dialog.
*
*
* @param promptType
* one of the following values:
* <ul>

View file

@ -67,7 +67,7 @@ public class RemoteConnectionChangeEvent {
/**
* Get the connection that has changed.
*
*
* @return IRemoteConnection
*/
public IRemoteConnection getConnection() {
@ -77,9 +77,9 @@ public class RemoteConnectionChangeEvent {
/**
* Returns the type of event being reported. This type
* is obtained by bitwise OR'ing the event types together.
*
*
* {@link #CONNECTION_CLOSED} {@link #CONNECTION_OPENED} {@link #CONNECTION_ABORTED} {@link #CONNECTION_RENAMED}
*
*
* @return a bitwise OR of event type constants
*/
public int getType() {

View file

@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
@ -15,9 +15,9 @@ import java.io.OutputStream;
/**
* Utility class to adapt an IRemoteProcess to a java.lang.Process
*
*
* @author crecoskie
*
*
*/
public class RemoteProcessAdapter extends Process {

View file

@ -49,12 +49,12 @@ public class RemoteServicesUtils {
/**
* Convert a UNC path to a URI
*
*
* Maps the UNC server component to a connection known by one of the remote service implementations. It is assumed that the
* server component is of the form "[connection_type_id:]connection_name". If the "connection_type_id:" part is omitted then the
* current connection type preference is used by default. If no preference is set, then each implementation is tried until
* a matching connection name is found.
*
*
* @param path
* UNC path
* @return corresponding URI or null if not a valid path

View file

@ -13,7 +13,7 @@ package org.eclipse.remote.core.exception;
/**
* Exception thrown when a connection address is already in use.
*
*
*/
public class AddressInUseException extends RemoteConnectionException {
private static final long serialVersionUID = 1771839754428411610L;

View file

@ -14,7 +14,7 @@ package org.eclipse.remote.core.exception;
* Thrown when trying to add a connection with the same name as an existing
* connection, or when trying to rename a connection to the same name as an
* existing connection.
*
*
* @since 2.0
*/
public class ConnectionExistsException extends RemoteConnectionException {

View file

@ -16,7 +16,7 @@ package org.eclipse.remote.core.exception;
*/
public class UnableToForwardPortException extends RemoteConnectionException {
/**
*
*
*/
private static final long serialVersionUID = -5814772755700213717L;

View file

@ -18,14 +18,14 @@ import org.eclipse.remote.core.IRemoteConnection;
* Manages and persists the mapping between launch configurations and
* remote connections that they run on. Each launch configuration has an
* active remote connection.
*
*
* @since 2.0
*/
public interface IRemoteLaunchConfigService {
/**
* Sets the active remote connection for the given launch configuration.
*
*
* @param launchConfig launch configuration
* @param connection active remote connection
*/
@ -41,10 +41,10 @@ public interface IRemoteLaunchConfigService {
/**
* For a given launch configuration type, get the remote connection that was last
* used by a launch configuration of that type.
*
* This is used for new launch configurations with the assumption that the user
*
* This is used for new launch configurations with the assumption that the user
* will want to use the same remote connection.
*
*
* @param launchConfigType launch configuration type
* @return last active remote configuration
*/

View file

@ -83,7 +83,7 @@ public class RemoteConnection implements IRemoteConnection {
/**
* Called from working copy when name has changed.
*
*
* @param name
* the new name
*/

View file

@ -61,13 +61,13 @@ public class RemoteConnectionType implements IRemoteConnectionType {
// capabilities, default is true for all of these
String canAddStr = ce.getAttribute("canAdd"); //$NON-NLS-1$
canAdd = canAddStr != null ? Boolean.parseBoolean(canAddStr) : true;
String canEditStr = ce.getAttribute("canEdit"); //$NON-NLS-1$
canEdit = canEditStr != null ? Boolean.parseBoolean(canEditStr) : true;
String canRemoveStr = ce.getAttribute("canRemove"); //$NON-NLS-1$
canRemove = canRemoveStr != null ? Boolean.parseBoolean(canRemoveStr) : true;
// load up existing connections
try {
for (String nodeName : getPreferenceNode().childrenNames()) {
@ -123,7 +123,7 @@ public class RemoteConnectionType implements IRemoteConnectionType {
}
@Override
public <T extends Service> T getService(Class<T> service) {
public <T extends Service> T getService(Class<T> service) {
synchronized (serviceDefinitionMap) {
@SuppressWarnings("unchecked")
T obj = (T) serviceMap.get(service);
@ -161,7 +161,7 @@ public class RemoteConnectionType implements IRemoteConnectionType {
/**
* Called from the connection to get a service object for that connection.
*
*
* @param connection
* the connection to which the service applies
* @param service
@ -169,7 +169,8 @@ public class RemoteConnectionType implements IRemoteConnectionType {
* @return the service object
* @throws CoreException
*/
public <T extends IRemoteConnection.Service> T getConnectionService(IRemoteConnection connection, Class<T> service) {
public <T extends IRemoteConnection.Service> T getConnectionService(IRemoteConnection connection,
Class<T> service) {
synchronized (connectionServiceDefinitionMap) {
IConfigurationElement ce = connectionServiceDefinitionMap.get(service.getName());
if (ce != null) {
@ -203,7 +204,7 @@ public class RemoteConnectionType implements IRemoteConnectionType {
/**
* Called from the remote process to get a service object for that process.
*
*
* @param process
* the process to which the service applies
* @param service
@ -216,7 +217,8 @@ public class RemoteConnectionType implements IRemoteConnectionType {
IConfigurationElement ce = processServiceDefinitionMap.get(service.getName());
if (ce != null) {
try {
IRemoteProcess.Service.Factory factory = (IRemoteProcess.Service.Factory) ce.createExecutableExtension("factory"); //$NON-NLS-1$
IRemoteProcess.Service.Factory factory = (IRemoteProcess.Service.Factory) ce
.createExecutableExtension("factory"); //$NON-NLS-1$
if (factory != null) {
return factory.getService(process, service);
}
@ -245,7 +247,7 @@ public class RemoteConnectionType implements IRemoteConnectionType {
/**
* Called from the remote service manager to register a service extension for
* this remote services implementation
*
*
* @param ce
* the extension element defining the service
*/
@ -267,7 +269,7 @@ public class RemoteConnectionType implements IRemoteConnectionType {
/**
* Signal connection has been added.
*
*
* @since 2.0
*/
protected void connectionAdded(final IRemoteConnection connection) {
@ -278,7 +280,7 @@ public class RemoteConnectionType implements IRemoteConnectionType {
/**
* Signal a connection is about to be removed.
*
*
* @since 2.0
*/
protected void connectionRemoved(final IRemoteConnection connection) {
@ -296,7 +298,7 @@ public class RemoteConnectionType implements IRemoteConnectionType {
@Override
public IRemoteConnection getConnection(URI uri) {
synchronized (connections) {
synchronized (connections) {
IRemoteConnection connection = connections.get(uri.getAuthority());
if (connection != null) {
return connection;
@ -356,7 +358,8 @@ public class RemoteConnectionType implements IRemoteConnectionType {
connections.remove(conn.getName());
connection.fireConnectionChangeEvent(RemoteConnectionChangeEvent.CONNECTION_REMOVED);
} else {
RemoteCorePlugin.log("Wrong class for " + connection.getName() + ", was " + connection.getClass().getName()); //$NON-NLS-1$ //$NON-NLS-2$
RemoteCorePlugin
.log("Wrong class for " + connection.getName() + ", was " + connection.getClass().getName()); //$NON-NLS-1$ //$NON-NLS-2$
}
}
}

View file

@ -35,7 +35,7 @@ public class RemoteCorePlugin extends Plugin {
/**
* Returns the shared instance
*
*
* @return the shared instance
*/
public static RemoteCorePlugin getDefault() {
@ -54,7 +54,7 @@ public class RemoteCorePlugin extends Plugin {
/**
* Logs the specified status with this plug-in's log.
*
*
* @param status
* status to log
*/
@ -64,7 +64,7 @@ public class RemoteCorePlugin extends Plugin {
/**
* Logs an internal error with the specified message.
*
*
* @param message
* the error message to log
*/
@ -74,7 +74,7 @@ public class RemoteCorePlugin extends Plugin {
/**
* Logs an internal error with the specified throwable
*
*
* @param e
* the exception to be logged
*/
@ -84,7 +84,7 @@ public class RemoteCorePlugin extends Plugin {
/**
* Return the OSGi service with the given service interface.
*
*
* @param service service interface
* @return the specified service or null if it's not registered
*/

View file

@ -78,7 +78,7 @@ public class RemoteDebugOptions implements DebugOptionsListener {
/**
* Prints the given message to System.out and to the OSGi tracing (if enabled)
*
*
* @param message
* the message or <code>null</code>
*/
@ -88,7 +88,7 @@ public class RemoteDebugOptions implements DebugOptionsListener {
/**
* Prints the given message to System.out and to the OSGi tracing (if enabled)
*
*
* @param option
* the option to determine if tracing is displayed
* @param message

View file

@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
*
* Contributors:
* IBM Corporation - initial API and implementation
* Patrick Tasse - Add extra constructor to Path class (bug 454959)
@ -18,12 +18,12 @@ import java.util.Arrays;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IPath;
/**
/**
* The Eclipse Mars implementation of <code>org.eclipse.core.runtime.Path</code>.
*
* Cloned from org.eclipse.equinox.common. This class should be removed when
* Eclipse older than Mars no longer needs to be supported.
*
*
* @see org.eclipse.core.runtime.Path
* @noextend This class is not intended to be subclassed by clients.
*/
@ -70,10 +70,10 @@ public class RemotePath implements IPath, Cloneable {
/** flags indicating separators (has leading, is UNC, has trailing, is for Windows) */
private int flags;
/**
/**
* Constructs a new path from the given string path.
* The string path must represent a valid file system path
* on the local file system.
* on the local file system.
* The path is canonicalized and double slashes are removed
* except at the beginning. (to handle UNC paths). All forward
* slashes ('/') are treated as segment delimiters, and any
@ -88,7 +88,7 @@ public class RemotePath implements IPath, Cloneable {
return new RemotePath(pathString);
}
/**
/**
* Constructs a new path from the given path string.
* The path string must have been produced by a previous
* call to <code>IPath.toPortableString</code>.
@ -164,10 +164,10 @@ public class RemotePath implements IPath, Cloneable {
// not allowed
}
/**
/**
* Constructs a new path from the given string path.
* The string path must represent a valid file system path
* on the local file system.
* on the local file system.
* The path is canonicalized and double slashes are removed
* except at the beginning. (to handle UNC paths). All forward
* slashes ('/') are treated as segment delimiters, and any
@ -182,7 +182,7 @@ public class RemotePath implements IPath, Cloneable {
this(fullPath, RUNNING_ON_WINDOWS);
}
/**
/**
* Constructs a new path from the given device id and string path.
* The given string path must be valid.
* The path is canonicalized and double slashes are removed except
@ -204,7 +204,7 @@ public class RemotePath implements IPath, Cloneable {
initialize(device, path, RUNNING_ON_WINDOWS);
}
/**
/**
* Constructs a new path from the given string path. The string path must
* represent a valid file system path on the specified file system. The path
* is canonicalized and double slashes are removed except at the beginning
@ -238,7 +238,7 @@ public class RemotePath implements IPath, Cloneable {
* Private constructor.
*/
private RemotePath(String device, String[] segments, int flags) {
// no segment validations are done for performance reasons
// no segment validations are done for performance reasons
this.segments = segments;
this.device = device;
//hash code is cached in all but the bottom four bits of the flags field
@ -298,7 +298,8 @@ public class RemotePath implements IPath, Cloneable {
newSegments[myLen + i] = tail.segment(i);
}
//use my leading separators and the tail's trailing separator
RemotePath result = new RemotePath(device, newSegments, (flags & (HAS_LEADING | IS_UNC | IS_FOR_WINDOWS)) | (tail.hasTrailingSeparator() ? HAS_TRAILING : 0));
RemotePath result = new RemotePath(device, newSegments,
(flags & (HAS_LEADING | IS_UNC | IS_FOR_WINDOWS)) | (tail.hasTrailingSeparator() ? HAS_TRAILING : 0));
String tailFirstSegment = newSegments[myLen];
if (tailFirstSegment.equals("..") || tailFirstSegment.equals(".")) { //$NON-NLS-1$ //$NON-NLS-2$
result.canonicalize();
@ -383,7 +384,7 @@ public class RemotePath implements IPath, Cloneable {
String segment = segments[i];
if (segment.equals("..")) { //$NON-NLS-1$
if (stackPointer == 0) {
// if the stack is empty we are going out of our scope
// if the stack is empty we are going out of our scope
// so we need to accumulate segments. But only if the original
// path is relative. If it is absolute then we can't go any higher than
// root so simply toss the .. references.
@ -530,7 +531,7 @@ public class RemotePath implements IPath, Cloneable {
if (firstPosition == 1 && len > 1 && (path.charAt(1) == SEPARATOR))
firstPosition = 2;
int lastPosition = (path.charAt(len - 1) != SEPARATOR) ? len - 1 : len - 2;
// for non-empty paths, the number of segments is
// for non-empty paths, the number of segments is
// the number of slashes plus 1, ignoring any leading
// and trailing slashes
int next = firstPosition;
@ -1070,7 +1071,8 @@ public class RemotePath implements IPath, Cloneable {
@Override
public IPath setDevice(String value) {
if (value != null) {
Assert.isTrue(value.indexOf(IPath.DEVICE_SEPARATOR) == (value.length() - 1), "Last character should be the device separator"); //$NON-NLS-1$
Assert.isTrue(value.indexOf(IPath.DEVICE_SEPARATOR) == (value.length() - 1),
"Last character should be the device separator"); //$NON-NLS-1$
}
//return the receiver if the device is the same
if (value == device || (value != null && value.equals(device)))

View file

@ -17,9 +17,9 @@ import org.eclipse.remote.core.IRemoteResource;
/**
* Factory to create an IRemoteResource
*
*
* @author greg
*
*
*/
public class RemoteResourceFactory {
private final IConfigurationElement fConfigElement;
@ -30,7 +30,7 @@ public class RemoteResourceFactory {
/**
* Get the remote resource associated with the platform resource.
*
*
* @return IRemoteResource
*/
public IRemoteResource getRemoteResource(IResource resource) {

View file

@ -35,7 +35,7 @@ import org.osgi.service.prefs.Preferences;
/**
* The implementation for the remote services manager service.
*
*
*/
public class RemoteServicesManager implements IRemoteServicesManager {
@ -83,7 +83,8 @@ public class RemoteServicesManager implements IRemoteServicesManager {
for (IExtension ext : point.getExtensions()) {
for (IConfigurationElement ce : ext.getConfigurationElements()) {
String name = ce.getName();
if (name.equals("connectionTypeService") || name.equals("connectionService") || name.equals("processService")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
if (name.equals("connectionTypeService") || name.equals("connectionService") //$NON-NLS-1$//$NON-NLS-2$
|| name.equals("processService")) { //$NON-NLS-1$
String id = ce.getAttribute("connectionTypeId"); //$NON-NLS-1$
RemoteConnectionType services = connectionTypeMap.get(id);
if (services != null) {
@ -95,7 +96,8 @@ public class RemoteServicesManager implements IRemoteServicesManager {
// Init connection providers
for (IRemoteConnectionType connectionType : connectionTypeMap.values()) {
IRemoteConnectionProviderService providerService = connectionType.getService(IRemoteConnectionProviderService.class);
IRemoteConnectionProviderService providerService = connectionType
.getService(IRemoteConnectionProviderService.class);
if (providerService != null) {
providerService.init();
}
@ -135,7 +137,8 @@ public class RemoteServicesManager implements IRemoteServicesManager {
@Override
@SafeVarargs
public final List<IRemoteConnectionType> getConnectionTypesSupporting(Class<? extends IRemoteConnection.Service>... services) {
public final List<IRemoteConnectionType> getConnectionTypesSupporting(
Class<? extends IRemoteConnection.Service>... services) {
List<IRemoteConnectionType> connTypes = new ArrayList<IRemoteConnectionType>();
for (IRemoteConnectionType connType : getAllConnectionTypes()) {
for (Class<? extends IRemoteConnection.Service> service : services) {
@ -150,7 +153,8 @@ public class RemoteServicesManager implements IRemoteServicesManager {
@Override
@SafeVarargs
public final List<IRemoteConnectionType> getConnectionTypesByService(Class<? extends IRemoteConnectionType.Service>... services) {
public final List<IRemoteConnectionType> getConnectionTypesByService(
Class<? extends IRemoteConnectionType.Service>... services) {
List<IRemoteConnectionType> connTypes = new ArrayList<IRemoteConnectionType>();
for (IRemoteConnectionType connType : getAllConnectionTypes()) {
for (Class<? extends IRemoteConnectionType.Service> service : services) {

View file

@ -19,12 +19,12 @@ public class RemoteLaunchConfigService implements IRemoteLaunchConfigService {
private Preferences getPreferences(String node) {
return InstanceScope.INSTANCE.getNode(RemoteCorePlugin.getUniqueIdentifier()).node(node);
}
private IRemoteConnection getRemoteConnection(String remoteId) {
if (remoteId == null) {
return null;
}
String[] ids = remoteId.split(":"); //$NON-NLS-1$
if (ids.length < 2) {
return null;
@ -35,7 +35,7 @@ public class RemoteLaunchConfigService implements IRemoteLaunchConfigService {
if (connectionType == null) {
return null;
}
return connectionType.getConnection(ids[1]);
}
@ -49,7 +49,7 @@ public class RemoteLaunchConfigService implements IRemoteLaunchConfigService {
RemoteCorePlugin.log(e.getStatus());
}
}
@Override
public IRemoteConnection getActiveConnection(ILaunchConfiguration launchConfig) {
String remoteId = getPreferences(REMOTE_LAUNCH_CONFIG).get(launchConfig.getName(), null);

View file

@ -16,7 +16,7 @@ import org.eclipse.remote.core.IRemotePreferenceConstants;
/**
* Class used to initialize default preference values.
*
*
* @since 6.0
*/
public class PreferenceInitializer extends AbstractPreferenceInitializer {

View file

@ -22,13 +22,14 @@ import org.osgi.service.prefs.BackingStoreException;
/**
* Convenience class to facilitate using the new {@link IEclipsePreferences} story. Adapted from
* org.eclipse.debug.internal.core.Preferences.
*
*
* @since 5.0
* @noinstantiate This class is not intended to be instantiated by clients.
*/
public final class Preferences {
private static final IScopeContext[] contexts = new IScopeContext[] { DefaultScope.INSTANCE, InstanceScope.INSTANCE };
private static final IScopeContext[] contexts = new IScopeContext[] { DefaultScope.INSTANCE,
InstanceScope.INSTANCE };
private static final int DEFAULT_CONTEXT = 0;
private static final int INSTANCE_CONTEXT = 1;
@ -37,7 +38,7 @@ public final class Preferences {
/**
* Adds the given preference listener to the {@link DefaultScope} and the {@link InstanceScope}
*
*
* @param listener
*/
public static void addPreferenceChangeListener(IPreferenceChangeListener listener) {
@ -47,23 +48,23 @@ public final class Preferences {
/**
* Returns whether the named preference is know in the preference store.
*
*
* @param name
* @return
*/
public static boolean contains(String name) {
return (contexts[INSTANCE_CONTEXT].getNode(fQualifier).get(name, null) != null || contexts[DEFAULT_CONTEXT].getNode(
fQualifier).get(name, null) != null);
return (contexts[INSTANCE_CONTEXT].getNode(fQualifier).get(name, null) != null
|| contexts[DEFAULT_CONTEXT].getNode(fQualifier).get(name, null) != null);
}
/**
* Returns the value in the preference store for the given key. If the key
* is not defined then return the default value. Use the canonical scope
* lookup order for finding the preference value.
*
*
* @param key
* @param defaultvalue
*
*
* @return the value of the preference or the given default value
*/
public static boolean getBoolean(String key) {
@ -74,10 +75,10 @@ public final class Preferences {
* Returns the value in the preference store for the given key. If the key
* is not defined then return the default value. Use the canonical scope
* lookup order for finding the preference value.
*
*
* @param key
* @param defaultvalue
*
*
* @return the value of the preference or the given default value
*/
public static byte[] getByteArray(String key) {
@ -88,10 +89,10 @@ public final class Preferences {
* Returns the default boolean value stored in the {@link DefaultScope} for
* the given key or the specified default value if the key does not appear
* in the {@link DefaultScope}
*
*
* @param key
* @param defaultvalue
*
*
* @return the boolean value set in the {@link DefaultScope} for the given
* key, or the specified default value.
*/
@ -103,10 +104,10 @@ public final class Preferences {
* Returns the default byte array value stored in the {@link DefaultScope} for the given key or the specified default value if
* the key does not
* appear in the {@link DefaultScope}
*
*
* @param key
* @param defaultvalue
*
*
* @return the byte array value set in the {@link DefaultScope} for the
* given key, or the specified default value.
*/
@ -118,10 +119,10 @@ public final class Preferences {
* Returns the default double value stored in the {@link DefaultScope} for
* the given key or the specified default value if the key does not appear
* in the {@link DefaultScope}
*
*
* @param key
* @param defaultvalue
*
*
* @return the double value set in the {@link DefaultScope} for the given
* key, or the specified default value.
*/
@ -133,10 +134,10 @@ public final class Preferences {
* Returns the default float value stored in the {@link DefaultScope} for
* the given key or the specified default value if the key does not appear
* in the {@link DefaultScope}
*
*
* @param key
* @param defaultvalue
*
*
* @return the float value set in the {@link DefaultScope} for the given
* key, or the specified default value.
*/
@ -148,10 +149,10 @@ public final class Preferences {
* Returns the default integer value stored in the {@link DefaultScope} for
* the given key or the specified default value if the key does not appear
* in the {@link DefaultScope}
*
*
* @param key
* @param defaultvalue
*
*
* @return the integer value set in the {@link DefaultScope} for the given
* key, or the specified default value.
*/
@ -163,10 +164,10 @@ public final class Preferences {
* Returns the default long value stored in the {@link DefaultScope} for the
* given key or the specified default value if the key does not appear in
* the {@link DefaultScope}
*
*
* @param key
* @param defaultvalue
*
*
* @return the long value set in the {@link DefaultScope} for the given key,
* or the specified default value.
*/
@ -178,10 +179,10 @@ public final class Preferences {
* Returns the default string value stored in the {@link DefaultScope} for
* the given key or the specified default value if the key does not appear
* in the {@link DefaultScope}
*
*
* @param key
* @param defaultvalue
*
*
* @return the string value set in the {@link DefaultScope} for the given
* key, or the specified default value.
*/
@ -193,10 +194,10 @@ public final class Preferences {
* Returns the value in the preference store for the given key. If the key
* is not defined then return the default value. Use the canonical scope
* lookup order for finding the preference value.
*
*
* @param key
* @param defaultvalue
*
*
* @return the value of the preference or the given default value
*/
public static double getDouble(String key) {
@ -207,11 +208,11 @@ public final class Preferences {
* Returns the value in the preference store for the given key. If the key
* is not defined then return the default value. Use the canonical scope
* lookup order for finding the preference value.
*
*
* @param fQualifier
* @param key
* @param defaultvalue
*
*
* @return the value of the preference or the given default value
*/
public static float getFloat(String key) {
@ -222,11 +223,11 @@ public final class Preferences {
* Returns the value in the preference store for the given key. If the key
* is not defined then return the default value. Use the canonical scope
* lookup order for finding the preference value.
*
*
* @param fQualifier
* @param key
* @param defaultvalue
*
*
* @return the value of the preference or the given default value
*/
public static int getInt(String key) {
@ -237,10 +238,10 @@ public final class Preferences {
* Returns the value in the preference store for the given key. If the key
* is not defined then return the default value. Use the canonical scope
* lookup order for finding the preference value.
*
*
* @param key
* @param defaultvalue
*
*
* @return the value of the preference or the given default value
*/
public static long getLong(String key) {
@ -251,10 +252,10 @@ public final class Preferences {
* Returns the value in the preference store for the given key. If the key
* is not defined then return the default value. Use the canonical scope
* lookup order for finding the preference value.
*
*
* @param key
* @param defaultvalue
*
*
* @return the value of the preference or the given default value
*/
public static String getString(String key) {
@ -263,7 +264,7 @@ public final class Preferences {
/**
* Returns true if the named preference has the default value.
*
*
* @param name
* @return
*/
@ -279,7 +280,7 @@ public final class Preferences {
/**
* Removes the given preference listener from the {@link DefaultScope} and
* the {@link InstanceScope}
*
*
* @param listener
*/
public static void removePreferenceChangeListener(IPreferenceChangeListener listener) {
@ -302,7 +303,7 @@ public final class Preferences {
/**
* Sets a boolean preference in the {@link InstanceScope}.
*
*
* @param key
* the key
* @param value
@ -314,7 +315,7 @@ public final class Preferences {
/**
* Sets a byte array preference in the {@link InstanceScope}.
*
*
* @param key
* the key
* @param value
@ -326,7 +327,7 @@ public final class Preferences {
/**
* Sets a boolean in the {@link DefaultScope}
*
*
* @param key
* the key
* @param value
@ -338,7 +339,7 @@ public final class Preferences {
/**
* Sets a byte array in the {@link DefaultScope}
*
*
* @param key
* the key
* @param value
@ -350,7 +351,7 @@ public final class Preferences {
/**
* Sets a double in the {@link DefaultScope}
*
*
* @param key
* the key
* @param value
@ -362,7 +363,7 @@ public final class Preferences {
/**
* Sets a float in the {@link DefaultScope}
*
*
* @param key
* the key
* @param value
@ -374,7 +375,7 @@ public final class Preferences {
/**
* Sets a integer in the {@link DefaultScope}
*
*
* @param key
* the key
* @param value
@ -386,7 +387,7 @@ public final class Preferences {
/**
* Sets a long in the {@link DefaultScope}
*
*
* @param key
* the key
* @param value
@ -398,7 +399,7 @@ public final class Preferences {
/**
* Sets a string in the {@link DefaultScope}
*
*
* @param key
* the key
* @param value
@ -410,7 +411,7 @@ public final class Preferences {
/**
* Sets a double preference in the {@link InstanceScope}.
*
*
* @param key
* the key
* @param value
@ -422,7 +423,7 @@ public final class Preferences {
/**
* Sets a float preference in the {@link InstanceScope}.
*
*
* @param key
* the key
* @param value
@ -434,7 +435,7 @@ public final class Preferences {
/**
* Sets a integer preference in the {@link InstanceScope}.
*
*
* @param key
* the key
* @param value
@ -446,7 +447,7 @@ public final class Preferences {
/**
* Sets a long preference in the {@link InstanceScope}.
*
*
* @param key
* the key
* @param value
@ -458,7 +459,7 @@ public final class Preferences {
/**
* Sets a string preference in the {@link InstanceScope}.
*
*
* @param key
* the key
* @param value
@ -472,7 +473,7 @@ public final class Preferences {
* Sets the given preference to its default value. This is done by removing
* any set value from the {@link InstanceScope}. Has no effect if the given
* key is <code>null</code>.
*
*
* @param key
* the key for the preference
*/

View file

@ -41,7 +41,7 @@ public class LocalCommandShellService implements IRemoteCommandShellService {
return null;
}
}
@Override
public IRemoteConnection getRemoteConnection() {
return connection;

View file

@ -19,9 +19,9 @@ import org.eclipse.remote.internal.core.RemoteCorePlugin;
public class LocalConnectionProviderService implements IRemoteConnectionProviderService {
private static final String localConnectionName = Messages.LocalConnectionProviderService_LocalConnectionName;
private IRemoteConnectionType connectionType;
public static class Factory implements IRemoteConnectionType.Service.Factory {
@SuppressWarnings("unchecked")
@Override
@ -32,7 +32,7 @@ public class LocalConnectionProviderService implements IRemoteConnectionProvider
return null;
}
}
public LocalConnectionProviderService(IRemoteConnectionType connectionType) {
this.connectionType = connectionType;
}

View file

@ -60,7 +60,7 @@ public class LocalProcess implements IRemoteProcessControlService, IRemoteProces
/**
* Thread to merge stdout and stderr. Keeps refcount so that output stream
* is not closed too early.
*
*
*/
private class ProcOutputMerger implements Runnable {
private final static int BUF_SIZE = 8192;

View file

@ -124,7 +124,8 @@ public class LocalProcessBuilder extends AbstractRemoteProcessBuilder {
private IProcessFactory getProcessFactory() {
IExtensionRegistry registry = Platform.getExtensionRegistry();
IExtensionPoint extensionPoint = registry.getExtensionPoint(RemoteCorePlugin.getUniqueIdentifier(), EXTENSION_POINT_ID);
IExtensionPoint extensionPoint = registry.getExtensionPoint(RemoteCorePlugin.getUniqueIdentifier(),
EXTENSION_POINT_ID);
IProcessFactory processFactory = null;

View file

@ -20,7 +20,7 @@ public class Activator extends Plugin {
/**
* Returns the shared instance
*
*
* @return the shared instance
*/
public static Activator getDefault() {
@ -29,7 +29,7 @@ public class Activator extends Plugin {
/**
* Get unique identifier
*
*
* @return
* @since 5.0
*/
@ -42,7 +42,7 @@ public class Activator extends Plugin {
/**
* Logs the specified status with this plug-in's log.
*
*
* @param status
* status to log
*/
@ -52,7 +52,7 @@ public class Activator extends Plugin {
/**
* Logs an internal error with the specified message.
*
*
* @param message
* the error message to log
*/
@ -62,7 +62,7 @@ public class Activator extends Plugin {
/**
* Logs an internal error with the specified throwable
*
*
* @param e
* the exception to be logged
*/
@ -80,7 +80,7 @@ public class Activator extends Plugin {
/**
* Return the OSGi service with the given service interface.
*
*
* @param service service interface
* @return the specified service or null if it's not registered
*/

View file

@ -51,7 +51,8 @@ public class ArgumentParser {
* string. Allows escaping.
*/
iterator.next(); // Skip quote
quoted_reader: while ((iterator.current() != CharacterIterator.DONE) && (iterator.current() != '"')) {
quoted_reader: while ((iterator.current() != CharacterIterator.DONE)
&& (iterator.current() != '"')) {
char innerChar = iterator.current();
switch (innerChar) {
case '\\':

View file

@ -51,8 +51,9 @@ import com.jcraft.jsch.Session;
/**
* @since 5.0
*/
public class JSchConnection implements IRemoteConnectionControlService, IRemoteConnectionPropertyService,
IRemotePortForwardingService, IRemoteProcessService, IRemoteConnectionHostService, IRemoteConnectionChangeListener {
public class JSchConnection
implements IRemoteConnectionControlService, IRemoteConnectionPropertyService, IRemotePortForwardingService,
IRemoteProcessService, IRemoteConnectionHostService, IRemoteConnectionChangeListener {
// Connection Type ID
public static final String JSCH_ID = "org.eclipse.remote.JSch"; //$NON-NLS-1$
@ -130,8 +131,9 @@ public class JSchConnection implements IRemoteConnectionControlService, IRemoteC
return (T) jschConnection;
}
} else if (IRemoteConnectionControlService.class.equals(service)
|| IRemoteConnectionPropertyService.class.equals(service) || IRemotePortForwardingService.class.equals(service)
|| IRemoteProcessService.class.equals(service) || IRemoteConnectionHostService.class.equals(service)) {
|| IRemoteConnectionPropertyService.class.equals(service)
|| IRemotePortForwardingService.class.equals(service) || IRemoteProcessService.class.equals(service)
|| IRemoteConnectionHostService.class.equals(service)) {
return (T) connection.getService(JSchConnection.class);
} else {
return null;
@ -230,7 +232,8 @@ public class JSchConnection implements IRemoteConnectionControlService, IRemoteC
}
@Override
public int forwardLocalPort(String fwdAddress, int fwdPort, IProgressMonitor monitor) throws RemoteConnectionException {
public int forwardLocalPort(String fwdAddress, int fwdPort, IProgressMonitor monitor)
throws RemoteConnectionException {
if (!isOpen()) {
throw new RemoteConnectionException(Messages.JSchConnection_connectionNotOpen);
}
@ -272,7 +275,8 @@ public class JSchConnection implements IRemoteConnectionControlService, IRemoteC
}
@Override
public int forwardRemotePort(String fwdAddress, int fwdPort, IProgressMonitor monitor) throws RemoteConnectionException {
public int forwardRemotePort(String fwdAddress, int fwdPort, IProgressMonitor monitor)
throws RemoteConnectionException {
if (!isOpen()) {
throw new RemoteConnectionException(Messages.JSchConnection_connectionNotOpen);
}
@ -426,7 +430,8 @@ public class JSchConnection implements IRemoteConnectionControlService, IRemoteC
if (proxyConnectionName.isEmpty()) {
return null;
}
return fRemoteConnection.getConnectionType().getConnection(proxyConnectionName).getService(JSchConnection.class);
return fRemoteConnection.getConnectionType().getConnection(proxyConnectionName)
.getService(JSchConnection.class);
}
/**
@ -442,7 +447,7 @@ public class JSchConnection implements IRemoteConnectionControlService, IRemoteC
* Open an sftp command channel to the remote host. This channel is for commands that do not require any
* state being preserved and should not be closed. Long running commands (such as get/put) should use a separate channel
* obtained via {#link #newSftpChannel()}.
*
*
* Always use the second session if available.
*
* @return sftp channel
@ -458,7 +463,7 @@ public class JSchConnection implements IRemoteConnectionControlService, IRemoteC
/**
* Open a channel for long running commands. This channel should be closed when the command is completed.
*
*
* @return sftp channel
* @throws RemoteConnectionException
* if a channel could not be opened
@ -680,12 +685,15 @@ public class JSchConnection implements IRemoteConnectionControlService, IRemoteC
IRemoteConnectionWorkingCopy wc = getRemoteConnection().getWorkingCopy();
IRemoteConnectionHostService hostService = wc.getService(IRemoteConnectionHostService.class);
IUserAuthenticatorService authService = wc.getService(IUserAuthenticatorService.class);
Session session = fJSchService.createSession(hostService.getHostname(), hostService.getPort(), hostService.getUsername());
Session session = fJSchService.createSession(hostService.getHostname(), hostService.getPort(),
hostService.getUsername());
session.setUserInfo(new JSchUserInfo(hostService, authService));
if (hostService.usePassword()) {
session.setConfig("PreferredAuthentications", "password,keyboard-interactive,gssapi-with-mic,publickey"); //$NON-NLS-1$ //$NON-NLS-2$
session.setConfig("PreferredAuthentications", //$NON-NLS-1$
"password,keyboard-interactive,gssapi-with-mic,publickey"); //$NON-NLS-1$
} else {
session.setConfig("PreferredAuthentications", "publickey,gssapi-with-mic,password,keyboard-interactive"); //$NON-NLS-1$ //$NON-NLS-2$
session.setConfig("PreferredAuthentications", //$NON-NLS-1$
"publickey,gssapi-with-mic,password,keyboard-interactive"); //$NON-NLS-1$
}
String password = hostService.getPassword();
if (!password.isEmpty()) {
@ -695,11 +703,12 @@ public class JSchConnection implements IRemoteConnectionControlService, IRemoteC
fJSchService.connect(session, getTimeout() * 1000, progress.newChild(10)); // connect without proxy
} else {
if (getProxyCommand().isEmpty()) {
session.setProxy(JSchConnectionProxyFactory.createForwardProxy(getProxyConnection(), progress.newChild(10)));
session.setProxy(
JSchConnectionProxyFactory.createForwardProxy(getProxyConnection(), progress.newChild(10)));
fJSchService.connect(session, getTimeout() * 1000, progress.newChild(10));
} else {
session.setProxy(JSchConnectionProxyFactory.createCommandProxy(getProxyConnection(), getProxyCommand(),
progress.newChild(10)));
session.setProxy(JSchConnectionProxyFactory.createCommandProxy(getProxyConnection(),
getProxyCommand(), progress.newChild(10)));
session.connect(getTimeout() * 1000); // the fJSchService doesn't pass the timeout correctly
}
}

View file

@ -97,8 +97,8 @@ public class JSchConnectionProxyFactory {
processBuilder.setPreamble(false);
process = processBuilder.start();
} else {
process = Activator.getService(IRemoteServicesManager.class).getLocalConnectionType().getConnections().get(0).
getService(IRemoteProcessService.class).getProcessBuilder(cmd).start();
process = Activator.getService(IRemoteServicesManager.class).getLocalConnectionType().getConnections()
.get(0).getService(IRemoteProcessService.class).getProcessBuilder(cmd).start();
}
// Wait on command to produce stdout output
@ -136,8 +136,8 @@ public class JSchConnectionProxyFactory {
} else if (bCanceled) {
cause = Messages.JSchConnectionProxyFactory_wasCanceled;
}
throw new IOException(MessageFormat.format(Messages.JSchConnectionProxyFactory_ProxyCommandFailed, command,
cause, msg));
throw new IOException(MessageFormat.format(Messages.JSchConnectionProxyFactory_ProxyCommandFailed,
command, cause, msg));
}
// Dump the stderr to log

View file

@ -1,15 +1,15 @@
/********************************************************************************
* Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
*
*
* Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight, Kushal Munir,
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
* component that contains this file: David McKnight, Kushal Munir,
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
*
* Contributors:
* David Dykstal (IBM) - 168977: refactoring IConnectorService and ServerLauncher hierarchies
* Kushal Munir (IBM) - moved to internal package
@ -34,7 +34,7 @@ import org.eclipse.core.runtime.IPath;
public class JSchFileSystem extends FileSystem {
/**
* Return the connection name encoded in the URI.
*
*
* @param uri
* URI specifying a remote tools connection
* @return name of the connection or null if the URI is invalid
@ -46,7 +46,7 @@ public class JSchFileSystem extends FileSystem {
/**
* Return an URI uniquely naming a remote tools remote resource.
*
*
* @param connectionName
* remote tools connection name
* @param path

View file

@ -27,10 +27,12 @@ import com.jcraft.jsch.Channel;
import com.jcraft.jsch.ChannelExec;
import com.jcraft.jsch.ChannelShell;
public class JSchProcess implements IRemoteProcessControlService, IRemoteProcessSignalService, IRemoteProcessTerminalService {
public class JSchProcess
implements IRemoteProcessControlService, IRemoteProcessSignalService, IRemoteProcessTerminalService {
@SuppressWarnings("nls")
private final String signals[] = new String[] { "", "HUP", "INT", "QUIT", "ILL", "", "ABRT", "", "FPE", "KILL", "", "SEGV", "",
"PIPE", "ALRM", "TERM", "", "STOP", "TSTP", "CONT", "", "", "", "", "", "", "", "", "", "", "USR1", "USR2" };
private final String signals[] = new String[] { "", "HUP", "INT", "QUIT", "ILL", "", "ABRT", "", "FPE", "KILL", "",
"SEGV", "", "PIPE", "ALRM", "TERM", "", "STOP", "TSTP", "CONT", "", "", "", "", "", "", "", "", "", "",
"USR1", "USR2" };
private static int WAIT_TIMEOUT = 1000;
private static int refCount = 0;
@ -147,7 +149,7 @@ public class JSchProcess implements IRemoteProcessControlService, IRemoteProcess
@Override
public int exitValue() {
if(!isCompleted()) {
if (!isCompleted()) {
throw new IllegalThreadStateException(Messages.JSchProcess_exitValue_exception_msg);
}
return fChannel.getExitStatus();

View file

@ -118,10 +118,10 @@ public class JSchProcessBuilder extends AbstractRemoteProcessBuilder {
/*
* There are two possibilities:
*
*
* 1. Some environment variables have changed values, or new variables have been added. In this case we just want to
* send send the changed values rather than all the variables.
*
*
* 2. Some of the existing variables have been removed. In this case, we need to resend the entire environment variable
* list.
*/

View file

@ -30,11 +30,11 @@ public class JSchUserInfo implements UserInfo, UIKeyboardInteractive {
private final IRemoteConnectionHostService hostService;
private IUserAuthenticatorService userAuthenticatorService;
public JSchUserInfo(IRemoteConnectionHostService hostService) {
this.hostService = hostService;
}
public JSchUserInfo(IRemoteConnectionHostService hostService, IUserAuthenticatorService userAuthenticatorService) {
this(hostService);
this.userAuthenticatorService = userAuthenticatorService;
@ -122,8 +122,9 @@ public class JSchUserInfo implements UserInfo, UIKeyboardInteractive {
System.out.println("promptYesNo:" + message); //$NON-NLS-1$
}
if (userAuthenticatorService != null) {
int prompt = userAuthenticatorService.prompt(IUserAuthenticatorService.QUESTION, Messages.AuthInfo_Authentication_message,
message, new int[] { IUserAuthenticatorService.YES, IUserAuthenticatorService.NO },
int prompt = userAuthenticatorService.prompt(IUserAuthenticatorService.QUESTION,
Messages.AuthInfo_Authentication_message, message,
new int[] { IUserAuthenticatorService.YES, IUserAuthenticatorService.NO },
IUserAuthenticatorService.YES);
return prompt == IUserAuthenticatorService.YES;
}
@ -136,8 +137,9 @@ public class JSchUserInfo implements UserInfo, UIKeyboardInteractive {
System.out.println("showMessage:" + message); //$NON-NLS-1$
}
if (userAuthenticatorService != null) {
userAuthenticatorService.prompt(IUserAuthenticatorService.INFORMATION, Messages.AuthInfo_Authentication_message, message,
new int[] { IUserAuthenticatorService.OK }, IUserAuthenticatorService.OK);
userAuthenticatorService.prompt(IUserAuthenticatorService.INFORMATION,
Messages.AuthInfo_Authentication_message, message, new int[] { IUserAuthenticatorService.OK },
IUserAuthenticatorService.OK);
}
}
}

View file

@ -46,7 +46,7 @@ import org.eclipse.remote.internal.jsch.core.messages.Messages;
public class JschFileStore extends FileStore {
/**
* Public factory method for obtaining JschFileStore instances.
*
*
* @param uri
* URI to get a fileStore for
* @return an JschFileStore instance for the URI.
@ -76,7 +76,8 @@ public class JschFileStore extends FileStore {
IRemoteServicesManager manager = Activator.getService(IRemoteServicesManager.class);
IRemoteConnectionType connectionType = manager.getConnectionType(fURI);
if (connectionType == null) {
throw new RemoteConnectionException(NLS.bind(Messages.JschFileStore_No_remote_services_found_for_URI, fURI));
throw new RemoteConnectionException(
NLS.bind(Messages.JschFileStore_No_remote_services_found_for_URI, fURI));
}
try {
@ -136,7 +137,8 @@ public class JschFileStore extends FileStore {
@Override
public IFileStore getChild(String name) {
URI uri = JSchFileSystem.getURIFor(JSchFileSystem.getConnectionNameFor(fURI), fRemotePath.append(name).toString());
URI uri = JSchFileSystem.getURIFor(JSchFileSystem.getConnectionNameFor(fURI),
fRemotePath.append(name).toString());
return JschFileStore.getInstance(uri);
}
@ -147,7 +149,7 @@ public class JschFileStore extends FileStore {
/**
* Utility routing to get the file name from an absolute path.
*
*
* @param path
* path to extract file name from
* @return last segment of path, or the full path if it is root
@ -168,7 +170,8 @@ public class JschFileStore extends FileStore {
if (fRemotePath.segmentCount() > 0) {
parentPath = fRemotePath.removeLastSegments(1).toString();
}
return JschFileStore.getInstance(JSchFileSystem.getURIFor(JSchFileSystem.getConnectionNameFor(fURI), parentPath));
return JschFileStore
.getInstance(JSchFileSystem.getURIFor(JSchFileSystem.getConnectionNameFor(fURI), parentPath));
}
@Override
@ -180,7 +183,8 @@ public class JschFileStore extends FileStore {
IFileStore parent = getParent();
if (parent != null && !parent.fetchInfo(EFS.NONE, subMon.newChild(9)).exists()) {
throw new CoreException(new Status(IStatus.ERROR, Activator.getUniqueIdentifier(), EFS.ERROR_WRITE,
NLS.bind(Messages.JschFileStore_The_parent_of_directory_does_not_exist, fRemotePath.toString()), null));
NLS.bind(Messages.JschFileStore_The_parent_of_directory_does_not_exist, fRemotePath.toString()),
null));
}
if (subMon.isCanceled()) {
return this;
@ -201,11 +205,14 @@ public class JschFileStore extends FileStore {
if (!subMon.isCanceled()) {
if (!info.exists()) {
throw new CoreException(new Status(IStatus.ERROR, Activator.getUniqueIdentifier(), EFS.ERROR_WRITE,
NLS.bind(Messages.JschFileStore_The_directory_could_not_be_created, fRemotePath.toString()), null));
NLS.bind(Messages.JschFileStore_The_directory_could_not_be_created, fRemotePath.toString()),
null));
}
if (!info.isDirectory()) {
throw new CoreException(new Status(IStatus.ERROR, Activator.getUniqueIdentifier(), EFS.ERROR_WRONG_TYPE,
NLS.bind(Messages.JschFileStore_A_file_of_name_already_exists, fRemotePath.toString()), null));
throw new CoreException(new Status(IStatus.ERROR, Activator.getUniqueIdentifier(),
EFS.ERROR_WRONG_TYPE,
NLS.bind(Messages.JschFileStore_A_file_of_name_already_exists, fRemotePath.toString()),
null));
}
}
}

View file

@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
*
* Contributors:
* IBM Corporation - Initial Implementation
* Martin Oberhuber - [468889] Support Eclipse older than Mars
@ -43,7 +43,7 @@ import com.jcraft.jsch.SftpProgressMonitor;
/**
* @author greg
*
*
*/
public abstract class AbstractRemoteCommand<T> {
protected static class CommandProgressMonitor implements SftpProgressMonitor {
@ -80,7 +80,8 @@ public abstract class AbstractRemoteCommand<T> {
taskName.append(fPrefix);
}
if (fWorkPercentFactor < 0) {
taskName.append(MessageFormat.format(Messages.AbstractRemoteCommand_format1, new Object[] { workToDate, size }));
taskName.append(MessageFormat.format(Messages.AbstractRemoteCommand_format1,
new Object[] { workToDate, size }));
} else {
Double workPercent = Double.valueOf(fWorkPercentFactor * fWorkToDate);
taskName.append(MessageFormat.format(Messages.AbstractRemoteCommand_format2,
@ -300,8 +301,8 @@ public abstract class AbstractRemoteCommand<T> {
return convertToFileInfo(path.lastSegment(), path.removeLastSegments(1), attrs, monitor);
}
protected IFileInfo convertToFileInfo(final String name, final IPath parentPath, SftpATTRS attrs, IProgressMonitor monitor)
throws RemoteConnectionException {
protected IFileInfo convertToFileInfo(final String name, final IPath parentPath, SftpATTRS attrs,
IProgressMonitor monitor) throws RemoteConnectionException {
SubMonitor progress = SubMonitor.convert(monitor, 10);
FileInfo fileInfo = new FileInfo(name);
fileInfo.setExists(true);

View file

@ -48,7 +48,7 @@ public class ExecCommand extends AbstractRemoteCommand<String> {
if (getProgressMonitor().isCanceled()) {
return ""; //$NON-NLS-1$
}
if (getChannel().getExitStatus()!=0) {
if (getChannel().getExitStatus() != 0) {
throw new RemoteConnectionException(err.toString());
}
return stream.toString();

View file

@ -19,7 +19,7 @@ import com.jcraft.jsch.SftpException;
* The JSch implementation does not support multiple streams open on a single channel, so we must create a new channel for each
* subsequent stream. This has the problem that there are usually only a limited number of channels that can be opened
* simultaneously, so it is possible that this call will fail unless the open streams are closed first.
*
*
* This code will use the initial (command) channel first, or if that is already being used, will open a new stream. It must be
* careful not to close the command stream as other threads may still be using it.
*/
@ -56,8 +56,10 @@ public class GetInputStreamCommand extends AbstractRemoteCommand<InputStream> {
@Override
public InputStream call() throws JSchException, SftpException, IOException {
return newChannel().get(fRemotePath.toString(), new CommandProgressMonitor(
NLS.bind(Messages.GetInputStreamCommand_Receiving, fRemotePath.toString()), getProgressMonitor()));
return newChannel().get(fRemotePath.toString(),
new CommandProgressMonitor(
NLS.bind(Messages.GetInputStreamCommand_Receiving, fRemotePath.toString()),
getProgressMonitor()));
}
};
try {

View file

@ -50,11 +50,9 @@ public class GetOutputStreamCommand extends AbstractRemoteCommand<OutputStream>
if ((fOptions & EFS.APPEND) != 0) {
mode = ChannelSftp.APPEND;
}
getChannel().put(
input,
fRemotePath.toString(),
new CommandProgressMonitor(NLS.bind(Messages.GetOutputStreamCommand_Sending, fRemotePath.toString()),
getProgressMonitor()), mode);
getChannel().put(input, fRemotePath.toString(), new CommandProgressMonitor(
NLS.bind(Messages.GetOutputStreamCommand_Sending, fRemotePath.toString()),
getProgressMonitor()), mode);
input.close();
} finally {
fIsClosed = true;

View file

@ -53,7 +53,8 @@ public class PutInfoCommand extends AbstractRemoteCommand<Void> {
return null;
}
private void chmod(final int permissions, final String path, IProgressMonitor monitor) throws RemoteConnectionException {
private void chmod(final int permissions, final String path, IProgressMonitor monitor)
throws RemoteConnectionException {
final SubMonitor subMon = SubMonitor.convert(monitor, 10);
SftpCallable<Void> c = new SftpCallable<Void>() {
@Override
@ -69,7 +70,8 @@ public class PutInfoCommand extends AbstractRemoteCommand<Void> {
}
}
private void setMTime(final int mtime, final String path, IProgressMonitor monitor) throws RemoteConnectionException {
private void setMTime(final int mtime, final String path, IProgressMonitor monitor)
throws RemoteConnectionException {
final SubMonitor subMon = SubMonitor.convert(monitor, 10);
SftpCallable<Void> c = new SftpCallable<Void>() {
@Override

View file

@ -4,7 +4,7 @@
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html
#
#
# Contributors:
# IBM Corporation - initial implementation
###############################################################################
@ -14,8 +14,8 @@ AbstractRemoteCommand_Get_symlink_target=Get symlink target
AbstractRemoteCommand_Operation_cancelled_by_user=Operation cancelled by user
AuthInfo_Authentication_message=Authentication Message
ExecCommand_Exec_command=Executing command "{0}"
GetInputStreamCommand_Receiving=Receiving {0}:
GetOutputStreamCommand_Sending=Sending {0}:
GetInputStreamCommand_Receiving=Receiving {0}:
GetOutputStreamCommand_Sending=Sending {0}:
JSchConnection_0=Connection canceled by user
JSchConnection_Connection_was_cancelled=Connection was cancelled
JSchConnection_connectionNotOpen=Connection is not open

View file

@ -14,7 +14,7 @@ public class Activator extends AbstractUIPlugin {
// The shared instance
private static Activator plugin;
/**
* The constructor
*/
@ -42,7 +42,7 @@ public class Activator extends AbstractUIPlugin {
/**
* Return the OSGi service with the given service interface.
*
*
* @param service service interface
* @return the specified service or null if it's not registered
*/

View file

@ -175,7 +175,7 @@ public class ProcessTests extends TestCase {
public void testExitValue() {
IRemoteProcessService processService = fRemoteConnection.getService(IRemoteProcessService.class);
assertNotNull(processService);
IRemoteProcessBuilder builder = processService.getProcessBuilder(new String[]{"sleep","60"}); //$NON-NLS-1$
IRemoteProcessBuilder builder = processService.getProcessBuilder(new String[] { "sleep", "60" }); //$NON-NLS-1$
assertNotNull(builder);
IRemoteProcess rp = null;
try {
@ -189,7 +189,7 @@ public class ProcessTests extends TestCase {
try {
p.exitValue();
fail("Process has not exited. Should throws an IllegalThreadStateException exception");
} catch(IllegalThreadStateException e) {
} catch (IllegalThreadStateException e) {
e.printStackTrace();
}
}

View file

@ -23,7 +23,7 @@ public class Activator extends AbstractUIPlugin {
/**
* Returns the shared instance
*
*
* @return the shared instance
*/
public static Activator getDefault() {
@ -32,7 +32,7 @@ public class Activator extends AbstractUIPlugin {
/**
* Get unique identifier
*
*
* @return
* @since 5.0
*/
@ -45,7 +45,7 @@ public class Activator extends AbstractUIPlugin {
/**
* Logs the specified status with this plug-in's log.
*
*
* @param status
* status to log
*/
@ -55,7 +55,7 @@ public class Activator extends AbstractUIPlugin {
/**
* Logs an internal error with the specified message.
*
*
* @param message
* the error message to log
*/
@ -65,7 +65,7 @@ public class Activator extends AbstractUIPlugin {
/**
* Logs an internal error with the specified throwable
*
*
* @param e
* the exception to be logged
*/
@ -83,7 +83,7 @@ public class Activator extends AbstractUIPlugin {
/**
* Return the OSGi service with the given service interface.
*
*
* @param service service interface
* @return the specified service or null if it's not registered
*/

View file

@ -1,15 +1,15 @@
/********************************************************************************
* Copyright (c) 2002, 2008 IBM Corporation and others. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
*
*
* Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight, Kushal Munir,
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
* component that contains this file: David McKnight, Kushal Munir,
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
*
* Contributors:
* Kushal Munir (IBM) - moved to internal package.
* Martin Oberhuber (Wind River) - [181917] EFS Improvements: Avoid unclosed Streams,

View file

@ -25,7 +25,7 @@ import com.jcraft.jsch.JSch;
import com.jcraft.jsch.JSchException;
public class JSchUserAuthenticator implements IUserAuthenticatorService {
private final IRemoteConnection remoteConnection;
private UserInfoPrompter prompter;
@ -44,7 +44,7 @@ public class JSchUserAuthenticator implements IUserAuthenticatorService {
public IRemoteConnection getRemoteConnection() {
return remoteConnection;
}
@Override
public PasswordAuthentication prompt(String username, String message) {
if (prompter.promptPassword(message)) {
@ -90,8 +90,8 @@ public class JSchUserAuthenticator implements IUserAuthenticatorService {
display.syncExec(new Runnable() {
@Override
public void run() {
final MessageDialog dialog = new MessageDialog(display.getActiveShell(), title, null /* title image */, message,
promptType, buttons, defaultResponseIndex);
final MessageDialog dialog = new MessageDialog(display.getActiveShell(), title, null /* title image */,
message, promptType, buttons, defaultResponseIndex);
retval[0] = dialog.open();
}
});
@ -105,7 +105,7 @@ public class JSchUserAuthenticator implements IUserAuthenticatorService {
}
return display;
}
public static class Factory implements IRemoteConnection.Service.Factory {
@Override
@SuppressWarnings("unchecked")

View file

@ -4,7 +4,7 @@
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html
#
#
# Contributors:
# IBM Corporation - initial implementation
###############################################################################

View file

@ -246,8 +246,8 @@ public class JSchConnectionPage extends WizardPage {
fPasswordButton.setSelection(JSchConnection.DEFAULT_IS_PASSWORD);
fPublicKeyButton.setSelection(!JSchConnection.DEFAULT_IS_PASSWORD);
controls.setTabList(
new Control[] { fHostText, fUserText, fPublicKeyButton, fPassphraseText, fPasswordButton, fPasswordText });
controls.setTabList(new Control[] { fHostText, fUserText, fPublicKeyButton, fPassphraseText, fPasswordButton,
fPasswordText });
}
@Override
@ -312,7 +312,8 @@ public class JSchConnectionPage extends WizardPage {
lblConnection.setText(Messages.JSchConnectionPage_SelectConnection);
fProxyConnectionWidget = new RemoteConnectionWidget(proxyComp, SWT.NONE, null, 0);
fProxyConnectionWidget.filterConnections(IRemoteConnectionHostService.class, IRemotePortForwardingService.class);
fProxyConnectionWidget.filterConnections(IRemoteConnectionHostService.class,
IRemotePortForwardingService.class);
Label lblCommand = new Label(proxyComp, SWT.WRAP);
lblCommand.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
@ -384,7 +385,8 @@ public class JSchConnectionPage extends WizardPage {
: Boolean.parseBoolean(useLoginShellStr);
fUseLoginShellButton.setSelection(useLoginShell);
String loginShellStr = fConnection.getAttribute(JSchConnection.LOGIN_SHELL_COMMAND_ATTR);
fLoginShellText.setText(loginShellStr.isEmpty() ? JSchConnection.DEFAULT_LOGIN_SHELL_COMMAND : loginShellStr);
fLoginShellText
.setText(loginShellStr.isEmpty() ? JSchConnection.DEFAULT_LOGIN_SHELL_COMMAND : loginShellStr);
fProxyCommandText.setText(fConnection.getAttribute(JSchConnection.PROXYCOMMAND_ATTR));
JSchConnection proxyConn = fConnection.getService(JSchConnection.class).getProxyConnection();
if (proxyConn == null) {
@ -520,7 +522,8 @@ public class JSchConnectionPage extends WizardPage {
fConnection.setAttribute(JSchConnection.TIMEOUT_ATTR, fTimeoutText.getText().trim());
fConnection.setAttribute(JSchConnection.PORT_ATTR, fPortText.getText().trim());
fConnection.setAttribute(JSchConnection.PROXYCOMMAND_ATTR, fProxyCommandText.getText().trim());
fConnection.setAttribute(JSchConnection.USE_LOGIN_SHELL_ATTR, Boolean.toString(fUseLoginShellButton.getSelection()));
fConnection.setAttribute(JSchConnection.USE_LOGIN_SHELL_ATTR,
Boolean.toString(fUseLoginShellButton.getSelection()));
fConnection.setAttribute(JSchConnection.LOGIN_SHELL_COMMAND_ATTR, fLoginShellText.getText().trim());
IRemoteConnection proxyConnection = fProxyConnectionWidget.getConnection();
IRemoteServicesManager manager = Activator.getService(IRemoteServicesManager.class);

View file

@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
*
* Contributors:
* IBM Corporation - Initial Implementation
*

View file

@ -11,8 +11,7 @@ Export-Package: org.eclipse.remote.internal.proxy.core;x-friends:="org.eclipse.r
org.eclipse.remote.internal.proxy.core.messages;x-friends:="org.eclipse.remote.proxy.ui"
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: JavaSE-11
Import-Package:
com.jcraft.jsch,
Import-Package: com.jcraft.jsch,
org.eclipse.core.filesystem,
org.eclipse.core.filesystem.provider,
org.eclipse.core.runtime,

View file

@ -6,5 +6,5 @@ bin.includes = META-INF/,\
plugin.properties,\
about.html,\
bootstrap.sh

View file

@ -19,7 +19,7 @@ public class Activator extends Plugin {
/**
* Returns the shared instance
*
*
* @return the shared instance
*/
public static Activator getDefault() {
@ -28,7 +28,7 @@ public class Activator extends Plugin {
/**
* Get unique identifier
*
*
* @return
* @since 5.0
*/
@ -41,7 +41,7 @@ public class Activator extends Plugin {
/**
* Logs the specified status with this plug-in's log.
*
*
* @param status
* status to log
*/
@ -51,7 +51,7 @@ public class Activator extends Plugin {
/**
* Logs an internal error with the specified message.
*
*
* @param message
* the error message to log
*/
@ -61,7 +61,7 @@ public class Activator extends Plugin {
/**
* Logs an internal error with the specified throwable
*
*
* @param e
* the exception to be logged
*/
@ -69,7 +69,6 @@ public class Activator extends Plugin {
log(new Status(IStatus.ERROR, getUniqueIdentifier(), IStatus.ERROR, e.getMessage(), e));
}
/**
* The constructor
*/
@ -78,7 +77,7 @@ public class Activator extends Plugin {
/**
* Return the OSGi service with the given service interface.
*
*
* @param service service interface
* @return the specified service or null if it's not registered
*/

View file

@ -46,10 +46,9 @@ import com.jcraft.jsch.ChannelShell;
/**
* @since 5.0
*/
public class ProxyConnection implements IRemoteConnectionControlService,
IRemoteConnectionChangeListener, IRemoteProcessService,
IRemoteCommandShellService, IRemoteConnectionHostService,
IRemoteConnectionPropertyService {
public class ProxyConnection
implements IRemoteConnectionControlService, IRemoteConnectionChangeListener, IRemoteProcessService,
IRemoteCommandShellService, IRemoteConnectionHostService, IRemoteConnectionPropertyService {
// Connection Type ID
public static final String JSCH_ID = "org.eclipse.remote.Proxy"; //$NON-NLS-1$
@ -73,7 +72,7 @@ public class ProxyConnection implements IRemoteConnectionControlService,
private StreamChannelManager channelMux;
private StreamChannel commandChannel;
private boolean isOpen;
private final IRemoteConnection fRemoteConnection;
private final Map<String, String> fEnv = new HashMap<>();
@ -119,10 +118,9 @@ public class ProxyConnection implements IRemoteConnectionControlService,
return (T) conn;
}
} else if (IRemoteConnectionControlService.class.equals(service)
|| IRemoteConnectionPropertyService.class.equals(service)
|| IRemoteConnectionHostService.class.equals(service)
|| IRemoteProcessService.class.equals(service)
|| IRemoteCommandShellService.class.equals(service)
|| IRemoteConnectionPropertyService.class.equals(service)
|| IRemoteConnectionHostService.class.equals(service) || IRemoteProcessService.class.equals(service)
|| IRemoteCommandShellService.class.equals(service)
|| IRemoteConnectionPropertyService.class.equals(service)) {
return (T) connection.getService(ProxyConnection.class);
} else {
@ -169,7 +167,7 @@ public class ProxyConnection implements IRemoteConnectionControlService,
fRemoteConnection.fireConnectionChangeEvent(RemoteConnectionChangeEvent.CONNECTION_OPENED);
}
}
private void initialize(IProgressMonitor monitor) throws RemoteConnectionException {
SubMonitor subMon = SubMonitor.convert(monitor, 30);
fWorkingDir = getCwd(subMon.newChild(10));
@ -194,7 +192,7 @@ public class ProxyConnection implements IRemoteConnectionControlService,
throw new RemoteConnectionException(e.getMessage());
}
}
private Map<String, String> loadEnv(IProgressMonitor monitor) throws RemoteConnectionException {
try {
GetEnvCommand cmd = new GetEnvCommand(this);
@ -203,7 +201,7 @@ public class ProxyConnection implements IRemoteConnectionControlService,
throw new RemoteConnectionException(e.getMessage());
}
}
private Map<String, String> loadProperties(IProgressMonitor monitor) throws RemoteConnectionException {
try {
GetPropertiesCommand cmd = new GetPropertiesCommand(this);
@ -212,22 +210,22 @@ public class ProxyConnection implements IRemoteConnectionControlService,
throw new RemoteConnectionException(e.getMessage());
}
}
public Map<String, String> getEnv() {
return Collections.unmodifiableMap(fEnv);
}
public StreamChannel getCommandChannel() {
return commandChannel;
}
public StreamChannel openChannel() throws IOException {
return channelMux.openChannel();
}
private StringBuffer stdout = new StringBuffer();
private StringBuffer stderr = new StringBuffer();
@SuppressWarnings("unused")
private String executeSshCommand(ChannelShell shell, String command) throws RemoteConnectionException {
try {
@ -246,7 +244,7 @@ public class ProxyConnection implements IRemoteConnectionControlService,
throw new RemoteConnectionException(e.getMessage());
}
}
@SuppressWarnings("unused")
private String executeCommand(List<String> command, IProgressMonitor monitor) throws ProxyException {
try {
@ -281,7 +279,8 @@ public class ProxyConnection implements IRemoteConnectionControlService,
}
}
}.start();
ExecCommand cmd = new ExecCommand(this, command, getEnv(), getWorkingDirectory(), false, false, chanA.getId(), chanB.getId(), chanC.getId());
ExecCommand cmd = new ExecCommand(this, command, getEnv(), getWorkingDirectory(), false, false,
chanA.getId(), chanB.getId(), chanC.getId());
cmd.getResult(monitor);
DataInputStream status = new DataInputStream(chanC.getInputStream());
int stat = status.readInt();

View file

@ -45,68 +45,68 @@ public class ProxyConnectionBootstrap {
private final IJSchService jSchService;
private Session session;
private ChannelExec exec;
private class Context {
private State state;
private String osName;
private String osArch;
private String errorMessage;
private final SubMonitor monitor;
private final BufferedReader reader;
private final BufferedWriter writer;
public Context(BufferedReader reader, BufferedWriter writer, IProgressMonitor monitor) {
this.reader = reader;
this.writer = writer;
this.monitor = SubMonitor.convert(monitor);
setState(States.INIT);
}
State getState() {
return state;
}
SubMonitor getMonitor() {
return monitor;
}
void setState(State state) {
this.state = state;
}
String getOSName() {
return osName;
}
void setOSName(String osName) {
this.osName = osName;
}
String getOSArch() {
return osArch;
}
void setOSArch(String osArch) {
this.osArch = osArch;
}
void setErrorMessage(String message) {
this.errorMessage = message;
}
String getErrorMessage() {
return errorMessage;
}
State getState() {
return state;
}
SubMonitor getMonitor() {
return monitor;
}
void setState(State state) {
this.state = state;
}
String getOSName() {
return osName;
}
void setOSName(String osName) {
this.osName = osName;
}
String getOSArch() {
return osArch;
}
void setOSArch(String osArch) {
this.osArch = osArch;
}
void setErrorMessage(String message) {
this.errorMessage = message;
}
String getErrorMessage() {
return errorMessage;
}
}
private interface State {
/**
* @return true to keep processing, false to read more data.
*/
boolean process(Context context) throws IOException;
/**
* @return true to keep processing, false to read more data.
*/
boolean process(Context context) throws IOException;
}
private enum States implements State {
INIT {
@Override
@ -145,7 +145,7 @@ public class ProxyConnectionBootstrap {
return true;
case "fail": //$NON-NLS-1$
context.setErrorMessage(parts[1]);
System.out.println("fail:"+parts[1]); //$NON-NLS-1$
System.out.println("fail:" + parts[1]); //$NON-NLS-1$
return false;
case "debug": //$NON-NLS-1$
System.err.println(line);
@ -163,7 +163,8 @@ public class ProxyConnectionBootstrap {
@Override
public boolean process(Context context) throws IOException {
context.getMonitor().subTask(Messages.ProxyConnectionBootstrap_3);
String bundleName = "org.eclipse.remote.proxy.server." + context.getOSName() + "." + context.getOSArch(); //$NON-NLS-1$ //$NON-NLS-2$
String bundleName = "org.eclipse.remote.proxy.server." + context.getOSName() + "." //$NON-NLS-1$//$NON-NLS-2$
+ context.getOSArch();
Bundle serverBundle = Platform.getBundle(bundleName);
if (serverBundle == null) {
throw new IOException(NLS.bind(Messages.ProxyConnectionBootstrap_2, bundleName));
@ -187,7 +188,7 @@ public class ProxyConnectionBootstrap {
return true;
case "fail": //$NON-NLS-1$
context.setErrorMessage(parts[1]);
System.out.println("fail:"+parts[1]); //$NON-NLS-1$
System.out.println("fail:" + parts[1]); //$NON-NLS-1$
return false;
case "debug": //$NON-NLS-1$
System.err.println(line);
@ -201,7 +202,7 @@ public class ProxyConnectionBootstrap {
}
return false;
}
private boolean downloadFile(File file, BufferedWriter writer, IProgressMonitor monitor) {
SubMonitor subMon = SubMonitor.convert(monitor, 10);
try {
@ -235,12 +236,13 @@ public class ProxyConnectionBootstrap {
}
}
}
public ProxyConnectionBootstrap() {
jSchService = Activator.getService(IJSchService.class);
}
public StreamChannelManager run(IRemoteConnection connection, IProgressMonitor monitor) throws RemoteConnectionException {
public StreamChannelManager run(IRemoteConnection connection, IProgressMonitor monitor)
throws RemoteConnectionException {
SubMonitor subMon = SubMonitor.convert(monitor, 20);
try {
final Channel chan = openChannel(connection, subMon.newChild(10));
@ -268,7 +270,8 @@ public class ProxyConnectionBootstrap {
if (context.getState() != States.START) {
context.writer.write("exit\n"); //$NON-NLS-1$
context.writer.flush();
throw new RemoteConnectionException(NLS.bind(Messages.ProxyConnectionBootstrap_7, context.getErrorMessage()));
throw new RemoteConnectionException(
NLS.bind(Messages.ProxyConnectionBootstrap_7, context.getErrorMessage()));
}
new Thread("server error stream") { //$NON-NLS-1$
@Override
@ -277,7 +280,7 @@ public class ProxyConnectionBootstrap {
BufferedReader reader = new BufferedReader(new InputStreamReader(chan.getExtInputStream()));
String line;
while ((line = reader.readLine()) != null) {
System.err.println("server: "+ line); //$NON-NLS-1$
System.err.println("server: " + line); //$NON-NLS-1$
}
} catch (IOException e) {
// Ignore and terminate thread
@ -289,18 +292,22 @@ public class ProxyConnectionBootstrap {
throw new RemoteConnectionException(e.getMessage());
}
}
private Channel openChannel(IRemoteConnection connection, IProgressMonitor monitor) throws RemoteConnectionException {
private Channel openChannel(IRemoteConnection connection, IProgressMonitor monitor)
throws RemoteConnectionException {
IRemoteConnectionWorkingCopy wc = connection.getWorkingCopy();
IRemoteConnectionHostService hostService = wc.getService(IRemoteConnectionHostService.class);
IUserAuthenticatorService authService = wc.getService(IUserAuthenticatorService.class);
try {
session = jSchService.createSession(hostService.getHostname(), hostService.getPort(), hostService.getUsername());
session = jSchService.createSession(hostService.getHostname(), hostService.getPort(),
hostService.getUsername());
session.setUserInfo(new JSchUserInfo(hostService, authService));
if (hostService.usePassword()) {
session.setConfig("PreferredAuthentications", "password,keyboard-interactive,gssapi-with-mic,publickey"); //$NON-NLS-1$ //$NON-NLS-2$
session.setConfig("PreferredAuthentications", //$NON-NLS-1$
"password,keyboard-interactive,gssapi-with-mic,publickey"); //$NON-NLS-1$
} else {
session.setConfig("PreferredAuthentications", "publickey,gssapi-with-mic,password,keyboard-interactive"); //$NON-NLS-1$ //$NON-NLS-2$
session.setConfig("PreferredAuthentications", //$NON-NLS-1$
"publickey,gssapi-with-mic,password,keyboard-interactive"); //$NON-NLS-1$
}
String password = hostService.getPassword();
if (!password.isEmpty()) {

View file

@ -14,7 +14,7 @@ import org.eclipse.remote.core.IRemoteConnectionType.Service;
public class ProxyConnectionProviderService implements IRemoteConnectionProviderService {
private IRemoteConnectionType connectionType;
public static class Factory implements IRemoteConnectionType.Service.Factory {
@SuppressWarnings("unchecked")
@Override
@ -25,7 +25,7 @@ public class ProxyConnectionProviderService implements IRemoteConnectionProvider
return null;
}
}
public ProxyConnectionProviderService(IRemoteConnectionType connectionType) {
this.connectionType = connectionType;
}

View file

@ -42,7 +42,7 @@ import org.eclipse.remote.proxy.protocol.core.exceptions.ProxyException;
public class ProxyFileStore extends FileStore {
/**
* Public factory method for obtaining ProxyFileStore instances.
*
*
* @param uri
* URI to get a fileStore for
* @return an ProxyFileStore instance for the URI.
@ -145,7 +145,8 @@ public class ProxyFileStore extends FileStore {
@Override
public IFileStore getChild(String name) {
URI uri = ProxyFileSystem.getURIFor(ProxyFileSystem.getConnectionNameFor(fURI), fRemotePath.append(name).toString());
URI uri = ProxyFileSystem.getURIFor(ProxyFileSystem.getConnectionNameFor(fURI),
fRemotePath.append(name).toString());
return getInstance(uri);
}
@ -156,7 +157,7 @@ public class ProxyFileStore extends FileStore {
/**
* Utility routing to get the file name from an absolute path.
*
*
* @param path
* path to extract file name from
* @return last segment of path, or the full path if it is root
@ -214,8 +215,8 @@ public class ProxyFileStore extends FileStore {
NLS.bind(Messages.ProxyFileStore_4, fRemotePath.toString()), null));
}
if (!info.isDirectory()) {
throw new CoreException(new Status(IStatus.ERROR, Activator.getUniqueIdentifier(), EFS.ERROR_WRONG_TYPE,
NLS.bind(Messages.ProxyFileStore_5, fRemotePath.toString()), null));
throw new CoreException(new Status(IStatus.ERROR, Activator.getUniqueIdentifier(),
EFS.ERROR_WRONG_TYPE, NLS.bind(Messages.ProxyFileStore_5, fRemotePath.toString()), null));
}
}
}

View file

@ -1,7 +1,7 @@
/********************************************************************************
* Copyright (c) 2016 Oak Ridge National Laboratory and others.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
********************************************************************************/
@ -18,7 +18,7 @@ import org.eclipse.core.runtime.IPath;
public class ProxyFileSystem extends FileSystem {
/**
* Return the connection name encoded in the URI.
*
*
* @param uri
* URI specifying a remote tools connection
* @return name of the connection or null if the URI is invalid
@ -30,7 +30,7 @@ public class ProxyFileSystem extends FileSystem {
/**
* Return an URI uniquely naming a remote tools remote resource.
*
*
* @param connectionName
* remote tools connection name
* @param path

View file

@ -23,7 +23,7 @@ import org.eclipse.remote.proxy.protocol.core.StreamChannel;
public class ProxyProcess implements IRemoteProcessControlService, IRemoteProcessTerminalService {
private IRemoteProcess remoteProcess;
private final StreamChannel stdIOChan;
private final StreamChannel stdErrChan;
private final StreamChannel controlChan;
@ -33,7 +33,7 @@ public class ProxyProcess implements IRemoteProcessControlService, IRemoteProces
private volatile int exitValue;
private volatile boolean isCompleted;
public static class Factory implements IRemoteProcess.Service.Factory {
@SuppressWarnings("unchecked")
@Override
@ -51,7 +51,7 @@ public class ProxyProcess implements IRemoteProcessControlService, IRemoteProces
protected ProxyProcess(IRemoteProcess process) {
remoteProcess = process;
ProxyProcessBuilder builder = (ProxyProcessBuilder)process.getProcessBuilder();
ProxyProcessBuilder builder = (ProxyProcessBuilder) process.getProcessBuilder();
List<StreamChannel> streams = builder.getStreams();
controlChan = streams.get(0);
stdIOChan = streams.get(1);
@ -60,7 +60,7 @@ public class ProxyProcess implements IRemoteProcessControlService, IRemoteProces
resultStream = new DataInputStream(controlChan.getInputStream());
isCompleted = false;
exitValue = 0;
cmdThread = new Thread("process result reader") { //$NON-NLS-1$
@Override
public void run() {
@ -91,7 +91,7 @@ public class ProxyProcess implements IRemoteProcessControlService, IRemoteProces
};
cmdThread.start();
}
@Override
public void destroy() {
try {
@ -113,7 +113,7 @@ public class ProxyProcess implements IRemoteProcessControlService, IRemoteProces
@Override
public InputStream getErrorStream() {
if (stdErrChan == null) {
return new InputStream() {
return new InputStream() {
@Override
public int read() throws IOException {
return -1;

View file

@ -32,7 +32,7 @@ public class ProxyProcessBuilder extends AbstractRemoteProcessBuilder {
private final ProxyConnection proxyConnection;
private Map<String, String> remoteEnv;
private List<StreamChannel> streams = new ArrayList<>();
public ProxyProcessBuilder(ProxyConnection connection, List<String> command) {
super(connection.getRemoteConnection(), command);
proxyConnection = connection;
@ -45,13 +45,13 @@ public class ProxyProcessBuilder extends AbstractRemoteProcessBuilder {
public ProxyProcessBuilder(ProxyConnection connection, String... command) {
this(connection, Arrays.asList(command));
}
/**
* Constructor for creating command shell
* @param connection
*/
public ProxyProcessBuilder(ProxyConnection connection) {
super(connection.getRemoteConnection(), (List<String>)null);
super(connection.getRemoteConnection(), (List<String>) null);
proxyConnection = connection;
redirectErrorStream(true);
}
@ -75,9 +75,9 @@ public class ProxyProcessBuilder extends AbstractRemoteProcessBuilder {
if (conn == null) {
throw new IOException(Messages.ProxyProcessBuilder_0);
}
Job job;
final List<String> cmdArgs = command();
if (cmdArgs != null) {
if (cmdArgs.size() < 1) {
@ -90,18 +90,19 @@ public class ProxyProcessBuilder extends AbstractRemoteProcessBuilder {
if (remoteEnv != null) {
env.putAll(remoteEnv);
}
final boolean append = (flags & IRemoteProcessBuilder.APPEND_ENVIRONMENT) != 0 || remoteEnv == null;
streams.add(conn.openChannel());
streams.add(conn.openChannel());
streams.add(conn.openChannel());
job = new Job("process executor") { //$NON-NLS-1$
@Override
protected IStatus run(IProgressMonitor monitor) {
ExecCommand cmd = new ExecCommand(conn, cmdArgs, env, directory().toURI().getPath(), redirectErrorStream(), append,
streams.get(0).getId(), streams.get(1).getId(), streams.get(2).getId());
ExecCommand cmd = new ExecCommand(conn, cmdArgs, env, directory().toURI().getPath(),
redirectErrorStream(), append, streams.get(0).getId(), streams.get(1).getId(),
streams.get(2).getId());
try {
cmd.getResult(monitor);
} catch (ProxyException e) {
@ -116,7 +117,7 @@ public class ProxyProcessBuilder extends AbstractRemoteProcessBuilder {
*/
streams.add(conn.openChannel());
streams.add(conn.openChannel());
job = new Job("process executor") { //$NON-NLS-1$
@Override
protected IStatus run(IProgressMonitor monitor) {
@ -130,7 +131,7 @@ public class ProxyProcessBuilder extends AbstractRemoteProcessBuilder {
}
};
}
job.schedule();
try {
job.join();

View file

@ -81,4 +81,3 @@ public abstract class AbstractCommand<T> implements Callable<T> {
this.connection = conn;
}
}

View file

@ -34,19 +34,19 @@ public class ChildInfosCommand extends AbstractCommand<IFileInfo[]> {
public IFileInfo[] call() throws ProxyException {
try {
final StreamChannel chan = openChannel();
out.writeByte(Protocol.PROTO_COMMAND);
out.writeShort(Protocol.CMD_CHILDINFOS);
out.writeByte(chan.getId());
out.writeUTF(path);
out.flush();
byte res = in.readByte();
if (res != Protocol.PROTO_OK) {
String errMsg = in.readUTF();
throw new ProxyException(errMsg);
}
DataInputStream resultStream = new DataInputStream(chan.getInputStream());
int length = resultStream.readInt();
SerializableFileInfo sInfo = new SerializableFileInfo();

View file

@ -37,7 +37,7 @@ public class DeleteCommand extends AbstractCommand<Void> {
out.writeInt(options);
out.writeUTF(path);
out.flush();
byte res = in.readByte();
if (res != Protocol.PROTO_OK) {
String errMsg = in.readUTF();

View file

@ -30,8 +30,8 @@ public class ExecCommand extends AbstractCommand<Void> {
private final int ioChan;
private final int errChan;
public ExecCommand(ProxyConnection conn, List<String> command, Map<String, String> env, String directory, boolean redirect, boolean appendEnv,
int cmdChan, int ioChan, int errChan) {
public ExecCommand(ProxyConnection conn, List<String> command, Map<String, String> env, String directory,
boolean redirect, boolean appendEnv, int cmdChan, int ioChan, int errChan) {
super(conn);
this.out = new DataOutputStream(conn.getCommandChannel().getOutputStream());
this.in = new DataInputStream(conn.getCommandChannel().getInputStream());
@ -65,7 +65,7 @@ public class ExecCommand extends AbstractCommand<Void> {
out.writeBoolean(redirect);
out.writeBoolean(appendEnv);
out.flush();
byte res = in.readByte();
if (res != Protocol.PROTO_OK) {
String errMsg = in.readUTF();

View file

@ -34,19 +34,19 @@ public class FetchInfoCommand extends AbstractCommand<IFileInfo> {
public IFileInfo call() throws ProxyException {
try {
final StreamChannel chan = openChannel();
out.writeByte(Protocol.PROTO_COMMAND);
out.writeShort(Protocol.CMD_FETCHINFO);
out.writeByte(chan.getId());
out.writeUTF(path);
out.flush();
byte res = in.readByte();
if (res != Protocol.PROTO_OK) {
String errMsg = in.readUTF();
throw new ProxyException(errMsg);
}
DataInputStream resultStream = new DataInputStream(chan.getInputStream());
SerializableFileInfo info = new SerializableFileInfo();
info.readObject(resultStream);

View file

@ -31,18 +31,18 @@ public class GetCwdCommand extends AbstractCommand<String> {
try {
final StreamChannel chan = openChannel();
DataInputStream resultStream = new DataInputStream(chan.getInputStream());
out.writeByte(Protocol.PROTO_COMMAND);
out.writeShort(Protocol.CMD_GETCWD);
out.writeByte(chan.getId());
out.flush();
byte res = in.readByte();
if (res != Protocol.PROTO_OK) {
String errMsg = in.readUTF();
throw new ProxyException(errMsg);
}
String cwd = resultStream.readUTF();
chan.close();
return cwd;

View file

@ -33,18 +33,18 @@ public class GetEnvCommand extends AbstractCommand<Map<String, String>> {
try {
final StreamChannel chan = openChannel();
DataInputStream resultStream = new DataInputStream(chan.getInputStream());
out.writeByte(Protocol.PROTO_COMMAND);
out.writeShort(Protocol.CMD_GETENV);
out.writeByte(chan.getId());
out.flush();
byte res = in.readByte();
if (res != Protocol.PROTO_OK) {
String errMsg = in.readUTF();
throw new ProxyException(errMsg);
}
int len = resultStream.readInt();
Map<String, String> env = new HashMap<String, String>(len);
for (int i = 0; i < len; i++) {

View file

@ -36,20 +36,20 @@ public class GetInputStreamCommand extends AbstractCommand<InputStream> {
public InputStream call() throws ProxyException {
try {
StreamChannel chan = openChannel();
out.writeByte(Protocol.PROTO_COMMAND);
out.writeShort(Protocol.CMD_GETINPUTSTREAM);
out.writeByte(chan.getId());
out.writeInt(options);
out.writeUTF(path);
out.flush();
byte res = in.readByte();
if (res != Protocol.PROTO_OK) {
String errMsg = in.readUTF();
throw new ProxyException(errMsg);
}
return new BufferedInputStream(chan.getInputStream());
} catch (IOException e) {
throw new ProxyException(e.getMessage());

View file

@ -43,13 +43,13 @@ public class GetOutputStreamCommand extends AbstractCommand<OutputStream> {
out.writeInt(options);
out.writeUTF(path);
out.flush();
byte res = in.readByte();
if (res != Protocol.PROTO_OK) {
String errMsg = in.readUTF();
throw new ProxyException(errMsg);
}
return new BufferedOutputStream(chan.getOutputStream());
} catch (IOException e) {
throw new ProxyException(e.getMessage());

View file

@ -33,18 +33,18 @@ public class GetPropertiesCommand extends AbstractCommand<Map<String, String>> {
try {
final StreamChannel chan = openChannel();
DataInputStream resultStream = new DataInputStream(chan.getInputStream());
out.writeByte(Protocol.PROTO_COMMAND);
out.writeShort(Protocol.CMD_GETPROPERTIES);
out.writeByte(chan.getId());
out.flush();
byte res = in.readByte();
if (res != Protocol.PROTO_OK) {
String errMsg = in.readUTF();
throw new ProxyException(errMsg);
}
int len = resultStream.readInt();
Map<String, String> props = new HashMap<String, String>(len);
for (int i = 0; i < len; i++) {

View file

@ -37,7 +37,7 @@ public class MkdirCommand extends AbstractCommand<Void> {
out.writeInt(options);
out.writeUTF(path);
out.flush();
byte res = in.readByte();
if (res != Protocol.PROTO_OK) {
String errMsg = in.readUTF();

Some files were not shown because too many files have changed in this diff Show more