EMMA Coverage Report (generated Sun Feb 05 10:43:15 CET 2012)
[all classes][de.uka.ipd.sdq.reliability.solver.runconfig]

COVERAGE SUMMARY FOR SOURCE FILE [RunPCMReliabilityAnalysisJob.java]

nameclass, %method, %block, %line, %
RunPCMReliabilityAnalysisJob.java0%   (0/1)0%   (0/7)0%   (0/74)0%   (0/29)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class RunPCMReliabilityAnalysisJob0%   (0/1)0%   (0/7)0%   (0/74)0%   (0/29)
<static initializer> 0%   (0/1)0%   (0/5)0%   (0/3)
RunPCMReliabilityAnalysisJob (PCMSolverWorkflowRunConfiguration): void 0%   (0/1)0%   (0/25)0%   (0/9)
execute (IProgressMonitor): void 0%   (0/1)0%   (0/34)0%   (0/12)
getName (): String 0%   (0/1)0%   (0/2)0%   (0/1)
getStrategy (): SolverStrategy 0%   (0/1)0%   (0/3)0%   (0/1)
rollback (IProgressMonitor): void 0%   (0/1)0%   (0/1)0%   (0/1)
setBlackboard (MDSDBlackboard): void 0%   (0/1)0%   (0/4)0%   (0/2)

1package de.uka.ipd.sdq.reliability.solver.runconfig;
2 
3import org.apache.log4j.Logger;
4import org.eclipse.core.runtime.IProgressMonitor;
5 
6import de.uka.ipd.sdq.pcmsolver.models.PCMInstance;
7import de.uka.ipd.sdq.pcmsolver.runconfig.PCMSolverWorkflowRunConfiguration;
8import de.uka.ipd.sdq.pcmsolver.transformations.SolverStrategy;
9import de.uka.ipd.sdq.probfunction.math.IProbabilityFunctionFactory;
10import de.uka.ipd.sdq.probfunction.math.PDFConfiguration;
11import de.uka.ipd.sdq.reliability.solver.pcm2markov.Pcm2MarkovStrategy;
12import de.uka.ipd.sdq.workflow.IBlackboardInteractingJob;
13import de.uka.ipd.sdq.workflow.exceptions.JobFailedException;
14import de.uka.ipd.sdq.workflow.exceptions.RollbackFailedException;
15import de.uka.ipd.sdq.workflow.exceptions.UserCanceledException;
16import de.uka.ipd.sdq.workflow.mdsd.blackboard.MDSDBlackboard;
17import de.uka.ipd.sdq.workflow.pcm.blackboard.PCMResourceSetPartition;
18import de.uka.ipd.sdq.workflow.pcm.jobs.LoadPCMModelsIntoBlackboardJob;
19 
20/**
21 * Controls the PCM Reliability Solver process when launched from the eclipse
22 * UI.
23 * 
24 * @author brosch,
25 * 
26 */
27public class RunPCMReliabilityAnalysisJob implements
28                IBlackboardInteractingJob<MDSDBlackboard> {
29 
30        /**
31         * Enables log4j logging for this class.
32         */
33        private static Logger logger = Logger
34                        .getLogger(RunPCMReliabilityAnalysisJob.class.getName());
35 
36        /**
37         * Blackboard for passing EMF model resources between jobs in the workflow.
38         */
39        private MDSDBlackboard blackboard;
40 
41        /**
42         * The strategy for reliability modelling & transformation.
43         */
44        private Pcm2MarkovStrategy strategy;
45 
46        /**
47         * The constructor.
48         * 
49         * Configures the PCM Solver process according to the launch configuration
50         * defined by the user.
51         * 
52         * @param configuration
53         *            the solver configuration object
54         */
55        public RunPCMReliabilityAnalysisJob(
56                        final PCMSolverWorkflowRunConfiguration configuration) {
57 
58                // Configure the PCM Solver process:
59                PDFConfiguration.setCurrentConfiguration(configuration.getDomainSize(),
60                                configuration.getDistance(),
61                                IProbabilityFunctionFactory.eINSTANCE.createDefaultUnit());
62                if (configuration.isReliabilityAnalysis()) {
63                        strategy = new Pcm2MarkovStrategy(configuration);
64                } else {
65                        throw new RuntimeException(
66                                        "Invoked reliability analysis with incompatible configuration data!");
67                }
68        }
69 
70        /**
71         * Executes the Solver workflow.
72         * 
73         * @param monitor
74         *            the progress monitor
75         * @throws JobFailedException
76         *             indicates that one of the jobs in the workflow was not
77         *             successfully completed
78         * @throws UserCanceledException
79         *             indicates that the user has canceled the workflow before
80         *             completion
81         */
82        public void execute(final IProgressMonitor monitor)
83                        throws JobFailedException, UserCanceledException {
84 
85                // Determine the PCM model parts from the launch configuration:
86                PCMInstance currentModel = new PCMInstance(
87                                (PCMResourceSetPartition) this.blackboard
88                                                .getPartition(LoadPCMModelsIntoBlackboardJob.PCM_MODELS_PARTITION_ID));
89 
90                // Check the model for being valid:
91                if (!currentModel.isValid()) {
92                        logger.error("PCM Instance invalid! Check filenames.");
93                        return;
94                }
95 
96                // Only a very coarse progress monitoring is supported, which assigns
97                // 50% progress to the execution of the involved transformation(s), and
98                // 50% to the final solving:
99                monitor.beginTask("Analysis", 100);
100                strategy.transform(currentModel);
101                monitor.worked(50);
102                strategy.solve();
103                monitor.worked(50);
104        }
105 
106        public String getName() {
107                return "Run PCM Reliability Analysis";
108        }
109 
110        public SolverStrategy getStrategy() {
111                return strategy;
112        }
113 
114        public void rollback(IProgressMonitor monitor)
115                        throws RollbackFailedException {
116                // Nothing to do here
117        }
118 
119        @Override
120        public void setBlackboard(MDSDBlackboard blackboard) {
121                this.blackboard = blackboard;
122        }
123}

[all classes][de.uka.ipd.sdq.reliability.solver.runconfig]
EMMA 2.0.9414 (unsupported private build) (C) Vladimir Roubtsov