PTP
Release 5.0

org.eclipse.ptp.launch
Class AbstractParallelLaunchConfigurationDelegate

java.lang.Object
  extended by org.eclipse.debug.core.model.LaunchConfigurationDelegate
      extended by org.eclipse.ptp.launch.AbstractParallelLaunchConfigurationDelegate
All Implemented Interfaces:
org.eclipse.debug.core.model.ILaunchConfigurationDelegate, org.eclipse.debug.core.model.ILaunchConfigurationDelegate2, org.eclipse.ptp.launch.rulesengine.ILaunchProcessCallback
Direct Known Subclasses:
ParallelLaunchConfigurationDelegate

public abstract class AbstractParallelLaunchConfigurationDelegate
extends org.eclipse.debug.core.model.LaunchConfigurationDelegate
implements org.eclipse.ptp.launch.rulesengine.ILaunchProcessCallback


Field Summary
protected  Map<String,org.eclipse.ptp.launch.AbstractParallelLaunchConfigurationDelegate.JobSubmission> jobSubmissions
           
 
Fields inherited from class org.eclipse.debug.core.model.LaunchConfigurationDelegate
complileErrorProjectPromptStatus, complileErrorPromptStatus, promptStatus, saveScopedDirtyEditors, switchToDebugPromptStatus
 
Constructor Summary
AbstractParallelLaunchConfigurationDelegate()
          Constructor
 
Method Summary
 void addSynchronizationRule(org.eclipse.ptp.launch.rulesengine.ISynchronizationRule rule)
           
protected  void copyExecutable(org.eclipse.debug.core.ILaunchConfiguration configuration, org.eclipse.core.runtime.IProgressMonitor monitor)
          Check if the copy local file is enabled.
protected  void copyFileFromRemoteHost(String remotePath, String localPath, org.eclipse.debug.core.ILaunchConfiguration configuration, org.eclipse.core.runtime.IProgressMonitor monitor)
          Copy a data from a path (can be a file or directory) from the remote host to the local host.
protected  void copyFileToRemoteHost(String localPath, String remotePath, org.eclipse.debug.core.ILaunchConfiguration configuration, org.eclipse.core.runtime.IProgressMonitor monitor)
          Copy a data from a path (can be a file or directory) from the local host to the remote host.
protected abstract  void doCleanupLaunch(IPLaunch launch)
          Called to cleanup once the job terminates
protected abstract  void doCompleteJobLaunch(IPLaunch launch, IPDebugger debugger)
          This method is called when the job state changes to RUNNING.
protected  void doPostLaunchSynchronization(org.eclipse.debug.core.ILaunchConfiguration configuration)
           
protected  void doPreLaunchSynchronization(org.eclipse.debug.core.ILaunchConfiguration configuration, org.eclipse.core.runtime.IProgressMonitor monitor)
          This method does the synchronization step before the job submission
protected static String getArguments(org.eclipse.debug.core.ILaunchConfiguration configuration)
          Get the program arguments specified in the Arguments tab
 boolean getCopyExecutable(org.eclipse.debug.core.ILaunchConfiguration configuration)
          Get if the executable shall be copied to remote target before launch.
protected  IPDebugConfiguration getDebugConfig(org.eclipse.debug.core.ILaunchConfiguration config)
          Get the debugger configuration
protected static String getDebuggerExePath(org.eclipse.debug.core.ILaunchConfiguration configuration)
          Get the debugger executable path
protected static String getDebuggerID(org.eclipse.debug.core.ILaunchConfiguration configuration)
          Get the ID of the debugger for this launch
protected static boolean getDebuggerStopInMainFlag(org.eclipse.debug.core.ILaunchConfiguration configuration)
          Get the debugger "stop in main" flag
protected static String getDebuggerWorkDirectory(org.eclipse.debug.core.ILaunchConfiguration configuration)
          Get the working directory for this debug session
protected static String[] getEnvironmentToAppend(org.eclipse.debug.core.ILaunchConfiguration configuration)
           
protected  String getExecutablePath(org.eclipse.debug.core.ILaunchConfiguration configuration)
          Get the absolute path of the executable to launch.
 org.eclipse.debug.core.ILaunch getLaunch(org.eclipse.debug.core.ILaunchConfiguration configuration, String mode)
           
 IRemoteFileManager getLocalFileManager(org.eclipse.debug.core.ILaunchConfiguration configuration)
           
protected  String[] getProgramArguments(org.eclipse.debug.core.ILaunchConfiguration configuration)
          Convert application arguments to an array of strings.
protected  String getProgramName(org.eclipse.debug.core.ILaunchConfiguration configuration)
          Get the name of the executable to launch
protected  String getProgramPath(org.eclipse.debug.core.ILaunchConfiguration configuration)
          Get the path component of the executable to launch.
protected  org.eclipse.core.resources.IProject getProject(String project)
          Get the IProject object from the project name.
protected static String getProjectName(org.eclipse.debug.core.ILaunchConfiguration configuration)
          Get the name of the project
protected  org.eclipse.ptp.core.elements.IPQueue getQueueDefault(org.eclipse.ptp.core.elements.IPResourceManager rm)
          Get the default queue for the given resource manager
protected static String getQueueName(org.eclipse.debug.core.ILaunchConfiguration configuration)
          Get the name of the queue for the launch
 IRemoteFileManager getRemoteFileManager(org.eclipse.debug.core.ILaunchConfiguration configuration, org.eclipse.core.runtime.IProgressMonitor monitor)
           
protected  org.eclipse.ptp.rmsystem.IResourceManager getResourceManager(org.eclipse.debug.core.ILaunchConfiguration configuration)
          Find the resource manager that corresponds to the unique name specified in the configuration
protected static String getResourceManagerUniqueName(org.eclipse.debug.core.ILaunchConfiguration configuration)
          Get the resource manager to use for the launch
protected  org.eclipse.ptp.launch.rulesengine.ISynchronizationRule[] getSynchronizeRules(org.eclipse.debug.core.ILaunchConfiguration configuration)
          Returns the (possible empty) list of synchronization rule objects according to the rules described in the configuration.
protected  String getWorkingDirectory(org.eclipse.debug.core.ILaunchConfiguration configuration)
          Get the working directory for the application launch
protected  org.eclipse.core.resources.IWorkspaceRoot getWorkspaceRoot()
          Get the workspace root.
protected  void setDefaultSourceLocator(org.eclipse.debug.core.ILaunch launch, org.eclipse.debug.core.ILaunchConfiguration configuration)
          Create a source locator from the ID specified in the configuration, or create a default one if it hasn't been specified.
protected  void setSourceLocator(org.eclipse.debug.core.ILaunch launch, org.eclipse.debug.core.ILaunchConfiguration config)
          Set the source locator for this application
protected  void setWorkingDirectory(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy configuration, String dir)
          Set the working directory
protected  void submitJob(org.eclipse.debug.core.ILaunchConfiguration configuration, String mode, IPLaunch launch, IPDebugger debugger, org.eclipse.core.runtime.IProgressMonitor monitor)
          Submit a job to the resource manager.
protected  void verifyDebuggerPath(org.eclipse.debug.core.ILaunchConfiguration configuration, org.eclipse.core.runtime.IProgressMonitor monitor)
          Verify the validity of the debugger path.
protected  org.eclipse.core.runtime.IPath verifyExecutablePath(org.eclipse.debug.core.ILaunchConfiguration configuration, org.eclipse.core.runtime.IProgressMonitor monitor)
          Verify the validity of executable path.
protected  void verifyLaunchAttributes(org.eclipse.debug.core.ILaunchConfiguration configuration, String mode, org.eclipse.core.runtime.IProgressMonitor monitor)
           
protected  org.eclipse.core.resources.IProject verifyProject(org.eclipse.debug.core.ILaunchConfiguration configuration)
          Verify that the project exists prior to the launch.
protected  org.eclipse.core.runtime.IPath verifyResource(String path, org.eclipse.debug.core.ILaunchConfiguration configuration, org.eclipse.core.runtime.IProgressMonitor monitor)
           
protected  String verifyWorkDirectory(org.eclipse.debug.core.ILaunchConfiguration configuration, org.eclipse.core.runtime.IProgressMonitor monitor)
          Verify the working directory.
 
Methods inherited from class org.eclipse.debug.core.model.LaunchConfigurationDelegate
addReferencedProjects, buildForLaunch, buildProjects, computeBuildOrder, computeReferencedBuildOrder, existsProblems, finalLaunchCheck, getBreakpoints, getBuildOrder, getProjectsForProblemSearch, isLaunchProblem, preLaunchCheck, saveBeforeLaunch
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.debug.core.model.ILaunchConfigurationDelegate
launch
 

Field Detail

jobSubmissions

protected Map<String,org.eclipse.ptp.launch.AbstractParallelLaunchConfigurationDelegate.JobSubmission> jobSubmissions
Constructor Detail

AbstractParallelLaunchConfigurationDelegate

public AbstractParallelLaunchConfigurationDelegate()
Constructor

Method Detail

getArguments

protected static String getArguments(org.eclipse.debug.core.ILaunchConfiguration configuration)
                              throws org.eclipse.core.runtime.CoreException
Get the program arguments specified in the Arguments tab

Parameters:
configuration -
Returns:
Throws:
org.eclipse.core.runtime.CoreException

getDebuggerExePath

protected static String getDebuggerExePath(org.eclipse.debug.core.ILaunchConfiguration configuration)
                                    throws org.eclipse.core.runtime.CoreException
Get the debugger executable path

Parameters:
configuration -
Returns:
Throws:
org.eclipse.core.runtime.CoreException

getDebuggerID

protected static String getDebuggerID(org.eclipse.debug.core.ILaunchConfiguration configuration)
                               throws org.eclipse.core.runtime.CoreException
Get the ID of the debugger for this launch

Parameters:
configuration -
Returns:
Throws:
org.eclipse.core.runtime.CoreException

getDebuggerStopInMainFlag

protected static boolean getDebuggerStopInMainFlag(org.eclipse.debug.core.ILaunchConfiguration configuration)
                                            throws org.eclipse.core.runtime.CoreException
Get the debugger "stop in main" flag

Parameters:
configuration -
Returns:
"stop in main" flag
Throws:
org.eclipse.core.runtime.CoreException

getDebuggerWorkDirectory

protected static String getDebuggerWorkDirectory(org.eclipse.debug.core.ILaunchConfiguration configuration)
                                          throws org.eclipse.core.runtime.CoreException
Get the working directory for this debug session

Parameters:
configuration -
Returns:
Throws:
org.eclipse.core.runtime.CoreException

getEnvironmentToAppend

protected static String[] getEnvironmentToAppend(org.eclipse.debug.core.ILaunchConfiguration configuration)
                                          throws org.eclipse.core.runtime.CoreException
Parameters:
configuration -
Returns:
Throws:
org.eclipse.core.runtime.CoreException

getProjectName

protected static String getProjectName(org.eclipse.debug.core.ILaunchConfiguration configuration)
                                throws org.eclipse.core.runtime.CoreException
Get the name of the project

Parameters:
configuration -
Returns:
Throws:
org.eclipse.core.runtime.CoreException

getQueueName

protected static String getQueueName(org.eclipse.debug.core.ILaunchConfiguration configuration)
                              throws org.eclipse.core.runtime.CoreException
Get the name of the queue for the launch

Parameters:
configuration -
Returns:
Throws:
org.eclipse.core.runtime.CoreException

getResourceManagerUniqueName

protected static String getResourceManagerUniqueName(org.eclipse.debug.core.ILaunchConfiguration configuration)
                                              throws org.eclipse.core.runtime.CoreException
Get the resource manager to use for the launch

Parameters:
configuration -
Returns:
Throws:
org.eclipse.core.runtime.CoreException

addSynchronizationRule

public void addSynchronizationRule(org.eclipse.ptp.launch.rulesengine.ISynchronizationRule rule)
Specified by:
addSynchronizationRule in interface org.eclipse.ptp.launch.rulesengine.ILaunchProcessCallback
Since:
5.0

getCopyExecutable

public boolean getCopyExecutable(org.eclipse.debug.core.ILaunchConfiguration configuration)
                          throws org.eclipse.core.runtime.CoreException
Get if the executable shall be copied to remote target before launch.

Parameters:
configuration -
Returns:
Throws:
org.eclipse.core.runtime.CoreException

getLaunch

public org.eclipse.debug.core.ILaunch getLaunch(org.eclipse.debug.core.ILaunchConfiguration configuration,
                                                String mode)
                                         throws org.eclipse.core.runtime.CoreException
Specified by:
getLaunch in interface org.eclipse.debug.core.model.ILaunchConfigurationDelegate2
Overrides:
getLaunch in class org.eclipse.debug.core.model.LaunchConfigurationDelegate
Throws:
org.eclipse.core.runtime.CoreException

getLocalFileManager

public IRemoteFileManager getLocalFileManager(org.eclipse.debug.core.ILaunchConfiguration configuration)
                                       throws org.eclipse.core.runtime.CoreException
Specified by:
getLocalFileManager in interface org.eclipse.ptp.launch.rulesengine.ILaunchProcessCallback
Throws:
org.eclipse.core.runtime.CoreException

getRemoteFileManager

public IRemoteFileManager getRemoteFileManager(org.eclipse.debug.core.ILaunchConfiguration configuration,
                                               org.eclipse.core.runtime.IProgressMonitor monitor)
                                        throws org.eclipse.core.runtime.CoreException
Specified by:
getRemoteFileManager in interface org.eclipse.ptp.launch.rulesengine.ILaunchProcessCallback
Throws:
org.eclipse.core.runtime.CoreException
Since:
5.0

copyExecutable

protected void copyExecutable(org.eclipse.debug.core.ILaunchConfiguration configuration,
                              org.eclipse.core.runtime.IProgressMonitor monitor)
                       throws org.eclipse.core.runtime.CoreException
Check if the copy local file is enabled. If it is, copy the executable file from the local host to the remote host.

Parameters:
configuration - launch configuration
Throws:
org.eclipse.core.runtime.CoreException - if the copy fails or is cancelled

copyFileFromRemoteHost

protected void copyFileFromRemoteHost(String remotePath,
                                      String localPath,
                                      org.eclipse.debug.core.ILaunchConfiguration configuration,
                                      org.eclipse.core.runtime.IProgressMonitor monitor)
                               throws org.eclipse.core.runtime.CoreException
Copy a data from a path (can be a file or directory) from the remote host to the local host.

Parameters:
remotePath -
localPath -
configuration -
Throws:
org.eclipse.core.runtime.CoreException

copyFileToRemoteHost

protected void copyFileToRemoteHost(String localPath,
                                    String remotePath,
                                    org.eclipse.debug.core.ILaunchConfiguration configuration,
                                    org.eclipse.core.runtime.IProgressMonitor monitor)
                             throws org.eclipse.core.runtime.CoreException
Copy a data from a path (can be a file or directory) from the local host to the remote host.

Parameters:
localPath -
remotePath -
configuration -
Throws:
org.eclipse.core.runtime.CoreException

doCleanupLaunch

protected abstract void doCleanupLaunch(IPLaunch launch)
Called to cleanup once the job terminates

Parameters:
config -
mode -
launch -
Since:
5.0

doCompleteJobLaunch

protected abstract void doCompleteJobLaunch(IPLaunch launch,
                                            IPDebugger debugger)
This method is called when the job state changes to RUNNING. This allows the launcher to complete the job launch.

Parameters:
launch -
debugger -
Since:
5.0

doPostLaunchSynchronization

protected void doPostLaunchSynchronization(org.eclipse.debug.core.ILaunchConfiguration configuration)
                                    throws org.eclipse.core.runtime.CoreException
Parameters:
configuration -
Throws:
org.eclipse.core.runtime.CoreException

doPreLaunchSynchronization

protected void doPreLaunchSynchronization(org.eclipse.debug.core.ILaunchConfiguration configuration,
                                          org.eclipse.core.runtime.IProgressMonitor monitor)
                                   throws org.eclipse.core.runtime.CoreException
