1 | package de.uka.ipd.sdq.dsexplore.launch; |
2 | |
3 | import org.eclipse.core.runtime.IProgressMonitor; |
4 | |
5 | import de.uka.ipd.sdq.workflow.IBlackboardInteractingJob; |
6 | import de.uka.ipd.sdq.workflow.IJob; |
7 | import de.uka.ipd.sdq.workflow.exceptions.JobFailedException; |
8 | import de.uka.ipd.sdq.workflow.exceptions.RollbackFailedException; |
9 | import de.uka.ipd.sdq.workflow.exceptions.UserCanceledException; |
10 | import de.uka.ipd.sdq.workflow.mdsd.blackboard.MDSDBlackboard; |
11 | import de.uka.ipd.sdq.workflow.pcm.blackboard.PCMResourceSetPartition; |
12 | import de.uka.ipd.sdq.workflow.pcm.jobs.LoadPCMModelsIntoBlackboardJob; |
13 | |
14 | |
15 | public class MoveInitialPCMModelPartitionJob implements IJob, IBlackboardInteractingJob<MDSDBlackboard> { |
16 | |
17 | public static final String INITIAL_PCM_MODEL_PARTITION_ID = "initialPCModelPartitionID"; |
18 | MDSDBlackboard blackboard; |
19 | |
20 | public MoveInitialPCMModelPartitionJob() { |
21 | } |
22 | |
23 | @Override |
24 | public void execute(IProgressMonitor monitor) throws JobFailedException, |
25 | UserCanceledException { |
26 | |
27 | String id = LoadPCMModelsIntoBlackboardJob.PCM_MODELS_PARTITION_ID; |
28 | PCMResourceSetPartition partition = (PCMResourceSetPartition)this.blackboard.getPartition(id); |
29 | this.blackboard.removePartition(id); |
30 | this.blackboard.addPartition(MoveInitialPCMModelPartitionJob.INITIAL_PCM_MODEL_PARTITION_ID, partition); |
31 | } |
32 | |
33 | @Override |
34 | public String getName() { |
35 | return this.getClass().getName(); |
36 | } |
37 | |
38 | @Override |
39 | public void rollback(IProgressMonitor monitor) |
40 | throws RollbackFailedException { |
41 | this.blackboard.removePartition(MoveInitialPCMModelPartitionJob.INITIAL_PCM_MODEL_PARTITION_ID); |
42 | } |
43 | |
44 | @Override |
45 | public void setBlackboard(MDSDBlackboard blackboard) { |
46 | this.blackboard = blackboard; |
47 | |
48 | } |
49 | |
50 | |
51 | |
52 | |
53 | } |