Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

RSE
Release 3.0

org.eclipse.rse.services.shells
Interface IShellService

All Superinterfaces:
IAdaptable, IService
All Known Implementing Classes:
AbstractShellService

public interface IShellService
extends IService

IShellService is an abstraction for running shells and shell commands.


Method Summary
  String[] getHostEnvironment ()
          Return an array of environment variables that describe the environment on the remote system.
  IHostShell launchShell ( String initialWorkingDirectory, String[] environment, IProgressMonitor monitor)
          Launch a new shell in the specified directory with a default encoding.
  IHostShell launchShell ( String initialWorkingDirectory, String encoding, String[] environment, IProgressMonitor monitor)
          Launch a new shell in the specified directory.
  IHostShell runCommand ( String initialWorkingDirectory, String command, String[] environment, IProgressMonitor monitor)
          Run a single command in it's own shell with a default encoding.
  IHostShell runCommand ( String initialWorkingDirectory, String command, String encoding, String[] environment, IProgressMonitor monitor)
          Run a single command in it's own shell.
 
Methods inherited from interface org.eclipse.rse.services. IService
getDescription, getName, initService, uninitService
 
Methods inherited from interface org.eclipse.core.runtime. IAdaptable
getAdapter
 

Method Detail

launchShell


IHostShell launchShell(
String initialWorkingDirectory,
                       
String[] environment,
                       
IProgressMonitor monitor)
                       throws 
SystemMessageException
Launch a new shell in the specified directory with a default encoding. This is a convenience method, passing null as encoding into launchShell(String, String, String[], IProgressMonitor).

Throws:
SystemMessageException - in case an error occurred or the user chose to cancel the operation via the progress monitor.

launchShell


IHostShell launchShell(
String initialWorkingDirectory,
                       
String encoding,
                       
String[] environment,
                       
IProgressMonitor monitor)
                       throws 
SystemMessageException
Launch a new shell in the specified directory.

Parameters:
initialWorkingDirectory - initial working directory or empty String ("") if not relevant. The remote shell will launch in a directory of its own choice in that case (typically a user's home directory).
encoding - Stream encoding to use, or null to fall back to a default encoding. The Shell Service will make efforts to determine a proper default encoding on the remote side but this is not guaranteed to be correct.
environment - Array of environment variable Strings of the form "var=text". Since not all shell implementations support the passing of environment variables, there is no guarantee that the created shell will actually have the specified environment set.
monitor - Progress Monitor for monitoring and cancellation
Returns:
the shell object. Note that the shell may not actually be usable in case the remote side allows opening a channel but immediately closes it again. In this case, IHostShell.isActive() returns false on the created Shell object.
Throws:
SystemMessageException - in case an error occurred or the user chose to cancel the operation via the progress monitor.

runCommand


IHostShell runCommand(
String initialWorkingDirectory,
                      
String command,
                      
String[] environment,
                      
IProgressMonitor monitor)
                      throws 
SystemMessageException
Run a single command in it's own shell with a default encoding. This is a convenience method, passing null as encoding into runCommand(String, String, String, String[], IProgressMonitor).

Throws:
SystemMessageException - in case an error occurred or the user chose to cancel the operation via the progress monitor.

runCommand


IHostShell runCommand(
String initialWorkingDirectory,
                      
String command,
                      
String encoding,
                      
String[] environment,
                      
IProgressMonitor monitor)
                      throws 
SystemMessageException
Run a single command in it's own shell. This method is similar to launchShell(String, String, String[], IProgressMonitor) but immediately executes a specified command rather than just opening a shell. There is no guarantee that after the host shell will accept any subsequent commands after the initial command has been executed; there is, however, also no guarantee that the host shell will terminate the connection automatically. Clients need to call IHostShell.exit() in case the shell remains active after the initial command is completed.

Parameters:
initialWorkingDirectory - initial working directory or empty String ("") if not relevant. The remote command will launch in a directory of its own choice in that case (typically a user's home directory).
command - initial command to send to the remote side.
encoding - Stream encoding to use, or null to fall back to a default encoding. The Shell Service will make efforts to determine a proper default encoding on the remote side but this is not guaranteed to be correct.
environment - Array of environment variable Strings of the form "var=text". Since not all shell implementations support the passing of environment variables, there is no guarantee that the created shell will actually have the specified environment set.
monitor - Progress Monitor for monitoring and cancellation
Returns:
the shell object for getting output and error streams. Note that the shell may not actually be usable in case an error occurred on the remote side, such as the command not being executable. In this case, IHostShell.isActive() returns false on the created Shell object.
Throws:
SystemMessageException - in case an error occurred or the user chose to cancel the operation via the progress monitor.

getHostEnvironment


String[] getHostEnvironment()
                            throws 
SystemMessageException
Return an array of environment variables that describe the environment on the remote system. Each String returned is of the format "var=text": Everything up to the first equals sign is the name of the given environment variable, everything after the equals sign is its contents.

Returns:
Array of environment variable Strings of the form "var=text" if supported by a shell service implementation. Should return an empty array in case environment variable retrieval is not supported on a particular shell service implementation.
Throws:
SystemMessageException - in case an error occurred or the user chose to cancel the operation via the progress monitor.

RSE
Release 3.0

Copyright (c) IBM Corporation and others 2000, 2008. All Rights Reserved.

 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire