| 1 | package de.uka.ipd.sdq.codegen.simucontroller.runconfig; |
| 2 | |
| 3 | import java.util.ArrayList; |
| 4 | |
| 5 | import org.apache.log4j.Level; |
| 6 | import org.eclipse.core.runtime.CoreException; |
| 7 | import org.eclipse.debug.core.ILaunch; |
| 8 | import org.eclipse.debug.core.ILaunchConfiguration; |
| 9 | |
| 10 | import de.fzi.se.accuracy.jobs.AccuracyInfluenceAnalysisJob; |
| 11 | import de.uka.ipd.sdq.codegen.simucontroller.debug.IDebugListener; |
| 12 | import de.uka.ipd.sdq.codegen.simucontroller.debug.SimulationDebugListener; |
| 13 | import de.uka.ipd.sdq.workflow.IJob; |
| 14 | import de.uka.ipd.sdq.workflow.launchconfig.AbstractWorkflowConfigurationBuilder; |
| 15 | import de.uka.ipd.sdq.workflow.launchconfig.LoggerAppenderStruct; |
| 16 | import de.uka.ipd.sdq.workflow.pcm.configurations.AbstractPCMLaunchConfigurationDelegate; |
| 17 | import de.uka.ipd.sdq.workflow.pcm.configurations.PCMWorkflowConfigurationBuilder; |
| 18 | |
| 19 | /** |
| 20 | * The class adapts defined functionality in the AbstractMDSDLaunchConfigurationDelegate for |
| 21 | * SimuCom Framework. |
| 22 | * |
| 23 | */ |
| 24 | public class SimuComWorkflowLauncher extends |
| 25 | AbstractPCMLaunchConfigurationDelegate<SimuComWorkflowConfiguration> { |
| 26 | |
| 27 | /* |
| 28 | * (non-Javadoc) |
| 29 | * |
| 30 | * @seede.uka.ipd.sdq.codegen.runconfig.LaunchConfigurationDelegate# |
| 31 | * creataAttributesGetMethods(org.eclipse.debug.core.ILaunchConfiguration) |
| 32 | */ |
| 33 | @Override |
| 34 | protected SimuComWorkflowConfiguration deriveConfiguration( |
| 35 | ILaunchConfiguration configuration, String mode) |
| 36 | throws CoreException { |
| 37 | SimuComWorkflowConfiguration config = new SimuComWorkflowConfiguration(configuration.getAttributes()); |
| 38 | |
| 39 | AbstractWorkflowConfigurationBuilder builder; |
| 40 | builder = new PCMWorkflowConfigurationBuilder(configuration, mode); |
| 41 | builder.fillConfiguration(config); |
| 42 | |
| 43 | builder = new SimuComLaunchConfigurationBasedConfigBuilder( |
| 44 | configuration, mode); |
| 45 | builder.fillConfiguration(config); |
| 46 | |
| 47 | return config; |
| 48 | } |
| 49 | |
| 50 | /* (non-Javadoc) |
| 51 | * @see de.uka.ipd.sdq.codegen.simucontroller.runconfig.AbstractMDSDLaunchConfigurationDelegate#setupLogging(org.apache.log4j.Level) |
| 52 | */ |
| 53 | @Override |
| 54 | protected ArrayList<LoggerAppenderStruct> setupLogging(Level logLevel) throws CoreException { |
| 55 | ArrayList<LoggerAppenderStruct> loggerList = super.setupLogging(logLevel); |
| 56 | loggerList.add(setupLogger("de.uka.ipd.sdq.codegen", logLevel, Level.DEBUG == logLevel ? DETAILED_LOG_PATTERN : SHORT_LOG_PATTERN)); |
| 57 | loggerList.add(setupLogger("de.uka.ipd.sdq.simucomframework", logLevel, Level.DEBUG == logLevel ? DETAILED_LOG_PATTERN : SHORT_LOG_PATTERN)); |
| 58 | loggerList.add(setupLogger("de.uka.ipd.sdq.workflow.mdsd.emf.qvtr", logLevel, Level.DEBUG == logLevel ? DETAILED_LOG_PATTERN : SHORT_LOG_PATTERN)); |
| 59 | loggerList.add(setupLogger("de.uka.ipd.sdq.statistics", logLevel, Level.DEBUG == logLevel ? DETAILED_LOG_PATTERN : SHORT_LOG_PATTERN)); |
| 60 | loggerList.add(setupLogger("de.uka.ipd.sdq.probespec.framework", logLevel, Level.DEBUG == logLevel ? DETAILED_LOG_PATTERN : SHORT_LOG_PATTERN)); |
| 61 | loggerList.add(setupLogger("de.uka.ipd.sdq.pipesandfilters.framework", logLevel, Level.DEBUG == logLevel ? DETAILED_LOG_PATTERN : SHORT_LOG_PATTERN)); |
| 62 | loggerList.add(setupLogger("de.uka.ipd.sdq.pcm.transformations", logLevel, Level.DEBUG == logLevel ? DETAILED_LOG_PATTERN : SHORT_LOG_PATTERN)); |
| 63 | loggerList.add(setupLogger("de.uka.ipd.sdq.simulation", logLevel, Level.DEBUG == logLevel ? DETAILED_LOG_PATTERN : SHORT_LOG_PATTERN)); |
| 64 | |
| 65 | return loggerList; |
| 66 | } |
| 67 | |
| 68 | /* |
| 69 | * (non-Javadoc) |
| 70 | * |
| 71 | * @seede.uka.ipd.sdq.codegen.runconfig.LaunchConfigurationDelegate# |
| 72 | * createRunCompositeJob |
| 73 | * (de.uka.ipd.sdq.codegen.runconfig.AttributesGetMethods) |
| 74 | */ |
| 75 | @Override |
| 76 | protected IJob createWorkflowJob(SimuComWorkflowConfiguration config, |
| 77 | final ILaunch launch) throws CoreException { |
| 78 | IDebugListener listener = null; |
| 79 | |
| 80 | if (config.isDebug()) { |
| 81 | listener = new SimulationDebugListener(launch); |
| 82 | } |
| 83 | |
| 84 | SimuComWorkflowJobBuilder jobBuilder = new SimuComWorkflowJobBuilder(listener); |
| 85 | return new AccuracyInfluenceAnalysisJob(config, jobBuilder); |
| 86 | } |
| 87 | } |