This method does the synchronization step before the job submission

Parameters:
configuration -
monitor -
Throws:
org.eclipse.core.runtime.CoreException

verifyLaunchAttributes

protected void verifyLaunchAttributes(org.eclipse.debug.core.ILaunchConfiguration configuration,
                                      String mode,
                                      org.eclipse.core.runtime.IProgressMonitor monitor)
                               throws org.eclipse.core.runtime.CoreException
Throws:
org.eclipse.core.runtime.CoreException
Since:
5.0

getDebugConfig

protected IPDebugConfiguration getDebugConfig(org.eclipse.debug.core.ILaunchConfiguration config)
                                       throws org.eclipse.core.runtime.CoreException
Get the debugger configuration

Parameters:
configuration - launch configuration
Returns:
debugger configuration
Throws:
org.eclipse.core.runtime.CoreException

getExecutablePath

protected String getExecutablePath(org.eclipse.debug.core.ILaunchConfiguration configuration)
                            throws org.eclipse.core.runtime.CoreException
Get the absolute path of the executable to launch. If the executable is on a remote machine, this is the path to the executable on that machine.

Parameters:
configuration -
Returns:
Throws:
org.eclipse.core.runtime.CoreException

getProgramArguments

protected String[] getProgramArguments(org.eclipse.debug.core.ILaunchConfiguration configuration)
                                throws org.eclipse.core.runtime.CoreException
Convert application arguments to an array of strings.

Parameters:
configuration - launch configuration
Returns:
array of strings containing the program arguments
Throws:
org.eclipse.core.runtime.CoreException

getProgramName

protected String getProgramName(org.eclipse.debug.core.ILaunchConfiguration configuration)
                         throws org.eclipse.core.runtime.CoreException
Get the name of the executable to launch

Parameters:
configuration -
Returns:
Throws:
org.eclipse.core.runtime.CoreException

getProgramPath

protected String getProgramPath(org.eclipse.debug.core.ILaunchConfiguration configuration)
                         throws org.eclipse.core.runtime.CoreException
Get the path component of the executable to launch.

Parameters:
configuration -
Returns:
Throws:
org.eclipse.core.runtime.CoreException
Since:
5.0

getProject

protected org.eclipse.core.resources.IProject getProject(String project)
Get the IProject object from the project name.

Parameters:
project - name of the project
Returns:
IProject resource

getQueueDefault

protected org.eclipse.ptp.core.elements.IPQueue getQueueDefault(org.eclipse.ptp.core.elements.IPResourceManager rm)
Get the default queue for the given resource manager

Parameters:
rm - resource manager
Returns:
default queue
Since:
5.0

getResourceManager

protected org.eclipse.ptp.rmsystem.IResourceManager getResourceManager(org.eclipse.debug.core.ILaunchConfiguration configuration)
                                                                throws org.eclipse.core.runtime.CoreException
Find the resource manager that corresponds to the unique name specified in the configuration

Parameters:
configuration - launch configuration
Returns:
resource manager
Throws:
org.eclipse.core.runtime.CoreException
Since:
5.0

getSynchronizeRules

protected org.eclipse.ptp.launch.rulesengine.ISynchronizationRule[] getSynchronizeRules(org.eclipse.debug.core.ILaunchConfiguration configuration)
                                                                                 throws org.eclipse.core.runtime.CoreException
Returns the (possible empty) list of synchronization rule objects according to the rules described in the configuration.

Throws:
org.eclipse.core.runtime.CoreException
Since:
5.0

getWorkingDirectory

protected String getWorkingDirectory(org.eclipse.debug.core.ILaunchConfiguration configuration)
                              throws org.eclipse.core.runtime.CoreException
Get the working directory for the application launch

Parameters:
configuration -
Returns:
Throws:
org.eclipse.core.runtime.CoreException
Since:
5.0

setWorkingDirectory

protected void setWorkingDirectory(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy configuration,
                                   String dir)
                            throws org.eclipse.core.runtime.CoreException
Set the working directory

Parameters:
configuration -
dir -
Throws:
org.eclipse.core.runtime.CoreException
Since:
5.0

