1 | package de.uka.ipd.sdq.cip.workflow.jobs.builder; |
2 | |
3 | import java.util.ArrayList; |
4 | import java.util.Collection; |
5 | |
6 | import de.uka.ipd.sdq.cip.configuration.CompletionConfiguration; |
7 | import de.uka.ipd.sdq.cip.configuration.Transformation; |
8 | import de.uka.ipd.sdq.cip.workflow.jobs.CreateCopyOfModelsJob; |
9 | import de.uka.ipd.sdq.cip.workflow.jobs.CreateWorkingCopyOfModelsJob; |
10 | import de.uka.ipd.sdq.cip.workflow.jobs.QVTOConfigurationJob; |
11 | import de.uka.ipd.sdq.workflow.IJob; |
12 | import de.uka.ipd.sdq.workflow.mdsd.blackboard.SavePartitionToDiskJob; |
13 | import de.uka.ipd.sdq.workflow.mdsd.emf.qvto.QVTOTransformationJob; |
14 | import de.uka.ipd.sdq.workflow.mdsd.emf.qvto.QVTOTransformationJobConfiguration; |
15 | import de.uka.ipd.sdq.workflow.pcm.jobs.LoadPCMModelsIntoBlackboardJob; |
16 | |
17 | /** |
18 | * Job Builder for a plain QVTO transformation completion. |
19 | * |
20 | * |
21 | * |
22 | * @author Benjamin Klatt |
23 | * |
24 | */ |
25 | public class QVTOCompletionBuilder implements CompletionBuilder { |
26 | |
27 | private CompletionConfiguration completionConfiguration; |
28 | private Transformation transformation; |
29 | |
30 | /** |
31 | * Constructor to hand over the required configurations to the super type. |
32 | * |
33 | * @param completionConfiguration The configuration for the completion |
34 | * @param transformation The transformation to execute |
35 | */ |
36 | public QVTOCompletionBuilder( CompletionConfiguration completionConfiguration, |
37 | Transformation transformation) { |
38 | this.completionConfiguration = completionConfiguration; |
39 | this.transformation = transformation; |
40 | } |
41 | |
42 | /** |
43 | * Build the transformation job itself. |
44 | * @return The prepared jobs created by this builder. |
45 | */ |
46 | public Collection<IJob> buildJobs() { |
47 | |
48 | Collection<IJob> jobs = new ArrayList<IJob>(); |
49 | |
50 | // The configuration for a QVTO completion |
51 | QVTOTransformationJobConfiguration qvtoConfig = new QVTOTransformationJobConfiguration(); |
52 | |
53 | // copy models for in-place transformation |
54 | jobs.add(new CreateWorkingCopyOfModelsJob(completionConfiguration, transformation)); |
55 | |
56 | // configure the QVTO Job |
57 | jobs.add(new QVTOConfigurationJob(qvtoConfig, completionConfiguration, transformation)); |
58 | |
59 | // create and add the qvto job |
60 | jobs.add(new QVTOTransformationJob(qvtoConfig)); |
61 | |
62 | // dump the partition to disk |
63 | jobs.add(new SavePartitionToDiskJob(LoadPCMModelsIntoBlackboardJob.PCM_MODELS_PARTITION_ID)); |
64 | |
65 | return jobs; |
66 | } |
67 | |
68 | |
69 | |
70 | } |