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

nameclass, %method, %block, %line, %
PrettyPrintQvtJob.java0%   (0/1)0%   (0/6)0%   (0/154)0%   (0/38)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class PrettyPrintQvtJob0%   (0/1)0%   (0/6)0%   (0/154)0%   (0/38)
<static initializer> 0%   (0/1)0%   (0/8)0%   (0/1)
PrettyPrintQvtJob (QVTRTransformationJobConfiguration, CompletionConfiguratio... 0%   (0/1)0%   (0/24)0%   (0/9)
execute (IProgressMonitor): void 0%   (0/1)0%   (0/39)0%   (0/6)
getGeneratorJob (HashMap, String): XpandGeneratorJob 0%   (0/1)0%   (0/14)0%   (0/7)
getModelSlot (): HashMap 0%   (0/1)0%   (0/30)0%   (0/7)
getQVTOutlets (): Outlet [] 0%   (0/1)0%   (0/39)0%   (0/8)

1package de.uka.ipd.sdq.cip.workflow.jobs;
2 
3import java.util.HashMap;
4 
5import org.eclipse.core.resources.IFolder;
6import org.eclipse.core.runtime.IProgressMonitor;
7import org.eclipse.emf.common.util.URI;
8import org.eclipse.emf.ecore.EObject;
9import org.eclipse.xpand2.output.Outlet;
10 
11import de.uka.ipd.sdq.cip.ConstantsContainer;
12import de.uka.ipd.sdq.cip.configuration.CompletionConfiguration;
13import de.uka.ipd.sdq.cip.configuration.QVTConfigurationHelper;
14import de.uka.ipd.sdq.cip.configuration.Transformation;
15import de.uka.ipd.sdq.workflow.IBlackboardInteractingJob;
16import de.uka.ipd.sdq.workflow.OrderPreservingBlackboardCompositeJob;
17import de.uka.ipd.sdq.workflow.exceptions.JobFailedException;
18import de.uka.ipd.sdq.workflow.exceptions.RollbackFailedException;
19import de.uka.ipd.sdq.workflow.exceptions.UserCanceledException;
20import de.uka.ipd.sdq.workflow.mdsd.blackboard.MDSDBlackboard;
21import de.uka.ipd.sdq.workflow.mdsd.blackboard.ResourceSetPartition;
22import de.uka.ipd.sdq.workflow.mdsd.emf.qvtr.jobs.QVTRTransformationJobConfiguration;
23import de.uka.ipd.sdq.workflow.mdsd.oaw.XpandGeneratorJob;
24 
25public class PrettyPrintQvtJob extends
26                OrderPreservingBlackboardCompositeJob<MDSDBlackboard> implements
27                IBlackboardInteractingJob<MDSDBlackboard> {
28 
29        private CompletionConfiguration completionConfiguration = null;
30        private Transformation transformation = null;
31        private QVTRTransformationJobConfiguration jobConfiguration = null;
32        private MDSDBlackboard blackboard = null;
33        
34        public PrettyPrintQvtJob(QVTRTransformationJobConfiguration jobConfiguration, 
35                        CompletionConfiguration completionConfiguration, Transformation transformation) {
36                
37                this.jobConfiguration = jobConfiguration;
38                this.transformation = transformation;
39                this.completionConfiguration = completionConfiguration;
40                
41        }
42        
43        private static final String PRETTYPRINT_EXPRESSION = "template::prettyprint::trafo FOR model"; 
44        @Override
45        public void execute(IProgressMonitor monitor)
46                        throws de.uka.ipd.sdq.workflow.exceptions.JobFailedException,
47                        de.uka.ipd.sdq.workflow.exceptions.UserCanceledException {
48 
49                assert (completionConfiguration != null);
50                assert (transformation != null);
51                assert (jobConfiguration != null);
52                
53                add(getGeneratorJob(getModelSlot(), PRETTYPRINT_EXPRESSION));
54                
55                super.execute(monitor);
56        }
57        
58        
59        private HashMap<String, Object> getModelSlot() {
60                HashMap<String,Object> sC2 = new HashMap<String, Object>();
61                ResourceSetPartition partition = this.myBlackboard.getPartition(ConstantsContainer.HOT_PARTITION_ID);
62                URI modelURI = URI.createURI(PrepareTransformationsJob.
63                                getModelFolder(completionConfiguration.getProjectID()).
64                                getFile("qvt.xmi").getFullPath().toPortableString());
65                sC2.put("model",partition.getFirstContentElement(modelURI));
66                return sC2;
67        }
68 
69 
70        private Outlet[] getQVTOutlets() throws JobFailedException {
71                
72                IFolder modelFolder = PrepareTransformationsJob.createFolder(
73                                        PrepareTransformationsJob.getModelFolder(completionConfiguration.getProjectID()).getFolder(
74                                                        QVTConfigurationHelper.createTransformationID(completionConfiguration, transformation)),
75                                        logger);
76                
77                Outlet outlet = new Outlet(modelFolder.getFullPath().toString());
78                outlet.setName("transformation");
79                
80                transformation.setQVTFileURI(modelFolder.getFile("trasformation.qvt").getFullPath().toString());
81                
82                return new Outlet[]{outlet};
83        }
84 
85        
86        /**
87         * @param slots 
88         * @param monitor
89         * @throws JobFailedException 
90         * @throws JobFailedException
91         * @throws UserCanceledException
92         */
93        private XpandGeneratorJob getGeneratorJob(
94                        HashMap<String, Object> slots,
95                        String expression) throws JobFailedException {
96                XpandGeneratorJob job = new XpandGeneratorJob(
97                                slots,
98                                ConstantsContainer.HOT_METAMODELS,
99                                getQVTOutlets(),
100                                expression);
101                //job.getAdvices().add(completionConfiguration.getCodeGenerationAdvicesFile());
102                job.setCheckProtectedRegions(true);
103                
104                return job;
105        }
106 
107}

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