public class MultiLauncher extends Item implements java.lang.Runnable
The MultiLauncher is an Item that is capable of launching a set of multiple jobs. It is a composite Item and requires information about the other job launchers available to ICE. The list of other job launchers is provided by the MultiLauncherBuilder.
The MultiLauncher is capable of launching a set of jobs, either serially or in parallel. By default, the MultiLauncher launches the jobs serially unless it is directed otherwise through its "Execution Mode" Data Component.
The output data from all of the runs are collected and placed in a ResourceComponent on the MultiLauncherForm.
For the time being, this class assumes that it is working with instances of ICE's JobLauncher class. Specifically, it assumes that the first DataComponent in the Form for one of the Items contains the job launch details. (See the JobLauncherForm for reference.)
When jobs are launched in sequential mode, the MultiLauncher launches a thread and monitors each job launcher until it finishes, then launches the next or breaks out if there was an error. When jobs are launched in parallel, the job launchers are processed asynchronously.
This class implements Runnable and uses itself as the thread. The run() operation works overtime: it handles all updates to the ResourceComponent from the launchers, it handles all job launch for the sequential launch and it polls the running jobs constantly to update the status if it is launched in parallel. This is implemented with two blocks. The first handles the sequential execution if it is required and the second updates both the parallel execution status and the ResourceComponent. I think, ideally, this would be separated out to a couple of separate threads.
component
Constructor and Description |
---|
MultiLauncher(org.eclipse.core.resources.IProject projectSpace)
The constructor.
|
Modifier and Type | Method and Description |
---|---|
Form |
getForm()
This operation overrides Item.getForm() to return the proper Form for one
of the launchers if it is needed.
|
FormStatus |
getStatus()
This operation overrides Item.getStatus().
|
FormStatus |
process(java.lang.String actionName)
This operation directs the MultiLauncher to launch the jobs.
|
void |
run()
(non-Javadoc)
|
void |
setJobLaunchers(java.util.ArrayList<Item> jobLaunchers)
This operation sets a set of Items that are capable of launching jobs.
|
FormStatus |
submitForm(Form preparedForm)
This operation overrides Item.submitForm() to make sure that the Form is
submitted to the proper JobLauncher and not submitted to an Action.
|
void |
visit(MasterDetailsComponent component)
This operation overrides the MasterDetailsComponent visitor from the Item
base class to search for the MasterDetailsComponent in the
MultiLauncher's Form.
|
addListener, cancelProcess, cancelProcess, clone, copy, disable, equals, getAvailableActions, getDescription, getId, getItemBuilderName, getItemType, getName, getOutputFile, getResource, getResource, hashCode, hasProject, isEnabled, loadFromPSF, loadInput, reloadProjectData, setActionFactory, setDescription, setId, setIOService, setItemBuilderName, setName, setProject, setupFormWithServices, update, update, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit
public MultiLauncher(org.eclipse.core.resources.IProject projectSpace)
The constructor.
projectSpace
- The project space in which the MultiLauncher should manage its data.
public void setJobLaunchers(java.util.ArrayList<Item> jobLaunchers)
This operation sets a set of Items that are capable of launching jobs. This sets the list of jobs that a client may configure in the launcher's Form.
jobLaunchers
- The list of launchers available to the MultiLauncher. These are Items with an Item type of Simulation.
public FormStatus process(java.lang.String actionName)
This operation directs the MultiLauncher to launch the jobs. The only valid input for this operation is the word "Launch" and any other string will result in failure.
public FormStatus getStatus()
This operation overrides Item.getStatus(). It functions as Item.getStatus(), but it must be overridden because the MultiLauncher needs to check the status of each running job, not just the current running action.
public Form getForm()
This operation overrides Item.getForm() to return the proper Form for one of the launchers if it is needed. Otherwise, it behaves exactly like Item.getForm().
public FormStatus submitForm(Form preparedForm)
This operation overrides Item.submitForm() to make sure that the Form is submitted to the proper JobLauncher and not submitted to an Action. Otherwise, it behaves exactly like Item.submitForm().
submitForm
in class Item
preparedForm
- The Form.
The status.
public void run()
run
in interface java.lang.Runnable
Runnable.run()
public void visit(MasterDetailsComponent component)
visit
in interface IComponentVisitor
visit
in class Item
component
- MasterDetailsComponent which was originally called by the
accept() operation.IComponentVisitor.visit(MasterDetailsComponent component)