1 |
mojays |
2 |
package appl.parallel.gui; |
2 |
|
|
|
3 |
|
|
import appl.parallel.client.RemoteExecutionController; |
4 |
|
|
import appl.parallel.model.ParallelStepModel; |
5 |
|
|
import edu.bonn.xulu.XuluModellingPlatform; |
6 |
|
|
import edu.bonn.xulu.model.XuluModel; |
7 |
|
|
import edu.bonn.xulu.plugin.gui.ModelControlContainer; |
8 |
|
|
|
9 |
|
|
/** |
10 |
|
|
* This class extends the functionality of the container to support the execution |
11 |
|
|
* of a {@link ParallelStepModel}. It retrieves the {@link RemoteExecutionController} |
12 |
|
|
* and uses it to prepare the model for parallel execution. |
13 |
|
|
* |
14 |
|
|
* @author Dominik Appl |
15 |
|
|
*/ |
16 |
|
|
public class ModelControlContainer_parallel extends ModelControlContainer { |
17 |
|
|
|
18 |
|
|
private final XuluModellingPlatform appl; |
19 |
|
|
|
20 |
|
|
private final ParallelControlPanelEngine pcpEngine; |
21 |
|
|
|
22 |
|
|
/** |
23 |
|
|
* A new instance |
24 |
|
|
* @param model the XuluModel which should be executed |
25 |
|
|
* @param pcpEngine the controlling engine for parallel execution |
26 |
|
|
* @param appl the Xulu application |
27 |
|
|
*/ |
28 |
|
|
public ModelControlContainer_parallel(XuluModel model, |
29 |
|
|
ParallelControlPanelEngine pcpEngine, XuluModellingPlatform appl) { |
30 |
|
|
super(model); |
31 |
|
|
this.pcpEngine = pcpEngine; |
32 |
|
|
// TODO Auto-generated constructor stub |
33 |
|
|
this.appl = appl; |
34 |
|
|
} |
35 |
|
|
|
36 |
|
|
@Override |
37 |
|
|
protected void createNewThread() { |
38 |
|
|
if (model instanceof ParallelStepModel) { |
39 |
|
|
// create the ClientController |
40 |
|
|
RemoteExecutionController remoteController = RemoteExecutionController |
41 |
|
|
.getRemoteExecutionController(appl); |
42 |
|
|
if (remoteController == null) |
43 |
|
|
throw new UnsupportedOperationException( |
44 |
|
|
"You must load the RemoteExecutionController-Plugin to execute parallel Models!"); |
45 |
|
|
remoteController.prepareModelForSPMDExecution( |
46 |
|
|
(ParallelStepModel) model, pcpEngine |
47 |
|
|
.getSelectedResourceContainers()); |
48 |
|
|
|
49 |
|
|
} |
50 |
|
|
super.createNewThread(); |
51 |
|
|
} |
52 |
|
|
} |