PTP
Release 7.0

org.eclipse.ptp.ems.core
Interface IEnvManager

All Known Implementing Classes:
LazyEnvManagerDetector

public interface IEnvManager

An object which provides access to an environment management system on a remote machine.

All contributions to the "org.eclipse.ptp.ems.core.envmanager" extension point must implement this interface.

Since:
6.0

Field Summary
static java.lang.String ENV_MANAGER_EXTENSION_POINT_ID
          ID for the envmanager extension point
 
Method Summary
 boolean checkForCompatibleInstallation(IProgressMonitor pm)
          Returns true iff the remote machine is running an environment management system supported by this IEnvManager.
 void configure(IRemoteConnection remoteConnection)
          Sets the IRemoteConnection which will be used to run commands on a remote machine.
 java.lang.String createBashScript(IProgressMonitor pm, boolean echo, IEnvManagerConfig config, java.lang.String commandToExecuteAfterward)
          Creates a temporary file on the remote machine and writes a Bash shell script into that file which will configure the remote environment with the given elements, execute the given command, and then delete the temporary file (shell script).
 java.util.List<java.lang.String> determineAvailableElements(IProgressMonitor pm)
          Returns the set of all environment configuration elements available on the remote machine (e.g., the result of module -t avail).
 java.util.List<java.lang.String> determineDefaultElements(IProgressMonitor pm)
          Returns the set of all environment configuration elements loaded by default upon login (e.g., the result of module -t list in a login shell).
 java.lang.String getBashConcatenation(java.lang.String separator, boolean echo, IEnvManagerConfig config, java.lang.String commandToExecuteAfterward)
          Returns a single Bash shell command which will configure the remote environment with the given elements and then execute the given command.
 java.util.Comparator<java.lang.String> getComparator()
          Returns a Comparator used to sort the strings returned by determineAvailableElements(IProgressMonitor) and determineDefaultElements(IProgressMonitor) when displaying them to the user.
 java.lang.String getDescription(IProgressMonitor pm)
          If the remote machine is running an environment management system supported by this IEnvManager, returns a short description of the environment management system (e.g., "Modules 3.2.7"); otherwise, returns null.
 java.lang.String getInstructions()
          Returns a short sentence that will be displayed to the user to request that items be selected from a checklist.
 java.lang.String getName()
          Returns a human-readable name for this environment management system.
 

Field Detail

ENV_MANAGER_EXTENSION_POINT_ID

static final java.lang.String ENV_MANAGER_EXTENSION_POINT_ID
ID for the envmanager extension point

See Also:
Constant Field Values
Method Detail

getName

java.lang.String getName()
Returns a human-readable name for this environment management system.

Returns:
String (non-null)

getComparator

java.util.Comparator<java.lang.String> getComparator()
Returns a Comparator used to sort the strings returned by determineAvailableElements(IProgressMonitor) and determineDefaultElements(IProgressMonitor) when displaying them to the user.

Returns:
Comparator (non-null)

getInstructions

java.lang.String getInstructions()
Returns a short sentence that will be displayed to the user to request that items be selected from a checklist.

For example, "Select modules to be loaded."

Returns:
String (non-null)

configure

void configure(IRemoteConnection remoteConnection)
Sets the IRemoteConnection which will be used to run commands on a remote machine.

This method must be invoked before checkForCompatibleInstallation(IProgressMonitor), getDescription(IProgressMonitor), determineAvailableElements(IProgressMonitor), determineDefaultElements(IProgressMonitor), or createBashScript(IProgressMonitor, boolean, IEnvManagerConfig, String).

Parameters:
remoteConnection - IRemoteConnection (non-null)

checkForCompatibleInstallation

boolean checkForCompatibleInstallation(IProgressMonitor pm)
                                       throws RemoteConnectionException,
                                              java.io.IOException
Returns true iff the remote machine is running an environment management system supported by this IEnvManager.

