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

COVERAGE SUMMARY FOR SOURCE FILE [RunPCMAnalysisJob.java]

nameclass, %method, %block, %line, %
RunPCMAnalysisJob.java0%   (0/1)0%   (0/7)0%   (0/102)0%   (0/35)

COVERAGE BREAKDOWN BY CLASS AND METHOD

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

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