| 1 | package de.uka.ipd.sdq.codegen.ejb; |
| 2 | |
| 3 | import org.eclipse.core.runtime.CoreException; |
| 4 | |
| 5 | import de.uka.ipd.sdq.codegen.simucontroller.debug.IDebugListener; |
| 6 | import de.uka.ipd.sdq.codegen.simucontroller.workflow.jobs.CompilePluginCodeJob; |
| 7 | import de.uka.ipd.sdq.codegen.simucontroller.workflow.jobs.CreateProtoComMetaDataFilesJob; |
| 8 | import de.uka.ipd.sdq.codegen.simucontroller.workflow.jobs.TransformPCMToCodeJob; |
| 9 | import de.uka.ipd.sdq.workflow.IBlackboardInteractingJob; |
| 10 | import de.uka.ipd.sdq.workflow.OrderPreservingBlackboardCompositeJob; |
| 11 | import de.uka.ipd.sdq.workflow.mdsd.blackboard.MDSDBlackboard; |
| 12 | import de.uka.ipd.sdq.workflow.pcm.configurations.AbstractCodeGenerationWorkflowRunConfiguration; |
| 13 | import de.uka.ipd.sdq.workflow.pcm.jobs.CreatePluginProjectJob; |
| 14 | import de.uka.ipd.sdq.workflow.pcm.jobs.LoadPCMModelsIntoBlackboardJob; |
| 15 | import de.uka.ipd.sdq.workflow.pcm.jobs.ValidatePCMModelsJob; |
| 16 | |
| 17 | /** |
| 18 | * Main job for the SDQ workflow engine which will run a SimuComSimulation |
| 19 | * @author Steffen |
| 20 | */ |
| 21 | public class EJBCodeGenerationJob |
| 22 | extends OrderPreservingBlackboardCompositeJob<MDSDBlackboard> |
| 23 | implements IBlackboardInteractingJob<MDSDBlackboard> { |
| 24 | |
| 25 | public EJBCodeGenerationJob(EjbCodeGenerationConfiguration configuration, IDebugListener listener) throws CoreException { |
| 26 | this(configuration, listener, true); |
| 27 | |
| 28 | } |
| 29 | |
| 30 | public EJBCodeGenerationJob(EjbCodeGenerationConfiguration configuration) throws CoreException { |
| 31 | this(configuration,null); |
| 32 | } |
| 33 | |
| 34 | public EJBCodeGenerationJob(EjbCodeGenerationConfiguration configuration, IDebugListener listener, boolean loadModels) throws CoreException { |
| 35 | super(); |
| 36 | |
| 37 | if (listener == null && configuration.isDebug()) |
| 38 | throw new IllegalArgumentException("Debug listener has to be non-null for debug runs"); |
| 39 | // 1. Load PCM Models into memory |
| 40 | if (loadModels == true) { |
| 41 | this.addJob(new LoadPCMModelsIntoBlackboardJob(configuration)); |
| 42 | } |
| 43 | //this.addJob(new LoadMiddlewareConfigurationIntoBlackboardJob(configuration)); |
| 44 | |
| 45 | // 2. Validate PCM Models |
| 46 | this.addJob(new ValidatePCMModelsJob(configuration)); |
| 47 | |
| 48 | // 3. Create new Eclipse plugin project |
| 49 | // We do NOT perform this step anymore. It causes PCM to delete and generate the |
| 50 | // plugin project twice! [zolynski] |
| 51 | //this.addJob(new CreatePluginProjectJob(configuration)); |
| 52 | |
| 53 | // 4. Generate the plugin's code using oAW |
| 54 | this.addJob(new TransformPCMToCodeJob(configuration)); |
| 55 | |
| 56 | if (configuration.getCodeGenerationAdvice() == AbstractCodeGenerationWorkflowRunConfiguration.CodeGenerationAdvice.PROTO) { |
| 57 | this.addJob(new CreateProtoComMetaDataFilesJob(configuration)); |
| 58 | } |
| 59 | |
| 60 | // 5. Compile the plugin (otherwise the source files are not properly found) |
| 61 | this.addJob(new CompilePluginCodeJob(configuration)); |
| 62 | |
| 63 | } |
| 64 | } |