Parameters:
pm - progress monitor used to report the status of potentially long-running operations to the user (non- null)
Returns:
true iff the remote machine is running an environment management system supported by this IEnvManager
Throws:
java.lang.NullPointerException - if configure(IRemoteConnection) has not been called
RemoteConnectionException - if an remote connection error occurs
java.io.IOException - if an input/output error occurs

getDescription

java.lang.String getDescription(IProgressMonitor pm)
                                throws RemoteConnectionException,
                                       java.io.IOException
If the remote machine is running an environment management system supported by this IEnvManager, returns a short description of the environment management system (e.g., "Modules 3.2.7"); otherwise, returns null.

Parameters:
pm - progress monitor used to report the status of potentially long-running operations to the user (non- null)
Returns:
a short, human-readable description of the environment configuration system (e.g., "SoftEnv 1.6.2"), or null if a compatible environment configuration system is not present on the remote machine
Throws:
java.lang.NullPointerException - if configure(IRemoteConnection) has not been called
RemoteConnectionException - if an remote connection error occurs
java.io.IOException - if an input/output error occurs

determineAvailableElements

java.util.List<java.lang.String> determineAvailableElements(IProgressMonitor pm)
                                                            throws RemoteConnectionException,
                                                                   java.io.IOException
Returns the set of all environment configuration elements available on the remote machine (e.g., the result of module -t avail).

Parameters:
pm - progress monitor used to report the status of potentially long-running operations to the user (non- null)
Returns:
unmodifiable Set (non-null)
Throws:
java.lang.NullPointerException - if configure(IRemoteConnection) has not been called
RemoteConnectionException - if an remote connection error occurs
java.io.IOException - if an input/output error occurs
Since:
2.0

determineDefaultElements

java.util.List<java.lang.String> determineDefaultElements(IProgressMonitor pm)
                                                          throws RemoteConnectionException,
                                                                 java.io.IOException
Returns the set of all environment configuration elements loaded by default upon login (e.g., the result of module -t list in a login shell). Note that the ordering of modules is important and must be retained.

Parameters:
pm - progress monitor used to report the status of potentially long-running operations to the user (non- null)
Returns:
unmodifiable List (non-null)
Throws:
java.lang.NullPointerException - if configure(IRemoteConnection) has not been called
RemoteConnectionException - if an remote connection error occurs
java.io.IOException - if an input/output error occurs
Since:
2.0

getBashConcatenation

java.lang.String getBashConcatenation(java.lang.String separator,
                                      boolean echo,
                                      IEnvManagerConfig config,
                                      java.lang.String commandToExecuteAfterward)
Returns a single Bash shell command which will configure the remote environment with the given elements and then execute the given command.

The returned command may include sequencing, piping, I/O redirection, etc.; however, it must be possible to concatenate additional Bash commands by appending a semicolon.

Parameters:
separator - string that will be inserted between consecutive Bash commands: typically, either a semicolon or a newline
echo - true iff the script should "echo" each command prior to execution
config - environment manager configuration (non-null)
commandToExecuteAfterward - a Bash shell command to execute after the environment has been configured
Returns:
a single Bash shell command which will configure the remote environment with the given elements and then execute the given command (non-null)

createBashScript

java.lang.String createBashScript(IProgressMonitor pm,
                                  boolean echo,
                                  IEnvManagerConfig config,
                                  java.lang.String commandToExecuteAfterward)
                                  throws RemoteConnectionException,
                                         java.io.IOException
Creates a temporary file on the remote machine and writes a Bash shell script into that file which will configure the remote environment with the given elements, execute the given command, and then delete the temporary file (shell script).

Parameters:
pm - progress monitor used to report the status of potentially long-running operations to the user (non- null)
echo - true iff the script should "echo" each command prior to execution
config - environment manager configuration (non-null)
commandToExecuteAfterward - a Bash shell command to execute after the environment has been configured
Returns:
path to the shell script on the remote machine (non-null)
Throws:
RemoteConnectionException - if an remote connection error occurs
java.io.IOException - if an input/output error occurs

PTP
Release 7.0

Copyright (c) 2011 IBM Corporation and others. All Rights Reserved.