Class AbstractWorkbenchDelegate<WorkflowConfigurationType extends AbstractJobConfiguration,WorkflowType extends Workflow>
java.lang.Object
de.uka.ipd.sdq.workflow.workbench.AbstractWorkbenchDelegate<WorkflowConfigurationType,WorkflowType>
- Type Parameters:
WorkflowConfigurationType
- The type of the configuration object needed by the workflow job to configure itself. Out of the box support for the run mode (run or debug), log-level, and unit test runs is provided.WorkflowType
- The type of the workflow to be executed. This can be simple workflows, workflows using a blackboard, etc.
- All Implemented Interfaces:
IActionDelegate
- Direct Known Subclasses:
AbstractMDSDWorkbenchDelegate
public abstract class AbstractWorkbenchDelegate<WorkflowConfigurationType extends AbstractJobConfiguration,WorkflowType extends Workflow>
extends Object
implements IActionDelegate
Abstract base class for Eclipse Workbench Actions which run based on the
Palladio workflow engine, i.e., the run has an IJob which gets executed. The
class offers features to support logging into the Eclipse console, support
for an Eclipse process which can be used to interrupt, terminate or debug the
run, integration of the Eclipse progress bar, exception handling, etc. * The
class is abstract and defines some methods, which must be implemented by
subclasses. See method descriptions for details.
This class is based on code provided by Roman Andrej
-
Field Summary
Modifier and TypeFieldDescriptionprotected static final String
Log Pattern used for debug mode.protected static final String
Log Pattern used for run mode.static final String
Name of the entry in the configuration hashmap containing the log level.protected final List<WorkflowStatusListener>
A list of listeners to inform about workflow status changes. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected WorkflowExceptionHandler
createExceptionHandler
(boolean interactive) Instanciate the workflow exception handler used to handle failures in the workflow.protected WorkflowType
createWorkflow
(WorkflowConfigurationType workflowConfiguration) Instantiate the workflow engine.protected abstract IJob
Instantiate the main job to be executed by the workflow engine.protected abstract WorkflowConfigurationType
This method is called as template method and has to be overriden by clients.protected org.apache.log4j.Level
Get the log level based on the extended CommonTab in DebugEnabledCommonTab.protected WorkflowProcess
Instantiate the Eclipse process used by the workflow engine.Access the list of registered workflow status listeners.void
register
(WorkflowStatusListener listner) Register a workflow status listener to the delegate.void
void
setProgressMonitor
(IProgressMonitor progressMonitor) Set another progress monitor the workflow should report to than the default null progress one.protected LoggerAppenderStruct
setupLogger
(String loggerName, org.apache.log4j.Level logLevel, String layout) Configure the named LOGGER to log on the given log level with the given PatternLayout.protected ArrayList<LoggerAppenderStruct>
setupLogging
(org.apache.log4j.Level logLevel) Setup LOGGER for the workflow run.protected abstract boolean
Use separate console for each job run.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.eclipse.ui.IActionDelegate
selectionChanged
-
Field Details
-
SHORT_LOG_PATTERN
Log Pattern used for run mode.- See Also:
-
DETAILED_LOG_PATTERN
Log Pattern used for debug mode.- See Also:
-
VERBOSE_LOGGING
Name of the entry in the configuration hashmap containing the log level.- See Also:
-
workflowListener
A list of listeners to inform about workflow status changes.
-
-
Constructor Details
-
AbstractWorkbenchDelegate
public AbstractWorkbenchDelegate()
-
-
Method Details
-
run
- Specified by:
run
in interfaceIActionDelegate
-
getLogLevel
protected org.apache.log4j.Level getLogLevel()Get the log level based on the extended CommonTab in DebugEnabledCommonTab.TODO: Anne has set this to protected because the logging has to be re-enabled during PerOpteryx. Check later whether there is a better solution.
- Returns:
- The log level selected by the user
-
createExceptionHandler
Instanciate the workflow exception handler used to handle failures in the workflow. By default returns an excpetion handler which uses Eclipse Dialogs to inform the user about the failure.- Parameters:
interactive
- Whether the workflow runs interactive- Returns:
- A workflow exception handler
-
createWorkflow
Instantiate the workflow engine. By default a standard workflow engine is created.- Parameters:
workflowConfiguration
- Configuration of the workflow job- Returns:
- The workflow engine to use for this launch
-
setupLogging
Setup LOGGER for the workflow run. May be overridden by clients to configure further LOGGER for other namespaces than de.uka.ipd.sdq.workflow. Use protected method setupLogger to configure additional loggers- Parameters:
logLevel
- The apache log4j log level requested by the user as log level- Returns:
- the array list
-
setupLogger
protected LoggerAppenderStruct setupLogger(String loggerName, org.apache.log4j.Level logLevel, String layout) Configure the named LOGGER to log on the given log level with the given PatternLayout.- Parameters:
loggerName
- The name of the LOGGER to configurelogLevel
- The log level to be used by the LOGGER to configurelayout
- The layout for the pattern layout to be used to format log messages. The layout may reuse the defined constants in this class for short and detailed log outputs- Returns:
- the LOGGER appender struct
-
getProcess
Instantiate the Eclipse process used by the workflow engine. Override this method to return a different process if you need support for debugging, etc.- Returns:
- The process used to execute this launch
-
getWorkflowListener
Access the list of registered workflow status listeners.- Returns:
- The currently registered listeners
-
register
Register a workflow status listener to the delegate.- Parameters:
listner
- The listener to register.
-
setProgressMonitor
Set another progress monitor the workflow should report to than the default null progress one. Note: The progress monitor must be set before the workflow is triggered! (run method)- Parameters:
progressMonitor
- The monitor to report to.
-
createWorkflowJob
Instantiate the main job to be executed by the workflow engine. The job can be a single job or any other job type like composite jobs. The job will be run by the workflow engine.- Parameters:
config
- The strongly-typed configuration object used to configure the main workflow job- Returns:
- The main workflow job to be executed by the workflow engine
-
useSeparateConsoleForEachJobRun
protected abstract boolean useSeparateConsoleForEachJobRun()Use separate console for each job run.- Returns:
- true, if successful
-
getConfiguration
This method is called as template method and has to be overriden by clients. Its purpose is to return a strongly typed configuration object needed by this workflow's main workflow job.- Returns:
- The strongly typed configuration object for the main workflow job
-