| 1 | package de.uka.ipd.sdq.reliability.solver.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.pcmsolver.runconfig.PCMSolverLaunchConfigurationDelegate; |
| 12 | import de.uka.ipd.sdq.pcmsolver.runconfig.PCMSolverWorkflowRunConfiguration; |
| 13 | import de.uka.ipd.sdq.workflow.IJob; |
| 14 | import de.uka.ipd.sdq.workflow.launchconfig.LoggerAppenderStruct; |
| 15 | |
| 16 | /** |
| 17 | * Launches the PCM Solver for Reliability analysis. |
| 18 | * |
| 19 | * The extension point org.eclipse.debug.core.launchConfigurationTypes in the |
| 20 | * plugin.xml refers to this class. The class inherits from the eclipse-internal |
| 21 | * launch configuration delegate. |
| 22 | * |
| 23 | * @author anne |
| 24 | * |
| 25 | */ |
| 26 | public class PCMSolverReliabilityLaunchConfigurationDelegate extends |
| 27 | PCMSolverLaunchConfigurationDelegate { |
| 28 | |
| 29 | /* |
| 30 | * (non-Javadoc) |
| 31 | * |
| 32 | * @see |
| 33 | * de.uka.ipd.sdq.pcmsolver.runconfig.PCMSolverLaunchConfigurationDelegate |
| 34 | * #createWorkflowJob |
| 35 | * (de.uka.ipd.sdq.pcmsolver.runconfig.PCMSolverWorkflowRunConfiguration, |
| 36 | * org.eclipse.debug.core.ILaunch) |
| 37 | */ |
| 38 | protected IJob createWorkflowJob(PCMSolverWorkflowRunConfiguration config, |
| 39 | ILaunch launch) throws CoreException { |
| 40 | |
| 41 | // To enable accuracy analysis, the former top-level job |
| 42 | // (PCMSolverReliabilityJob) |
| 43 | // is replaced through a new AccuracyInfluenceAnalysisJob: |
| 44 | ReliabilityWorkflowJobBuilder jobBuilder = new ReliabilityWorkflowJobBuilder( |
| 45 | launch); |
| 46 | return new AccuracyInfluenceAnalysisJob(config, jobBuilder); |
| 47 | } |
| 48 | |
| 49 | /* |
| 50 | * (non-Javadoc) |
| 51 | * |
| 52 | * @see |
| 53 | * de.uka.ipd.sdq.pcmsolver.runconfig.PCMSolverLaunchConfigurationDelegate |
| 54 | * #deriveConfiguration(org.eclipse.debug.core.ILaunchConfiguration, |
| 55 | * java.lang.String) |
| 56 | */ |
| 57 | protected PCMSolverWorkflowRunConfiguration deriveConfiguration( |
| 58 | ILaunchConfiguration configuration, String mode) |
| 59 | throws CoreException { |
| 60 | |
| 61 | // First derive a configuration with general attributes for the PCM |
| 62 | // Solver workflow: |
| 63 | PCMSolverWorkflowRunConfiguration solverConfiguration = super |
| 64 | .deriveConfiguration(configuration, mode); |
| 65 | |
| 66 | // Then, derive attributes specific to reliability solving: |
| 67 | PCMSolverReliabilityConfigurationBasedConfigBuilder builder = new PCMSolverReliabilityConfigurationBasedConfigBuilder( |
| 68 | configuration, mode); |
| 69 | builder.fillConfiguration(solverConfiguration); |
| 70 | |
| 71 | return solverConfiguration; |
| 72 | } |
| 73 | |
| 74 | /* |
| 75 | * (non-Javadoc) |
| 76 | * |
| 77 | * @see |
| 78 | * de.uka.ipd.sdq.pcmsolver.runconfig.PCMSolverLaunchConfigurationDelegate |
| 79 | * #setupLogging(org.apache.log4j.Level) |
| 80 | */ |
| 81 | protected ArrayList<LoggerAppenderStruct> setupLogging(Level logLevel) |
| 82 | throws CoreException { |
| 83 | ArrayList<LoggerAppenderStruct> loggerList = super |
| 84 | .setupLogging(logLevel); |
| 85 | loggerList.add(setupLogger("de.uka.ipd.sdq.reliability", logLevel, |
| 86 | Level.DEBUG == logLevel ? DETAILED_LOG_PATTERN |
| 87 | : SHORT_LOG_PATTERN)); |
| 88 | loggerList.add(setupLogger("de.uka.ipd.sdq.markov", logLevel, |
| 89 | Level.DEBUG == logLevel ? DETAILED_LOG_PATTERN |
| 90 | : SHORT_LOG_PATTERN)); |
| 91 | |
| 92 | return loggerList; |
| 93 | } |
| 94 | } |