1 | package de.uka.ipd.sdq.codegen.simucontroller.runconfig; |
2 | |
3 | import org.eclipse.core.runtime.CoreException; |
4 | import org.eclipse.debug.core.ILaunchConfiguration; |
5 | |
6 | import de.uka.ipd.sdq.simucomframework.SimuComConfig; |
7 | import de.uka.ipd.sdq.simucomframework.SimuComConfigExtension; |
8 | import de.uka.ipd.sdq.workflow.launchconfig.AbstractWorkflowBasedRunConfiguration; |
9 | import de.uka.ipd.sdq.workflow.launchconfig.extension.ExtensionHelper; |
10 | import de.uka.ipd.sdq.workflow.launchconfig.extension.WorkflowExtension; |
11 | import de.uka.ipd.sdq.workflow.pcm.ConstantsContainer; |
12 | |
13 | public class SimuComLaunchConfigurationBasedConfigBuilder extends |
14 | AbstractSimulationLaunchConfigurationBasedConfigBuilder { |
15 | |
16 | public SimuComLaunchConfigurationBasedConfigBuilder(ILaunchConfiguration configuration, String mode) |
17 | throws CoreException { |
18 | super(configuration, mode); |
19 | } |
20 | |
21 | @Override |
22 | public void fillConfiguration(AbstractWorkflowBasedRunConfiguration configuration) throws CoreException { |
23 | super.fillConfiguration(configuration); |
24 | |
25 | SimuComWorkflowConfiguration config = (SimuComWorkflowConfiguration) configuration; |
26 | config.setSimulateFailures(getBooleanAttribute(ConstantsContainer.SIMULATE_FAILURES)); |
27 | |
28 | SimuComConfig simuComConfig = new SimuComConfig(properties, config.isDebug()); |
29 | |
30 | // Set SimuCom config extensions based on registered extensions |
31 | for (WorkflowExtension workflowExtension : ExtensionHelper.getWorkflowExtensions(getWorkflowId())) { |
32 | if ((workflowExtension.getExtensionConfigurationBuilder() != null) |
33 | && (workflowExtension.getExtensionConfigurationBuilder() instanceof SimuComExtensionConfigurationBuilder)) { |
34 | SimuComConfigExtension simuComConfigExtension = ((SimuComExtensionConfigurationBuilder) workflowExtension |
35 | .getExtensionConfigurationBuilder()).deriveSimuComConfigExtension(properties); |
36 | if (simuComConfigExtension != null) { |
37 | simuComConfig.addSimuComConfigExtension(workflowExtension.getId(), simuComConfigExtension); |
38 | } |
39 | } |
40 | } |
41 | |
42 | config.setSimuComConfiguration(simuComConfig); |
43 | } |
44 | |
45 | public String getWorkflowId() { |
46 | return "workflow.extension.simucom"; |
47 | } |
48 | |
49 | } |