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

COVERAGE SUMMARY FOR SOURCE FILE [QVTRHotConfigurationJob.java]

nameclass, %method, %block, %line, %
QVTRHotConfigurationJob.java0%   (0/1)0%   (0/6)0%   (0/166)0%   (0/45)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class QVTRHotConfigurationJob0%   (0/1)0%   (0/6)0%   (0/166)0%   (0/45)
<static initializer> 0%   (0/1)0%   (0/8)0%   (0/1)
QVTRHotConfigurationJob (QVTRTransformationJobConfiguration, CompletionConfig... 0%   (0/1)0%   (0/24)0%   (0/9)
execute (IProgressMonitor): void 0%   (0/1)0%   (0/127)0%   (0/31)
getName (): String 0%   (0/1)0%   (0/2)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.cip.workflow.jobs;
2 
3import java.util.Collection;
4 
5import org.eclipse.core.runtime.IProgressMonitor;
6import org.eclipse.emf.common.util.URI;
7 
8import de.uka.ipd.sdq.cip.ConstantsContainer;
9import de.uka.ipd.sdq.cip.configuration.CompletionConfiguration;
10import de.uka.ipd.sdq.cip.configuration.QVTConfigurationHelper;
11import de.uka.ipd.sdq.cip.configuration.Transformation;
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.mdsd.blackboard.ModelLocation;
18import de.uka.ipd.sdq.workflow.mdsd.blackboard.ResourceSetPartition;
19import de.uka.ipd.sdq.workflow.mdsd.emf.qvtr.QVTRScript;
20import de.uka.ipd.sdq.workflow.mdsd.emf.qvtr.jobs.QVTRTransformationJobConfiguration;
21 
22public class QVTRHotConfigurationJob implements
23                IBlackboardInteractingJob<MDSDBlackboard> {
24 
25        private CompletionConfiguration completionConfiguration = null;
26        private Transformation transformation = null;
27        private QVTRTransformationJobConfiguration jobConfiguration = null;
28        private MDSDBlackboard blackboard = null;
29        
30        public QVTRHotConfigurationJob(QVTRTransformationJobConfiguration jobConfiguration, 
31                        CompletionConfiguration completionConfiguration, Transformation transformation) {
32                
33                this.jobConfiguration = jobConfiguration;
34                this.transformation = transformation;
35                this.completionConfiguration = completionConfiguration;
36                
37        }
38        
39        @Override
40        public void execute(IProgressMonitor monitor) throws JobFailedException,
41                        UserCanceledException {
42                
43                assert (completionConfiguration != null);
44                assert (transformation != null);
45                assert (jobConfiguration != null);
46                
47                String modelPartitionID = completionConfiguration.getInputPartitionName();
48                
49                // check if hot partition exists and remove
50                if( blackboard.hasPartition(ConstantsContainer.HOT_PARTITION_ID)){
51                        blackboard.removePartition(ConstantsContainer.HOT_PARTITION_ID);
52                }
53                
54                // create new empty hot partition
55                ResourceSetPartition hotPartition = new ResourceSetPartition();
56                blackboard.addPartition(ConstantsContainer.HOT_PARTITION_ID, hotPartition);
57                
58                hotPartition.initialiseResourceSetEPackages(ConstantsContainer.HOT_METAMODELS);
59                
60                ModelLocation[] featureConfigLocation = new ModelLocation[] { 
61                                        QVTConfigurationHelper.loadResourceToInputPartition(
62                                                        blackboard, 
63                                                        ConstantsContainer.HOT_PARTITION_ID, 
64                                                        URI.createURI(transformation.getFeatureFileURI()))};
65                
66                
67        
68                ModelLocation[] outputModelLocations = new ModelLocation[] {
69                        QVTConfigurationHelper.createResourceToInputPartition(
70                                        blackboard, 
71                                        modelPartitionID,
72                                        URI.createURI(PrepareTransformationsJob.
73                                                        getModelFolder(completionConfiguration.getProjectID()).
74                                                        getFile("qvt.xmi").getFullPath().toPortableString()))};
75                
76                // get meta models needed for qvt script
77                Collection<Object> metamodels = QVTConfigurationHelper.getMetaModelsFromBlackboard(blackboard, ConstantsContainer.HOT_PARTITION_ID);
78                
79                QVTRScript qvtrScript = QVTConfigurationHelper.createQVTScript(ConstantsContainer.FEATURECONFIG2QVT_FILE, metamodels, null, null);
80        
81                URI traceFileURI = QVTConfigurationHelper.getTraceFileURI(completionConfiguration.getProjectID());
82        
83                Boolean isDebug = completionConfiguration.getDebug();
84        
85                // set the job configuration
86                jobConfiguration.setDebug(isDebug);
87                jobConfiguration.addModelLocationSets(featureConfigLocation);
88                jobConfiguration.addModelLocationSets(outputModelLocations);
89                jobConfiguration.setTraceFileURI(traceFileURI);
90                jobConfiguration.setQVTRScript(qvtrScript);
91        }
92        
93        @Override
94        public void setBlackboard(MDSDBlackboard blackboard) {
95                this.blackboard = blackboard;
96                
97        }
98 
99        @Override
100        public String getName() {
101                return "Configure QVTR HOT transformation";
102        }
103 
104        @Override
105        public void rollback(IProgressMonitor monitor)
106                        throws RollbackFailedException {} // nothing to roll back
107 
108}

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