| 1 | package de.uka.ipd.sdq.reliability.solver.runconfig; |
| 2 | |
| 3 | import org.eclipse.core.runtime.CoreException; |
| 4 | import org.eclipse.debug.core.ILaunchConfiguration; |
| 5 | |
| 6 | import de.uka.ipd.sdq.pcmsolver.runconfig.MessageStrings; |
| 7 | import de.uka.ipd.sdq.pcmsolver.runconfig.PCMSolverWorkflowRunConfiguration; |
| 8 | import de.uka.ipd.sdq.reliability.core.MarkovEvaluationType; |
| 9 | import de.uka.ipd.sdq.workflow.launchconfig.AbstractWorkflowBasedRunConfiguration; |
| 10 | import de.uka.ipd.sdq.workflow.launchconfig.AbstractWorkflowConfigurationBuilder; |
| 11 | import de.uka.ipd.sdq.workflow.pcm.ConstantsContainer; |
| 12 | |
| 13 | /** |
| 14 | * This class can build PCM reliability solver specific configuration objects |
| 15 | * out of a given Eclipse Launch Configuration. |
| 16 | * |
| 17 | * @author brosch |
| 18 | * |
| 19 | */ |
| 20 | public class PCMSolverReliabilityConfigurationBasedConfigBuilder extends |
| 21 | AbstractWorkflowConfigurationBuilder { |
| 22 | |
| 23 | /** |
| 24 | * The constructor takes an Eclipse Launch Configuration object. |
| 25 | * |
| 26 | * @param configuration |
| 27 | * the Eclipse Launch Configuration object |
| 28 | * @param mode |
| 29 | * distinguishes between debug mode and normal mode |
| 30 | * @throws CoreException |
| 31 | * the access of attributes of the Eclipse Launch Configuration |
| 32 | * object might lead to a CoreException |
| 33 | */ |
| 34 | public PCMSolverReliabilityConfigurationBasedConfigBuilder( |
| 35 | final ILaunchConfiguration configuration, final String mode) |
| 36 | throws CoreException { |
| 37 | super(configuration, mode); |
| 38 | } |
| 39 | |
| 40 | @Override |
| 41 | public void fillConfiguration( |
| 42 | final AbstractWorkflowBasedRunConfiguration configuration) |
| 43 | throws CoreException { |
| 44 | |
| 45 | // We assume that we got a PCMSolverWorkflowRunConfiguration object: |
| 46 | PCMSolverWorkflowRunConfiguration config = (PCMSolverWorkflowRunConfiguration) configuration; |
| 47 | |
| 48 | // This is a reliability analysis: |
| 49 | config.setReliabilityAnalysis(true); |
| 50 | |
| 51 | // Set further properties of the reliability analysis: |
| 52 | config |
| 53 | .setPrintMarkovStatistics(hasAttribute(MessageStrings.MARKOV_STATISTICS) ? getBooleanAttribute(MessageStrings.MARKOV_STATISTICS) |
| 54 | : false); |
| 55 | config |
| 56 | .setPrintMarkovSingleResults(hasAttribute(MessageStrings.SINGLE_RESULTS) ? getBooleanAttribute(MessageStrings.SINGLE_RESULTS) |
| 57 | : false); |
| 58 | config |
| 59 | .setSensitivityModelEnabled(hasAttribute(ConstantsContainer.DO_SENSITIVITY_ANALYSIS) ? getBooleanAttribute(ConstantsContainer.DO_SENSITIVITY_ANALYSIS) |
| 60 | : ConstantsContainer.DEFAULT_DO_SENSITIVITY_ANALYSIS); |
| 61 | config |
| 62 | .setSensitivityModelFileName(hasAttribute(ConstantsContainer.SENSITIVITY_MODEL_FILE) ? getStringAttribute(ConstantsContainer.SENSITIVITY_MODEL_FILE) |
| 63 | : ConstantsContainer.DEFAULT_SENSITIVITY_MODEL_FILE); |
| 64 | config |
| 65 | .setSensitivityLogFileName(hasAttribute(ConstantsContainer.SENSITIVITY_LOG_FILE) ? getStringAttribute(ConstantsContainer.SENSITIVITY_LOG_FILE) |
| 66 | : ConstantsContainer.DEFAULT_SENSITIVITY_LOG_FILE); |
| 67 | config |
| 68 | .setLogFile(hasAttribute(MessageStrings.LOG_FILE) ? getStringAttribute(MessageStrings.LOG_FILE) |
| 69 | : null); |
| 70 | config |
| 71 | .setNumberOfEvaluatedSystemStatesEnabled(hasAttribute(MessageStrings.NUMBER_OF_EVALUATED_SYSTEM_STATES_ENABLED) ? getBooleanAttribute(MessageStrings.NUMBER_OF_EVALUATED_SYSTEM_STATES_ENABLED) |
| 72 | : false); |
| 73 | config |
| 74 | .setNumberOfEvaluatedSystemStates(hasAttribute(MessageStrings.NUMBER_OF_EVALUATED_SYSTEM_STATES) ? getLongAttribute(MessageStrings.NUMBER_OF_EVALUATED_SYSTEM_STATES) |
| 75 | : 0); |
| 76 | config |
| 77 | .setNumberOfExactDecimalPlacesEnabled(hasAttribute(MessageStrings.NUMBER_OF_EXACT_DECIMAL_PLACES_ENABLED) ? getBooleanAttribute(MessageStrings.NUMBER_OF_EXACT_DECIMAL_PLACES_ENABLED) |
| 78 | : false); |
| 79 | config |
| 80 | .setNumberOfExactDecimalPlaces(hasAttribute(MessageStrings.NUMBER_OF_EXACT_DECIMAL_PLACES) ? getIntegerAttribute(MessageStrings.NUMBER_OF_EXACT_DECIMAL_PLACES) |
| 81 | : 0); |
| 82 | config |
| 83 | .setSolvingTimeLimitEnabled(hasAttribute(MessageStrings.SOLVING_TIME_LIMIT_ENABLED) ? getBooleanAttribute(MessageStrings.SOLVING_TIME_LIMIT_ENABLED) |
| 84 | : false); |
| 85 | config |
| 86 | .setSolvingTimeLimit(hasAttribute(MessageStrings.SOLVING_TIME_LIMIT) ? getIntegerAttribute(MessageStrings.SOLVING_TIME_LIMIT) |
| 87 | : 0); |
| 88 | config |
| 89 | .setMarkovModelReductionEnabled(hasAttribute(MessageStrings.MARKOV_MODEL_REDUCTION_ENABLED) ? getBooleanAttribute(MessageStrings.MARKOV_MODEL_REDUCTION_ENABLED) |
| 90 | : true); |
| 91 | config |
| 92 | .setMarkovModelTracesEnabled(hasAttribute(MessageStrings.MARKOV_MODEL_TRACES_ENABLED) ? getBooleanAttribute(MessageStrings.MARKOV_MODEL_TRACES_ENABLED) |
| 93 | : false); |
| 94 | config |
| 95 | .setMarkovModelStorageEnabled(hasAttribute(MessageStrings.MARKOV_MODEL_STORAGE_ENABLED) ? getBooleanAttribute(MessageStrings.MARKOV_MODEL_STORAGE_ENABLED) |
| 96 | : false); |
| 97 | config |
| 98 | .setIterationOverPhysicalSystemStatesEnabled(hasAttribute(MessageStrings.ITERATION_OVER_PHYSICAL_SYSTEM_STATES_ENABLED) ? getBooleanAttribute(MessageStrings.ITERATION_OVER_PHYSICAL_SYSTEM_STATES_ENABLED) |
| 99 | : true); |
| 100 | config |
| 101 | .setMarkovModelFile(hasAttribute(MessageStrings.MARKOV_MODEL_FILE) ? getStringAttribute(MessageStrings.MARKOV_MODEL_FILE) |
| 102 | : null); |
| 103 | config |
| 104 | .setMarkovEvaluationMode(hasAttribute(MessageStrings.MARKOV_EVALUATION_MODE) ? getStringAttribute(MessageStrings.MARKOV_EVALUATION_MODE) |
| 105 | : MarkovEvaluationType.POINTSOFFAILURE.toString()); // POINTSOFFAILURE |
| 106 | // will |
| 107 | // be |
| 108 | // default |
| 109 | // evaluation |
| 110 | // mode |
| 111 | // if |
| 112 | // attribute |
| 113 | // cannot |
| 114 | // be |
| 115 | // found |
| 116 | config |
| 117 | .setSaveResultsToFileEnabled(hasAttribute(MessageStrings.SAVE_RESULTS_TO_FILE_ENABLED) ? getBooleanAttribute(MessageStrings.SAVE_RESULTS_TO_FILE_ENABLED) |
| 118 | : true); |
| 119 | config |
| 120 | .setSaveFile(hasAttribute(MessageStrings.SAVE_FILE_DEFAULT) ? getStringAttribute(MessageStrings.SAVE_FILE_DEFAULT) |
| 121 | : null); |
| 122 | } |
| 123 | |
| 124 | } |