mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-04 14:55:41 +02: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:
parent
8980b1f104
commit
3e9dadd642
178 changed files with 2219 additions and 2134 deletions
|
@ -19,7 +19,7 @@ import org.eclipse.ui.console.IConsole;
|
||||||
/**
|
/**
|
||||||
* A collection of public API utility methods to open consoles to
|
* A collection of public API utility methods to open consoles to
|
||||||
* IRemoteConnection objects
|
* IRemoteConnection objects
|
||||||
*
|
*
|
||||||
* @since 1.1
|
* @since 1.1
|
||||||
*/
|
*/
|
||||||
public class TerminalConsoleUtility {
|
public class TerminalConsoleUtility {
|
||||||
|
@ -33,7 +33,7 @@ public class TerminalConsoleUtility {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Open a specific IRemoteConnection and encoding combination.
|
* Open a specific IRemoteConnection and encoding combination.
|
||||||
*
|
*
|
||||||
* @param connection
|
* @param connection
|
||||||
* @param encoding
|
* @param encoding
|
||||||
*/
|
*/
|
||||||
|
@ -43,7 +43,7 @@ public class TerminalConsoleUtility {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find an existing console for the given IRemoteConnection
|
* Find an existing console for the given IRemoteConnection
|
||||||
*
|
*
|
||||||
* @param connection
|
* @param connection
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -23,7 +23,7 @@ public abstract class ConsoleAction extends Action {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param id
|
* @param id
|
||||||
* The action id
|
* The action id
|
||||||
*/
|
*/
|
||||||
public ConsoleAction(String id) {
|
public ConsoleAction(String id) {
|
||||||
this(id, 0);
|
this(id, 0);
|
||||||
|
@ -31,9 +31,9 @@ public abstract class ConsoleAction extends Action {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param id
|
* @param id
|
||||||
* The action id
|
* The action id
|
||||||
* @param style
|
* @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
|
* and AS_UNSPECIFIED
|
||||||
*/
|
*/
|
||||||
public ConsoleAction(String id, int style) {
|
public ConsoleAction(String id, int style) {
|
||||||
|
@ -55,8 +55,7 @@ public abstract class ConsoleAction extends Action {
|
||||||
* @param enabled
|
* @param enabled
|
||||||
* the enabled state for this action
|
* the enabled state for this action
|
||||||
*/
|
*/
|
||||||
protected void setupAction(String text, String tooltip,
|
protected void setupAction(String text, String tooltip, String image, String enabledImage, String disabledImage,
|
||||||
String image, String enabledImage, String disabledImage,
|
|
||||||
boolean enabled) {
|
boolean enabled) {
|
||||||
ImageRegistry imageRegistry = Activator.getDefault().getImageRegistry();
|
ImageRegistry imageRegistry = Activator.getDefault().getImageRegistry();
|
||||||
setupAction(text, tooltip, image, enabledImage, disabledImage, enabled, imageRegistry);
|
setupAction(text, tooltip, image, enabledImage, disabledImage, enabled, imageRegistry);
|
||||||
|
@ -78,15 +77,10 @@ public abstract class ConsoleAction extends Action {
|
||||||
* @param imageRegistry
|
* @param imageRegistry
|
||||||
* the ImageRegistry to retrieve ImageDescriptor for the keys provided
|
* the ImageRegistry to retrieve ImageDescriptor for the keys provided
|
||||||
*/
|
*/
|
||||||
protected void setupAction(String text, String tooltip,
|
protected void setupAction(String text, String tooltip, String hoverImage, String enabledImage,
|
||||||
String hoverImage, String enabledImage, String disabledImage,
|
String disabledImage, boolean enabled, ImageRegistry imageRegistry) {
|
||||||
boolean enabled, ImageRegistry imageRegistry) {
|
setupAction(text, tooltip, imageRegistry.getDescriptor(hoverImage), imageRegistry.getDescriptor(enabledImage),
|
||||||
setupAction(text,
|
imageRegistry.getDescriptor(disabledImage), enabled);
|
||||||
tooltip,
|
|
||||||
imageRegistry.getDescriptor(hoverImage),
|
|
||||||
imageRegistry.getDescriptor(enabledImage),
|
|
||||||
imageRegistry.getDescriptor(disabledImage),
|
|
||||||
enabled);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -103,9 +97,8 @@ public abstract class ConsoleAction extends Action {
|
||||||
* @param enabled
|
* @param enabled
|
||||||
* the enabled state for this action
|
* the enabled state for this action
|
||||||
*/
|
*/
|
||||||
protected void setupAction(String text, String tooltip,
|
protected void setupAction(String text, String tooltip, ImageDescriptor hoverImage, ImageDescriptor enabledImage,
|
||||||
ImageDescriptor hoverImage, ImageDescriptor enabledImage, ImageDescriptor disabledImage,
|
ImageDescriptor disabledImage, boolean enabled) {
|
||||||
boolean enabled) {
|
|
||||||
setText(text);
|
setText(text);
|
||||||
setToolTipText(tooltip);
|
setToolTipText(tooltip);
|
||||||
setEnabled(enabled);
|
setEnabled(enabled);
|
||||||
|
|
|
@ -16,15 +16,15 @@ import org.eclipse.core.runtime.IAdaptable;
|
||||||
* @since 1.1
|
* @since 1.1
|
||||||
*/
|
*/
|
||||||
public interface IConsoleActionFactory {
|
public interface IConsoleActionFactory {
|
||||||
/**
|
/**
|
||||||
* Returns an implementation of ConsoleAction
|
* Returns an implementation of ConsoleAction
|
||||||
*
|
*
|
||||||
* @param actionId
|
* @param actionId
|
||||||
* The id of the action being requested
|
* The id of the action being requested
|
||||||
* @param connectionType
|
* @param connectionType
|
||||||
* The connection type of the terminal console
|
* The connection type of the terminal console
|
||||||
* @param adapter
|
* @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
|
* @return an implementation of ConsoleAction
|
||||||
*/
|
*/
|
||||||
public ConsoleAction createAction(String actionId, String connectionType, IAdaptable adapter);
|
public ConsoleAction createAction(String actionId, String connectionType, IAdaptable adapter);
|
||||||
|
|
|
@ -23,7 +23,7 @@ public class Activator extends AbstractUIPlugin {
|
||||||
|
|
||||||
// The shared instance
|
// The shared instance
|
||||||
private static Activator plugin;
|
private static Activator plugin;
|
||||||
|
|
||||||
public void start(BundleContext context) throws Exception {
|
public void start(BundleContext context) throws Exception {
|
||||||
super.start(context);
|
super.start(context);
|
||||||
plugin = this;
|
plugin = this;
|
||||||
|
@ -102,10 +102,10 @@ public class Activator extends AbstractUIPlugin {
|
||||||
imageRegistry.put(entry.getKey(), imageDescriptor);
|
imageRegistry.put(entry.getKey(), imageDescriptor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create log entry from an IStatus
|
* Create log entry from an IStatus
|
||||||
*
|
*
|
||||||
* @param status
|
* @param status
|
||||||
* status to log
|
* status to log
|
||||||
*/
|
*/
|
||||||
|
@ -115,7 +115,7 @@ public class Activator extends AbstractUIPlugin {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create log entry from a string
|
* Create log entry from a string
|
||||||
*
|
*
|
||||||
* @param msg
|
* @param msg
|
||||||
* message to log
|
* message to log
|
||||||
*/
|
*/
|
||||||
|
@ -125,7 +125,7 @@ public class Activator extends AbstractUIPlugin {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create log entry from a Throwable
|
* Create log entry from a Throwable
|
||||||
*
|
*
|
||||||
* @param e
|
* @param e
|
||||||
* throwable to log
|
* throwable to log
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -19,34 +19,33 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.remote.internal.console;
|
package org.eclipse.remote.internal.console;
|
||||||
|
|
||||||
public interface ImageConsts
|
public interface ImageConsts {
|
||||||
{
|
public final static String IMAGE_DIR_ROOT = "icons/"; //$NON-NLS-1$
|
||||||
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_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_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_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_VIEW = "cview16/"; // views //$NON-NLS-1$
|
public final static String IMAGE_DIR_EVIEW = "eview16/"; // 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_NEW_TERMINAL = "TerminalViewNewTerminal"; //$NON-NLS-1$
|
||||||
public static final String IMAGE_TERMINAL_VIEW = "TerminalView"; //$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_CONNECT = "ImageClclConnect"; //$NON-NLS-1$
|
||||||
public static final String IMAGE_CLCL_DISCONNECT = "ImageClclDisconnect"; //$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_SETTINGS = "ImageClclSettings"; //$NON-NLS-1$
|
||||||
public static final String IMAGE_CLCL_SCROLL_LOCK = "ImageClclScrollLock"; //$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_CONNECT = "ImageDlclConnect"; //$NON-NLS-1$
|
||||||
public static final String IMAGE_DLCL_DISCONNECT = "ImageDlclDisconnect"; //$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_SETTINGS = "ImageDlclSettings"; //$NON-NLS-1$
|
||||||
public static final String IMAGE_DLCL_SCROLL_LOCK = "ImageDlclScrollLock"; //$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_REMOVE = "ImageDlclRemove"; //$NON-NLS-1$
|
||||||
|
|
||||||
public static final String IMAGE_ELCL_CONNECT = "ImageElclConnect"; //$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_DISCONNECT = "ImageElclDisconnect"; //$NON-NLS-1$
|
||||||
public static final String IMAGE_ELCL_SETTINGS = "ImageElclSettings"; //$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_SCROLL_LOCK = "ImageElclScrollLock"; //$NON-NLS-1$
|
||||||
public static final String IMAGE_ELCL_REMOVE = "ImageElclRemove"; //$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_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_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_DLCL_COMMAND_INPUT_FIELD = "ImageDlclCommandInputField";//$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,8 @@ public class TerminalConsole extends AbstractConsole implements ITerminalConsole
|
||||||
private final int index;
|
private final int index;
|
||||||
|
|
||||||
public TerminalConsole(IRemoteConnection connection, int index, String encoding) {
|
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.encoding = encoding;
|
||||||
this.terminalConnector = new TerminalConsoleConnector(connection);
|
this.terminalConnector = new TerminalConsoleConnector(connection);
|
||||||
this.index = index;
|
this.index = index;
|
||||||
|
@ -45,7 +46,7 @@ public class TerminalConsole extends AbstractConsole implements ITerminalConsole
|
||||||
public int getIndex() {
|
public int getIndex() {
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void setState(TerminalState terminalState) {
|
public synchronized void setState(TerminalState terminalState) {
|
||||||
StringBuffer nameBuff = new StringBuffer(getConnection().getName());
|
StringBuffer nameBuff = new StringBuffer(getConnection().getName());
|
||||||
if (index > 0) {
|
if (index > 0) {
|
||||||
|
|
|
@ -140,14 +140,16 @@ public class TerminalConsoleConnector {
|
||||||
return new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getLocalizedMessage(), e);
|
return new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getLocalizedMessage(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (remoteProcess == null) {
|
if (remoteProcess == null) {
|
||||||
disconnect();
|
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) {
|
if (width > 0 || height > 0) {
|
||||||
IRemoteProcessTerminalService termService = remoteProcess.getService(IRemoteProcessTerminalService.class);
|
IRemoteProcessTerminalService termService = remoteProcess
|
||||||
|
.getService(IRemoteProcessTerminalService.class);
|
||||||
if (termService != null) {
|
if (termService != null) {
|
||||||
termService.setTerminalSize(width, height, 8 * width, 8 * height);
|
termService.setTerminalSize(width, height, 8 * width, 8 * height);
|
||||||
}
|
}
|
||||||
|
@ -202,7 +204,8 @@ public class TerminalConsoleConnector {
|
||||||
height = minHeight;
|
height = minHeight;
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
if (remoteProcess != null) {
|
if (remoteProcess != null) {
|
||||||
IRemoteProcessTerminalService termService = remoteProcess.getService(IRemoteProcessTerminalService.class);
|
IRemoteProcessTerminalService termService = remoteProcess
|
||||||
|
.getService(IRemoteProcessTerminalService.class);
|
||||||
if (termService != null) {
|
if (termService != null) {
|
||||||
termService.setTerminalSize(width, height, 8 * width, 8 * height);
|
termService.setTerminalSize(width, height, 8 * width, 8 * height);
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ public class TerminalConsoleExtensionManager {
|
||||||
List<String> list = actions.get(id);
|
List<String> list = actions.get(id);
|
||||||
return list == null ? new ArrayList<String>() : list;
|
return list == null ? new ArrayList<String>() : list;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IConsoleActionFactory getFactory(String id) {
|
public IConsoleActionFactory getFactory(String id) {
|
||||||
return factories.get(id);
|
return factories.get(id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,9 +99,9 @@ public class TerminalConsolePage extends Page implements IAdaptable {
|
||||||
toolBarManager.appendToGroup(TOOLBAR_GROUP_ID, disconnectAction);
|
toolBarManager.appendToGroup(TOOLBAR_GROUP_ID, disconnectAction);
|
||||||
toolBarManager.appendToGroup(TOOLBAR_GROUP_ID, new ConsoleActionScrollLock(this));
|
toolBarManager.appendToGroup(TOOLBAR_GROUP_ID, new ConsoleActionScrollLock(this));
|
||||||
toolBarManager.appendToGroup(TOOLBAR_GROUP_ID, new CloseConsoleAction(terminalConsole));
|
toolBarManager.appendToGroup(TOOLBAR_GROUP_ID, new CloseConsoleAction(terminalConsole));
|
||||||
|
|
||||||
toolBarManager.insertAfter(TOOLBAR_GROUP_ID, new GroupMarker(CONTRIBUTIONS_GROUP_ID));
|
toolBarManager.insertAfter(TOOLBAR_GROUP_ID, new GroupMarker(CONTRIBUTIONS_GROUP_ID));
|
||||||
|
|
||||||
addToolbarContributions(toolBarManager);
|
addToolbarContributions(toolBarManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,9 +125,7 @@ public class TerminalConsolePage extends Page implements IAdaptable {
|
||||||
mainComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
|
mainComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||||
mainComposite.setLayout(new FillLayout());
|
mainComposite.setLayout(new FillLayout());
|
||||||
|
|
||||||
tViewCtrl = TerminalViewControlFactory.makeControl(listener,
|
tViewCtrl = TerminalViewControlFactory.makeControl(listener, mainComposite, new ITerminalConnector[] {});
|
||||||
mainComposite,
|
|
||||||
new ITerminalConnector[] {});
|
|
||||||
tViewCtrl.setConnector(terminalConsole.getTerminalConnector().newPageConnector());
|
tViewCtrl.setConnector(terminalConsole.getTerminalConnector().newPageConnector());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -137,9 +135,7 @@ public class TerminalConsolePage extends Page implements IAdaptable {
|
||||||
NLS.bind(ConsoleMessages.ENCODING_UNAVAILABLE_1, encoding));
|
NLS.bind(ConsoleMessages.ENCODING_UNAVAILABLE_1, encoding));
|
||||||
Activator.log(status);
|
Activator.log(status);
|
||||||
ErrorDialog.openError(PlatformUI.getWorkbench().getDisplay().getActiveShell(),
|
ErrorDialog.openError(PlatformUI.getWorkbench().getDisplay().getActiveShell(),
|
||||||
ConsoleMessages.OPEN_CONSOLE_ERROR,
|
ConsoleMessages.OPEN_CONSOLE_ERROR, ConsoleMessages.ENCODING_UNAVAILABLE_0, status);
|
||||||
ConsoleMessages.ENCODING_UNAVAILABLE_0,
|
|
||||||
status);
|
|
||||||
}
|
}
|
||||||
connectTerminalJob.schedule();
|
connectTerminalJob.schedule();
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class TerminalConsoleSettingsDialog extends Dialog {
|
||||||
private static final String CONNECTION_TYPE = "connectionType"; //$NON-NLS-1$
|
private static final String CONNECTION_TYPE = "connectionType"; //$NON-NLS-1$
|
||||||
private static final String CONNECTION_NAME = "connectionName"; //$NON-NLS-1$
|
private static final String CONNECTION_NAME = "connectionName"; //$NON-NLS-1$
|
||||||
private static final String ENCODING = "encoding"; //$NON-NLS-1$
|
private static final String ENCODING = "encoding"; //$NON-NLS-1$
|
||||||
|
|
||||||
private RemoteConnectionWidget remoteConnWidget;
|
private RemoteConnectionWidget remoteConnWidget;
|
||||||
private Combo encodingCombo;
|
private Combo encodingCombo;
|
||||||
private String selectedEncoding;
|
private String selectedEncoding;
|
||||||
|
@ -60,11 +60,12 @@ public class TerminalConsoleSettingsDialog extends Dialog {
|
||||||
|
|
||||||
IRemoteServicesManager manager = Activator.getService(IRemoteServicesManager.class);
|
IRemoteServicesManager manager = Activator.getService(IRemoteServicesManager.class);
|
||||||
// TODO remove the remote process service once we get command shell available with ssh and local
|
// TODO remove the remote process service once we get command shell available with ssh and local
|
||||||
@SuppressWarnings("unchecked") List<IRemoteConnectionType> connTypes = manager.getConnectionTypesSupporting(
|
@SuppressWarnings("unchecked")
|
||||||
IRemoteCommandShellService.class, IRemoteProcessService.class);
|
List<IRemoteConnectionType> connTypes = manager.getConnectionTypesSupporting(IRemoteCommandShellService.class,
|
||||||
|
IRemoteProcessService.class);
|
||||||
|
|
||||||
remoteConnWidget = new RemoteConnectionWidget(composite, SWT.NONE, null, 0, connTypes);
|
remoteConnWidget = new RemoteConnectionWidget(composite, SWT.NONE, null, 0, connTypes);
|
||||||
|
|
||||||
IDialogSettings settings = getDialogSettings();
|
IDialogSettings settings = getDialogSettings();
|
||||||
String initialId = settings.get(CONNECTION_TYPE);
|
String initialId = settings.get(CONNECTION_TYPE);
|
||||||
String initialName = settings.get(CONNECTION_NAME);
|
String initialName = settings.get(CONNECTION_NAME);
|
||||||
|
@ -100,7 +101,7 @@ public class TerminalConsoleSettingsDialog extends Dialog {
|
||||||
return composite;
|
return composite;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<String> getEncodings(){
|
private List<String> getEncodings() {
|
||||||
List<String> encodings = new ArrayList<>(2);
|
List<String> encodings = new ArrayList<>(2);
|
||||||
encodings.add("ISO-8859-1"); //$NON-NLS-1$
|
encodings.add("ISO-8859-1"); //$NON-NLS-1$
|
||||||
encodings.add("UTF-8"); //$NON-NLS-1$
|
encodings.add("UTF-8"); //$NON-NLS-1$
|
||||||
|
@ -159,18 +160,20 @@ public class TerminalConsoleSettingsDialog extends Dialog {
|
||||||
validateDialog();
|
validateDialog();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private IDialogSettings getDialogSettings() {
|
private IDialogSettings getDialogSettings() {
|
||||||
IDialogSettings result = Activator.getDefault().getDialogSettings().getSection(TerminalConsoleSettingsDialog.class.getName());
|
IDialogSettings result = Activator.getDefault().getDialogSettings()
|
||||||
|
.getSection(TerminalConsoleSettingsDialog.class.getName());
|
||||||
|
|
||||||
if (result == null) {
|
if (result == null) {
|
||||||
result = Activator.getDefault().getDialogSettings().addNewSection(TerminalConsoleSettingsDialog.class.getName());
|
result = Activator.getDefault().getDialogSettings()
|
||||||
|
.addNewSection(TerminalConsoleSettingsDialog.class.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int open() {
|
public int open() {
|
||||||
int rc = super.open();
|
int rc = super.open();
|
||||||
|
@ -184,5 +187,5 @@ public class TerminalConsoleSettingsDialog extends Dialog {
|
||||||
}
|
}
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,12 +22,8 @@ public class ConsoleActionConnect extends ConsoleAction {
|
||||||
|
|
||||||
this.console = console;
|
this.console = console;
|
||||||
|
|
||||||
setupAction(ActionMessages.CONNECT,
|
setupAction(ActionMessages.CONNECT, ActionMessages.CONNECT, ImageConsts.IMAGE_CLCL_CONNECT,
|
||||||
ActionMessages.CONNECT,
|
ImageConsts.IMAGE_ELCL_CONNECT, ImageConsts.IMAGE_DLCL_CONNECT, true);
|
||||||
ImageConsts.IMAGE_CLCL_CONNECT,
|
|
||||||
ImageConsts.IMAGE_ELCL_CONNECT,
|
|
||||||
ImageConsts.IMAGE_DLCL_CONNECT,
|
|
||||||
true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -16,19 +16,14 @@ import org.eclipse.remote.internal.console.TerminalConsole;
|
||||||
|
|
||||||
public class ConsoleActionDisconnect extends ConsoleAction {
|
public class ConsoleActionDisconnect extends ConsoleAction {
|
||||||
private final TerminalConsole console;
|
private final TerminalConsole console;
|
||||||
|
|
||||||
public ConsoleActionDisconnect(TerminalConsole console)
|
public ConsoleActionDisconnect(TerminalConsole console) {
|
||||||
{
|
|
||||||
super(ConsoleActionDisconnect.class.getName());
|
super(ConsoleActionDisconnect.class.getName());
|
||||||
|
|
||||||
this.console = console;
|
this.console = console;
|
||||||
|
|
||||||
setupAction(ActionMessages.DISCONNECT,
|
setupAction(ActionMessages.DISCONNECT, ActionMessages.DISCONNECT, ImageConsts.IMAGE_CLCL_DISCONNECT,
|
||||||
ActionMessages.DISCONNECT,
|
ImageConsts.IMAGE_ELCL_DISCONNECT, ImageConsts.IMAGE_DLCL_DISCONNECT, false);
|
||||||
ImageConsts.IMAGE_CLCL_DISCONNECT,
|
|
||||||
ImageConsts.IMAGE_ELCL_DISCONNECT,
|
|
||||||
ImageConsts.IMAGE_DLCL_DISCONNECT,
|
|
||||||
false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -18,18 +18,13 @@ import org.eclipse.remote.internal.console.TerminalConsolePage;
|
||||||
public class ConsoleActionScrollLock extends ConsoleAction {
|
public class ConsoleActionScrollLock extends ConsoleAction {
|
||||||
private final TerminalConsolePage page;
|
private final TerminalConsolePage page;
|
||||||
|
|
||||||
public ConsoleActionScrollLock(TerminalConsolePage page)
|
public ConsoleActionScrollLock(TerminalConsolePage page) {
|
||||||
{
|
|
||||||
super(ConsoleActionScrollLock.class.getName(), IAction.AS_RADIO_BUTTON);
|
super(ConsoleActionScrollLock.class.getName(), IAction.AS_RADIO_BUTTON);
|
||||||
|
|
||||||
this.page = page;
|
this.page = page;
|
||||||
|
|
||||||
setupAction(ActionMessages.SCROLL_LOCK,
|
setupAction(ActionMessages.SCROLL_LOCK, ActionMessages.SCROLL_LOCK, ImageConsts.IMAGE_CLCL_SCROLL_LOCK,
|
||||||
ActionMessages.SCROLL_LOCK,
|
ImageConsts.IMAGE_ELCL_SCROLL_LOCK, ImageConsts.IMAGE_DLCL_SCROLL_LOCK, true);
|
||||||
ImageConsts.IMAGE_CLCL_SCROLL_LOCK,
|
|
||||||
ImageConsts.IMAGE_ELCL_SCROLL_LOCK,
|
|
||||||
ImageConsts.IMAGE_DLCL_SCROLL_LOCK,
|
|
||||||
true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -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
|
* Abstract base class for remote process builders. Implementors can use this class to provide a default implementation of a remote
|
||||||
* process builder.
|
* process builder.
|
||||||
*
|
*
|
||||||
* @since 5.0
|
* @since 5.0
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractRemoteProcessBuilder implements IRemoteProcessBuilder {
|
public abstract class AbstractRemoteProcessBuilder implements IRemoteProcessBuilder {
|
||||||
|
@ -122,7 +122,7 @@ public abstract class AbstractRemoteProcessBuilder implements IRemoteProcessBuil
|
||||||
public IRemoteConnection getRemoteConnection() {
|
public IRemoteConnection getRemoteConnection() {
|
||||||
return fConnection;
|
return fConnection;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @since 4.0
|
* @since 4.0
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -15,7 +15,7 @@ import java.io.IOException;
|
||||||
/**
|
/**
|
||||||
* A service that provides a command shell on a remote. This is mainly used by
|
* A service that provides a command shell on a remote. This is mainly used by
|
||||||
* Terminal views.
|
* Terminal views.
|
||||||
*
|
*
|
||||||
* @since 2.0
|
* @since 2.0
|
||||||
*/
|
*/
|
||||||
public interface IRemoteCommandShellService extends IRemoteConnection.Service {
|
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
|
* 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
|
* of remote service providers. Clients can use {@link IRemoteProcessBuilder#getSupportedFlags()} to find out the flags
|
||||||
* supported by the service provider.
|
* supported by the service provider.
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
* Current flags are:
|
* Current flags are:
|
||||||
* {@link IRemoteProcessBuilder#NONE} - disable any flags
|
* {@link IRemoteProcessBuilder#NONE} - disable any flags
|
||||||
* {@link IRemoteProcessBuilder#ALLOCATE_PTY} - allocate a pseudo-terminal for the process (RFC-4254 Sec. 6.2)
|
* {@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)
|
* {@link IRemoteProcessBuilder#FORWARD_X11} - enable X11 forwarding (RFC-4254 Sec. 6.3)
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @param flags
|
* @param flags
|
||||||
* bitwise-or of flags
|
* bitwise-or of flags
|
||||||
* @return remote process object
|
* @return remote process object
|
||||||
|
|
|
@ -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
|
* 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
|
* describe the connection and are discovered. Connections also have attributes which are
|
||||||
* client specified values that control the connection.
|
* client specified values that control the connection.
|
||||||
*
|
*
|
||||||
* @noimplement This interface is not intended to be implemented by clients.
|
* @noimplement This interface is not intended to be implemented by clients.
|
||||||
*/
|
*/
|
||||||
public interface IRemoteConnection {
|
public interface IRemoteConnection {
|
||||||
/**
|
/**
|
||||||
* The interface that is extend by services provided for this remote connection.
|
* The interface that is extend by services provided for this remote connection.
|
||||||
*
|
*
|
||||||
* @since 2.0
|
* @since 2.0
|
||||||
*/
|
*/
|
||||||
interface Service {
|
interface Service {
|
||||||
|
@ -52,7 +52,7 @@ public interface IRemoteConnection {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the connection type of this connection
|
* Get the connection type of this connection
|
||||||
*
|
*
|
||||||
* @return connection type
|
* @return connection type
|
||||||
* @since 2.0
|
* @since 2.0
|
||||||
*/
|
*/
|
||||||
|
@ -60,14 +60,14 @@ public interface IRemoteConnection {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get unique name for this connection.
|
* Get unique name for this connection.
|
||||||
*
|
*
|
||||||
* @return connection name
|
* @return connection name
|
||||||
*/
|
*/
|
||||||
public String getName();
|
public String getName();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the service for this remote connection that implements the given interface.
|
* Get the service for this remote connection that implements the given interface.
|
||||||
*
|
*
|
||||||
* @param service
|
* @param service
|
||||||
* the interface the required service must implements
|
* the interface the required service must implements
|
||||||
* @return the desired service or null if there is no such service available
|
* @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.
|
* Does this connection support the given service.
|
||||||
*
|
*
|
||||||
* @param service
|
* @param service
|
||||||
* The service to be tested
|
* The service to be tested
|
||||||
* @return true if this connection supports the service
|
* @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.
|
* Open the connection. Must be called before the connection can be used.
|
||||||
*
|
*
|
||||||
* @param monitor
|
* @param monitor
|
||||||
* the progress monitor to use for reporting progress to the user. It is the caller's responsibility to call done()
|
* 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
|
* 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.
|
* Test if the connection is open.
|
||||||
*
|
*
|
||||||
* @return true if connection is open.
|
* @return true if connection is open.
|
||||||
*/
|
*/
|
||||||
public boolean isOpen();
|
public boolean isOpen();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the remote system property indicated by the specified key. The connection must be open prior to calling this method.
|
* Gets the remote system property indicated by the specified key. The connection must be open prior to calling this method.
|
||||||
*
|
*
|
||||||
* @param key
|
* @param key
|
||||||
* the name of the property
|
* the name of the property
|
||||||
* @return the string value of the property, or null if no property has that key
|
* @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.
|
* Get an attribute for a connection.
|
||||||
*
|
*
|
||||||
* NOTE: the attributes do not include any security related information (e.g. passwords, keys, etc.)
|
* NOTE: the attributes do not include any security related information (e.g. passwords, keys, etc.)
|
||||||
*
|
*
|
||||||
* @param key
|
* @param key
|
||||||
* @return the attribute value, or empty string if not defined.
|
* @return the attribute value, or empty string if not defined.
|
||||||
* @since 2.0
|
* @since 2.0
|
||||||
|
@ -131,7 +131,7 @@ public interface IRemoteConnection {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get an attribute that is stored in secure storage, such as passwords.
|
* Get an attribute that is stored in secure storage, such as passwords.
|
||||||
*
|
*
|
||||||
* @param key
|
* @param key
|
||||||
* @return the attribute value, or empty string if not defined.
|
* @return the attribute value, or empty string if not defined.
|
||||||
* @since 2.0
|
* @since 2.0
|
||||||
|
@ -140,21 +140,21 @@ public interface IRemoteConnection {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a working copy to allow setting and changing of attributes.
|
* Return a working copy to allow setting and changing of attributes.
|
||||||
*
|
*
|
||||||
* @return working copy of remote
|
* @return working copy of remote
|
||||||
*/
|
*/
|
||||||
public IRemoteConnectionWorkingCopy getWorkingCopy();
|
public IRemoteConnectionWorkingCopy getWorkingCopy();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register a listener that will be notified when this connection's status changes.
|
* Register a listener that will be notified when this connection's status changes.
|
||||||
*
|
*
|
||||||
* @param listener
|
* @param listener
|
||||||
*/
|
*/
|
||||||
public void addConnectionChangeListener(IRemoteConnectionChangeListener listener);
|
public void addConnectionChangeListener(IRemoteConnectionChangeListener listener);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a listener that will be notified when this connection's status changes.
|
* Remove a listener that will be notified when this connection's status changes.
|
||||||
*
|
*
|
||||||
* @param listener
|
* @param listener
|
||||||
*/
|
*/
|
||||||
public void removeConnectionChangeListener(IRemoteConnectionChangeListener 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
|
* Notify all listeners when this connection's status changes. See {{@link RemoteConnectionChangeEvent} for a list of event
|
||||||
* types.
|
* types.
|
||||||
*
|
*
|
||||||
* @param event
|
* @param event
|
||||||
* event type indicating the nature of the event
|
* event type indicating the nature of the event
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -23,7 +23,7 @@ public interface IRemoteConnectionChangeListener extends EventListener {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notifies this listener that the status of a connection has changed.
|
* Notifies this listener that the status of a connection has changed.
|
||||||
*
|
*
|
||||||
* @param event
|
* @param event
|
||||||
* the connection change event
|
* the connection change event
|
||||||
* @since 2.0
|
* @since 2.0
|
||||||
|
|
|
@ -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.
|
* 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.
|
* Connections that do not provide this service are always assumed to be opened.
|
||||||
*
|
*
|
||||||
* @since 2.0
|
* @since 2.0
|
||||||
*/
|
*/
|
||||||
public interface IRemoteConnectionControlService extends IRemoteConnection.Service {
|
public interface IRemoteConnectionControlService extends IRemoteConnection.Service {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Open the connection. Must be called before the connection can be used.
|
* Open the connection. Must be called before the connection can be used.
|
||||||
*
|
*
|
||||||
* @param monitor
|
* @param monitor
|
||||||
* the progress monitor to use for reporting progress to the user. It is the caller's responsibility to call done()
|
* 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
|
* 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.
|
* Test if the connection is open.
|
||||||
*
|
*
|
||||||
* @return true if connection is open.
|
* @return true if connection is open.
|
||||||
*/
|
*/
|
||||||
public boolean isOpen();
|
public boolean isOpen();
|
||||||
|
|
|
@ -12,43 +12,43 @@ package org.eclipse.remote.core;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A service to obtain host specific information.
|
* A service to obtain host specific information.
|
||||||
*
|
*
|
||||||
* @since 2.0
|
* @since 2.0
|
||||||
*/
|
*/
|
||||||
public interface IRemoteConnectionHostService extends IRemoteConnection.Service {
|
public interface IRemoteConnectionHostService extends IRemoteConnection.Service {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Obtain the hostname associated with this connection.
|
* Obtain the hostname associated with this connection.
|
||||||
*
|
*
|
||||||
* @return hostname
|
* @return hostname
|
||||||
*/
|
*/
|
||||||
String getHostname();
|
String getHostname();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Obtain the port associated with this connection
|
* Obtain the port associated with this connection
|
||||||
*
|
*
|
||||||
* @return port
|
* @return port
|
||||||
*/
|
*/
|
||||||
int getPort();
|
int getPort();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Obtain the timeout used when establishing the connection.
|
* Obtain the timeout used when establishing the connection.
|
||||||
*
|
*
|
||||||
* @return timeout
|
* @return timeout
|
||||||
*/
|
*/
|
||||||
int getTimeout();
|
int getTimeout();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the pass phrase associated with this connection.
|
* Get the pass phrase associated with this connection.
|
||||||
*
|
*
|
||||||
* @return pass phrase
|
* @return pass phrase
|
||||||
* @since 3.0
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
String getPassphrase();
|
String getPassphrase();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the password associated with this connection.
|
* Get the password associated with this connection.
|
||||||
*
|
*
|
||||||
* @return password
|
* @return password
|
||||||
* @since 3.0
|
* @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.
|
* Get the value of the use password authentication flag. If true, the connection will try using a password first.
|
||||||
*
|
*
|
||||||
* @return use password authentication flag
|
* @return use password authentication flag
|
||||||
* @since 3.0
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
boolean usePassword();
|
boolean usePassword();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Obtain the flag that indicates a login shell should be started once the connection is established
|
* Obtain the flag that indicates a login shell should be started once the connection is established
|
||||||
*
|
*
|
||||||
* @return login shell flag
|
* @return login shell flag
|
||||||
*/
|
*/
|
||||||
boolean useLoginShell();
|
boolean useLoginShell();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Obtain the username associated with this connection.
|
* Obtain the username associated with this connection.
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
String getUsername();
|
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
|
* Set the hostname associated with this connection. Note, this method can only be used for an
|
||||||
* IRemoteConnectionWorkingCopy and will have no effect otherwise.
|
* IRemoteConnectionWorkingCopy and will have no effect otherwise.
|
||||||
*
|
*
|
||||||
* @param hostname
|
* @param hostname
|
||||||
* new hostname for connection
|
* 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
|
* Set the pass phrase associated with this connection. Note, this method can only be used for an
|
||||||
* IRemoteConnectionWorkingCopy and will have no effect otherwise.
|
* IRemoteConnectionWorkingCopy and will have no effect otherwise.
|
||||||
*
|
*
|
||||||
* @param passphrase
|
* @param passphrase
|
||||||
*/
|
*/
|
||||||
void setPassphrase(String 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
|
* Set the password associated with this connection. Note, this method can only be used for an
|
||||||
* IRemoteConnectionWorkingCopy and will have no effect otherwise.
|
* IRemoteConnectionWorkingCopy and will have no effect otherwise.
|
||||||
*
|
*
|
||||||
* @param password
|
* @param password
|
||||||
* new password for connection
|
* 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
|
* Set the port used for the connection. Note, this method can only be used forh an
|
||||||
* IRemoteConnectionWorkingCopy and will have no effect otherwise.
|
* IRemoteConnectionWorkingCopy and will have no effect otherwise.
|
||||||
*
|
*
|
||||||
* @param port
|
* @param port
|
||||||
* new port for connection
|
* 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
|
* 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.
|
* for an IRemoteConnectionWorkingCopy and will have no effect otherwise.
|
||||||
*
|
*
|
||||||
* @param timeout
|
* @param timeout
|
||||||
* new timeout value
|
* 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
|
* 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.
|
* for an IRemoteConnectionWorkingCopy and will have no effect otherwise.
|
||||||
*
|
*
|
||||||
* @param useLogingShell
|
* @param useLogingShell
|
||||||
* true to start a login shell
|
* 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
|
* Set the connection to try password authentication first. Note, this method can only be used for an
|
||||||
* IRemoteConnectionWorkingCopy and will have no effect otherwise.
|
* IRemoteConnectionWorkingCopy and will have no effect otherwise.
|
||||||
*
|
*
|
||||||
* @param usePassword
|
* @param usePassword
|
||||||
* use password authentication
|
* 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
|
* Set the username associated with this connection. Note, this method can only be used for an
|
||||||
* IRemoteConnectionWorkingCopy and will have no effect otherwise.
|
* IRemoteConnectionWorkingCopy and will have no effect otherwise.
|
||||||
*
|
*
|
||||||
* @param username
|
* @param username
|
||||||
* new username for connection
|
* new username for connection
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -13,10 +13,10 @@ package org.eclipse.remote.core;
|
||||||
/**
|
/**
|
||||||
* A connection property is some descriptive information that's discovered about the connection.
|
* A connection property is some descriptive information that's discovered about the connection.
|
||||||
* This service provides property values for a connection.
|
* This service provides property values for a connection.
|
||||||
*
|
*
|
||||||
* Examples include:
|
* Examples include:
|
||||||
* <pre>
|
* <pre>
|
||||||
* os.name Operating system name
|
* os.name Operating system name
|
||||||
* os.arch Operating system architecture
|
* os.arch Operating system architecture
|
||||||
* os.version Operating system version
|
* os.version Operating system version
|
||||||
* file.separator File separator ("/" on UNIX)
|
* file.separator File separator ("/" on UNIX)
|
||||||
|
@ -24,14 +24,14 @@ package org.eclipse.remote.core;
|
||||||
* line.separator Line separator ("\n" on UNIX)
|
* line.separator Line separator ("\n" on UNIX)
|
||||||
* user.home Home directory
|
* user.home Home directory
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @since 2.0
|
* @since 2.0
|
||||||
*/
|
*/
|
||||||
public interface IRemoteConnectionPropertyService extends IRemoteConnection.Service {
|
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.
|
* Gets the remote system property indicated by the specified key. The connection must be open prior to calling this method.
|
||||||
*
|
*
|
||||||
* @param key
|
* @param key
|
||||||
* the name of the property
|
* the name of the property
|
||||||
* @return the string value of the property, or null if no property has that key
|
* @return the string value of the property, or null if no property has that key
|
||||||
|
|
|
@ -15,7 +15,7 @@ package org.eclipse.remote.core;
|
||||||
* and removing services. For example, the Local connection type needs to be able
|
* 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
|
* to ensure the Local connection is created, or adapters to other target management
|
||||||
* systems may prefer to let those systems manage the connections.
|
* systems may prefer to let those systems manage the connections.
|
||||||
*
|
*
|
||||||
* @since 2.0
|
* @since 2.0
|
||||||
*/
|
*/
|
||||||
public interface IRemoteConnectionProviderService extends IRemoteConnectionType.Service {
|
public interface IRemoteConnectionProviderService extends IRemoteConnectionType.Service {
|
||||||
|
|
|
@ -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.
|
* 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
|
* Services may be registered on the individual connections, or at the connection type level
|
||||||
* for service that apply to all connections of this type.
|
* for service that apply to all connections of this type.
|
||||||
*
|
*
|
||||||
* @noimplement This interface is not intended to be implemented by clients.
|
* @noimplement This interface is not intended to be implemented by clients.
|
||||||
* @since 2.0
|
* @since 2.0
|
||||||
*/
|
*/
|
||||||
public interface IRemoteConnectionType {
|
public interface IRemoteConnectionType {
|
||||||
/**
|
/**
|
||||||
* The interface that is extend by services provided for this remote services implementation.
|
* The interface that is extend by services provided for this remote services implementation.
|
||||||
*
|
*
|
||||||
* @since 2.0
|
* @since 2.0
|
||||||
*/
|
*/
|
||||||
interface Service {
|
interface Service {
|
||||||
|
@ -41,56 +41,56 @@ public interface IRemoteConnectionType {
|
||||||
/**
|
/**
|
||||||
* Get the remote services manager. This is a convenient way to get back
|
* Get the remote services manager. This is a convenient way to get back
|
||||||
* to the root.
|
* to the root.
|
||||||
*
|
*
|
||||||
* @return remote services manager
|
* @return remote services manager
|
||||||
*/
|
*/
|
||||||
IRemoteServicesManager getRemoteServicesManager();
|
IRemoteServicesManager getRemoteServicesManager();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get unique ID of this service. Can be used as a lookup key.
|
* Get unique ID of this service. Can be used as a lookup key.
|
||||||
*
|
*
|
||||||
* @return unique ID
|
* @return unique ID
|
||||||
*/
|
*/
|
||||||
String getId();
|
String getId();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get display name of this service.
|
* Get display name of this service.
|
||||||
*
|
*
|
||||||
* @return display name
|
* @return display name
|
||||||
*/
|
*/
|
||||||
String getName();
|
String getName();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the EFS scheme provided by this service.
|
* Get the EFS scheme provided by this service.
|
||||||
*
|
*
|
||||||
* @return display name
|
* @return display name
|
||||||
*/
|
*/
|
||||||
String getScheme();
|
String getScheme();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Can you add new connections of this type using the API.
|
* Can you add new connections of this type using the API.
|
||||||
*
|
*
|
||||||
* @return can add
|
* @return can add
|
||||||
*/
|
*/
|
||||||
boolean canAdd();
|
boolean canAdd();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Can you edit connections of this type, i.e. create working copies.
|
* Can you edit connections of this type, i.e. create working copies.
|
||||||
*
|
*
|
||||||
* @return can edit
|
* @return can edit
|
||||||
*/
|
*/
|
||||||
boolean canEdit();
|
boolean canEdit();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Can you remove connections of this type using the API.
|
* Can you remove connections of this type using the API.
|
||||||
*
|
*
|
||||||
* @return can remove
|
* @return can remove
|
||||||
*/
|
*/
|
||||||
boolean canRemove();
|
boolean canRemove();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the service for this remote services implementation that implements the given interface.
|
* Get the service for this remote services implementation that implements the given interface.
|
||||||
*
|
*
|
||||||
* @param service
|
* @param service
|
||||||
* the interface the required service must implements
|
* the interface the required service must implements
|
||||||
* @return the desired service or null if there is no such service available
|
* @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.
|
* Does this connection type support the given service.
|
||||||
*
|
*
|
||||||
* @param service
|
* @param service
|
||||||
* the service to be tested
|
* the service to be tested
|
||||||
* @return true if this connection type supports this service
|
* @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 the list of connection type services supported by this type.
|
||||||
*
|
*
|
||||||
* @return connection type services
|
* @return connection type services
|
||||||
*/
|
*/
|
||||||
List<String> getServices();
|
List<String> getServices();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Do connections created by this connection type support the given service.
|
* Do connections created by this connection type support the given service.
|
||||||
*
|
*
|
||||||
* @param service
|
* @param service
|
||||||
* the service to be tested
|
* the service to be tested
|
||||||
* @return true if connections created by this connection type support this service
|
* @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 the list of connection services supported by connections of this type.
|
||||||
*
|
*
|
||||||
* @return connection services
|
* @return connection services
|
||||||
*/
|
*/
|
||||||
List<String> getConnectionServices();
|
List<String> getConnectionServices();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Do processes created by this connection type support the given service.
|
* Do processes created by this connection type support the given service.
|
||||||
*
|
*
|
||||||
* @param service
|
* @param service
|
||||||
* the service to be tested
|
* the service to be tested
|
||||||
* @return true if processes created by this connection type support this service
|
* @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 the list of process services supported by connections of this type.
|
||||||
*
|
*
|
||||||
* @return process services
|
* @return process services
|
||||||
*/
|
*/
|
||||||
List<String> getProcessServices();
|
List<String> getProcessServices();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the remote connection corresponding to the supplied name.
|
* Gets the remote connection corresponding to the supplied name.
|
||||||
*
|
*
|
||||||
* @param name
|
* @param name
|
||||||
* name of the connection (as returned by {@link IRemoteConnection#getName()})
|
* name of the connection (as returned by {@link IRemoteConnection#getName()})
|
||||||
* @return remote connection or null if no connection exists
|
* @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.
|
* Gets the remote connection corresponding to the supplied URI.
|
||||||
*
|
*
|
||||||
* @param uri
|
* @param uri
|
||||||
* URI containing a schema for this remote connection
|
* URI containing a schema for this remote connection
|
||||||
* @return remote connection or null if no connection exists or the schema
|
* @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.
|
* Get all the connections for this service provider.
|
||||||
*
|
*
|
||||||
* @return connections that we know about
|
* @return connections that we know about
|
||||||
*/
|
*/
|
||||||
List<IRemoteConnection> getConnections();
|
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
|
* Creates a new remote connection named with supplied name. The connection attributes will be the default for the
|
||||||
* implementation.
|
* implementation.
|
||||||
*
|
*
|
||||||
* Returns a working copy of the remote connection. Callers must call {@link IRemoteConnectionWorkingCopy#save()} before the
|
* Returns a working copy of the remote connection. Callers must call {@link IRemoteConnectionWorkingCopy#save()} before the
|
||||||
* connection can be used.
|
* connection can be used.
|
||||||
*
|
*
|
||||||
* @param name
|
* @param name
|
||||||
* name of the connection
|
* name of the connection
|
||||||
* @return a new connection working copy with the supplied name
|
* @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.
|
* Remove a connection and all resources associated with it.
|
||||||
*
|
*
|
||||||
* @param connection
|
* @param connection
|
||||||
* connection to remove
|
* connection to remove
|
||||||
* @throws RemoteConnectionException
|
* @throws RemoteConnectionException
|
||||||
|
|
|
@ -22,14 +22,14 @@ public interface IRemoteConnectionWorkingCopy extends IRemoteConnection {
|
||||||
/**
|
/**
|
||||||
* Returns the original connection this working copy was created from.
|
* Returns the original connection this working copy was created from.
|
||||||
* Returns null if this is a new connection.
|
* Returns null if this is a new connection.
|
||||||
*
|
*
|
||||||
* @return original connection
|
* @return original connection
|
||||||
*/
|
*/
|
||||||
public IRemoteConnection getOriginal();
|
public IRemoteConnection getOriginal();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether this connection has been modified since it was last saved or created.
|
* Returns whether this connection has been modified since it was last saved or created.
|
||||||
*
|
*
|
||||||
* @return true if the connection has been modified
|
* @return true if the connection has been modified
|
||||||
*/
|
*/
|
||||||
public boolean isDirty();
|
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
|
* 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.
|
* connection does not need saving.
|
||||||
*
|
*
|
||||||
* @return saved connection
|
* @return saved connection
|
||||||
* @throws RemoteConnectionException
|
* @throws RemoteConnectionException
|
||||||
*/
|
*/
|
||||||
public IRemoteConnection save() throws RemoteConnectionException;
|
public IRemoteConnection save() throws RemoteConnectionException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the name for this connection
|
* Set the name for this connection
|
||||||
*
|
*
|
||||||
* @param name
|
* @param name
|
||||||
*/
|
*/
|
||||||
public void setName(String 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
|
* 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.
|
* using {@link #getAttributes()}. Attributes are persisted along with connection information.
|
||||||
*
|
*
|
||||||
* @param key
|
* @param key
|
||||||
* attribute key
|
* attribute key
|
||||||
* @param value
|
* @param value
|
||||||
|
@ -63,7 +63,7 @@ public interface IRemoteConnectionWorkingCopy extends IRemoteConnection {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set an attribute such as a password that's stored in secure storage.
|
* Set an attribute such as a password that's stored in secure storage.
|
||||||
*
|
*
|
||||||
* @param key
|
* @param key
|
||||||
* @param value
|
* @param value
|
||||||
* @since 2.0
|
* @since 2.0
|
||||||
|
|
|
@ -17,7 +17,7 @@ import org.eclipse.core.runtime.IPath;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface for managing files on a remote system.
|
* Interface for managing files on a remote system.
|
||||||
*
|
*
|
||||||
* @since 2.0
|
* @since 2.0
|
||||||
*/
|
*/
|
||||||
public interface IRemoteFileService extends IRemoteConnection.Service {
|
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
|
* Get the resource associated with path. IFileStore can then be used to
|
||||||
* perform operations on the file.
|
* perform operations on the file.
|
||||||
*
|
*
|
||||||
* The remote connection does not need to be open to use this method, but
|
* The remote connection does not need to be open to use this method, but
|
||||||
* subsequent operations on the IFileStore that access the underlying remote
|
* subsequent operations on the IFileStore that access the underlying remote
|
||||||
* filesystem may require the connection to be open.
|
* filesystem may require the connection to be open.
|
||||||
*
|
*
|
||||||
* @param path
|
* @param path
|
||||||
* path to resource
|
* path to resource
|
||||||
* @return the file store representing the remote path
|
* @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.
|
* Get the base directory to be used for relative paths.
|
||||||
*
|
*
|
||||||
* @return base directory
|
* @return base directory
|
||||||
*/
|
*/
|
||||||
String getBaseDirectory();
|
String getBaseDirectory();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the base directory to be used for relative paths..
|
* Set the base directory to be used for relative paths..
|
||||||
*
|
*
|
||||||
* @param path new base directory
|
* @param path new base directory
|
||||||
*/
|
*/
|
||||||
void setBaseDirectory(String path);
|
void setBaseDirectory(String path);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the directory separator on the target system.
|
* Gets the directory separator on the target system.
|
||||||
*
|
*
|
||||||
* @return String
|
* @return String
|
||||||
*/
|
*/
|
||||||
String getDirectorySeparator();
|
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
|
* Convert URI to a remote path. This path is suitable for direct file
|
||||||
* operations <i>on the remote system</i>.
|
* operations <i>on the remote system</i>.
|
||||||
*
|
*
|
||||||
* The remote connection does not need to be open to use this method.
|
* The remote connection does not need to be open to use this method.
|
||||||
*
|
*
|
||||||
* @return IPath representing the remote path
|
* @return IPath representing the remote path
|
||||||
*/
|
*/
|
||||||
String toPath(URI uri);
|
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
|
* Convert remote path to equivalent URI. This URI is suitable for EFS
|
||||||
* operations <i>on the local system</i>.
|
* operations <i>on the local system</i>.
|
||||||
*
|
*
|
||||||
* The remote connection does not need to be open to use this method.
|
* The remote connection does not need to be open to use this method.
|
||||||
*
|
*
|
||||||
* @param path
|
* @param path
|
||||||
* path on remote system
|
* path on remote system
|
||||||
* @return URI representing path on remote system, or null if the path is
|
* @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
|
* Convert string representation of a remote path to equivalent URI. This
|
||||||
* URI is suitable for EFS operations <i>on the local system</i>.
|
* 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.
|
* The remote connection does not need to be open to use this method.
|
||||||
*
|
*
|
||||||
* @param path
|
* @param path
|
||||||
* path on remote system
|
* path on remote system
|
||||||
* @return URI representing path on remote system, or null if the path is
|
* @return URI representing path on remote system, or null if the path is
|
||||||
|
|
|
@ -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.
|
* A connection service for setting up port forwarding between the host and the remote.
|
||||||
* This is a feature provided by SSH.
|
* This is a feature provided by SSH.
|
||||||
*
|
*
|
||||||
* @since 2.0
|
* @since 2.0
|
||||||
*/
|
*/
|
||||||
public interface IRemotePortForwardingService extends IRemoteConnection.Service {
|
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
|
* 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.
|
* fwdAddress, the port will be routed via the connection machine to fwdAddress.
|
||||||
*
|
*
|
||||||
* @param localPort
|
* @param localPort
|
||||||
* local port to forward
|
* local port to forward
|
||||||
* @param fwdAddress
|
* @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
|
* 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
|
* by the method. If this IRemoteConnection is not to fwdAddress, the port will be routed via the connection machine to
|
||||||
* fwdAddress.
|
* fwdAddress.
|
||||||
*
|
*
|
||||||
* @param fwdAddress
|
* @param fwdAddress
|
||||||
* @param fwdPort
|
* @param fwdPort
|
||||||
* @param monitor
|
* @param monitor
|
||||||
* @return local port number
|
* @return local port number
|
||||||
* @throws RemoteConnectionException
|
* @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
|
* 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.
|
* machine, it is forwarded via this IRemoteConnection to fwdPort on machine fwdAddress.
|
||||||
*
|
*
|
||||||
* @param remotePort
|
* @param remotePort
|
||||||
* remote port to forward
|
* remote port to forward
|
||||||
* @param fwdAddress
|
* @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
|
* 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
|
* method. When a connection is made to this port on the remote machine, it is forwarded via this IRemoteConnection to fwdPort
|
||||||
* on machine fwdAddress.
|
* on machine fwdAddress.
|
||||||
*
|
*
|
||||||
* If fwdAddress is the empty string ("") then the fwdPort will be bound to any address on all interfaces. Note that this
|
* 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.
|
* requires enabling the GatewayPort sshd option on some systems.
|
||||||
*
|
*
|
||||||
* @param fwdAddress
|
* @param fwdAddress
|
||||||
* @param fwdPort
|
* @param fwdPort
|
||||||
* @param monitor
|
* @param monitor
|
||||||
* @return remote port number
|
* @return remote port number
|
||||||
* @throws RemoteConnectionException
|
* @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.
|
* Remove the local port forwarding associated with the given port.
|
||||||
*
|
*
|
||||||
* @param port
|
* @param port
|
||||||
* forwarded port
|
* forwarded port
|
||||||
* @throws RemoteConnectionException
|
* @throws RemoteConnectionException
|
||||||
|
@ -90,7 +92,7 @@ public interface IRemotePortForwardingService extends IRemoteConnection.Service
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove the remote port forwarding associated with the given port.
|
* Remove the remote port forwarding associated with the given port.
|
||||||
*
|
*
|
||||||
* @param port
|
* @param port
|
||||||
* forwarded port
|
* forwarded port
|
||||||
* @throws RemoteConnectionException
|
* @throws RemoteConnectionException
|
||||||
|
|
|
@ -12,14 +12,14 @@ package org.eclipse.remote.core;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Preference constants that can be used to check the default remote service provider preference.
|
* Preference constants that can be used to check the default remote service provider preference.
|
||||||
*
|
*
|
||||||
* @since 6.0
|
* @since 6.0
|
||||||
*/
|
*/
|
||||||
public interface IRemotePreferenceConstants {
|
public interface IRemotePreferenceConstants {
|
||||||
/**
|
/**
|
||||||
* Preference setting for the default connection type. Clients can check this preference to see if a default provider
|
* 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.
|
* has been set, and if so, what the provider ID is.
|
||||||
*
|
*
|
||||||
* @since 2.0
|
* @since 2.0
|
||||||
*/
|
*/
|
||||||
public static final String PREF_CONNECTION_TYPE_ID = "connectionTypeId"; //$NON-NLS-1$
|
public static final String PREF_CONNECTION_TYPE_ID = "connectionTypeId"; //$NON-NLS-1$
|
||||||
|
|
|
@ -19,7 +19,7 @@ import java.io.OutputStream;
|
||||||
public interface IRemoteProcess {
|
public interface IRemoteProcess {
|
||||||
/**
|
/**
|
||||||
* The interface that is extend by services provided for this remote connection.
|
* The interface that is extend by services provided for this remote connection.
|
||||||
*
|
*
|
||||||
* @since 2.0
|
* @since 2.0
|
||||||
*/
|
*/
|
||||||
interface Service {
|
interface Service {
|
||||||
|
@ -37,17 +37,17 @@ public interface IRemoteProcess {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the exit value for the process
|
* Returns the exit value for the process
|
||||||
*
|
*
|
||||||
* @return the exit value
|
* @return the exit value
|
||||||
*/
|
*/
|
||||||
int exitValue();
|
int exitValue();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the error output stream of the process
|
* 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
|
* 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.
|
* calling thread does not read the corresponding output or error streams.
|
||||||
*
|
*
|
||||||
* @return the output stream connected to the standard
|
* @return the output stream connected to the standard
|
||||||
* error of the process
|
* 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
|
* 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
|
* 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.
|
* calling thread does not read the corresponding input or error streams.
|
||||||
*
|
*
|
||||||
* @return the input stream connected to the standard
|
* @return the input stream connected to the standard
|
||||||
* output of the process
|
* 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
|
* 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
|
* @return the output stream connected to the standard
|
||||||
* input of the process
|
* input of the process
|
||||||
*/
|
*/
|
||||||
|
@ -74,7 +74,7 @@ public interface IRemoteProcess {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the service for this remote process that implements the given interface.
|
* Get the service for this remote process that implements the given interface.
|
||||||
*
|
*
|
||||||
* @param service
|
* @param service
|
||||||
* the interface the required service must implements
|
* the interface the required service must implements
|
||||||
* @return the desired service or null if there is no such service available
|
* @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.
|
* Does this remote process support the given service.
|
||||||
*
|
*
|
||||||
* @param service
|
* @param service
|
||||||
* The service to be tested
|
* The service to be tested
|
||||||
* @return true if this connection supports the service
|
* @return true if this connection supports the service
|
||||||
|
@ -94,10 +94,10 @@ public interface IRemoteProcess {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wait until the process has terminated
|
* 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
|
* 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.
|
* calling thread does not read the corresponding input or error streams.
|
||||||
*
|
*
|
||||||
* @return the exit value of the process
|
* @return the exit value of the process
|
||||||
* @throws InterruptedException
|
* @throws InterruptedException
|
||||||
* if the current thread is
|
* if the current thread is
|
||||||
|
@ -107,17 +107,17 @@ public interface IRemoteProcess {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the remote process has completed.
|
* 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
|
* 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.
|
* calling thread does not read the corresponding input or error streams.
|
||||||
*
|
*
|
||||||
* @return true if remote process has completed
|
* @return true if remote process has completed
|
||||||
*/
|
*/
|
||||||
boolean isCompleted();
|
boolean isCompleted();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the connection that is used by this process
|
* Get the connection that is used by this process
|
||||||
*
|
*
|
||||||
* @return connection used by this process
|
* @return connection used by this process
|
||||||
* @since 2.0
|
* @since 2.0
|
||||||
*/
|
*/
|
||||||
|
@ -125,7 +125,7 @@ public interface IRemoteProcess {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the process builder used to create this process
|
* Get the process builder used to create this process
|
||||||
*
|
*
|
||||||
* @return process builder used to create this process
|
* @return process builder used to create this process
|
||||||
* @since 2.0
|
* @since 2.0
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -29,14 +29,14 @@ public interface IRemoteProcessBuilder {
|
||||||
/**
|
/**
|
||||||
* Flag to request allocation of a pseudo-terminal for the process (RFC-4254
|
* Flag to request allocation of a pseudo-terminal for the process (RFC-4254
|
||||||
* Sec. 6.2)
|
* Sec. 6.2)
|
||||||
*
|
*
|
||||||
* @since 5.0
|
* @since 5.0
|
||||||
*/
|
*/
|
||||||
public static int ALLOCATE_PTY = 0x01;
|
public static int ALLOCATE_PTY = 0x01;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flag to request X11 forwarding (RFC-4254 Sec. 6.3)
|
* Flag to request X11 forwarding (RFC-4254 Sec. 6.3)
|
||||||
*
|
*
|
||||||
* @since 5.0
|
* @since 5.0
|
||||||
*/
|
*/
|
||||||
public static int FORWARD_X11 = 0x02;
|
public static int FORWARD_X11 = 0x02;
|
||||||
|
@ -47,17 +47,17 @@ public interface IRemoteProcessBuilder {
|
||||||
* @since 3.0
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
public static int APPEND_ENVIRONMENT = 0x03;
|
public static int APPEND_ENVIRONMENT = 0x03;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns this process builder's operating system program and arguments.
|
* Returns this process builder's operating system program and arguments.
|
||||||
*
|
*
|
||||||
* @return a list containing the program and arguments
|
* @return a list containing the program and arguments
|
||||||
*/
|
*/
|
||||||
List<String> command();
|
List<String> command();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets this process builder's operating system program and arguments.
|
* Sets this process builder's operating system program and arguments.
|
||||||
*
|
*
|
||||||
* @param command
|
* @param command
|
||||||
* @return This process builder
|
* @return This process builder
|
||||||
*/
|
*/
|
||||||
|
@ -65,7 +65,7 @@ public interface IRemoteProcessBuilder {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets this process builder's operating system program and arguments.
|
* Sets this process builder's operating system program and arguments.
|
||||||
*
|
*
|
||||||
* @param command
|
* @param command
|
||||||
* @return this process builder
|
* @return this process builder
|
||||||
*/
|
*/
|
||||||
|
@ -73,14 +73,14 @@ public interface IRemoteProcessBuilder {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns this process builder's working directory.
|
* Returns this process builder's working directory.
|
||||||
*
|
*
|
||||||
* @return an IFileStore reference to the working directory
|
* @return an IFileStore reference to the working directory
|
||||||
*/
|
*/
|
||||||
IFileStore directory();
|
IFileStore directory();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets this process builder's working directory.
|
* Sets this process builder's working directory.
|
||||||
*
|
*
|
||||||
* @param directory
|
* @param directory
|
||||||
* @return This process builder
|
* @return This process builder
|
||||||
*/
|
*/
|
||||||
|
@ -89,14 +89,14 @@ public interface IRemoteProcessBuilder {
|
||||||
/**
|
/**
|
||||||
* Returns a string map view of this process builder's environment. The
|
* 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()}.
|
* returned map behaves in the same manner as described in {@link java.lang.ProcessBuilder#environment()}.
|
||||||
*
|
*
|
||||||
* @return the process builder's environment
|
* @return the process builder's environment
|
||||||
*/
|
*/
|
||||||
Map<String, String> environment();
|
Map<String, String> environment();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the flags that are supported by this process builder.
|
* Get the flags that are supported by this process builder.
|
||||||
*
|
*
|
||||||
* @return bitwise-or of the supported flags
|
* @return bitwise-or of the supported flags
|
||||||
* @since 5.0
|
* @since 5.0
|
||||||
*/
|
*/
|
||||||
|
@ -105,14 +105,14 @@ public interface IRemoteProcessBuilder {
|
||||||
/**
|
/**
|
||||||
* Tells whether this process builder merges standard error and standard
|
* Tells whether this process builder merges standard error and standard
|
||||||
* output.
|
* output.
|
||||||
*
|
*
|
||||||
* @return true if standard error and standard output will be merged
|
* @return true if standard error and standard output will be merged
|
||||||
*/
|
*/
|
||||||
boolean redirectErrorStream();
|
boolean redirectErrorStream();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets this process builder's redirectErrorStream property.
|
* Sets this process builder's redirectErrorStream property.
|
||||||
*
|
*
|
||||||
* @param redirectErrorStream
|
* @param redirectErrorStream
|
||||||
* @return This process builder
|
* @return This process builder
|
||||||
*/
|
*/
|
||||||
|
@ -120,7 +120,7 @@ public interface IRemoteProcessBuilder {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Starts a new process using the attributes of this process builder.
|
* Starts a new process using the attributes of this process builder.
|
||||||
*
|
*
|
||||||
* @return remote process object
|
* @return remote process object
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
|
@ -132,14 +132,14 @@ public interface IRemoteProcessBuilder {
|
||||||
* may only be supported by specific types of remote service providers.
|
* may only be supported by specific types of remote service providers.
|
||||||
* Clients can use {@link #getSupportedFlags()} to find out the flags
|
* Clients can use {@link #getSupportedFlags()} to find out the flags
|
||||||
* supported by the service provider.
|
* supported by the service provider.
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
* Current flags are:
|
* Current flags are:
|
||||||
* NONE - disable any flags
|
* NONE - disable any flags
|
||||||
* ALLOCATE_PTY - allocate a pseudo-terminal for the process (RFC-4254 Sec. 6.2)
|
* ALLOCATE_PTY - allocate a pseudo-terminal for the process (RFC-4254 Sec. 6.2)
|
||||||
* FORWARD_X11 - enable X11 forwarding (RFC-4254 Sec. 6.3)
|
* FORWARD_X11 - enable X11 forwarding (RFC-4254 Sec. 6.3)
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @param flags
|
* @param flags
|
||||||
* bitwise-or of flags to use when starting process
|
* bitwise-or of flags to use when starting process
|
||||||
* @return remote process object
|
* @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.
|
* Get the connection that will be used by this process builder to create remote processes.
|
||||||
*
|
*
|
||||||
* @return connection used to create remote processes
|
* @return connection used to create remote processes
|
||||||
* @since 2.0
|
* @since 2.0
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -15,7 +15,7 @@ import java.io.OutputStream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A service to control and report on the state of a process.
|
* A service to control and report on the state of a process.
|
||||||
*
|
*
|
||||||
* @since 2.0
|
* @since 2.0
|
||||||
*/
|
*/
|
||||||
public interface IRemoteProcessControlService extends IRemoteProcess.Service {
|
public interface IRemoteProcessControlService extends IRemoteProcess.Service {
|
||||||
|
@ -26,14 +26,14 @@ public interface IRemoteProcessControlService extends IRemoteProcess.Service {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the exit value for the process
|
* Returns the exit value for the process
|
||||||
*
|
*
|
||||||
* @return the exit value
|
* @return the exit value
|
||||||
*/
|
*/
|
||||||
public int exitValue();
|
public int exitValue();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the error output stream of the process
|
* Gets the error output stream of the process
|
||||||
*
|
*
|
||||||
* @return the output stream connected to the standard
|
* @return the output stream connected to the standard
|
||||||
* error of the process
|
* 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
|
* Gets an InputStream which can be used to read the standard output stream of the process
|
||||||
*
|
*
|
||||||
* @return the input stream connected to the standard
|
* @return the input stream connected to the standard
|
||||||
* output of the process
|
* 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
|
* 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
|
* @return the output stream connected to the standard
|
||||||
* input of the process
|
* input of the process
|
||||||
*/
|
*/
|
||||||
|
@ -57,7 +57,7 @@ public interface IRemoteProcessControlService extends IRemoteProcess.Service {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wait until the process has terminated
|
* Wait until the process has terminated
|
||||||
*
|
*
|
||||||
* @return the exit value of the process
|
* @return the exit value of the process
|
||||||
* @throws InterruptedException
|
* @throws InterruptedException
|
||||||
* if the current thread is
|
* if the current thread is
|
||||||
|
@ -67,7 +67,7 @@ public interface IRemoteProcessControlService extends IRemoteProcess.Service {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the remote process has completed
|
* Check if the remote process has completed
|
||||||
*
|
*
|
||||||
* @return true if remote process has completed
|
* @return true if remote process has completed
|
||||||
*/
|
*/
|
||||||
public boolean isCompleted();
|
public boolean isCompleted();
|
||||||
|
|
|
@ -15,21 +15,21 @@ import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A connection service for starting up processes on a remote.
|
* A connection service for starting up processes on a remote.
|
||||||
*
|
*
|
||||||
* @since 2.0
|
* @since 2.0
|
||||||
*/
|
*/
|
||||||
public interface IRemoteProcessService extends IRemoteConnection.Service {
|
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.
|
* Returns an unmodifiable string map view of the remote environment. The connection must be open prior to calling this method.
|
||||||
*
|
*
|
||||||
* @return the remote environment
|
* @return the remote environment
|
||||||
*/
|
*/
|
||||||
public Map<String, String> getEnv();
|
public Map<String, String> getEnv();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the value of an environment variable. The connection must be open prior to calling this method.
|
* Returns the value of an environment variable. The connection must be open prior to calling this method.
|
||||||
*
|
*
|
||||||
* @param name
|
* @param name
|
||||||
* name of the environment variable
|
* name of the environment variable
|
||||||
* @return value of the environment variable or null if the variable is not defined
|
* @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
|
* Get a process builder for creating remote processes
|
||||||
*
|
*
|
||||||
* @return process builder or null if connection is not open
|
* @return process builder or null if connection is not open
|
||||||
*/
|
*/
|
||||||
public IRemoteProcessBuilder getProcessBuilder(List<String> command);
|
public IRemoteProcessBuilder getProcessBuilder(List<String> command);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a process builder for creating remote processes
|
* Get a process builder for creating remote processes
|
||||||
*
|
*
|
||||||
* @return process builder or null if connection is not open
|
* @return process builder or null if connection is not open
|
||||||
*/
|
*/
|
||||||
public IRemoteProcessBuilder getProcessBuilder(String... command);
|
public IRemoteProcessBuilder getProcessBuilder(String... command);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the working directory. Relative paths will be resolved using this path.
|
* 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
|
* 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.
|
* working directory, may be returned in this case.
|
||||||
*
|
*
|
||||||
* @return String representing the current working directory
|
* @return String representing the current working directory
|
||||||
*/
|
*/
|
||||||
public String getWorkingDirectory();
|
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
|
* 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.
|
* 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.
|
* Relative paths will be resolved using this path. The path must be valid and absolute for any changes to be made.
|
||||||
*
|
*
|
||||||
* @param path
|
* @param path
|
||||||
* String representing the current working directory
|
* String representing the current working directory
|
||||||
* @since 4.0
|
* @since 4.0
|
||||||
|
|
|
@ -14,7 +14,7 @@ import org.eclipse.remote.core.exception.RemoteConnectionException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A service abstraction for signals.
|
* A service abstraction for signals.
|
||||||
*
|
*
|
||||||
* @since 2.0
|
* @since 2.0
|
||||||
*/
|
*/
|
||||||
public interface IRemoteProcessSignalService extends IRemoteProcess.Service {
|
public interface IRemoteProcessSignalService extends IRemoteProcess.Service {
|
||||||
|
@ -37,7 +37,7 @@ public interface IRemoteProcessSignalService extends IRemoteProcess.Service {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a signal to the remote process.
|
* Send a signal to the remote process.
|
||||||
*
|
*
|
||||||
* @param signal
|
* @param signal
|
||||||
* signal to send.
|
* signal to send.
|
||||||
* @throws RemoteConnectionException
|
* @throws RemoteConnectionException
|
||||||
|
|
|
@ -12,14 +12,14 @@ package org.eclipse.remote.core;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A service abstraction for remote terminals.
|
* A service abstraction for remote terminals.
|
||||||
*
|
*
|
||||||
* @since 2.0
|
* @since 2.0
|
||||||
*/
|
*/
|
||||||
public interface IRemoteProcessTerminalService extends IRemoteProcess.Service {
|
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
|
* 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.
|
* dimensions override the pixel dimensions (when nonzero). Pixel dimensions refer to the drawable area of the window.
|
||||||
*
|
*
|
||||||
* @param cols
|
* @param cols
|
||||||
* terminal width in characters
|
* terminal width in characters
|
||||||
* @param rows
|
* @param rows
|
||||||
|
|
|
@ -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
|
* 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.
|
* interface provides a common mechanism for accessing resource information from either type.
|
||||||
*
|
*
|
||||||
* Usage:
|
* Usage:
|
||||||
*
|
*
|
||||||
* <code>
|
* <code>
|
||||||
* IRemoteResource remoteRes = (IRemoteResource)resource.getAdapter(IRemoteResource.class);
|
* IRemoteResource remoteRes = (IRemoteResource)resource.getAdapter(IRemoteResource.class);
|
||||||
* if (remoteRes != null) {
|
* if (remoteRes != null) {
|
||||||
|
@ -29,26 +29,26 @@ import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
* ...
|
* ...
|
||||||
* }
|
* }
|
||||||
* </code>
|
* </code>
|
||||||
*
|
*
|
||||||
* @author greg
|
* @author greg
|
||||||
* @since 6.0
|
* @since 6.0
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public interface IRemoteResource {
|
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
|
* 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()}).
|
* {@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
|
* 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.
|
* resource from the active synchronization target.
|
||||||
*
|
*
|
||||||
* @return URI or null if URI can't be obtained
|
* @return URI or null if URI can't be obtained
|
||||||
*/
|
*/
|
||||||
public URI getActiveLocationURI();
|
public URI getActiveLocationURI();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the platform resource corresponding to the remote resource
|
* Get the platform resource corresponding to the remote resource
|
||||||
*
|
*
|
||||||
* @return IResource
|
* @return IResource
|
||||||
*/
|
*/
|
||||||
public IResource getResource();
|
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
|
* 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.
|
* 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.
|
* Blocks until the refresh has completed, so callers should use a job if necessary.
|
||||||
*
|
*
|
||||||
* @param monitor
|
* @param monitor
|
||||||
* progress monitor to cancel refresh
|
* progress monitor to cancel refresh
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
|
@ -67,7 +67,7 @@ public interface IRemoteResource {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the platform resource
|
* Set the platform resource
|
||||||
*
|
*
|
||||||
* @param resource
|
* @param resource
|
||||||
* platform resource corresponding to this remote resource
|
* platform resource corresponding to this remote resource
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -17,7 +17,7 @@ import java.util.List;
|
||||||
* The main entry point into the remote services system. The remote services manager
|
* 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
|
* is an OSGi service. It provides a list of connection types and the global
|
||||||
* list of all connections.
|
* list of all connections.
|
||||||
*
|
*
|
||||||
* @noimplement This interface is not intended to be implemented by clients.
|
* @noimplement This interface is not intended to be implemented by clients.
|
||||||
* @since 2.0
|
* @since 2.0
|
||||||
*/
|
*/
|
||||||
|
@ -25,7 +25,7 @@ public interface IRemoteServicesManager {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the connection type identified by the id
|
* Get the connection type identified by the id
|
||||||
*
|
*
|
||||||
* @param id
|
* @param id
|
||||||
* id of the connection type
|
* id of the connection type
|
||||||
* @return connection type or null if the service can not be found
|
* @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
|
* Get the connection type that provides connections to locations identified by
|
||||||
* the URI.
|
* the URI.
|
||||||
*
|
*
|
||||||
* @param uri
|
* @param uri
|
||||||
* uri of locations to be accessed
|
* uri of locations to be accessed
|
||||||
* @return the connection type that can be used to access the locations
|
* @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 connection type used to access local resources.
|
||||||
*
|
*
|
||||||
* @return the local services
|
* @return the local services
|
||||||
*/
|
*/
|
||||||
IRemoteConnectionType getLocalConnectionType();
|
IRemoteConnectionType getLocalConnectionType();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the list of all connection types including the local services.
|
* Returns the list of all connection types including the local services.
|
||||||
*
|
*
|
||||||
* @return all connection types
|
* @return all connection types
|
||||||
*/
|
*/
|
||||||
List<IRemoteConnectionType> getAllConnectionTypes();
|
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
|
* 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
|
* can provide additional services that are not included in the list, so this just guarantees the minimum set of services that
|
||||||
* will be supported.
|
* will be supported.
|
||||||
*
|
*
|
||||||
* @param services
|
* @param services
|
||||||
* services provided by connections supported by this connection type
|
* services provided by connections supported by this connection type
|
||||||
* @return compatible connection types
|
* @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
|
* 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.
|
* that are not included in the list, so this just guarantees the minimum set of services that will be supported.
|
||||||
*
|
*
|
||||||
* @param services
|
* @param services
|
||||||
* services provided by this connection type
|
* services provided by this connection type
|
||||||
* @return compatible connection types
|
* @return compatible connection types
|
||||||
|
@ -82,21 +82,21 @@ public interface IRemoteServicesManager {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the list of connection types except for the local connection type.
|
* Returns the list of connection types except for the local connection type.
|
||||||
*
|
*
|
||||||
* @return all connection types that are really remote
|
* @return all connection types that are really remote
|
||||||
*/
|
*/
|
||||||
List<IRemoteConnectionType> getRemoteConnectionTypes();
|
List<IRemoteConnectionType> getRemoteConnectionTypes();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the list of all known remote connections.
|
* Returns the list of all known remote connections.
|
||||||
*
|
*
|
||||||
* @return all remote connections
|
* @return all remote connections
|
||||||
*/
|
*/
|
||||||
List<IRemoteConnection> getAllRemoteConnections();
|
List<IRemoteConnection> getAllRemoteConnections();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a global connection change listener that receives events for all connections.
|
* Add a global connection change listener that receives events for all connections.
|
||||||
*
|
*
|
||||||
* @param listener
|
* @param listener
|
||||||
* global connection change listener to be added
|
* global connection change listener to be added
|
||||||
*/
|
*/
|
||||||
|
@ -104,7 +104,7 @@ public interface IRemoteServicesManager {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove the global connection change listener.
|
* Remove the global connection change listener.
|
||||||
*
|
*
|
||||||
* @param listener
|
* @param listener
|
||||||
* global connection change listener to be removed
|
* 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
|
* Used by connections and other components to notify the global connection
|
||||||
* change listeners of events.
|
* change listeners of events.
|
||||||
*
|
*
|
||||||
* @param event
|
* @param event
|
||||||
* connection change event
|
* connection change event
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -17,7 +17,7 @@ import java.net.PasswordAuthentication;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allow clients to provide their own user interface for connection authentication.
|
* Allow clients to provide their own user interface for connection authentication.
|
||||||
*
|
*
|
||||||
* @since 2.0
|
* @since 2.0
|
||||||
*/
|
*/
|
||||||
public interface IUserAuthenticatorService extends IRemoteConnection.Service {
|
public interface IUserAuthenticatorService extends IRemoteConnection.Service {
|
||||||
|
@ -73,7 +73,7 @@ public interface IUserAuthenticatorService extends IRemoteConnection.Service {
|
||||||
* into returned object. Implementors are allowed to
|
* into returned object. Implementors are allowed to
|
||||||
* save user names and passwords. The user should be prompted for
|
* save user names and passwords. The user should be prompted for
|
||||||
* user name and password if there is no saved one.
|
* user name and password if there is no saved one.
|
||||||
*
|
*
|
||||||
* @param username
|
* @param username
|
||||||
* The initial username, or null if there is no initial username
|
* The initial username, or null if there is no initial username
|
||||||
* @param message
|
* @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
|
* 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 <core>prompt</code> array. Implementors will return the entered values, or null if
|
||||||
* the user cancels the prompt.
|
* the user cancels the prompt.
|
||||||
*
|
*
|
||||||
* @param destination
|
* @param destination
|
||||||
* the destination in the format like username@hostname:port
|
* the destination in the format like username@hostname:port
|
||||||
* @param name
|
* @param name
|
||||||
|
@ -104,7 +104,7 @@ public interface IUserAuthenticatorService extends IRemoteConnection.Service {
|
||||||
* Prompts for additional information regarding this authentication
|
* Prompts for additional information regarding this authentication
|
||||||
* request. A default implementation of this method should return the <code>defaultResponse</code>,
|
* request. A default implementation of this method should return the <code>defaultResponse</code>,
|
||||||
* whereas alternate implementations could prompt the user with a dialog.
|
* whereas alternate implementations could prompt the user with a dialog.
|
||||||
*
|
*
|
||||||
* @param promptType
|
* @param promptType
|
||||||
* one of the following values:
|
* one of the following values:
|
||||||
* <ul>
|
* <ul>
|
||||||
|
|
|
@ -67,7 +67,7 @@ public class RemoteConnectionChangeEvent {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the connection that has changed.
|
* Get the connection that has changed.
|
||||||
*
|
*
|
||||||
* @return IRemoteConnection
|
* @return IRemoteConnection
|
||||||
*/
|
*/
|
||||||
public IRemoteConnection getConnection() {
|
public IRemoteConnection getConnection() {
|
||||||
|
@ -77,9 +77,9 @@ public class RemoteConnectionChangeEvent {
|
||||||
/**
|
/**
|
||||||
* Returns the type of event being reported. This type
|
* Returns the type of event being reported. This type
|
||||||
* is obtained by bitwise OR'ing the event types together.
|
* is obtained by bitwise OR'ing the event types together.
|
||||||
*
|
*
|
||||||
* {@link #CONNECTION_CLOSED} {@link #CONNECTION_OPENED} {@link #CONNECTION_ABORTED} {@link #CONNECTION_RENAMED}
|
* {@link #CONNECTION_CLOSED} {@link #CONNECTION_OPENED} {@link #CONNECTION_ABORTED} {@link #CONNECTION_RENAMED}
|
||||||
*
|
*
|
||||||
* @return a bitwise OR of event type constants
|
* @return a bitwise OR of event type constants
|
||||||
*/
|
*/
|
||||||
public int getType() {
|
public int getType() {
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM Corporation - initial API and implementation
|
* 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
|
* Utility class to adapt an IRemoteProcess to a java.lang.Process
|
||||||
*
|
*
|
||||||
* @author crecoskie
|
* @author crecoskie
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class RemoteProcessAdapter extends Process {
|
public class RemoteProcessAdapter extends Process {
|
||||||
|
|
||||||
|
|
|
@ -49,12 +49,12 @@ public class RemoteServicesUtils {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert a UNC path to a URI
|
* 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
|
* 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
|
* 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
|
* 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.
|
* a matching connection name is found.
|
||||||
*
|
*
|
||||||
* @param path
|
* @param path
|
||||||
* UNC path
|
* UNC path
|
||||||
* @return corresponding URI or null if not a valid path
|
* @return corresponding URI or null if not a valid path
|
||||||
|
|
|
@ -13,7 +13,7 @@ package org.eclipse.remote.core.exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Exception thrown when a connection address is already in use.
|
* Exception thrown when a connection address is already in use.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class AddressInUseException extends RemoteConnectionException {
|
public class AddressInUseException extends RemoteConnectionException {
|
||||||
private static final long serialVersionUID = 1771839754428411610L;
|
private static final long serialVersionUID = 1771839754428411610L;
|
||||||
|
|
|
@ -14,7 +14,7 @@ package org.eclipse.remote.core.exception;
|
||||||
* Thrown when trying to add a connection with the same name as an existing
|
* 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
|
* connection, or when trying to rename a connection to the same name as an
|
||||||
* existing connection.
|
* existing connection.
|
||||||
*
|
*
|
||||||
* @since 2.0
|
* @since 2.0
|
||||||
*/
|
*/
|
||||||
public class ConnectionExistsException extends RemoteConnectionException {
|
public class ConnectionExistsException extends RemoteConnectionException {
|
||||||
|
|
|
@ -16,7 +16,7 @@ package org.eclipse.remote.core.exception;
|
||||||
*/
|
*/
|
||||||
public class UnableToForwardPortException extends RemoteConnectionException {
|
public class UnableToForwardPortException extends RemoteConnectionException {
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = -5814772755700213717L;
|
private static final long serialVersionUID = -5814772755700213717L;
|
||||||
|
|
||||||
|
|
|
@ -18,14 +18,14 @@ import org.eclipse.remote.core.IRemoteConnection;
|
||||||
* Manages and persists the mapping between launch configurations and
|
* Manages and persists the mapping between launch configurations and
|
||||||
* remote connections that they run on. Each launch configuration has an
|
* remote connections that they run on. Each launch configuration has an
|
||||||
* active remote connection.
|
* active remote connection.
|
||||||
*
|
*
|
||||||
* @since 2.0
|
* @since 2.0
|
||||||
*/
|
*/
|
||||||
public interface IRemoteLaunchConfigService {
|
public interface IRemoteLaunchConfigService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the active remote connection for the given launch configuration.
|
* Sets the active remote connection for the given launch configuration.
|
||||||
*
|
*
|
||||||
* @param launchConfig launch configuration
|
* @param launchConfig launch configuration
|
||||||
* @param connection active remote connection
|
* @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
|
* For a given launch configuration type, get the remote connection that was last
|
||||||
* used by a launch configuration of that type.
|
* 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.
|
* will want to use the same remote connection.
|
||||||
*
|
*
|
||||||
* @param launchConfigType launch configuration type
|
* @param launchConfigType launch configuration type
|
||||||
* @return last active remote configuration
|
* @return last active remote configuration
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -83,7 +83,7 @@ public class RemoteConnection implements IRemoteConnection {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called from working copy when name has changed.
|
* Called from working copy when name has changed.
|
||||||
*
|
*
|
||||||
* @param name
|
* @param name
|
||||||
* the new name
|
* the new name
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -61,13 +61,13 @@ public class RemoteConnectionType implements IRemoteConnectionType {
|
||||||
// capabilities, default is true for all of these
|
// capabilities, default is true for all of these
|
||||||
String canAddStr = ce.getAttribute("canAdd"); //$NON-NLS-1$
|
String canAddStr = ce.getAttribute("canAdd"); //$NON-NLS-1$
|
||||||
canAdd = canAddStr != null ? Boolean.parseBoolean(canAddStr) : true;
|
canAdd = canAddStr != null ? Boolean.parseBoolean(canAddStr) : true;
|
||||||
|
|
||||||
String canEditStr = ce.getAttribute("canEdit"); //$NON-NLS-1$
|
String canEditStr = ce.getAttribute("canEdit"); //$NON-NLS-1$
|
||||||
canEdit = canEditStr != null ? Boolean.parseBoolean(canEditStr) : true;
|
canEdit = canEditStr != null ? Boolean.parseBoolean(canEditStr) : true;
|
||||||
|
|
||||||
String canRemoveStr = ce.getAttribute("canRemove"); //$NON-NLS-1$
|
String canRemoveStr = ce.getAttribute("canRemove"); //$NON-NLS-1$
|
||||||
canRemove = canRemoveStr != null ? Boolean.parseBoolean(canRemoveStr) : true;
|
canRemove = canRemoveStr != null ? Boolean.parseBoolean(canRemoveStr) : true;
|
||||||
|
|
||||||
// load up existing connections
|
// load up existing connections
|
||||||
try {
|
try {
|
||||||
for (String nodeName : getPreferenceNode().childrenNames()) {
|
for (String nodeName : getPreferenceNode().childrenNames()) {
|
||||||
|
@ -123,7 +123,7 @@ public class RemoteConnectionType implements IRemoteConnectionType {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T extends Service> T getService(Class<T> service) {
|
public <T extends Service> T getService(Class<T> service) {
|
||||||
synchronized (serviceDefinitionMap) {
|
synchronized (serviceDefinitionMap) {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
T obj = (T) serviceMap.get(service);
|
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.
|
* Called from the connection to get a service object for that connection.
|
||||||
*
|
*
|
||||||
* @param connection
|
* @param connection
|
||||||
* the connection to which the service applies
|
* the connection to which the service applies
|
||||||
* @param service
|
* @param service
|
||||||
|
@ -169,7 +169,8 @@ public class RemoteConnectionType implements IRemoteConnectionType {
|
||||||
* @return the service object
|
* @return the service object
|
||||||
* @throws CoreException
|
* @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) {
|
synchronized (connectionServiceDefinitionMap) {
|
||||||
IConfigurationElement ce = connectionServiceDefinitionMap.get(service.getName());
|
IConfigurationElement ce = connectionServiceDefinitionMap.get(service.getName());
|
||||||
if (ce != null) {
|
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.
|
* Called from the remote process to get a service object for that process.
|
||||||
*
|
*
|
||||||
* @param process
|
* @param process
|
||||||
* the process to which the service applies
|
* the process to which the service applies
|
||||||
* @param service
|
* @param service
|
||||||
|
@ -216,7 +217,8 @@ public class RemoteConnectionType implements IRemoteConnectionType {
|
||||||
IConfigurationElement ce = processServiceDefinitionMap.get(service.getName());
|
IConfigurationElement ce = processServiceDefinitionMap.get(service.getName());
|
||||||
if (ce != null) {
|
if (ce != null) {
|
||||||
try {
|
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) {
|
if (factory != null) {
|
||||||
return factory.getService(process, service);
|
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
|
* Called from the remote service manager to register a service extension for
|
||||||
* this remote services implementation
|
* this remote services implementation
|
||||||
*
|
*
|
||||||
* @param ce
|
* @param ce
|
||||||
* the extension element defining the service
|
* the extension element defining the service
|
||||||
*/
|
*/
|
||||||
|
@ -267,7 +269,7 @@ public class RemoteConnectionType implements IRemoteConnectionType {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Signal connection has been added.
|
* Signal connection has been added.
|
||||||
*
|
*
|
||||||
* @since 2.0
|
* @since 2.0
|
||||||
*/
|
*/
|
||||||
protected void connectionAdded(final IRemoteConnection connection) {
|
protected void connectionAdded(final IRemoteConnection connection) {
|
||||||
|
@ -278,7 +280,7 @@ public class RemoteConnectionType implements IRemoteConnectionType {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Signal a connection is about to be removed.
|
* Signal a connection is about to be removed.
|
||||||
*
|
*
|
||||||
* @since 2.0
|
* @since 2.0
|
||||||
*/
|
*/
|
||||||
protected void connectionRemoved(final IRemoteConnection connection) {
|
protected void connectionRemoved(final IRemoteConnection connection) {
|
||||||
|
@ -296,7 +298,7 @@ public class RemoteConnectionType implements IRemoteConnectionType {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IRemoteConnection getConnection(URI uri) {
|
public IRemoteConnection getConnection(URI uri) {
|
||||||
synchronized (connections) {
|
synchronized (connections) {
|
||||||
IRemoteConnection connection = connections.get(uri.getAuthority());
|
IRemoteConnection connection = connections.get(uri.getAuthority());
|
||||||
if (connection != null) {
|
if (connection != null) {
|
||||||
return connection;
|
return connection;
|
||||||
|
@ -356,7 +358,8 @@ public class RemoteConnectionType implements IRemoteConnectionType {
|
||||||
connections.remove(conn.getName());
|
connections.remove(conn.getName());
|
||||||
connection.fireConnectionChangeEvent(RemoteConnectionChangeEvent.CONNECTION_REMOVED);
|
connection.fireConnectionChangeEvent(RemoteConnectionChangeEvent.CONNECTION_REMOVED);
|
||||||
} else {
|
} 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$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ public class RemoteCorePlugin extends Plugin {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the shared instance
|
* Returns the shared instance
|
||||||
*
|
*
|
||||||
* @return the shared instance
|
* @return the shared instance
|
||||||
*/
|
*/
|
||||||
public static RemoteCorePlugin getDefault() {
|
public static RemoteCorePlugin getDefault() {
|
||||||
|
@ -54,7 +54,7 @@ public class RemoteCorePlugin extends Plugin {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Logs the specified status with this plug-in's log.
|
* Logs the specified status with this plug-in's log.
|
||||||
*
|
*
|
||||||
* @param status
|
* @param status
|
||||||
* status to log
|
* status to log
|
||||||
*/
|
*/
|
||||||
|
@ -64,7 +64,7 @@ public class RemoteCorePlugin extends Plugin {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Logs an internal error with the specified message.
|
* Logs an internal error with the specified message.
|
||||||
*
|
*
|
||||||
* @param message
|
* @param message
|
||||||
* the error message to log
|
* the error message to log
|
||||||
*/
|
*/
|
||||||
|
@ -74,7 +74,7 @@ public class RemoteCorePlugin extends Plugin {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Logs an internal error with the specified throwable
|
* Logs an internal error with the specified throwable
|
||||||
*
|
*
|
||||||
* @param e
|
* @param e
|
||||||
* the exception to be logged
|
* the exception to be logged
|
||||||
*/
|
*/
|
||||||
|
@ -84,7 +84,7 @@ public class RemoteCorePlugin extends Plugin {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the OSGi service with the given service interface.
|
* Return the OSGi service with the given service interface.
|
||||||
*
|
*
|
||||||
* @param service service interface
|
* @param service service interface
|
||||||
* @return the specified service or null if it's not registered
|
* @return the specified service or null if it's not registered
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -78,7 +78,7 @@ public class RemoteDebugOptions implements DebugOptionsListener {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prints the given message to System.out and to the OSGi tracing (if enabled)
|
* Prints the given message to System.out and to the OSGi tracing (if enabled)
|
||||||
*
|
*
|
||||||
* @param message
|
* @param message
|
||||||
* the message or <code>null</code>
|
* 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)
|
* Prints the given message to System.out and to the OSGi tracing (if enabled)
|
||||||
*
|
*
|
||||||
* @param option
|
* @param option
|
||||||
* the option to determine if tracing is displayed
|
* the option to determine if tracing is displayed
|
||||||
* @param message
|
* @param message
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM Corporation - initial API and implementation
|
* IBM Corporation - initial API and implementation
|
||||||
* Patrick Tasse - Add extra constructor to Path class (bug 454959)
|
* 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.Assert;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Eclipse Mars implementation of <code>org.eclipse.core.runtime.Path</code>.
|
* The Eclipse Mars implementation of <code>org.eclipse.core.runtime.Path</code>.
|
||||||
*
|
*
|
||||||
* Cloned from org.eclipse.equinox.common. This class should be removed when
|
* Cloned from org.eclipse.equinox.common. This class should be removed when
|
||||||
* Eclipse older than Mars no longer needs to be supported.
|
* Eclipse older than Mars no longer needs to be supported.
|
||||||
*
|
*
|
||||||
* @see org.eclipse.core.runtime.Path
|
* @see org.eclipse.core.runtime.Path
|
||||||
* @noextend This class is not intended to be subclassed by clients.
|
* @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) */
|
/** flags indicating separators (has leading, is UNC, has trailing, is for Windows) */
|
||||||
private int flags;
|
private int flags;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new path from the given string path.
|
* Constructs a new path from the given string path.
|
||||||
* The string path must represent a valid file system 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
|
* The path is canonicalized and double slashes are removed
|
||||||
* except at the beginning. (to handle UNC paths). All forward
|
* except at the beginning. (to handle UNC paths). All forward
|
||||||
* slashes ('/') are treated as segment delimiters, and any
|
* slashes ('/') are treated as segment delimiters, and any
|
||||||
|
@ -88,7 +88,7 @@ public class RemotePath implements IPath, Cloneable {
|
||||||
return new RemotePath(pathString);
|
return new RemotePath(pathString);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new path from the given path string.
|
* Constructs a new path from the given path string.
|
||||||
* The path string must have been produced by a previous
|
* The path string must have been produced by a previous
|
||||||
* call to <code>IPath.toPortableString</code>.
|
* call to <code>IPath.toPortableString</code>.
|
||||||
|
@ -164,10 +164,10 @@ public class RemotePath implements IPath, Cloneable {
|
||||||
// not allowed
|
// not allowed
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new path from the given string path.
|
* Constructs a new path from the given string path.
|
||||||
* The string path must represent a valid file system 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
|
* The path is canonicalized and double slashes are removed
|
||||||
* except at the beginning. (to handle UNC paths). All forward
|
* except at the beginning. (to handle UNC paths). All forward
|
||||||
* slashes ('/') are treated as segment delimiters, and any
|
* slashes ('/') are treated as segment delimiters, and any
|
||||||
|
@ -182,7 +182,7 @@ public class RemotePath implements IPath, Cloneable {
|
||||||
this(fullPath, RUNNING_ON_WINDOWS);
|
this(fullPath, RUNNING_ON_WINDOWS);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new path from the given device id and string path.
|
* Constructs a new path from the given device id and string path.
|
||||||
* The given string path must be valid.
|
* The given string path must be valid.
|
||||||
* The path is canonicalized and double slashes are removed except
|
* 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);
|
initialize(device, path, RUNNING_ON_WINDOWS);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new path from the given string path. The string path must
|
* 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
|
* represent a valid file system path on the specified file system. The path
|
||||||
* is canonicalized and double slashes are removed except at the beginning
|
* is canonicalized and double slashes are removed except at the beginning
|
||||||
|
@ -238,7 +238,7 @@ public class RemotePath implements IPath, Cloneable {
|
||||||
* Private constructor.
|
* Private constructor.
|
||||||
*/
|
*/
|
||||||
private RemotePath(String device, String[] segments, int flags) {
|
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.segments = segments;
|
||||||
this.device = device;
|
this.device = device;
|
||||||
//hash code is cached in all but the bottom four bits of the flags field
|
//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);
|
newSegments[myLen + i] = tail.segment(i);
|
||||||
}
|
}
|
||||||
//use my leading separators and the tail's trailing separator
|
//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];
|
String tailFirstSegment = newSegments[myLen];
|
||||||
if (tailFirstSegment.equals("..") || tailFirstSegment.equals(".")) { //$NON-NLS-1$ //$NON-NLS-2$
|
if (tailFirstSegment.equals("..") || tailFirstSegment.equals(".")) { //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
result.canonicalize();
|
result.canonicalize();
|
||||||
|
@ -383,7 +384,7 @@ public class RemotePath implements IPath, Cloneable {
|
||||||
String segment = segments[i];
|
String segment = segments[i];
|
||||||
if (segment.equals("..")) { //$NON-NLS-1$
|
if (segment.equals("..")) { //$NON-NLS-1$
|
||||||
if (stackPointer == 0) {
|
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
|
// 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
|
// path is relative. If it is absolute then we can't go any higher than
|
||||||
// root so simply toss the .. references.
|
// 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))
|
if (firstPosition == 1 && len > 1 && (path.charAt(1) == SEPARATOR))
|
||||||
firstPosition = 2;
|
firstPosition = 2;
|
||||||
int lastPosition = (path.charAt(len - 1) != SEPARATOR) ? len - 1 : len - 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
|
// the number of slashes plus 1, ignoring any leading
|
||||||
// and trailing slashes
|
// and trailing slashes
|
||||||
int next = firstPosition;
|
int next = firstPosition;
|
||||||
|
@ -1070,7 +1071,8 @@ public class RemotePath implements IPath, Cloneable {
|
||||||
@Override
|
@Override
|
||||||
public IPath setDevice(String value) {
|
public IPath setDevice(String value) {
|
||||||
if (value != null) {
|
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
|
//return the receiver if the device is the same
|
||||||
if (value == device || (value != null && value.equals(device)))
|
if (value == device || (value != null && value.equals(device)))
|
||||||
|
|
|
@ -17,9 +17,9 @@ import org.eclipse.remote.core.IRemoteResource;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Factory to create an IRemoteResource
|
* Factory to create an IRemoteResource
|
||||||
*
|
*
|
||||||
* @author greg
|
* @author greg
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class RemoteResourceFactory {
|
public class RemoteResourceFactory {
|
||||||
private final IConfigurationElement fConfigElement;
|
private final IConfigurationElement fConfigElement;
|
||||||
|
@ -30,7 +30,7 @@ public class RemoteResourceFactory {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the remote resource associated with the platform resource.
|
* Get the remote resource associated with the platform resource.
|
||||||
*
|
*
|
||||||
* @return IRemoteResource
|
* @return IRemoteResource
|
||||||
*/
|
*/
|
||||||
public IRemoteResource getRemoteResource(IResource resource) {
|
public IRemoteResource getRemoteResource(IResource resource) {
|
||||||
|
|
|
@ -35,7 +35,7 @@ import org.osgi.service.prefs.Preferences;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The implementation for the remote services manager service.
|
* The implementation for the remote services manager service.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class RemoteServicesManager implements IRemoteServicesManager {
|
public class RemoteServicesManager implements IRemoteServicesManager {
|
||||||
|
|
||||||
|
@ -83,7 +83,8 @@ public class RemoteServicesManager implements IRemoteServicesManager {
|
||||||
for (IExtension ext : point.getExtensions()) {
|
for (IExtension ext : point.getExtensions()) {
|
||||||
for (IConfigurationElement ce : ext.getConfigurationElements()) {
|
for (IConfigurationElement ce : ext.getConfigurationElements()) {
|
||||||
String name = ce.getName();
|
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$
|
String id = ce.getAttribute("connectionTypeId"); //$NON-NLS-1$
|
||||||
RemoteConnectionType services = connectionTypeMap.get(id);
|
RemoteConnectionType services = connectionTypeMap.get(id);
|
||||||
if (services != null) {
|
if (services != null) {
|
||||||
|
@ -95,7 +96,8 @@ public class RemoteServicesManager implements IRemoteServicesManager {
|
||||||
|
|
||||||
// Init connection providers
|
// Init connection providers
|
||||||
for (IRemoteConnectionType connectionType : connectionTypeMap.values()) {
|
for (IRemoteConnectionType connectionType : connectionTypeMap.values()) {
|
||||||
IRemoteConnectionProviderService providerService = connectionType.getService(IRemoteConnectionProviderService.class);
|
IRemoteConnectionProviderService providerService = connectionType
|
||||||
|
.getService(IRemoteConnectionProviderService.class);
|
||||||
if (providerService != null) {
|
if (providerService != null) {
|
||||||
providerService.init();
|
providerService.init();
|
||||||
}
|
}
|
||||||
|
@ -135,7 +137,8 @@ public class RemoteServicesManager implements IRemoteServicesManager {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SafeVarargs
|
@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>();
|
List<IRemoteConnectionType> connTypes = new ArrayList<IRemoteConnectionType>();
|
||||||
for (IRemoteConnectionType connType : getAllConnectionTypes()) {
|
for (IRemoteConnectionType connType : getAllConnectionTypes()) {
|
||||||
for (Class<? extends IRemoteConnection.Service> service : services) {
|
for (Class<? extends IRemoteConnection.Service> service : services) {
|
||||||
|
@ -150,7 +153,8 @@ public class RemoteServicesManager implements IRemoteServicesManager {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SafeVarargs
|
@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>();
|
List<IRemoteConnectionType> connTypes = new ArrayList<IRemoteConnectionType>();
|
||||||
for (IRemoteConnectionType connType : getAllConnectionTypes()) {
|
for (IRemoteConnectionType connType : getAllConnectionTypes()) {
|
||||||
for (Class<? extends IRemoteConnectionType.Service> service : services) {
|
for (Class<? extends IRemoteConnectionType.Service> service : services) {
|
||||||
|
|
|
@ -19,12 +19,12 @@ public class RemoteLaunchConfigService implements IRemoteLaunchConfigService {
|
||||||
private Preferences getPreferences(String node) {
|
private Preferences getPreferences(String node) {
|
||||||
return InstanceScope.INSTANCE.getNode(RemoteCorePlugin.getUniqueIdentifier()).node(node);
|
return InstanceScope.INSTANCE.getNode(RemoteCorePlugin.getUniqueIdentifier()).node(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
private IRemoteConnection getRemoteConnection(String remoteId) {
|
private IRemoteConnection getRemoteConnection(String remoteId) {
|
||||||
if (remoteId == null) {
|
if (remoteId == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
String[] ids = remoteId.split(":"); //$NON-NLS-1$
|
String[] ids = remoteId.split(":"); //$NON-NLS-1$
|
||||||
if (ids.length < 2) {
|
if (ids.length < 2) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -35,7 +35,7 @@ public class RemoteLaunchConfigService implements IRemoteLaunchConfigService {
|
||||||
if (connectionType == null) {
|
if (connectionType == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return connectionType.getConnection(ids[1]);
|
return connectionType.getConnection(ids[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ public class RemoteLaunchConfigService implements IRemoteLaunchConfigService {
|
||||||
RemoteCorePlugin.log(e.getStatus());
|
RemoteCorePlugin.log(e.getStatus());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IRemoteConnection getActiveConnection(ILaunchConfiguration launchConfig) {
|
public IRemoteConnection getActiveConnection(ILaunchConfiguration launchConfig) {
|
||||||
String remoteId = getPreferences(REMOTE_LAUNCH_CONFIG).get(launchConfig.getName(), null);
|
String remoteId = getPreferences(REMOTE_LAUNCH_CONFIG).get(launchConfig.getName(), null);
|
||||||
|
|
|
@ -16,7 +16,7 @@ import org.eclipse.remote.core.IRemotePreferenceConstants;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class used to initialize default preference values.
|
* Class used to initialize default preference values.
|
||||||
*
|
*
|
||||||
* @since 6.0
|
* @since 6.0
|
||||||
*/
|
*/
|
||||||
public class PreferenceInitializer extends AbstractPreferenceInitializer {
|
public class PreferenceInitializer extends AbstractPreferenceInitializer {
|
||||||
|
|
|
@ -22,13 +22,14 @@ import org.osgi.service.prefs.BackingStoreException;
|
||||||
/**
|
/**
|
||||||
* Convenience class to facilitate using the new {@link IEclipsePreferences} story. Adapted from
|
* Convenience class to facilitate using the new {@link IEclipsePreferences} story. Adapted from
|
||||||
* org.eclipse.debug.internal.core.Preferences.
|
* org.eclipse.debug.internal.core.Preferences.
|
||||||
*
|
*
|
||||||
* @since 5.0
|
* @since 5.0
|
||||||
* @noinstantiate This class is not intended to be instantiated by clients.
|
* @noinstantiate This class is not intended to be instantiated by clients.
|
||||||
*/
|
*/
|
||||||
public final class Preferences {
|
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 DEFAULT_CONTEXT = 0;
|
||||||
private static final int INSTANCE_CONTEXT = 1;
|
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}
|
* Adds the given preference listener to the {@link DefaultScope} and the {@link InstanceScope}
|
||||||
*
|
*
|
||||||
* @param listener
|
* @param listener
|
||||||
*/
|
*/
|
||||||
public static void addPreferenceChangeListener(IPreferenceChangeListener 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.
|
* Returns whether the named preference is know in the preference store.
|
||||||
*
|
*
|
||||||
* @param name
|
* @param name
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static boolean contains(String name) {
|
public static boolean contains(String name) {
|
||||||
return (contexts[INSTANCE_CONTEXT].getNode(fQualifier).get(name, null) != null || contexts[DEFAULT_CONTEXT].getNode(
|
return (contexts[INSTANCE_CONTEXT].getNode(fQualifier).get(name, null) != null
|
||||||
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
|
* 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
|
* is not defined then return the default value. Use the canonical scope
|
||||||
* lookup order for finding the preference value.
|
* lookup order for finding the preference value.
|
||||||
*
|
*
|
||||||
* @param key
|
* @param key
|
||||||
* @param defaultvalue
|
* @param defaultvalue
|
||||||
*
|
*
|
||||||
* @return the value of the preference or the given default value
|
* @return the value of the preference or the given default value
|
||||||
*/
|
*/
|
||||||
public static boolean getBoolean(String key) {
|
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
|
* 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
|
* is not defined then return the default value. Use the canonical scope
|
||||||
* lookup order for finding the preference value.
|
* lookup order for finding the preference value.
|
||||||
*
|
*
|
||||||
* @param key
|
* @param key
|
||||||
* @param defaultvalue
|
* @param defaultvalue
|
||||||
*
|
*
|
||||||
* @return the value of the preference or the given default value
|
* @return the value of the preference or the given default value
|
||||||
*/
|
*/
|
||||||
public static byte[] getByteArray(String key) {
|
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
|
* 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
|
* the given key or the specified default value if the key does not appear
|
||||||
* in the {@link DefaultScope}
|
* in the {@link DefaultScope}
|
||||||
*
|
*
|
||||||
* @param key
|
* @param key
|
||||||
* @param defaultvalue
|
* @param defaultvalue
|
||||||
*
|
*
|
||||||
* @return the boolean value set in the {@link DefaultScope} for the given
|
* @return the boolean value set in the {@link DefaultScope} for the given
|
||||||
* key, or the specified default value.
|
* 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
|
* 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
|
* the key does not
|
||||||
* appear in the {@link DefaultScope}
|
* appear in the {@link DefaultScope}
|
||||||
*
|
*
|
||||||
* @param key
|
* @param key
|
||||||
* @param defaultvalue
|
* @param defaultvalue
|
||||||
*
|
*
|
||||||
* @return the byte array value set in the {@link DefaultScope} for the
|
* @return the byte array value set in the {@link DefaultScope} for the
|
||||||
* given key, or the specified default value.
|
* 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
|
* 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
|
* the given key or the specified default value if the key does not appear
|
||||||
* in the {@link DefaultScope}
|
* in the {@link DefaultScope}
|
||||||
*
|
*
|
||||||
* @param key
|
* @param key
|
||||||
* @param defaultvalue
|
* @param defaultvalue
|
||||||
*
|
*
|
||||||
* @return the double value set in the {@link DefaultScope} for the given
|
* @return the double value set in the {@link DefaultScope} for the given
|
||||||
* key, or the specified default value.
|
* 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
|
* 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
|
* the given key or the specified default value if the key does not appear
|
||||||
* in the {@link DefaultScope}
|
* in the {@link DefaultScope}
|
||||||
*
|
*
|
||||||
* @param key
|
* @param key
|
||||||
* @param defaultvalue
|
* @param defaultvalue
|
||||||
*
|
*
|
||||||
* @return the float value set in the {@link DefaultScope} for the given
|
* @return the float value set in the {@link DefaultScope} for the given
|
||||||
* key, or the specified default value.
|
* 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
|
* 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
|
* the given key or the specified default value if the key does not appear
|
||||||
* in the {@link DefaultScope}
|
* in the {@link DefaultScope}
|
||||||
*
|
*
|
||||||
* @param key
|
* @param key
|
||||||
* @param defaultvalue
|
* @param defaultvalue
|
||||||
*
|
*
|
||||||
* @return the integer value set in the {@link DefaultScope} for the given
|
* @return the integer value set in the {@link DefaultScope} for the given
|
||||||
* key, or the specified default value.
|
* 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
|
* 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
|
* given key or the specified default value if the key does not appear in
|
||||||
* the {@link DefaultScope}
|
* the {@link DefaultScope}
|
||||||
*
|
*
|
||||||
* @param key
|
* @param key
|
||||||
* @param defaultvalue
|
* @param defaultvalue
|
||||||
*
|
*
|
||||||
* @return the long value set in the {@link DefaultScope} for the given key,
|
* @return the long value set in the {@link DefaultScope} for the given key,
|
||||||
* or the specified default value.
|
* or the specified default value.
|
||||||
*/
|
*/
|
||||||
|
@ -178,10 +179,10 @@ public final class Preferences {
|
||||||
* Returns the default string value stored in the {@link DefaultScope} for
|
* 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
|
* the given key or the specified default value if the key does not appear
|
||||||
* in the {@link DefaultScope}
|
* in the {@link DefaultScope}
|
||||||
*
|
*
|
||||||
* @param key
|
* @param key
|
||||||
* @param defaultvalue
|
* @param defaultvalue
|
||||||
*
|
*
|
||||||
* @return the string value set in the {@link DefaultScope} for the given
|
* @return the string value set in the {@link DefaultScope} for the given
|
||||||
* key, or the specified default value.
|
* 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
|
* 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
|
* is not defined then return the default value. Use the canonical scope
|
||||||
* lookup order for finding the preference value.
|
* lookup order for finding the preference value.
|
||||||
*
|
*
|
||||||
* @param key
|
* @param key
|
||||||
* @param defaultvalue
|
* @param defaultvalue
|
||||||
*
|
*
|
||||||
* @return the value of the preference or the given default value
|
* @return the value of the preference or the given default value
|
||||||
*/
|
*/
|
||||||
public static double getDouble(String key) {
|
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
|
* 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
|
* is not defined then return the default value. Use the canonical scope
|
||||||
* lookup order for finding the preference value.
|
* lookup order for finding the preference value.
|
||||||
*
|
*
|
||||||
* @param fQualifier
|
* @param fQualifier
|
||||||
* @param key
|
* @param key
|
||||||
* @param defaultvalue
|
* @param defaultvalue
|
||||||
*
|
*
|
||||||
* @return the value of the preference or the given default value
|
* @return the value of the preference or the given default value
|
||||||
*/
|
*/
|
||||||
public static float getFloat(String key) {
|
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
|
* 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
|
* is not defined then return the default value. Use the canonical scope
|
||||||
* lookup order for finding the preference value.
|
* lookup order for finding the preference value.
|
||||||
*
|
*
|
||||||
* @param fQualifier
|
* @param fQualifier
|
||||||
* @param key
|
* @param key
|
||||||
* @param defaultvalue
|
* @param defaultvalue
|
||||||
*
|
*
|
||||||
* @return the value of the preference or the given default value
|
* @return the value of the preference or the given default value
|
||||||
*/
|
*/
|
||||||
public static int getInt(String key) {
|
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
|
* 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
|
* is not defined then return the default value. Use the canonical scope
|
||||||
* lookup order for finding the preference value.
|
* lookup order for finding the preference value.
|
||||||
*
|
*
|
||||||
* @param key
|
* @param key
|
||||||
* @param defaultvalue
|
* @param defaultvalue
|
||||||
*
|
*
|
||||||
* @return the value of the preference or the given default value
|
* @return the value of the preference or the given default value
|
||||||
*/
|
*/
|
||||||
public static long getLong(String key) {
|
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
|
* 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
|
* is not defined then return the default value. Use the canonical scope
|
||||||
* lookup order for finding the preference value.
|
* lookup order for finding the preference value.
|
||||||
*
|
*
|
||||||
* @param key
|
* @param key
|
||||||
* @param defaultvalue
|
* @param defaultvalue
|
||||||
*
|
*
|
||||||
* @return the value of the preference or the given default value
|
* @return the value of the preference or the given default value
|
||||||
*/
|
*/
|
||||||
public static String getString(String key) {
|
public static String getString(String key) {
|
||||||
|
@ -263,7 +264,7 @@ public final class Preferences {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if the named preference has the default value.
|
* Returns true if the named preference has the default value.
|
||||||
*
|
*
|
||||||
* @param name
|
* @param name
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@ -279,7 +280,7 @@ public final class Preferences {
|
||||||
/**
|
/**
|
||||||
* Removes the given preference listener from the {@link DefaultScope} and
|
* Removes the given preference listener from the {@link DefaultScope} and
|
||||||
* the {@link InstanceScope}
|
* the {@link InstanceScope}
|
||||||
*
|
*
|
||||||
* @param listener
|
* @param listener
|
||||||
*/
|
*/
|
||||||
public static void removePreferenceChangeListener(IPreferenceChangeListener listener) {
|
public static void removePreferenceChangeListener(IPreferenceChangeListener listener) {
|
||||||
|
@ -302,7 +303,7 @@ public final class Preferences {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets a boolean preference in the {@link InstanceScope}.
|
* Sets a boolean preference in the {@link InstanceScope}.
|
||||||
*
|
*
|
||||||
* @param key
|
* @param key
|
||||||
* the key
|
* the key
|
||||||
* @param value
|
* @param value
|
||||||
|
@ -314,7 +315,7 @@ public final class Preferences {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets a byte array preference in the {@link InstanceScope}.
|
* Sets a byte array preference in the {@link InstanceScope}.
|
||||||
*
|
*
|
||||||
* @param key
|
* @param key
|
||||||
* the key
|
* the key
|
||||||
* @param value
|
* @param value
|
||||||
|
@ -326,7 +327,7 @@ public final class Preferences {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets a boolean in the {@link DefaultScope}
|
* Sets a boolean in the {@link DefaultScope}
|
||||||
*
|
*
|
||||||
* @param key
|
* @param key
|
||||||
* the key
|
* the key
|
||||||
* @param value
|
* @param value
|
||||||
|
@ -338,7 +339,7 @@ public final class Preferences {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets a byte array in the {@link DefaultScope}
|
* Sets a byte array in the {@link DefaultScope}
|
||||||
*
|
*
|
||||||
* @param key
|
* @param key
|
||||||
* the key
|
* the key
|
||||||
* @param value
|
* @param value
|
||||||
|
@ -350,7 +351,7 @@ public final class Preferences {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets a double in the {@link DefaultScope}
|
* Sets a double in the {@link DefaultScope}
|
||||||
*
|
*
|
||||||
* @param key
|
* @param key
|
||||||
* the key
|
* the key
|
||||||
* @param value
|
* @param value
|
||||||
|
@ -362,7 +363,7 @@ public final class Preferences {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets a float in the {@link DefaultScope}
|
* Sets a float in the {@link DefaultScope}
|
||||||
*
|
*
|
||||||
* @param key
|
* @param key
|
||||||
* the key
|
* the key
|
||||||
* @param value
|
* @param value
|
||||||
|
@ -374,7 +375,7 @@ public final class Preferences {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets a integer in the {@link DefaultScope}
|
* Sets a integer in the {@link DefaultScope}
|
||||||
*
|
*
|
||||||
* @param key
|
* @param key
|
||||||
* the key
|
* the key
|
||||||
* @param value
|
* @param value
|
||||||
|
@ -386,7 +387,7 @@ public final class Preferences {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets a long in the {@link DefaultScope}
|
* Sets a long in the {@link DefaultScope}
|
||||||
*
|
*
|
||||||
* @param key
|
* @param key
|
||||||
* the key
|
* the key
|
||||||
* @param value
|
* @param value
|
||||||
|
@ -398,7 +399,7 @@ public final class Preferences {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets a string in the {@link DefaultScope}
|
* Sets a string in the {@link DefaultScope}
|
||||||
*
|
*
|
||||||
* @param key
|
* @param key
|
||||||
* the key
|
* the key
|
||||||
* @param value
|
* @param value
|
||||||
|
@ -410,7 +411,7 @@ public final class Preferences {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets a double preference in the {@link InstanceScope}.
|
* Sets a double preference in the {@link InstanceScope}.
|
||||||
*
|
*
|
||||||
* @param key
|
* @param key
|
||||||
* the key
|
* the key
|
||||||
* @param value
|
* @param value
|
||||||
|
@ -422,7 +423,7 @@ public final class Preferences {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets a float preference in the {@link InstanceScope}.
|
* Sets a float preference in the {@link InstanceScope}.
|
||||||
*
|
*
|
||||||
* @param key
|
* @param key
|
||||||
* the key
|
* the key
|
||||||
* @param value
|
* @param value
|
||||||
|
@ -434,7 +435,7 @@ public final class Preferences {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets a integer preference in the {@link InstanceScope}.
|
* Sets a integer preference in the {@link InstanceScope}.
|
||||||
*
|
*
|
||||||
* @param key
|
* @param key
|
||||||
* the key
|
* the key
|
||||||
* @param value
|
* @param value
|
||||||
|
@ -446,7 +447,7 @@ public final class Preferences {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets a long preference in the {@link InstanceScope}.
|
* Sets a long preference in the {@link InstanceScope}.
|
||||||
*
|
*
|
||||||
* @param key
|
* @param key
|
||||||
* the key
|
* the key
|
||||||
* @param value
|
* @param value
|
||||||
|
@ -458,7 +459,7 @@ public final class Preferences {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets a string preference in the {@link InstanceScope}.
|
* Sets a string preference in the {@link InstanceScope}.
|
||||||
*
|
*
|
||||||
* @param key
|
* @param key
|
||||||
* the key
|
* the key
|
||||||
* @param value
|
* @param value
|
||||||
|
@ -472,7 +473,7 @@ public final class Preferences {
|
||||||
* Sets the given preference to its default value. This is done by removing
|
* 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
|
* any set value from the {@link InstanceScope}. Has no effect if the given
|
||||||
* key is <code>null</code>.
|
* key is <code>null</code>.
|
||||||
*
|
*
|
||||||
* @param key
|
* @param key
|
||||||
* the key for the preference
|
* the key for the preference
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -41,7 +41,7 @@ public class LocalCommandShellService implements IRemoteCommandShellService {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IRemoteConnection getRemoteConnection() {
|
public IRemoteConnection getRemoteConnection() {
|
||||||
return connection;
|
return connection;
|
||||||
|
|
|
@ -19,9 +19,9 @@ import org.eclipse.remote.internal.core.RemoteCorePlugin;
|
||||||
public class LocalConnectionProviderService implements IRemoteConnectionProviderService {
|
public class LocalConnectionProviderService implements IRemoteConnectionProviderService {
|
||||||
|
|
||||||
private static final String localConnectionName = Messages.LocalConnectionProviderService_LocalConnectionName;
|
private static final String localConnectionName = Messages.LocalConnectionProviderService_LocalConnectionName;
|
||||||
|
|
||||||
private IRemoteConnectionType connectionType;
|
private IRemoteConnectionType connectionType;
|
||||||
|
|
||||||
public static class Factory implements IRemoteConnectionType.Service.Factory {
|
public static class Factory implements IRemoteConnectionType.Service.Factory {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
|
@ -32,7 +32,7 @@ public class LocalConnectionProviderService implements IRemoteConnectionProvider
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public LocalConnectionProviderService(IRemoteConnectionType connectionType) {
|
public LocalConnectionProviderService(IRemoteConnectionType connectionType) {
|
||||||
this.connectionType = connectionType;
|
this.connectionType = connectionType;
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,7 @@ public class LocalProcess implements IRemoteProcessControlService, IRemoteProces
|
||||||
/**
|
/**
|
||||||
* Thread to merge stdout and stderr. Keeps refcount so that output stream
|
* Thread to merge stdout and stderr. Keeps refcount so that output stream
|
||||||
* is not closed too early.
|
* is not closed too early.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private class ProcOutputMerger implements Runnable {
|
private class ProcOutputMerger implements Runnable {
|
||||||
private final static int BUF_SIZE = 8192;
|
private final static int BUF_SIZE = 8192;
|
||||||
|
|
|
@ -124,7 +124,8 @@ public class LocalProcessBuilder extends AbstractRemoteProcessBuilder {
|
||||||
|
|
||||||
private IProcessFactory getProcessFactory() {
|
private IProcessFactory getProcessFactory() {
|
||||||
IExtensionRegistry registry = Platform.getExtensionRegistry();
|
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;
|
IProcessFactory processFactory = null;
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ public class Activator extends Plugin {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the shared instance
|
* Returns the shared instance
|
||||||
*
|
*
|
||||||
* @return the shared instance
|
* @return the shared instance
|
||||||
*/
|
*/
|
||||||
public static Activator getDefault() {
|
public static Activator getDefault() {
|
||||||
|
@ -29,7 +29,7 @@ public class Activator extends Plugin {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get unique identifier
|
* Get unique identifier
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
* @since 5.0
|
* @since 5.0
|
||||||
*/
|
*/
|
||||||
|
@ -42,7 +42,7 @@ public class Activator extends Plugin {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Logs the specified status with this plug-in's log.
|
* Logs the specified status with this plug-in's log.
|
||||||
*
|
*
|
||||||
* @param status
|
* @param status
|
||||||
* status to log
|
* status to log
|
||||||
*/
|
*/
|
||||||
|
@ -52,7 +52,7 @@ public class Activator extends Plugin {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Logs an internal error with the specified message.
|
* Logs an internal error with the specified message.
|
||||||
*
|
*
|
||||||
* @param message
|
* @param message
|
||||||
* the error message to log
|
* the error message to log
|
||||||
*/
|
*/
|
||||||
|
@ -62,7 +62,7 @@ public class Activator extends Plugin {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Logs an internal error with the specified throwable
|
* Logs an internal error with the specified throwable
|
||||||
*
|
*
|
||||||
* @param e
|
* @param e
|
||||||
* the exception to be logged
|
* the exception to be logged
|
||||||
*/
|
*/
|
||||||
|
@ -80,7 +80,7 @@ public class Activator extends Plugin {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the OSGi service with the given service interface.
|
* Return the OSGi service with the given service interface.
|
||||||
*
|
*
|
||||||
* @param service service interface
|
* @param service service interface
|
||||||
* @return the specified service or null if it's not registered
|
* @return the specified service or null if it's not registered
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -51,7 +51,8 @@ public class ArgumentParser {
|
||||||
* string. Allows escaping.
|
* string. Allows escaping.
|
||||||
*/
|
*/
|
||||||
iterator.next(); // Skip quote
|
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();
|
char innerChar = iterator.current();
|
||||||
switch (innerChar) {
|
switch (innerChar) {
|
||||||
case '\\':
|
case '\\':
|
||||||
|
|
|
@ -51,8 +51,9 @@ import com.jcraft.jsch.Session;
|
||||||
/**
|
/**
|
||||||
* @since 5.0
|
* @since 5.0
|
||||||
*/
|
*/
|
||||||
public class JSchConnection implements IRemoteConnectionControlService, IRemoteConnectionPropertyService,
|
public class JSchConnection
|
||||||
IRemotePortForwardingService, IRemoteProcessService, IRemoteConnectionHostService, IRemoteConnectionChangeListener {
|
implements IRemoteConnectionControlService, IRemoteConnectionPropertyService, IRemotePortForwardingService,
|
||||||
|
IRemoteProcessService, IRemoteConnectionHostService, IRemoteConnectionChangeListener {
|
||||||
// Connection Type ID
|
// Connection Type ID
|
||||||
public static final String JSCH_ID = "org.eclipse.remote.JSch"; //$NON-NLS-1$
|
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;
|
return (T) jschConnection;
|
||||||
}
|
}
|
||||||
} else if (IRemoteConnectionControlService.class.equals(service)
|
} else if (IRemoteConnectionControlService.class.equals(service)
|
||||||
|| IRemoteConnectionPropertyService.class.equals(service) || IRemotePortForwardingService.class.equals(service)
|
|| IRemoteConnectionPropertyService.class.equals(service)
|
||||||
|| IRemoteProcessService.class.equals(service) || IRemoteConnectionHostService.class.equals(service)) {
|
|| IRemotePortForwardingService.class.equals(service) || IRemoteProcessService.class.equals(service)
|
||||||
|
|| IRemoteConnectionHostService.class.equals(service)) {
|
||||||
return (T) connection.getService(JSchConnection.class);
|
return (T) connection.getService(JSchConnection.class);
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
|
@ -230,7 +232,8 @@ public class JSchConnection implements IRemoteConnectionControlService, IRemoteC
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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()) {
|
if (!isOpen()) {
|
||||||
throw new RemoteConnectionException(Messages.JSchConnection_connectionNotOpen);
|
throw new RemoteConnectionException(Messages.JSchConnection_connectionNotOpen);
|
||||||
}
|
}
|
||||||
|
@ -272,7 +275,8 @@ public class JSchConnection implements IRemoteConnectionControlService, IRemoteC
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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()) {
|
if (!isOpen()) {
|
||||||
throw new RemoteConnectionException(Messages.JSchConnection_connectionNotOpen);
|
throw new RemoteConnectionException(Messages.JSchConnection_connectionNotOpen);
|
||||||
}
|
}
|
||||||
|
@ -426,7 +430,8 @@ public class JSchConnection implements IRemoteConnectionControlService, IRemoteC
|
||||||
if (proxyConnectionName.isEmpty()) {
|
if (proxyConnectionName.isEmpty()) {
|
||||||
return null;
|
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
|
* 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
|
* state being preserved and should not be closed. Long running commands (such as get/put) should use a separate channel
|
||||||
* obtained via {#link #newSftpChannel()}.
|
* obtained via {#link #newSftpChannel()}.
|
||||||
*
|
*
|
||||||
* Always use the second session if available.
|
* Always use the second session if available.
|
||||||
*
|
*
|
||||||
* @return sftp channel
|
* @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.
|
* Open a channel for long running commands. This channel should be closed when the command is completed.
|
||||||
*
|
*
|
||||||
* @return sftp channel
|
* @return sftp channel
|
||||||
* @throws RemoteConnectionException
|
* @throws RemoteConnectionException
|
||||||
* if a channel could not be opened
|
* if a channel could not be opened
|
||||||
|
@ -680,12 +685,15 @@ public class JSchConnection implements IRemoteConnectionControlService, IRemoteC
|
||||||
IRemoteConnectionWorkingCopy wc = getRemoteConnection().getWorkingCopy();
|
IRemoteConnectionWorkingCopy wc = getRemoteConnection().getWorkingCopy();
|
||||||
IRemoteConnectionHostService hostService = wc.getService(IRemoteConnectionHostService.class);
|
IRemoteConnectionHostService hostService = wc.getService(IRemoteConnectionHostService.class);
|
||||||
IUserAuthenticatorService authService = wc.getService(IUserAuthenticatorService.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));
|
session.setUserInfo(new JSchUserInfo(hostService, authService));
|
||||||
if (hostService.usePassword()) {
|
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 {
|
} 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();
|
String password = hostService.getPassword();
|
||||||
if (!password.isEmpty()) {
|
if (!password.isEmpty()) {
|
||||||
|
@ -695,11 +703,12 @@ public class JSchConnection implements IRemoteConnectionControlService, IRemoteC
|
||||||
fJSchService.connect(session, getTimeout() * 1000, progress.newChild(10)); // connect without proxy
|
fJSchService.connect(session, getTimeout() * 1000, progress.newChild(10)); // connect without proxy
|
||||||
} else {
|
} else {
|
||||||
if (getProxyCommand().isEmpty()) {
|
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));
|
fJSchService.connect(session, getTimeout() * 1000, progress.newChild(10));
|
||||||
} else {
|
} else {
|
||||||
session.setProxy(JSchConnectionProxyFactory.createCommandProxy(getProxyConnection(), getProxyCommand(),
|
session.setProxy(JSchConnectionProxyFactory.createCommandProxy(getProxyConnection(),
|
||||||
progress.newChild(10)));
|
getProxyCommand(), progress.newChild(10)));
|
||||||
session.connect(getTimeout() * 1000); // the fJSchService doesn't pass the timeout correctly
|
session.connect(getTimeout() * 1000); // the fJSchService doesn't pass the timeout correctly
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,8 +97,8 @@ public class JSchConnectionProxyFactory {
|
||||||
processBuilder.setPreamble(false);
|
processBuilder.setPreamble(false);
|
||||||
process = processBuilder.start();
|
process = processBuilder.start();
|
||||||
} else {
|
} else {
|
||||||
process = Activator.getService(IRemoteServicesManager.class).getLocalConnectionType().getConnections().get(0).
|
process = Activator.getService(IRemoteServicesManager.class).getLocalConnectionType().getConnections()
|
||||||
getService(IRemoteProcessService.class).getProcessBuilder(cmd).start();
|
.get(0).getService(IRemoteProcessService.class).getProcessBuilder(cmd).start();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wait on command to produce stdout output
|
// Wait on command to produce stdout output
|
||||||
|
@ -136,8 +136,8 @@ public class JSchConnectionProxyFactory {
|
||||||
} else if (bCanceled) {
|
} else if (bCanceled) {
|
||||||
cause = Messages.JSchConnectionProxyFactory_wasCanceled;
|
cause = Messages.JSchConnectionProxyFactory_wasCanceled;
|
||||||
}
|
}
|
||||||
throw new IOException(MessageFormat.format(Messages.JSchConnectionProxyFactory_ProxyCommandFailed, command,
|
throw new IOException(MessageFormat.format(Messages.JSchConnectionProxyFactory_ProxyCommandFailed,
|
||||||
cause, msg));
|
command, cause, msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dump the stderr to log
|
// Dump the stderr to log
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
/********************************************************************************
|
/********************************************************************************
|
||||||
* Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved.
|
* Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved.
|
||||||
* This program and the accompanying materials are made available under the terms
|
* 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
|
* available at http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Initial Contributors:
|
* Initial Contributors:
|
||||||
* The following IBM employees contributed to the Remote System Explorer
|
* The following IBM employees contributed to the Remote System Explorer
|
||||||
* component that contains this file: David McKnight, Kushal Munir,
|
* component that contains this file: David McKnight, Kushal Munir,
|
||||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* David Dykstal (IBM) - 168977: refactoring IConnectorService and ServerLauncher hierarchies
|
* David Dykstal (IBM) - 168977: refactoring IConnectorService and ServerLauncher hierarchies
|
||||||
* Kushal Munir (IBM) - moved to internal package
|
* Kushal Munir (IBM) - moved to internal package
|
||||||
|
@ -34,7 +34,7 @@ import org.eclipse.core.runtime.IPath;
|
||||||
public class JSchFileSystem extends FileSystem {
|
public class JSchFileSystem extends FileSystem {
|
||||||
/**
|
/**
|
||||||
* Return the connection name encoded in the URI.
|
* Return the connection name encoded in the URI.
|
||||||
*
|
*
|
||||||
* @param uri
|
* @param uri
|
||||||
* URI specifying a remote tools connection
|
* URI specifying a remote tools connection
|
||||||
* @return name of the connection or null if the URI is invalid
|
* @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.
|
* Return an URI uniquely naming a remote tools remote resource.
|
||||||
*
|
*
|
||||||
* @param connectionName
|
* @param connectionName
|
||||||
* remote tools connection name
|
* remote tools connection name
|
||||||
* @param path
|
* @param path
|
||||||
|
|
|
@ -27,10 +27,12 @@ import com.jcraft.jsch.Channel;
|
||||||
import com.jcraft.jsch.ChannelExec;
|
import com.jcraft.jsch.ChannelExec;
|
||||||
import com.jcraft.jsch.ChannelShell;
|
import com.jcraft.jsch.ChannelShell;
|
||||||
|
|
||||||
public class JSchProcess implements IRemoteProcessControlService, IRemoteProcessSignalService, IRemoteProcessTerminalService {
|
public class JSchProcess
|
||||||
|
implements IRemoteProcessControlService, IRemoteProcessSignalService, IRemoteProcessTerminalService {
|
||||||
@SuppressWarnings("nls")
|
@SuppressWarnings("nls")
|
||||||
private final String signals[] = new String[] { "", "HUP", "INT", "QUIT", "ILL", "", "ABRT", "", "FPE", "KILL", "", "SEGV", "",
|
private final String signals[] = new String[] { "", "HUP", "INT", "QUIT", "ILL", "", "ABRT", "", "FPE", "KILL", "",
|
||||||
"PIPE", "ALRM", "TERM", "", "STOP", "TSTP", "CONT", "", "", "", "", "", "", "", "", "", "", "USR1", "USR2" };
|
"SEGV", "", "PIPE", "ALRM", "TERM", "", "STOP", "TSTP", "CONT", "", "", "", "", "", "", "", "", "", "",
|
||||||
|
"USR1", "USR2" };
|
||||||
|
|
||||||
private static int WAIT_TIMEOUT = 1000;
|
private static int WAIT_TIMEOUT = 1000;
|
||||||
private static int refCount = 0;
|
private static int refCount = 0;
|
||||||
|
@ -147,7 +149,7 @@ public class JSchProcess implements IRemoteProcessControlService, IRemoteProcess
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int exitValue() {
|
public int exitValue() {
|
||||||
if(!isCompleted()) {
|
if (!isCompleted()) {
|
||||||
throw new IllegalThreadStateException(Messages.JSchProcess_exitValue_exception_msg);
|
throw new IllegalThreadStateException(Messages.JSchProcess_exitValue_exception_msg);
|
||||||
}
|
}
|
||||||
return fChannel.getExitStatus();
|
return fChannel.getExitStatus();
|
||||||
|
|
|
@ -118,10 +118,10 @@ public class JSchProcessBuilder extends AbstractRemoteProcessBuilder {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* There are two possibilities:
|
* There are two possibilities:
|
||||||
*
|
*
|
||||||
* 1. Some environment variables have changed values, or new variables have been added. In this case we just want to
|
* 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.
|
* 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
|
* 2. Some of the existing variables have been removed. In this case, we need to resend the entire environment variable
|
||||||
* list.
|
* list.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -30,11 +30,11 @@ public class JSchUserInfo implements UserInfo, UIKeyboardInteractive {
|
||||||
|
|
||||||
private final IRemoteConnectionHostService hostService;
|
private final IRemoteConnectionHostService hostService;
|
||||||
private IUserAuthenticatorService userAuthenticatorService;
|
private IUserAuthenticatorService userAuthenticatorService;
|
||||||
|
|
||||||
public JSchUserInfo(IRemoteConnectionHostService hostService) {
|
public JSchUserInfo(IRemoteConnectionHostService hostService) {
|
||||||
this.hostService = hostService;
|
this.hostService = hostService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public JSchUserInfo(IRemoteConnectionHostService hostService, IUserAuthenticatorService userAuthenticatorService) {
|
public JSchUserInfo(IRemoteConnectionHostService hostService, IUserAuthenticatorService userAuthenticatorService) {
|
||||||
this(hostService);
|
this(hostService);
|
||||||
this.userAuthenticatorService = userAuthenticatorService;
|
this.userAuthenticatorService = userAuthenticatorService;
|
||||||
|
@ -122,8 +122,9 @@ public class JSchUserInfo implements UserInfo, UIKeyboardInteractive {
|
||||||
System.out.println("promptYesNo:" + message); //$NON-NLS-1$
|
System.out.println("promptYesNo:" + message); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
if (userAuthenticatorService != null) {
|
if (userAuthenticatorService != null) {
|
||||||
int prompt = userAuthenticatorService.prompt(IUserAuthenticatorService.QUESTION, Messages.AuthInfo_Authentication_message,
|
int prompt = userAuthenticatorService.prompt(IUserAuthenticatorService.QUESTION,
|
||||||
message, new int[] { IUserAuthenticatorService.YES, IUserAuthenticatorService.NO },
|
Messages.AuthInfo_Authentication_message, message,
|
||||||
|
new int[] { IUserAuthenticatorService.YES, IUserAuthenticatorService.NO },
|
||||||
IUserAuthenticatorService.YES);
|
IUserAuthenticatorService.YES);
|
||||||
return prompt == IUserAuthenticatorService.YES;
|
return prompt == IUserAuthenticatorService.YES;
|
||||||
}
|
}
|
||||||
|
@ -136,8 +137,9 @@ public class JSchUserInfo implements UserInfo, UIKeyboardInteractive {
|
||||||
System.out.println("showMessage:" + message); //$NON-NLS-1$
|
System.out.println("showMessage:" + message); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
if (userAuthenticatorService != null) {
|
if (userAuthenticatorService != null) {
|
||||||
userAuthenticatorService.prompt(IUserAuthenticatorService.INFORMATION, Messages.AuthInfo_Authentication_message, message,
|
userAuthenticatorService.prompt(IUserAuthenticatorService.INFORMATION,
|
||||||
new int[] { IUserAuthenticatorService.OK }, IUserAuthenticatorService.OK);
|
Messages.AuthInfo_Authentication_message, message, new int[] { IUserAuthenticatorService.OK },
|
||||||
|
IUserAuthenticatorService.OK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ import org.eclipse.remote.internal.jsch.core.messages.Messages;
|
||||||
public class JschFileStore extends FileStore {
|
public class JschFileStore extends FileStore {
|
||||||
/**
|
/**
|
||||||
* Public factory method for obtaining JschFileStore instances.
|
* Public factory method for obtaining JschFileStore instances.
|
||||||
*
|
*
|
||||||
* @param uri
|
* @param uri
|
||||||
* URI to get a fileStore for
|
* URI to get a fileStore for
|
||||||
* @return an JschFileStore instance for the URI.
|
* @return an JschFileStore instance for the URI.
|
||||||
|
@ -76,7 +76,8 @@ public class JschFileStore extends FileStore {
|
||||||
IRemoteServicesManager manager = Activator.getService(IRemoteServicesManager.class);
|
IRemoteServicesManager manager = Activator.getService(IRemoteServicesManager.class);
|
||||||
IRemoteConnectionType connectionType = manager.getConnectionType(fURI);
|
IRemoteConnectionType connectionType = manager.getConnectionType(fURI);
|
||||||
if (connectionType == null) {
|
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 {
|
try {
|
||||||
|
@ -136,7 +137,8 @@ public class JschFileStore extends FileStore {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IFileStore getChild(String name) {
|
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);
|
return JschFileStore.getInstance(uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,7 +149,7 @@ public class JschFileStore extends FileStore {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility routing to get the file name from an absolute path.
|
* Utility routing to get the file name from an absolute path.
|
||||||
*
|
*
|
||||||
* @param path
|
* @param path
|
||||||
* path to extract file name from
|
* path to extract file name from
|
||||||
* @return last segment of path, or the full path if it is root
|
* @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) {
|
if (fRemotePath.segmentCount() > 0) {
|
||||||
parentPath = fRemotePath.removeLastSegments(1).toString();
|
parentPath = fRemotePath.removeLastSegments(1).toString();
|
||||||
}
|
}
|
||||||
return JschFileStore.getInstance(JSchFileSystem.getURIFor(JSchFileSystem.getConnectionNameFor(fURI), parentPath));
|
return JschFileStore
|
||||||
|
.getInstance(JSchFileSystem.getURIFor(JSchFileSystem.getConnectionNameFor(fURI), parentPath));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -180,7 +183,8 @@ public class JschFileStore extends FileStore {
|
||||||
IFileStore parent = getParent();
|
IFileStore parent = getParent();
|
||||||
if (parent != null && !parent.fetchInfo(EFS.NONE, subMon.newChild(9)).exists()) {
|
if (parent != null && !parent.fetchInfo(EFS.NONE, subMon.newChild(9)).exists()) {
|
||||||
throw new CoreException(new Status(IStatus.ERROR, Activator.getUniqueIdentifier(), EFS.ERROR_WRITE,
|
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()) {
|
if (subMon.isCanceled()) {
|
||||||
return this;
|
return this;
|
||||||
|
@ -201,11 +205,14 @@ public class JschFileStore extends FileStore {
|
||||||
if (!subMon.isCanceled()) {
|
if (!subMon.isCanceled()) {
|
||||||
if (!info.exists()) {
|
if (!info.exists()) {
|
||||||
throw new CoreException(new Status(IStatus.ERROR, Activator.getUniqueIdentifier(), EFS.ERROR_WRITE,
|
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()) {
|
if (!info.isDirectory()) {
|
||||||
throw new CoreException(new Status(IStatus.ERROR, Activator.getUniqueIdentifier(), EFS.ERROR_WRONG_TYPE,
|
throw new CoreException(new Status(IStatus.ERROR, Activator.getUniqueIdentifier(),
|
||||||
NLS.bind(Messages.JschFileStore_A_file_of_name_already_exists, fRemotePath.toString()), null));
|
EFS.ERROR_WRONG_TYPE,
|
||||||
|
NLS.bind(Messages.JschFileStore_A_file_of_name_already_exists, fRemotePath.toString()),
|
||||||
|
null));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM Corporation - Initial Implementation
|
* IBM Corporation - Initial Implementation
|
||||||
* Martin Oberhuber - [468889] Support Eclipse older than Mars
|
* Martin Oberhuber - [468889] Support Eclipse older than Mars
|
||||||
|
@ -43,7 +43,7 @@ import com.jcraft.jsch.SftpProgressMonitor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author greg
|
* @author greg
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractRemoteCommand<T> {
|
public abstract class AbstractRemoteCommand<T> {
|
||||||
protected static class CommandProgressMonitor implements SftpProgressMonitor {
|
protected static class CommandProgressMonitor implements SftpProgressMonitor {
|
||||||
|
@ -80,7 +80,8 @@ public abstract class AbstractRemoteCommand<T> {
|
||||||
taskName.append(fPrefix);
|
taskName.append(fPrefix);
|
||||||
}
|
}
|
||||||
if (fWorkPercentFactor < 0) {
|
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 {
|
} else {
|
||||||
Double workPercent = Double.valueOf(fWorkPercentFactor * fWorkToDate);
|
Double workPercent = Double.valueOf(fWorkPercentFactor * fWorkToDate);
|
||||||
taskName.append(MessageFormat.format(Messages.AbstractRemoteCommand_format2,
|
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);
|
return convertToFileInfo(path.lastSegment(), path.removeLastSegments(1), attrs, monitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected IFileInfo convertToFileInfo(final String name, final IPath parentPath, SftpATTRS attrs, IProgressMonitor monitor)
|
protected IFileInfo convertToFileInfo(final String name, final IPath parentPath, SftpATTRS attrs,
|
||||||
throws RemoteConnectionException {
|
IProgressMonitor monitor) throws RemoteConnectionException {
|
||||||
SubMonitor progress = SubMonitor.convert(monitor, 10);
|
SubMonitor progress = SubMonitor.convert(monitor, 10);
|
||||||
FileInfo fileInfo = new FileInfo(name);
|
FileInfo fileInfo = new FileInfo(name);
|
||||||
fileInfo.setExists(true);
|
fileInfo.setExists(true);
|
||||||
|
|
|
@ -48,7 +48,7 @@ public class ExecCommand extends AbstractRemoteCommand<String> {
|
||||||
if (getProgressMonitor().isCanceled()) {
|
if (getProgressMonitor().isCanceled()) {
|
||||||
return ""; //$NON-NLS-1$
|
return ""; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
if (getChannel().getExitStatus()!=0) {
|
if (getChannel().getExitStatus() != 0) {
|
||||||
throw new RemoteConnectionException(err.toString());
|
throw new RemoteConnectionException(err.toString());
|
||||||
}
|
}
|
||||||
return stream.toString();
|
return stream.toString();
|
||||||
|
|
|
@ -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
|
* 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
|
* 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.
|
* 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
|
* 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.
|
* 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
|
@Override
|
||||||
public InputStream call() throws JSchException, SftpException, IOException {
|
public InputStream call() throws JSchException, SftpException, IOException {
|
||||||
return newChannel().get(fRemotePath.toString(), new CommandProgressMonitor(
|
return newChannel().get(fRemotePath.toString(),
|
||||||
NLS.bind(Messages.GetInputStreamCommand_Receiving, fRemotePath.toString()), getProgressMonitor()));
|
new CommandProgressMonitor(
|
||||||
|
NLS.bind(Messages.GetInputStreamCommand_Receiving, fRemotePath.toString()),
|
||||||
|
getProgressMonitor()));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -50,11 +50,9 @@ public class GetOutputStreamCommand extends AbstractRemoteCommand<OutputStream>
|
||||||
if ((fOptions & EFS.APPEND) != 0) {
|
if ((fOptions & EFS.APPEND) != 0) {
|
||||||
mode = ChannelSftp.APPEND;
|
mode = ChannelSftp.APPEND;
|
||||||
}
|
}
|
||||||
getChannel().put(
|
getChannel().put(input, fRemotePath.toString(), new CommandProgressMonitor(
|
||||||
input,
|
NLS.bind(Messages.GetOutputStreamCommand_Sending, fRemotePath.toString()),
|
||||||
fRemotePath.toString(),
|
getProgressMonitor()), mode);
|
||||||
new CommandProgressMonitor(NLS.bind(Messages.GetOutputStreamCommand_Sending, fRemotePath.toString()),
|
|
||||||
getProgressMonitor()), mode);
|
|
||||||
input.close();
|
input.close();
|
||||||
} finally {
|
} finally {
|
||||||
fIsClosed = true;
|
fIsClosed = true;
|
||||||
|
|
|
@ -53,7 +53,8 @@ public class PutInfoCommand extends AbstractRemoteCommand<Void> {
|
||||||
return null;
|
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);
|
final SubMonitor subMon = SubMonitor.convert(monitor, 10);
|
||||||
SftpCallable<Void> c = new SftpCallable<Void>() {
|
SftpCallable<Void> c = new SftpCallable<Void>() {
|
||||||
@Override
|
@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);
|
final SubMonitor subMon = SubMonitor.convert(monitor, 10);
|
||||||
SftpCallable<Void> c = new SftpCallable<Void>() {
|
SftpCallable<Void> c = new SftpCallable<Void>() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
# are made available under the terms of the Eclipse Public License v1.0
|
# are made available under the terms of the Eclipse Public License v1.0
|
||||||
# which accompanies this distribution, and is available at
|
# which accompanies this distribution, and is available at
|
||||||
# http://www.eclipse.org/legal/epl-v10.html
|
# http://www.eclipse.org/legal/epl-v10.html
|
||||||
#
|
#
|
||||||
# Contributors:
|
# Contributors:
|
||||||
# IBM Corporation - initial implementation
|
# IBM Corporation - initial implementation
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
@ -14,8 +14,8 @@ AbstractRemoteCommand_Get_symlink_target=Get symlink target
|
||||||
AbstractRemoteCommand_Operation_cancelled_by_user=Operation cancelled by user
|
AbstractRemoteCommand_Operation_cancelled_by_user=Operation cancelled by user
|
||||||
AuthInfo_Authentication_message=Authentication Message
|
AuthInfo_Authentication_message=Authentication Message
|
||||||
ExecCommand_Exec_command=Executing command "{0}"
|
ExecCommand_Exec_command=Executing command "{0}"
|
||||||
GetInputStreamCommand_Receiving=Receiving {0}:
|
GetInputStreamCommand_Receiving=Receiving {0}:
|
||||||
GetOutputStreamCommand_Sending=Sending {0}:
|
GetOutputStreamCommand_Sending=Sending {0}:
|
||||||
JSchConnection_0=Connection canceled by user
|
JSchConnection_0=Connection canceled by user
|
||||||
JSchConnection_Connection_was_cancelled=Connection was cancelled
|
JSchConnection_Connection_was_cancelled=Connection was cancelled
|
||||||
JSchConnection_connectionNotOpen=Connection is not open
|
JSchConnection_connectionNotOpen=Connection is not open
|
||||||
|
|
|
@ -14,7 +14,7 @@ public class Activator extends AbstractUIPlugin {
|
||||||
|
|
||||||
// The shared instance
|
// The shared instance
|
||||||
private static Activator plugin;
|
private static Activator plugin;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The constructor
|
* The constructor
|
||||||
*/
|
*/
|
||||||
|
@ -42,7 +42,7 @@ public class Activator extends AbstractUIPlugin {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the OSGi service with the given service interface.
|
* Return the OSGi service with the given service interface.
|
||||||
*
|
*
|
||||||
* @param service service interface
|
* @param service service interface
|
||||||
* @return the specified service or null if it's not registered
|
* @return the specified service or null if it's not registered
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -175,7 +175,7 @@ public class ProcessTests extends TestCase {
|
||||||
public void testExitValue() {
|
public void testExitValue() {
|
||||||
IRemoteProcessService processService = fRemoteConnection.getService(IRemoteProcessService.class);
|
IRemoteProcessService processService = fRemoteConnection.getService(IRemoteProcessService.class);
|
||||||
assertNotNull(processService);
|
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);
|
assertNotNull(builder);
|
||||||
IRemoteProcess rp = null;
|
IRemoteProcess rp = null;
|
||||||
try {
|
try {
|
||||||
|
@ -189,7 +189,7 @@ public class ProcessTests extends TestCase {
|
||||||
try {
|
try {
|
||||||
p.exitValue();
|
p.exitValue();
|
||||||
fail("Process has not exited. Should throws an IllegalThreadStateException exception");
|
fail("Process has not exited. Should throws an IllegalThreadStateException exception");
|
||||||
} catch(IllegalThreadStateException e) {
|
} catch (IllegalThreadStateException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ public class Activator extends AbstractUIPlugin {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the shared instance
|
* Returns the shared instance
|
||||||
*
|
*
|
||||||
* @return the shared instance
|
* @return the shared instance
|
||||||
*/
|
*/
|
||||||
public static Activator getDefault() {
|
public static Activator getDefault() {
|
||||||
|
@ -32,7 +32,7 @@ public class Activator extends AbstractUIPlugin {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get unique identifier
|
* Get unique identifier
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
* @since 5.0
|
* @since 5.0
|
||||||
*/
|
*/
|
||||||
|
@ -45,7 +45,7 @@ public class Activator extends AbstractUIPlugin {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Logs the specified status with this plug-in's log.
|
* Logs the specified status with this plug-in's log.
|
||||||
*
|
*
|
||||||
* @param status
|
* @param status
|
||||||
* status to log
|
* status to log
|
||||||
*/
|
*/
|
||||||
|
@ -55,7 +55,7 @@ public class Activator extends AbstractUIPlugin {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Logs an internal error with the specified message.
|
* Logs an internal error with the specified message.
|
||||||
*
|
*
|
||||||
* @param message
|
* @param message
|
||||||
* the error message to log
|
* the error message to log
|
||||||
*/
|
*/
|
||||||
|
@ -65,7 +65,7 @@ public class Activator extends AbstractUIPlugin {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Logs an internal error with the specified throwable
|
* Logs an internal error with the specified throwable
|
||||||
*
|
*
|
||||||
* @param e
|
* @param e
|
||||||
* the exception to be logged
|
* the exception to be logged
|
||||||
*/
|
*/
|
||||||
|
@ -83,7 +83,7 @@ public class Activator extends AbstractUIPlugin {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the OSGi service with the given service interface.
|
* Return the OSGi service with the given service interface.
|
||||||
*
|
*
|
||||||
* @param service service interface
|
* @param service service interface
|
||||||
* @return the specified service or null if it's not registered
|
* @return the specified service or null if it's not registered
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
/********************************************************************************
|
/********************************************************************************
|
||||||
* Copyright (c) 2002, 2008 IBM Corporation and others. All rights reserved.
|
* Copyright (c) 2002, 2008 IBM Corporation and others. All rights reserved.
|
||||||
* This program and the accompanying materials are made available under the terms
|
* 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
|
* available at http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Initial Contributors:
|
* Initial Contributors:
|
||||||
* The following IBM employees contributed to the Remote System Explorer
|
* The following IBM employees contributed to the Remote System Explorer
|
||||||
* component that contains this file: David McKnight, Kushal Munir,
|
* component that contains this file: David McKnight, Kushal Munir,
|
||||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Kushal Munir (IBM) - moved to internal package.
|
* Kushal Munir (IBM) - moved to internal package.
|
||||||
* Martin Oberhuber (Wind River) - [181917] EFS Improvements: Avoid unclosed Streams,
|
* Martin Oberhuber (Wind River) - [181917] EFS Improvements: Avoid unclosed Streams,
|
||||||
|
|
|
@ -25,7 +25,7 @@ import com.jcraft.jsch.JSch;
|
||||||
import com.jcraft.jsch.JSchException;
|
import com.jcraft.jsch.JSchException;
|
||||||
|
|
||||||
public class JSchUserAuthenticator implements IUserAuthenticatorService {
|
public class JSchUserAuthenticator implements IUserAuthenticatorService {
|
||||||
|
|
||||||
private final IRemoteConnection remoteConnection;
|
private final IRemoteConnection remoteConnection;
|
||||||
private UserInfoPrompter prompter;
|
private UserInfoPrompter prompter;
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ public class JSchUserAuthenticator implements IUserAuthenticatorService {
|
||||||
public IRemoteConnection getRemoteConnection() {
|
public IRemoteConnection getRemoteConnection() {
|
||||||
return remoteConnection;
|
return remoteConnection;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PasswordAuthentication prompt(String username, String message) {
|
public PasswordAuthentication prompt(String username, String message) {
|
||||||
if (prompter.promptPassword(message)) {
|
if (prompter.promptPassword(message)) {
|
||||||
|
@ -90,8 +90,8 @@ public class JSchUserAuthenticator implements IUserAuthenticatorService {
|
||||||
display.syncExec(new Runnable() {
|
display.syncExec(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
final MessageDialog dialog = new MessageDialog(display.getActiveShell(), title, null /* title image */, message,
|
final MessageDialog dialog = new MessageDialog(display.getActiveShell(), title, null /* title image */,
|
||||||
promptType, buttons, defaultResponseIndex);
|
message, promptType, buttons, defaultResponseIndex);
|
||||||
retval[0] = dialog.open();
|
retval[0] = dialog.open();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -105,7 +105,7 @@ public class JSchUserAuthenticator implements IUserAuthenticatorService {
|
||||||
}
|
}
|
||||||
return display;
|
return display;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Factory implements IRemoteConnection.Service.Factory {
|
public static class Factory implements IRemoteConnection.Service.Factory {
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
# are made available under the terms of the Eclipse Public License v1.0
|
# are made available under the terms of the Eclipse Public License v1.0
|
||||||
# which accompanies this distribution, and is available at
|
# which accompanies this distribution, and is available at
|
||||||
# http://www.eclipse.org/legal/epl-v10.html
|
# http://www.eclipse.org/legal/epl-v10.html
|
||||||
#
|
#
|
||||||
# Contributors:
|
# Contributors:
|
||||||
# IBM Corporation - initial implementation
|
# IBM Corporation - initial implementation
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
|
@ -246,8 +246,8 @@ public class JSchConnectionPage extends WizardPage {
|
||||||
|
|
||||||
fPasswordButton.setSelection(JSchConnection.DEFAULT_IS_PASSWORD);
|
fPasswordButton.setSelection(JSchConnection.DEFAULT_IS_PASSWORD);
|
||||||
fPublicKeyButton.setSelection(!JSchConnection.DEFAULT_IS_PASSWORD);
|
fPublicKeyButton.setSelection(!JSchConnection.DEFAULT_IS_PASSWORD);
|
||||||
controls.setTabList(
|
controls.setTabList(new Control[] { fHostText, fUserText, fPublicKeyButton, fPassphraseText, fPasswordButton,
|
||||||
new Control[] { fHostText, fUserText, fPublicKeyButton, fPassphraseText, fPasswordButton, fPasswordText });
|
fPasswordText });
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -312,7 +312,8 @@ public class JSchConnectionPage extends WizardPage {
|
||||||
lblConnection.setText(Messages.JSchConnectionPage_SelectConnection);
|
lblConnection.setText(Messages.JSchConnectionPage_SelectConnection);
|
||||||
|
|
||||||
fProxyConnectionWidget = new RemoteConnectionWidget(proxyComp, SWT.NONE, null, 0);
|
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);
|
Label lblCommand = new Label(proxyComp, SWT.WRAP);
|
||||||
lblCommand.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
lblCommand.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||||
|
@ -384,7 +385,8 @@ public class JSchConnectionPage extends WizardPage {
|
||||||
: Boolean.parseBoolean(useLoginShellStr);
|
: Boolean.parseBoolean(useLoginShellStr);
|
||||||
fUseLoginShellButton.setSelection(useLoginShell);
|
fUseLoginShellButton.setSelection(useLoginShell);
|
||||||
String loginShellStr = fConnection.getAttribute(JSchConnection.LOGIN_SHELL_COMMAND_ATTR);
|
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));
|
fProxyCommandText.setText(fConnection.getAttribute(JSchConnection.PROXYCOMMAND_ATTR));
|
||||||
JSchConnection proxyConn = fConnection.getService(JSchConnection.class).getProxyConnection();
|
JSchConnection proxyConn = fConnection.getService(JSchConnection.class).getProxyConnection();
|
||||||
if (proxyConn == null) {
|
if (proxyConn == null) {
|
||||||
|
@ -520,7 +522,8 @@ public class JSchConnectionPage extends WizardPage {
|
||||||
fConnection.setAttribute(JSchConnection.TIMEOUT_ATTR, fTimeoutText.getText().trim());
|
fConnection.setAttribute(JSchConnection.TIMEOUT_ATTR, fTimeoutText.getText().trim());
|
||||||
fConnection.setAttribute(JSchConnection.PORT_ATTR, fPortText.getText().trim());
|
fConnection.setAttribute(JSchConnection.PORT_ATTR, fPortText.getText().trim());
|
||||||
fConnection.setAttribute(JSchConnection.PROXYCOMMAND_ATTR, fProxyCommandText.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());
|
fConnection.setAttribute(JSchConnection.LOGIN_SHELL_COMMAND_ATTR, fLoginShellText.getText().trim());
|
||||||
IRemoteConnection proxyConnection = fProxyConnectionWidget.getConnection();
|
IRemoteConnection proxyConnection = fProxyConnectionWidget.getConnection();
|
||||||
IRemoteServicesManager manager = Activator.getService(IRemoteServicesManager.class);
|
IRemoteServicesManager manager = Activator.getService(IRemoteServicesManager.class);
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM Corporation - Initial Implementation
|
* IBM Corporation - Initial Implementation
|
||||||
*
|
*
|
||||||
|
|
|
@ -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"
|
org.eclipse.remote.internal.proxy.core.messages;x-friends:="org.eclipse.remote.proxy.ui"
|
||||||
Bundle-Localization: plugin
|
Bundle-Localization: plugin
|
||||||
Bundle-RequiredExecutionEnvironment: JavaSE-11
|
Bundle-RequiredExecutionEnvironment: JavaSE-11
|
||||||
Import-Package:
|
Import-Package: com.jcraft.jsch,
|
||||||
com.jcraft.jsch,
|
|
||||||
org.eclipse.core.filesystem,
|
org.eclipse.core.filesystem,
|
||||||
org.eclipse.core.filesystem.provider,
|
org.eclipse.core.filesystem.provider,
|
||||||
org.eclipse.core.runtime,
|
org.eclipse.core.runtime,
|
||||||
|
|
|
@ -6,5 +6,5 @@ bin.includes = META-INF/,\
|
||||||
plugin.properties,\
|
plugin.properties,\
|
||||||
about.html,\
|
about.html,\
|
||||||
bootstrap.sh
|
bootstrap.sh
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ public class Activator extends Plugin {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the shared instance
|
* Returns the shared instance
|
||||||
*
|
*
|
||||||
* @return the shared instance
|
* @return the shared instance
|
||||||
*/
|
*/
|
||||||
public static Activator getDefault() {
|
public static Activator getDefault() {
|
||||||
|
@ -28,7 +28,7 @@ public class Activator extends Plugin {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get unique identifier
|
* Get unique identifier
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
* @since 5.0
|
* @since 5.0
|
||||||
*/
|
*/
|
||||||
|
@ -41,7 +41,7 @@ public class Activator extends Plugin {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Logs the specified status with this plug-in's log.
|
* Logs the specified status with this plug-in's log.
|
||||||
*
|
*
|
||||||
* @param status
|
* @param status
|
||||||
* status to log
|
* status to log
|
||||||
*/
|
*/
|
||||||
|
@ -51,7 +51,7 @@ public class Activator extends Plugin {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Logs an internal error with the specified message.
|
* Logs an internal error with the specified message.
|
||||||
*
|
*
|
||||||
* @param message
|
* @param message
|
||||||
* the error message to log
|
* the error message to log
|
||||||
*/
|
*/
|
||||||
|
@ -61,7 +61,7 @@ public class Activator extends Plugin {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Logs an internal error with the specified throwable
|
* Logs an internal error with the specified throwable
|
||||||
*
|
*
|
||||||
* @param e
|
* @param e
|
||||||
* the exception to be logged
|
* 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));
|
log(new Status(IStatus.ERROR, getUniqueIdentifier(), IStatus.ERROR, e.getMessage(), e));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The constructor
|
* The constructor
|
||||||
*/
|
*/
|
||||||
|
@ -78,7 +77,7 @@ public class Activator extends Plugin {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the OSGi service with the given service interface.
|
* Return the OSGi service with the given service interface.
|
||||||
*
|
*
|
||||||
* @param service service interface
|
* @param service service interface
|
||||||
* @return the specified service or null if it's not registered
|
* @return the specified service or null if it's not registered
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -46,10 +46,9 @@ import com.jcraft.jsch.ChannelShell;
|
||||||
/**
|
/**
|
||||||
* @since 5.0
|
* @since 5.0
|
||||||
*/
|
*/
|
||||||
public class ProxyConnection implements IRemoteConnectionControlService,
|
public class ProxyConnection
|
||||||
IRemoteConnectionChangeListener, IRemoteProcessService,
|
implements IRemoteConnectionControlService, IRemoteConnectionChangeListener, IRemoteProcessService,
|
||||||
IRemoteCommandShellService, IRemoteConnectionHostService,
|
IRemoteCommandShellService, IRemoteConnectionHostService, IRemoteConnectionPropertyService {
|
||||||
IRemoteConnectionPropertyService {
|
|
||||||
// Connection Type ID
|
// Connection Type ID
|
||||||
public static final String JSCH_ID = "org.eclipse.remote.Proxy"; //$NON-NLS-1$
|
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 StreamChannelManager channelMux;
|
||||||
private StreamChannel commandChannel;
|
private StreamChannel commandChannel;
|
||||||
private boolean isOpen;
|
private boolean isOpen;
|
||||||
|
|
||||||
private final IRemoteConnection fRemoteConnection;
|
private final IRemoteConnection fRemoteConnection;
|
||||||
|
|
||||||
private final Map<String, String> fEnv = new HashMap<>();
|
private final Map<String, String> fEnv = new HashMap<>();
|
||||||
|
@ -119,10 +118,9 @@ public class ProxyConnection implements IRemoteConnectionControlService,
|
||||||
return (T) conn;
|
return (T) conn;
|
||||||
}
|
}
|
||||||
} else if (IRemoteConnectionControlService.class.equals(service)
|
} else if (IRemoteConnectionControlService.class.equals(service)
|
||||||
|| IRemoteConnectionPropertyService.class.equals(service)
|
|| IRemoteConnectionPropertyService.class.equals(service)
|
||||||
|| IRemoteConnectionHostService.class.equals(service)
|
|| IRemoteConnectionHostService.class.equals(service) || IRemoteProcessService.class.equals(service)
|
||||||
|| IRemoteProcessService.class.equals(service)
|
|| IRemoteCommandShellService.class.equals(service)
|
||||||
|| IRemoteCommandShellService.class.equals(service)
|
|
||||||
|| IRemoteConnectionPropertyService.class.equals(service)) {
|
|| IRemoteConnectionPropertyService.class.equals(service)) {
|
||||||
return (T) connection.getService(ProxyConnection.class);
|
return (T) connection.getService(ProxyConnection.class);
|
||||||
} else {
|
} else {
|
||||||
|
@ -169,7 +167,7 @@ public class ProxyConnection implements IRemoteConnectionControlService,
|
||||||
fRemoteConnection.fireConnectionChangeEvent(RemoteConnectionChangeEvent.CONNECTION_OPENED);
|
fRemoteConnection.fireConnectionChangeEvent(RemoteConnectionChangeEvent.CONNECTION_OPENED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initialize(IProgressMonitor monitor) throws RemoteConnectionException {
|
private void initialize(IProgressMonitor monitor) throws RemoteConnectionException {
|
||||||
SubMonitor subMon = SubMonitor.convert(monitor, 30);
|
SubMonitor subMon = SubMonitor.convert(monitor, 30);
|
||||||
fWorkingDir = getCwd(subMon.newChild(10));
|
fWorkingDir = getCwd(subMon.newChild(10));
|
||||||
|
@ -194,7 +192,7 @@ public class ProxyConnection implements IRemoteConnectionControlService,
|
||||||
throw new RemoteConnectionException(e.getMessage());
|
throw new RemoteConnectionException(e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map<String, String> loadEnv(IProgressMonitor monitor) throws RemoteConnectionException {
|
private Map<String, String> loadEnv(IProgressMonitor monitor) throws RemoteConnectionException {
|
||||||
try {
|
try {
|
||||||
GetEnvCommand cmd = new GetEnvCommand(this);
|
GetEnvCommand cmd = new GetEnvCommand(this);
|
||||||
|
@ -203,7 +201,7 @@ public class ProxyConnection implements IRemoteConnectionControlService,
|
||||||
throw new RemoteConnectionException(e.getMessage());
|
throw new RemoteConnectionException(e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map<String, String> loadProperties(IProgressMonitor monitor) throws RemoteConnectionException {
|
private Map<String, String> loadProperties(IProgressMonitor monitor) throws RemoteConnectionException {
|
||||||
try {
|
try {
|
||||||
GetPropertiesCommand cmd = new GetPropertiesCommand(this);
|
GetPropertiesCommand cmd = new GetPropertiesCommand(this);
|
||||||
|
@ -212,22 +210,22 @@ public class ProxyConnection implements IRemoteConnectionControlService,
|
||||||
throw new RemoteConnectionException(e.getMessage());
|
throw new RemoteConnectionException(e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, String> getEnv() {
|
public Map<String, String> getEnv() {
|
||||||
return Collections.unmodifiableMap(fEnv);
|
return Collections.unmodifiableMap(fEnv);
|
||||||
}
|
}
|
||||||
|
|
||||||
public StreamChannel getCommandChannel() {
|
public StreamChannel getCommandChannel() {
|
||||||
return commandChannel;
|
return commandChannel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public StreamChannel openChannel() throws IOException {
|
public StreamChannel openChannel() throws IOException {
|
||||||
return channelMux.openChannel();
|
return channelMux.openChannel();
|
||||||
}
|
}
|
||||||
|
|
||||||
private StringBuffer stdout = new StringBuffer();
|
private StringBuffer stdout = new StringBuffer();
|
||||||
private StringBuffer stderr = new StringBuffer();
|
private StringBuffer stderr = new StringBuffer();
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
private String executeSshCommand(ChannelShell shell, String command) throws RemoteConnectionException {
|
private String executeSshCommand(ChannelShell shell, String command) throws RemoteConnectionException {
|
||||||
try {
|
try {
|
||||||
|
@ -246,7 +244,7 @@ public class ProxyConnection implements IRemoteConnectionControlService,
|
||||||
throw new RemoteConnectionException(e.getMessage());
|
throw new RemoteConnectionException(e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
private String executeCommand(List<String> command, IProgressMonitor monitor) throws ProxyException {
|
private String executeCommand(List<String> command, IProgressMonitor monitor) throws ProxyException {
|
||||||
try {
|
try {
|
||||||
|
@ -281,7 +279,8 @@ public class ProxyConnection implements IRemoteConnectionControlService,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.start();
|
}.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);
|
cmd.getResult(monitor);
|
||||||
DataInputStream status = new DataInputStream(chanC.getInputStream());
|
DataInputStream status = new DataInputStream(chanC.getInputStream());
|
||||||
int stat = status.readInt();
|
int stat = status.readInt();
|
||||||
|
|
|
@ -45,68 +45,68 @@ public class ProxyConnectionBootstrap {
|
||||||
private final IJSchService jSchService;
|
private final IJSchService jSchService;
|
||||||
private Session session;
|
private Session session;
|
||||||
private ChannelExec exec;
|
private ChannelExec exec;
|
||||||
|
|
||||||
private class Context {
|
private class Context {
|
||||||
private State state;
|
private State state;
|
||||||
private String osName;
|
private String osName;
|
||||||
private String osArch;
|
private String osArch;
|
||||||
private String errorMessage;
|
private String errorMessage;
|
||||||
|
|
||||||
private final SubMonitor monitor;
|
private final SubMonitor monitor;
|
||||||
private final BufferedReader reader;
|
private final BufferedReader reader;
|
||||||
private final BufferedWriter writer;
|
private final BufferedWriter writer;
|
||||||
|
|
||||||
public Context(BufferedReader reader, BufferedWriter writer, IProgressMonitor monitor) {
|
public Context(BufferedReader reader, BufferedWriter writer, IProgressMonitor monitor) {
|
||||||
this.reader = reader;
|
this.reader = reader;
|
||||||
this.writer = writer;
|
this.writer = writer;
|
||||||
this.monitor = SubMonitor.convert(monitor);
|
this.monitor = SubMonitor.convert(monitor);
|
||||||
setState(States.INIT);
|
setState(States.INIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
State getState() {
|
State getState() {
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
SubMonitor getMonitor() {
|
SubMonitor getMonitor() {
|
||||||
return monitor;
|
return monitor;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setState(State state) {
|
void setState(State state) {
|
||||||
this.state = state;
|
this.state = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
String getOSName() {
|
String getOSName() {
|
||||||
return osName;
|
return osName;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setOSName(String osName) {
|
void setOSName(String osName) {
|
||||||
this.osName = osName;
|
this.osName = osName;
|
||||||
}
|
}
|
||||||
|
|
||||||
String getOSArch() {
|
String getOSArch() {
|
||||||
return osArch;
|
return osArch;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setOSArch(String osArch) {
|
void setOSArch(String osArch) {
|
||||||
this.osArch = osArch;
|
this.osArch = osArch;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setErrorMessage(String message) {
|
void setErrorMessage(String message) {
|
||||||
this.errorMessage = message;
|
this.errorMessage = message;
|
||||||
}
|
}
|
||||||
|
|
||||||
String getErrorMessage() {
|
String getErrorMessage() {
|
||||||
return errorMessage;
|
return errorMessage;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private interface State {
|
private interface State {
|
||||||
/**
|
/**
|
||||||
* @return true to keep processing, false to read more data.
|
* @return true to keep processing, false to read more data.
|
||||||
*/
|
*/
|
||||||
boolean process(Context context) throws IOException;
|
boolean process(Context context) throws IOException;
|
||||||
}
|
}
|
||||||
|
|
||||||
private enum States implements State {
|
private enum States implements State {
|
||||||
INIT {
|
INIT {
|
||||||
@Override
|
@Override
|
||||||
|
@ -145,7 +145,7 @@ public class ProxyConnectionBootstrap {
|
||||||
return true;
|
return true;
|
||||||
case "fail": //$NON-NLS-1$
|
case "fail": //$NON-NLS-1$
|
||||||
context.setErrorMessage(parts[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;
|
return false;
|
||||||
case "debug": //$NON-NLS-1$
|
case "debug": //$NON-NLS-1$
|
||||||
System.err.println(line);
|
System.err.println(line);
|
||||||
|
@ -163,7 +163,8 @@ public class ProxyConnectionBootstrap {
|
||||||
@Override
|
@Override
|
||||||
public boolean process(Context context) throws IOException {
|
public boolean process(Context context) throws IOException {
|
||||||
context.getMonitor().subTask(Messages.ProxyConnectionBootstrap_3);
|
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);
|
Bundle serverBundle = Platform.getBundle(bundleName);
|
||||||
if (serverBundle == null) {
|
if (serverBundle == null) {
|
||||||
throw new IOException(NLS.bind(Messages.ProxyConnectionBootstrap_2, bundleName));
|
throw new IOException(NLS.bind(Messages.ProxyConnectionBootstrap_2, bundleName));
|
||||||
|
@ -187,7 +188,7 @@ public class ProxyConnectionBootstrap {
|
||||||
return true;
|
return true;
|
||||||
case "fail": //$NON-NLS-1$
|
case "fail": //$NON-NLS-1$
|
||||||
context.setErrorMessage(parts[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;
|
return false;
|
||||||
case "debug": //$NON-NLS-1$
|
case "debug": //$NON-NLS-1$
|
||||||
System.err.println(line);
|
System.err.println(line);
|
||||||
|
@ -201,7 +202,7 @@ public class ProxyConnectionBootstrap {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean downloadFile(File file, BufferedWriter writer, IProgressMonitor monitor) {
|
private boolean downloadFile(File file, BufferedWriter writer, IProgressMonitor monitor) {
|
||||||
SubMonitor subMon = SubMonitor.convert(monitor, 10);
|
SubMonitor subMon = SubMonitor.convert(monitor, 10);
|
||||||
try {
|
try {
|
||||||
|
@ -235,12 +236,13 @@ public class ProxyConnectionBootstrap {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProxyConnectionBootstrap() {
|
public ProxyConnectionBootstrap() {
|
||||||
jSchService = Activator.getService(IJSchService.class);
|
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);
|
SubMonitor subMon = SubMonitor.convert(monitor, 20);
|
||||||
try {
|
try {
|
||||||
final Channel chan = openChannel(connection, subMon.newChild(10));
|
final Channel chan = openChannel(connection, subMon.newChild(10));
|
||||||
|
@ -268,7 +270,8 @@ public class ProxyConnectionBootstrap {
|
||||||
if (context.getState() != States.START) {
|
if (context.getState() != States.START) {
|
||||||
context.writer.write("exit\n"); //$NON-NLS-1$
|
context.writer.write("exit\n"); //$NON-NLS-1$
|
||||||
context.writer.flush();
|
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$
|
new Thread("server error stream") { //$NON-NLS-1$
|
||||||
@Override
|
@Override
|
||||||
|
@ -277,7 +280,7 @@ public class ProxyConnectionBootstrap {
|
||||||
BufferedReader reader = new BufferedReader(new InputStreamReader(chan.getExtInputStream()));
|
BufferedReader reader = new BufferedReader(new InputStreamReader(chan.getExtInputStream()));
|
||||||
String line;
|
String line;
|
||||||
while ((line = reader.readLine()) != null) {
|
while ((line = reader.readLine()) != null) {
|
||||||
System.err.println("server: "+ line); //$NON-NLS-1$
|
System.err.println("server: " + line); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
// Ignore and terminate thread
|
// Ignore and terminate thread
|
||||||
|
@ -289,18 +292,22 @@ public class ProxyConnectionBootstrap {
|
||||||
throw new RemoteConnectionException(e.getMessage());
|
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();
|
IRemoteConnectionWorkingCopy wc = connection.getWorkingCopy();
|
||||||
IRemoteConnectionHostService hostService = wc.getService(IRemoteConnectionHostService.class);
|
IRemoteConnectionHostService hostService = wc.getService(IRemoteConnectionHostService.class);
|
||||||
IUserAuthenticatorService authService = wc.getService(IUserAuthenticatorService.class);
|
IUserAuthenticatorService authService = wc.getService(IUserAuthenticatorService.class);
|
||||||
try {
|
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));
|
session.setUserInfo(new JSchUserInfo(hostService, authService));
|
||||||
if (hostService.usePassword()) {
|
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 {
|
} 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();
|
String password = hostService.getPassword();
|
||||||
if (!password.isEmpty()) {
|
if (!password.isEmpty()) {
|
||||||
|
|
|
@ -14,7 +14,7 @@ import org.eclipse.remote.core.IRemoteConnectionType.Service;
|
||||||
public class ProxyConnectionProviderService implements IRemoteConnectionProviderService {
|
public class ProxyConnectionProviderService implements IRemoteConnectionProviderService {
|
||||||
|
|
||||||
private IRemoteConnectionType connectionType;
|
private IRemoteConnectionType connectionType;
|
||||||
|
|
||||||
public static class Factory implements IRemoteConnectionType.Service.Factory {
|
public static class Factory implements IRemoteConnectionType.Service.Factory {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
|
@ -25,7 +25,7 @@ public class ProxyConnectionProviderService implements IRemoteConnectionProvider
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProxyConnectionProviderService(IRemoteConnectionType connectionType) {
|
public ProxyConnectionProviderService(IRemoteConnectionType connectionType) {
|
||||||
this.connectionType = connectionType;
|
this.connectionType = connectionType;
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ import org.eclipse.remote.proxy.protocol.core.exceptions.ProxyException;
|
||||||
public class ProxyFileStore extends FileStore {
|
public class ProxyFileStore extends FileStore {
|
||||||
/**
|
/**
|
||||||
* Public factory method for obtaining ProxyFileStore instances.
|
* Public factory method for obtaining ProxyFileStore instances.
|
||||||
*
|
*
|
||||||
* @param uri
|
* @param uri
|
||||||
* URI to get a fileStore for
|
* URI to get a fileStore for
|
||||||
* @return an ProxyFileStore instance for the URI.
|
* @return an ProxyFileStore instance for the URI.
|
||||||
|
@ -145,7 +145,8 @@ public class ProxyFileStore extends FileStore {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IFileStore getChild(String name) {
|
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);
|
return getInstance(uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,7 +157,7 @@ public class ProxyFileStore extends FileStore {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility routing to get the file name from an absolute path.
|
* Utility routing to get the file name from an absolute path.
|
||||||
*
|
*
|
||||||
* @param path
|
* @param path
|
||||||
* path to extract file name from
|
* path to extract file name from
|
||||||
* @return last segment of path, or the full path if it is root
|
* @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));
|
NLS.bind(Messages.ProxyFileStore_4, fRemotePath.toString()), null));
|
||||||
}
|
}
|
||||||
if (!info.isDirectory()) {
|
if (!info.isDirectory()) {
|
||||||
throw new CoreException(new Status(IStatus.ERROR, Activator.getUniqueIdentifier(), EFS.ERROR_WRONG_TYPE,
|
throw new CoreException(new Status(IStatus.ERROR, Activator.getUniqueIdentifier(),
|
||||||
NLS.bind(Messages.ProxyFileStore_5, fRemotePath.toString()), null));
|
EFS.ERROR_WRONG_TYPE, NLS.bind(Messages.ProxyFileStore_5, fRemotePath.toString()), null));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/********************************************************************************
|
/********************************************************************************
|
||||||
* Copyright (c) 2016 Oak Ridge National Laboratory and others.
|
* Copyright (c) 2016 Oak Ridge National Laboratory and others.
|
||||||
* This program and the accompanying materials are made available under the terms
|
* 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
|
* 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 {
|
public class ProxyFileSystem extends FileSystem {
|
||||||
/**
|
/**
|
||||||
* Return the connection name encoded in the URI.
|
* Return the connection name encoded in the URI.
|
||||||
*
|
*
|
||||||
* @param uri
|
* @param uri
|
||||||
* URI specifying a remote tools connection
|
* URI specifying a remote tools connection
|
||||||
* @return name of the connection or null if the URI is invalid
|
* @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.
|
* Return an URI uniquely naming a remote tools remote resource.
|
||||||
*
|
*
|
||||||
* @param connectionName
|
* @param connectionName
|
||||||
* remote tools connection name
|
* remote tools connection name
|
||||||
* @param path
|
* @param path
|
||||||
|
|
|
@ -23,7 +23,7 @@ import org.eclipse.remote.proxy.protocol.core.StreamChannel;
|
||||||
|
|
||||||
public class ProxyProcess implements IRemoteProcessControlService, IRemoteProcessTerminalService {
|
public class ProxyProcess implements IRemoteProcessControlService, IRemoteProcessTerminalService {
|
||||||
private IRemoteProcess remoteProcess;
|
private IRemoteProcess remoteProcess;
|
||||||
|
|
||||||
private final StreamChannel stdIOChan;
|
private final StreamChannel stdIOChan;
|
||||||
private final StreamChannel stdErrChan;
|
private final StreamChannel stdErrChan;
|
||||||
private final StreamChannel controlChan;
|
private final StreamChannel controlChan;
|
||||||
|
@ -33,7 +33,7 @@ public class ProxyProcess implements IRemoteProcessControlService, IRemoteProces
|
||||||
|
|
||||||
private volatile int exitValue;
|
private volatile int exitValue;
|
||||||
private volatile boolean isCompleted;
|
private volatile boolean isCompleted;
|
||||||
|
|
||||||
public static class Factory implements IRemoteProcess.Service.Factory {
|
public static class Factory implements IRemoteProcess.Service.Factory {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
|
@ -51,7 +51,7 @@ public class ProxyProcess implements IRemoteProcessControlService, IRemoteProces
|
||||||
|
|
||||||
protected ProxyProcess(IRemoteProcess process) {
|
protected ProxyProcess(IRemoteProcess process) {
|
||||||
remoteProcess = process;
|
remoteProcess = process;
|
||||||
ProxyProcessBuilder builder = (ProxyProcessBuilder)process.getProcessBuilder();
|
ProxyProcessBuilder builder = (ProxyProcessBuilder) process.getProcessBuilder();
|
||||||
List<StreamChannel> streams = builder.getStreams();
|
List<StreamChannel> streams = builder.getStreams();
|
||||||
controlChan = streams.get(0);
|
controlChan = streams.get(0);
|
||||||
stdIOChan = streams.get(1);
|
stdIOChan = streams.get(1);
|
||||||
|
@ -60,7 +60,7 @@ public class ProxyProcess implements IRemoteProcessControlService, IRemoteProces
|
||||||
resultStream = new DataInputStream(controlChan.getInputStream());
|
resultStream = new DataInputStream(controlChan.getInputStream());
|
||||||
isCompleted = false;
|
isCompleted = false;
|
||||||
exitValue = 0;
|
exitValue = 0;
|
||||||
|
|
||||||
cmdThread = new Thread("process result reader") { //$NON-NLS-1$
|
cmdThread = new Thread("process result reader") { //$NON-NLS-1$
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
@ -91,7 +91,7 @@ public class ProxyProcess implements IRemoteProcessControlService, IRemoteProces
|
||||||
};
|
};
|
||||||
cmdThread.start();
|
cmdThread.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void destroy() {
|
public void destroy() {
|
||||||
try {
|
try {
|
||||||
|
@ -113,7 +113,7 @@ public class ProxyProcess implements IRemoteProcessControlService, IRemoteProces
|
||||||
@Override
|
@Override
|
||||||
public InputStream getErrorStream() {
|
public InputStream getErrorStream() {
|
||||||
if (stdErrChan == null) {
|
if (stdErrChan == null) {
|
||||||
return new InputStream() {
|
return new InputStream() {
|
||||||
@Override
|
@Override
|
||||||
public int read() throws IOException {
|
public int read() throws IOException {
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -32,7 +32,7 @@ public class ProxyProcessBuilder extends AbstractRemoteProcessBuilder {
|
||||||
private final ProxyConnection proxyConnection;
|
private final ProxyConnection proxyConnection;
|
||||||
private Map<String, String> remoteEnv;
|
private Map<String, String> remoteEnv;
|
||||||
private List<StreamChannel> streams = new ArrayList<>();
|
private List<StreamChannel> streams = new ArrayList<>();
|
||||||
|
|
||||||
public ProxyProcessBuilder(ProxyConnection connection, List<String> command) {
|
public ProxyProcessBuilder(ProxyConnection connection, List<String> command) {
|
||||||
super(connection.getRemoteConnection(), command);
|
super(connection.getRemoteConnection(), command);
|
||||||
proxyConnection = connection;
|
proxyConnection = connection;
|
||||||
|
@ -45,13 +45,13 @@ public class ProxyProcessBuilder extends AbstractRemoteProcessBuilder {
|
||||||
public ProxyProcessBuilder(ProxyConnection connection, String... command) {
|
public ProxyProcessBuilder(ProxyConnection connection, String... command) {
|
||||||
this(connection, Arrays.asList(command));
|
this(connection, Arrays.asList(command));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for creating command shell
|
* Constructor for creating command shell
|
||||||
* @param connection
|
* @param connection
|
||||||
*/
|
*/
|
||||||
public ProxyProcessBuilder(ProxyConnection connection) {
|
public ProxyProcessBuilder(ProxyConnection connection) {
|
||||||
super(connection.getRemoteConnection(), (List<String>)null);
|
super(connection.getRemoteConnection(), (List<String>) null);
|
||||||
proxyConnection = connection;
|
proxyConnection = connection;
|
||||||
redirectErrorStream(true);
|
redirectErrorStream(true);
|
||||||
}
|
}
|
||||||
|
@ -75,9 +75,9 @@ public class ProxyProcessBuilder extends AbstractRemoteProcessBuilder {
|
||||||
if (conn == null) {
|
if (conn == null) {
|
||||||
throw new IOException(Messages.ProxyProcessBuilder_0);
|
throw new IOException(Messages.ProxyProcessBuilder_0);
|
||||||
}
|
}
|
||||||
|
|
||||||
Job job;
|
Job job;
|
||||||
|
|
||||||
final List<String> cmdArgs = command();
|
final List<String> cmdArgs = command();
|
||||||
if (cmdArgs != null) {
|
if (cmdArgs != null) {
|
||||||
if (cmdArgs.size() < 1) {
|
if (cmdArgs.size() < 1) {
|
||||||
|
@ -90,18 +90,19 @@ public class ProxyProcessBuilder extends AbstractRemoteProcessBuilder {
|
||||||
if (remoteEnv != null) {
|
if (remoteEnv != null) {
|
||||||
env.putAll(remoteEnv);
|
env.putAll(remoteEnv);
|
||||||
}
|
}
|
||||||
|
|
||||||
final boolean append = (flags & IRemoteProcessBuilder.APPEND_ENVIRONMENT) != 0 || remoteEnv == null;
|
final boolean append = (flags & IRemoteProcessBuilder.APPEND_ENVIRONMENT) != 0 || remoteEnv == null;
|
||||||
|
|
||||||
streams.add(conn.openChannel());
|
streams.add(conn.openChannel());
|
||||||
streams.add(conn.openChannel());
|
streams.add(conn.openChannel());
|
||||||
streams.add(conn.openChannel());
|
streams.add(conn.openChannel());
|
||||||
|
|
||||||
job = new Job("process executor") { //$NON-NLS-1$
|
job = new Job("process executor") { //$NON-NLS-1$
|
||||||
@Override
|
@Override
|
||||||
protected IStatus run(IProgressMonitor monitor) {
|
protected IStatus run(IProgressMonitor monitor) {
|
||||||
ExecCommand cmd = new ExecCommand(conn, cmdArgs, env, directory().toURI().getPath(), redirectErrorStream(), append,
|
ExecCommand cmd = new ExecCommand(conn, cmdArgs, env, directory().toURI().getPath(),
|
||||||
streams.get(0).getId(), streams.get(1).getId(), streams.get(2).getId());
|
redirectErrorStream(), append, streams.get(0).getId(), streams.get(1).getId(),
|
||||||
|
streams.get(2).getId());
|
||||||
try {
|
try {
|
||||||
cmd.getResult(monitor);
|
cmd.getResult(monitor);
|
||||||
} catch (ProxyException e) {
|
} catch (ProxyException e) {
|
||||||
|
@ -116,7 +117,7 @@ public class ProxyProcessBuilder extends AbstractRemoteProcessBuilder {
|
||||||
*/
|
*/
|
||||||
streams.add(conn.openChannel());
|
streams.add(conn.openChannel());
|
||||||
streams.add(conn.openChannel());
|
streams.add(conn.openChannel());
|
||||||
|
|
||||||
job = new Job("process executor") { //$NON-NLS-1$
|
job = new Job("process executor") { //$NON-NLS-1$
|
||||||
@Override
|
@Override
|
||||||
protected IStatus run(IProgressMonitor monitor) {
|
protected IStatus run(IProgressMonitor monitor) {
|
||||||
|
@ -130,7 +131,7 @@ public class ProxyProcessBuilder extends AbstractRemoteProcessBuilder {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
job.schedule();
|
job.schedule();
|
||||||
try {
|
try {
|
||||||
job.join();
|
job.join();
|
||||||
|
|
|
@ -81,4 +81,3 @@ public abstract class AbstractCommand<T> implements Callable<T> {
|
||||||
this.connection = conn;
|
this.connection = conn;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,19 +34,19 @@ public class ChildInfosCommand extends AbstractCommand<IFileInfo[]> {
|
||||||
public IFileInfo[] call() throws ProxyException {
|
public IFileInfo[] call() throws ProxyException {
|
||||||
try {
|
try {
|
||||||
final StreamChannel chan = openChannel();
|
final StreamChannel chan = openChannel();
|
||||||
|
|
||||||
out.writeByte(Protocol.PROTO_COMMAND);
|
out.writeByte(Protocol.PROTO_COMMAND);
|
||||||
out.writeShort(Protocol.CMD_CHILDINFOS);
|
out.writeShort(Protocol.CMD_CHILDINFOS);
|
||||||
out.writeByte(chan.getId());
|
out.writeByte(chan.getId());
|
||||||
out.writeUTF(path);
|
out.writeUTF(path);
|
||||||
out.flush();
|
out.flush();
|
||||||
|
|
||||||
byte res = in.readByte();
|
byte res = in.readByte();
|
||||||
if (res != Protocol.PROTO_OK) {
|
if (res != Protocol.PROTO_OK) {
|
||||||
String errMsg = in.readUTF();
|
String errMsg = in.readUTF();
|
||||||
throw new ProxyException(errMsg);
|
throw new ProxyException(errMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
DataInputStream resultStream = new DataInputStream(chan.getInputStream());
|
DataInputStream resultStream = new DataInputStream(chan.getInputStream());
|
||||||
int length = resultStream.readInt();
|
int length = resultStream.readInt();
|
||||||
SerializableFileInfo sInfo = new SerializableFileInfo();
|
SerializableFileInfo sInfo = new SerializableFileInfo();
|
||||||
|
|
|
@ -37,7 +37,7 @@ public class DeleteCommand extends AbstractCommand<Void> {
|
||||||
out.writeInt(options);
|
out.writeInt(options);
|
||||||
out.writeUTF(path);
|
out.writeUTF(path);
|
||||||
out.flush();
|
out.flush();
|
||||||
|
|
||||||
byte res = in.readByte();
|
byte res = in.readByte();
|
||||||
if (res != Protocol.PROTO_OK) {
|
if (res != Protocol.PROTO_OK) {
|
||||||
String errMsg = in.readUTF();
|
String errMsg = in.readUTF();
|
||||||
|
|
|
@ -30,8 +30,8 @@ public class ExecCommand extends AbstractCommand<Void> {
|
||||||
private final int ioChan;
|
private final int ioChan;
|
||||||
private final int errChan;
|
private final int errChan;
|
||||||
|
|
||||||
public ExecCommand(ProxyConnection conn, List<String> command, Map<String, String> env, String directory, boolean redirect, boolean appendEnv,
|
public ExecCommand(ProxyConnection conn, List<String> command, Map<String, String> env, String directory,
|
||||||
int cmdChan, int ioChan, int errChan) {
|
boolean redirect, boolean appendEnv, int cmdChan, int ioChan, int errChan) {
|
||||||
super(conn);
|
super(conn);
|
||||||
this.out = new DataOutputStream(conn.getCommandChannel().getOutputStream());
|
this.out = new DataOutputStream(conn.getCommandChannel().getOutputStream());
|
||||||
this.in = new DataInputStream(conn.getCommandChannel().getInputStream());
|
this.in = new DataInputStream(conn.getCommandChannel().getInputStream());
|
||||||
|
@ -65,7 +65,7 @@ public class ExecCommand extends AbstractCommand<Void> {
|
||||||
out.writeBoolean(redirect);
|
out.writeBoolean(redirect);
|
||||||
out.writeBoolean(appendEnv);
|
out.writeBoolean(appendEnv);
|
||||||
out.flush();
|
out.flush();
|
||||||
|
|
||||||
byte res = in.readByte();
|
byte res = in.readByte();
|
||||||
if (res != Protocol.PROTO_OK) {
|
if (res != Protocol.PROTO_OK) {
|
||||||
String errMsg = in.readUTF();
|
String errMsg = in.readUTF();
|
||||||
|
|
|
@ -34,19 +34,19 @@ public class FetchInfoCommand extends AbstractCommand<IFileInfo> {
|
||||||
public IFileInfo call() throws ProxyException {
|
public IFileInfo call() throws ProxyException {
|
||||||
try {
|
try {
|
||||||
final StreamChannel chan = openChannel();
|
final StreamChannel chan = openChannel();
|
||||||
|
|
||||||
out.writeByte(Protocol.PROTO_COMMAND);
|
out.writeByte(Protocol.PROTO_COMMAND);
|
||||||
out.writeShort(Protocol.CMD_FETCHINFO);
|
out.writeShort(Protocol.CMD_FETCHINFO);
|
||||||
out.writeByte(chan.getId());
|
out.writeByte(chan.getId());
|
||||||
out.writeUTF(path);
|
out.writeUTF(path);
|
||||||
out.flush();
|
out.flush();
|
||||||
|
|
||||||
byte res = in.readByte();
|
byte res = in.readByte();
|
||||||
if (res != Protocol.PROTO_OK) {
|
if (res != Protocol.PROTO_OK) {
|
||||||
String errMsg = in.readUTF();
|
String errMsg = in.readUTF();
|
||||||
throw new ProxyException(errMsg);
|
throw new ProxyException(errMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
DataInputStream resultStream = new DataInputStream(chan.getInputStream());
|
DataInputStream resultStream = new DataInputStream(chan.getInputStream());
|
||||||
SerializableFileInfo info = new SerializableFileInfo();
|
SerializableFileInfo info = new SerializableFileInfo();
|
||||||
info.readObject(resultStream);
|
info.readObject(resultStream);
|
||||||
|
|
|
@ -31,18 +31,18 @@ public class GetCwdCommand extends AbstractCommand<String> {
|
||||||
try {
|
try {
|
||||||
final StreamChannel chan = openChannel();
|
final StreamChannel chan = openChannel();
|
||||||
DataInputStream resultStream = new DataInputStream(chan.getInputStream());
|
DataInputStream resultStream = new DataInputStream(chan.getInputStream());
|
||||||
|
|
||||||
out.writeByte(Protocol.PROTO_COMMAND);
|
out.writeByte(Protocol.PROTO_COMMAND);
|
||||||
out.writeShort(Protocol.CMD_GETCWD);
|
out.writeShort(Protocol.CMD_GETCWD);
|
||||||
out.writeByte(chan.getId());
|
out.writeByte(chan.getId());
|
||||||
out.flush();
|
out.flush();
|
||||||
|
|
||||||
byte res = in.readByte();
|
byte res = in.readByte();
|
||||||
if (res != Protocol.PROTO_OK) {
|
if (res != Protocol.PROTO_OK) {
|
||||||
String errMsg = in.readUTF();
|
String errMsg = in.readUTF();
|
||||||
throw new ProxyException(errMsg);
|
throw new ProxyException(errMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
String cwd = resultStream.readUTF();
|
String cwd = resultStream.readUTF();
|
||||||
chan.close();
|
chan.close();
|
||||||
return cwd;
|
return cwd;
|
||||||
|
|
|
@ -33,18 +33,18 @@ public class GetEnvCommand extends AbstractCommand<Map<String, String>> {
|
||||||
try {
|
try {
|
||||||
final StreamChannel chan = openChannel();
|
final StreamChannel chan = openChannel();
|
||||||
DataInputStream resultStream = new DataInputStream(chan.getInputStream());
|
DataInputStream resultStream = new DataInputStream(chan.getInputStream());
|
||||||
|
|
||||||
out.writeByte(Protocol.PROTO_COMMAND);
|
out.writeByte(Protocol.PROTO_COMMAND);
|
||||||
out.writeShort(Protocol.CMD_GETENV);
|
out.writeShort(Protocol.CMD_GETENV);
|
||||||
out.writeByte(chan.getId());
|
out.writeByte(chan.getId());
|
||||||
out.flush();
|
out.flush();
|
||||||
|
|
||||||
byte res = in.readByte();
|
byte res = in.readByte();
|
||||||
if (res != Protocol.PROTO_OK) {
|
if (res != Protocol.PROTO_OK) {
|
||||||
String errMsg = in.readUTF();
|
String errMsg = in.readUTF();
|
||||||
throw new ProxyException(errMsg);
|
throw new ProxyException(errMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
int len = resultStream.readInt();
|
int len = resultStream.readInt();
|
||||||
Map<String, String> env = new HashMap<String, String>(len);
|
Map<String, String> env = new HashMap<String, String>(len);
|
||||||
for (int i = 0; i < len; i++) {
|
for (int i = 0; i < len; i++) {
|
||||||
|
|
|
@ -36,20 +36,20 @@ public class GetInputStreamCommand extends AbstractCommand<InputStream> {
|
||||||
public InputStream call() throws ProxyException {
|
public InputStream call() throws ProxyException {
|
||||||
try {
|
try {
|
||||||
StreamChannel chan = openChannel();
|
StreamChannel chan = openChannel();
|
||||||
|
|
||||||
out.writeByte(Protocol.PROTO_COMMAND);
|
out.writeByte(Protocol.PROTO_COMMAND);
|
||||||
out.writeShort(Protocol.CMD_GETINPUTSTREAM);
|
out.writeShort(Protocol.CMD_GETINPUTSTREAM);
|
||||||
out.writeByte(chan.getId());
|
out.writeByte(chan.getId());
|
||||||
out.writeInt(options);
|
out.writeInt(options);
|
||||||
out.writeUTF(path);
|
out.writeUTF(path);
|
||||||
out.flush();
|
out.flush();
|
||||||
|
|
||||||
byte res = in.readByte();
|
byte res = in.readByte();
|
||||||
if (res != Protocol.PROTO_OK) {
|
if (res != Protocol.PROTO_OK) {
|
||||||
String errMsg = in.readUTF();
|
String errMsg = in.readUTF();
|
||||||
throw new ProxyException(errMsg);
|
throw new ProxyException(errMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new BufferedInputStream(chan.getInputStream());
|
return new BufferedInputStream(chan.getInputStream());
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new ProxyException(e.getMessage());
|
throw new ProxyException(e.getMessage());
|
||||||
|
|
|
@ -43,13 +43,13 @@ public class GetOutputStreamCommand extends AbstractCommand<OutputStream> {
|
||||||
out.writeInt(options);
|
out.writeInt(options);
|
||||||
out.writeUTF(path);
|
out.writeUTF(path);
|
||||||
out.flush();
|
out.flush();
|
||||||
|
|
||||||
byte res = in.readByte();
|
byte res = in.readByte();
|
||||||
if (res != Protocol.PROTO_OK) {
|
if (res != Protocol.PROTO_OK) {
|
||||||
String errMsg = in.readUTF();
|
String errMsg = in.readUTF();
|
||||||
throw new ProxyException(errMsg);
|
throw new ProxyException(errMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new BufferedOutputStream(chan.getOutputStream());
|
return new BufferedOutputStream(chan.getOutputStream());
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new ProxyException(e.getMessage());
|
throw new ProxyException(e.getMessage());
|
||||||
|
|
|
@ -33,18 +33,18 @@ public class GetPropertiesCommand extends AbstractCommand<Map<String, String>> {
|
||||||
try {
|
try {
|
||||||
final StreamChannel chan = openChannel();
|
final StreamChannel chan = openChannel();
|
||||||
DataInputStream resultStream = new DataInputStream(chan.getInputStream());
|
DataInputStream resultStream = new DataInputStream(chan.getInputStream());
|
||||||
|
|
||||||
out.writeByte(Protocol.PROTO_COMMAND);
|
out.writeByte(Protocol.PROTO_COMMAND);
|
||||||
out.writeShort(Protocol.CMD_GETPROPERTIES);
|
out.writeShort(Protocol.CMD_GETPROPERTIES);
|
||||||
out.writeByte(chan.getId());
|
out.writeByte(chan.getId());
|
||||||
out.flush();
|
out.flush();
|
||||||
|
|
||||||
byte res = in.readByte();
|
byte res = in.readByte();
|
||||||
if (res != Protocol.PROTO_OK) {
|
if (res != Protocol.PROTO_OK) {
|
||||||
String errMsg = in.readUTF();
|
String errMsg = in.readUTF();
|
||||||
throw new ProxyException(errMsg);
|
throw new ProxyException(errMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
int len = resultStream.readInt();
|
int len = resultStream.readInt();
|
||||||
Map<String, String> props = new HashMap<String, String>(len);
|
Map<String, String> props = new HashMap<String, String>(len);
|
||||||
for (int i = 0; i < len; i++) {
|
for (int i = 0; i < len; i++) {
|
||||||
|
|
|
@ -37,7 +37,7 @@ public class MkdirCommand extends AbstractCommand<Void> {
|
||||||
out.writeInt(options);
|
out.writeInt(options);
|
||||||
out.writeUTF(path);
|
out.writeUTF(path);
|
||||||
out.flush();
|
out.flush();
|
||||||
|
|
||||||
byte res = in.readByte();
|
byte res = in.readByte();
|
||||||
if (res != Protocol.PROTO_OK) {
|
if (res != Protocol.PROTO_OK) {
|
||||||
String errMsg = in.readUTF();
|
String errMsg = in.readUTF();
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue