1 | package de.uka.ipd.sdq.workflow.pcm.configurations; |
2 | |
3 | import java.util.ArrayList; |
4 | |
5 | import org.apache.log4j.Level; |
6 | import org.eclipse.core.runtime.CoreException; |
7 | import org.eclipse.core.runtime.IProgressMonitor; |
8 | import org.eclipse.debug.core.ILaunch; |
9 | |
10 | import de.uka.ipd.sdq.workflow.launchconfig.LoggerAppenderStruct; |
11 | import de.uka.ipd.sdq.workflow.mdsd.AbstractWorkflowBasedMDSDLaunchConfigurationDelegate; |
12 | import de.uka.ipd.sdq.workflow.mdsd.blackboard.MDSDBlackboard; |
13 | import de.uka.ipd.sdq.workflow.ui.UIBasedWorkflow; |
14 | |
15 | /** |
16 | * Base class for workflow based launch configurations (i.e., Eclipse Run and Debug tasks) which sets up a blackboard |
17 | * containing PCM and other models (e.g., annotation mark models), a UI based run (i.e., a run which reports errors |
18 | * to its user by the means of Eclipse UI Dialogs), and which configures openArchitectureWare's logging to report |
19 | * to this runs console. |
20 | * |
21 | * @author Steffen Becker |
22 | * |
23 | * @param <WorkflowConfigurationType> The type of the workflow configuration used in this workflow. It has to be a subclass |
24 | * of {@link AbstractPCMWorkflowRunConfiguration} as it needs the names of the PCM model parts involved |
25 | */ |
26 | public abstract class AbstractPCMLaunchConfigurationDelegate<WorkflowConfigurationType extends AbstractPCMWorkflowRunConfiguration> |
27 | extends |
28 | AbstractWorkflowBasedMDSDLaunchConfigurationDelegate<WorkflowConfigurationType> { |
29 | |
30 | /** |
31 | * Constructor |
32 | */ |
33 | public AbstractPCMLaunchConfigurationDelegate() { |
34 | super(); |
35 | } |
36 | |
37 | /* (non-Javadoc) |
38 | * @see de.uka.ipd.sdq.workflow.mdsd.AbstractWorkflowBasedMDSDLaunchConfigurationDelegate#createBlackboard() |
39 | */ |
40 | @Override |
41 | protected MDSDBlackboard createBlackboard() { |
42 | return new MDSDBlackboard(); |
43 | } |
44 | |
45 | /* (non-Javadoc) |
46 | * @see de.uka.ipd.sdq.workflow.launchconfig.AbstractWorkflowBasedLaunchConfigurationDelegate#createWorkflow(de.uka.ipd.sdq.workflow.launchconfig.AbstractWorkflowBasedRunConfiguration, org.eclipse.core.runtime.IProgressMonitor, org.eclipse.debug.core.ILaunch) |
47 | */ |
48 | @Override |
49 | protected UIBasedWorkflow<MDSDBlackboard> createWorkflow( |
50 | WorkflowConfigurationType workflowConfiguration, |
51 | IProgressMonitor monitor, |
52 | ILaunch launch) throws CoreException { |
53 | return new UIBasedWorkflow<MDSDBlackboard>( |
54 | createWorkflowJob(workflowConfiguration, launch), |
55 | monitor, |
56 | createExcpetionHandler(workflowConfiguration.isInteractive()), |
57 | createBlackboard()); |
58 | } |
59 | |
60 | /* (non-Javadoc) |
61 | * @see de.uka.ipd.sdq.workflow.launchconfig.AbstractWorkflowBasedLaunchConfigurationDelegate#setupLogging(org.apache.log4j.Level) |
62 | */ |
63 | @Override |
64 | protected ArrayList<LoggerAppenderStruct> setupLogging(Level logLevel) throws CoreException { |
65 | ArrayList<LoggerAppenderStruct> loggerList = super.setupLogging(logLevel); |
66 | |
67 | // Setup openArchitectureWare Logging |
68 | loggerList.add(setupLogger("org.openarchitectureware", logLevel, SHORT_LOG_PATTERN)); |
69 | |
70 | return loggerList; |
71 | } |
72 | } |