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 [QVTOConfigurationJob.java]

nameclass, %method, %block, %line, %
QVTOConfigurationJob.java0%   (0/1)0%   (0/7)0%   (0/155)0%   (0/36)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class QVTOConfigurationJob0%   (0/1)0%   (0/7)0%   (0/155)0%   (0/36)
<static initializer> 0%   (0/1)0%   (0/8)0%   (0/1)
QVTOConfigurationJob (QVTOTransformationJobConfiguration, CompletionConfigura... 0%   (0/1)0%   (0/24)0%   (0/9)
execute (IProgressMonitor): void 0%   (0/1)0%   (0/113)0%   (0/21)
getJobConfiguration (): QVTOTransformationJobConfiguration 0%   (0/1)0%   (0/3)0%   (0/1)
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.HashMap;
4 
5import org.eclipse.core.runtime.IProgressMonitor;
6import org.eclipse.emf.common.util.URI;
7 
8import de.uka.ipd.sdq.cip.configuration.CompletionConfiguration;
9import de.uka.ipd.sdq.cip.configuration.QVTConfigurationHelper;
10import de.uka.ipd.sdq.cip.configuration.Transformation;
11import de.uka.ipd.sdq.workflow.IBlackboardInteractingJob;
12import de.uka.ipd.sdq.workflow.exceptions.JobFailedException;
13import de.uka.ipd.sdq.workflow.exceptions.RollbackFailedException;
14import de.uka.ipd.sdq.workflow.exceptions.UserCanceledException;
15import de.uka.ipd.sdq.workflow.mdsd.blackboard.MDSDBlackboard;
16import de.uka.ipd.sdq.workflow.mdsd.blackboard.ModelLocation;
17import de.uka.ipd.sdq.workflow.mdsd.emf.qvto.QVTOTransformationJobConfiguration;
18 
19/**
20 * @author Thomas Schuischel
21 *
22 */
23public class QVTOConfigurationJob implements
24                IBlackboardInteractingJob<MDSDBlackboard> {
25        
26        private CompletionConfiguration completionConfiguration = null;
27        private Transformation transformation = null;
28        private QVTOTransformationJobConfiguration jobConfiguration = null;
29        private MDSDBlackboard blackboard = null;
30        
31        public QVTOConfigurationJob(QVTOTransformationJobConfiguration jobConfiguration, 
32                        CompletionConfiguration completionConfiguration, Transformation transformation) {
33                
34                this.jobConfiguration = jobConfiguration;
35                this.transformation = transformation;
36                this.completionConfiguration = completionConfiguration;
37                
38        }
39        
40        @Override
41        public void execute(IProgressMonitor monitor) throws JobFailedException,
42                        UserCanceledException {
43                
44                assert (completionConfiguration != null);
45                assert (transformation != null);
46                assert (jobConfiguration != null);
47                
48                // get the models to work with
49                ModelLocation[] modelLocations = QVTConfigurationHelper.
50                        getModelsFromBlackboard(blackboard, completionConfiguration.getInputPartitionName());
51                
52                // if an optional model is configured, add this to the model location list
53                if(transformation.getOptionalModelFileURI() != null &&
54                                !transformation.getOptionalModelFileURI().equals("")){
55                        
56                        // build the location for the optional model
57                        URI optionalModelURI = URI.createURI(transformation.getOptionalModelFileURI());
58                        //ModelLocation optionalModel = new ModelLocation(configuration.getInputPartitionName(), optionalModelURI);
59                        ModelLocation optionalModel = QVTConfigurationHelper.loadResourceToInputPartition(blackboard, completionConfiguration.getInputPartitionName(), optionalModelURI);
60                        
61                        // build the new location array with an additional entry
62                        ModelLocation[] tempModelLocations = new ModelLocation[modelLocations.length + 1];
63                        for(int i = 0; i < modelLocations.length; i++ ){
64                                tempModelLocations[i] = modelLocations[i];
65                        }
66                        tempModelLocations[modelLocations.length] = optionalModel;
67                        modelLocations = tempModelLocations;
68                }
69                
70                // build file paths
71                URI traceFileURI = QVTConfigurationHelper.getTraceFileURI(completionConfiguration.getProjectID());
72                URI scriptFileURI = URI.createURI(transformation.getQVTFileURI());
73                
74                // set the job configuration
75                jobConfiguration.setInoutModels(modelLocations);
76                jobConfiguration.setTraceFileURI(traceFileURI);
77                jobConfiguration.setScriptFileURI(scriptFileURI);
78                jobConfiguration.setOptions(new HashMap<String,Object>());
79                
80        }
81        
82        public QVTOTransformationJobConfiguration getJobConfiguration() {
83                return jobConfiguration;
84        }
85        
86        @Override
87        public void setBlackboard(MDSDBlackboard blackboard) {
88                this.blackboard = blackboard;
89        }
90 
91        @Override
92        public String getName() {
93                return "Configure QVTO transformation";
94        }
95 
96        @Override
97        public void rollback(IProgressMonitor monitor)
98                        throws RollbackFailedException {} // nothing to roll back
99 
100}

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