getWorkspaceRoot

protected org.eclipse.core.resources.IWorkspaceRoot getWorkspaceRoot()
Get the workspace root.

Returns:
workspace root

setDefaultSourceLocator

protected void setDefaultSourceLocator(org.eclipse.debug.core.ILaunch launch,
                                       org.eclipse.debug.core.ILaunchConfiguration configuration)
                                throws org.eclipse.core.runtime.CoreException
Create a source locator from the ID specified in the configuration, or create a default one if it hasn't been specified.

Parameters:
launch -
configuration -
Throws:
org.eclipse.core.runtime.CoreException

setSourceLocator

protected void setSourceLocator(org.eclipse.debug.core.ILaunch launch,
                                org.eclipse.debug.core.ILaunchConfiguration config)
                         throws org.eclipse.core.runtime.CoreException
Set the source locator for this application

Parameters:
launch -
config -
Throws:
org.eclipse.core.runtime.CoreException

submitJob

protected void submitJob(org.eclipse.debug.core.ILaunchConfiguration configuration,
                         String mode,
                         IPLaunch launch,
                         IPDebugger debugger,
                         org.eclipse.core.runtime.IProgressMonitor monitor)
                  throws org.eclipse.core.runtime.CoreException
Submit a job to the resource manager. Keeps track of the submission so we know when the job actually starts running. When this happens, the abstract method doCompleteJobLaunch() is invoked.

Parameters:
configuration -
mode -
launch -
debugger -
monitor -
Throws:
org.eclipse.core.runtime.CoreException
Since:
5.0

verifyDebuggerPath

protected void verifyDebuggerPath(org.eclipse.debug.core.ILaunchConfiguration configuration,
                                  org.eclipse.core.runtime.IProgressMonitor monitor)
                           throws org.eclipse.core.runtime.CoreException
Verify the validity of the debugger path.

Parameters:
configuration - launch configuration
monitor - progress monitor
Throws:
org.eclipse.core.runtime.CoreException - if the path is invalid or the monitor was canceled.
Since:
5.0

verifyExecutablePath

protected org.eclipse.core.runtime.IPath verifyExecutablePath(org.eclipse.debug.core.ILaunchConfiguration configuration,
                                                              org.eclipse.core.runtime.IProgressMonitor monitor)
                                                       throws org.eclipse.core.runtime.CoreException
Verify the validity of executable path. If the executable is to be copied, then no additional verification is required. Otherwise, the path must point to an existing file.

Parameters:
configuration - launch configuration
monitor - progress monitor
Returns:
IPath representing path to the executable (either local or remote)
Throws:
org.eclipse.core.runtime.CoreException - if the resource can't be found or the monitor was canceled.
Since:
5.0

verifyProject

protected org.eclipse.core.resources.IProject verifyProject(org.eclipse.debug.core.ILaunchConfiguration configuration)
                                                     throws org.eclipse.core.runtime.CoreException
Verify that the project exists prior to the launch.

Parameters:
configuration -
Returns:
Throws:
org.eclipse.core.runtime.CoreException

verifyResource

protected org.eclipse.core.runtime.IPath verifyResource(String path,
                                                        org.eclipse.debug.core.ILaunchConfiguration configuration,
                                                        org.eclipse.core.runtime.IProgressMonitor monitor)
                                                 throws org.eclipse.core.runtime.CoreException
Parameters:
path -
configuration -
Returns:
Throws:
org.eclipse.core.runtime.CoreException
Since:
5.0

verifyWorkDirectory

protected String verifyWorkDirectory(org.eclipse.debug.core.ILaunchConfiguration configuration,
                                     org.eclipse.core.runtime.IProgressMonitor monitor)
                              throws org.eclipse.core.runtime.CoreException
Verify the working directory. If no working directory is specified, the default is the location of the executable.

Parameters:
configuration - launch configuration
monitor - progress monitor
Returns:
path of working directory
Throws:
org.eclipse.core.runtime.CoreException - if the working directory is invalid or the monitor was canceled.
Since:
5.0

PTP
Release 5.0

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