Class AbstractWorkflowBasedLaunchConfigurationDelegate<WorkflowConfigurationType extends AbstractWorkflowBasedRunConfiguration,WorkflowType extends Workflow>

java.lang.Object
de.uka.ipd.sdq.workflow.launchconfig.AbstractWorkflowBasedLaunchConfigurationDelegate<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:
ILaunchConfigurationDelegate
Direct Known Subclasses:
AbstractConfigBuilderBasedLaunchConfigurationDelegate, AbstractWorkflowBasedMDSDLaunchConfigurationDelegate

public abstract class AbstractWorkflowBasedLaunchConfigurationDelegate<WorkflowConfigurationType extends AbstractWorkflowBasedRunConfiguration,WorkflowType extends Workflow> extends Object implements ILaunchConfigurationDelegate
Abstract base class for Eclipse Launches (both Run and Debug mode are supported) which run based on the Palladio workflow engine, i.e., the run has an IJob which gets executed. The class offers features to convert the information contained in ILaunchConfiguration into a strongly typed configuration object for the workflow job, features to suport 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, execption handling, etc. The class is supposed to be used to implement Eclipse run configurations, like SimuCom, ProtoCom, PCM2Java, PCM2LQN, SoMoX, Java2PCM, 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 Details

    • SHORT_LOG_PATTERN

      protected static final String SHORT_LOG_PATTERN
      Log Pattern used for run mode.
      See Also:
    • DETAILED_LOG_PATTERN

      protected static final String DETAILED_LOG_PATTERN
      Log Pattern used for debug mode.
      See Also:
    • VERBOSE_LOGGING

      public static final String VERBOSE_LOGGING
      Name of the entry in the configuration hashmap containing the log level.
      See Also:
  • Constructor Details

    • AbstractWorkflowBasedLaunchConfigurationDelegate

      public AbstractWorkflowBasedLaunchConfigurationDelegate()
  • Method Details

    • launch

      public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException
      Specified by:
      launch in interface ILaunchConfigurationDelegate
      Throws:
      CoreException
    • configureLogging

      protected List<LoggerAppenderStruct> configureLogging(ILaunchConfiguration configuration) throws CoreException
      Throws:
      CoreException
    • getLogLevel

      protected org.apache.log4j.Level getLogLevel(ILaunchConfiguration configuration)
      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.
      Parameters:
      configuration - The configuration passed from the eclipse run dialog
      Returns:
      The log level selected by the user
    • createExceptionHandler

      protected WorkflowExceptionHandler createExceptionHandler(boolean interactive)
      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

      protected WorkflowType createWorkflow(WorkflowConfigurationType workflowConfiguration, IProgressMonitor monitor, ILaunch launch) throws CoreException
      Instantiate the workflow engine. By default a standard workflow engine is created.
      Parameters:
      workflowConfiguration - Configuration of the workflow job
      monitor - A progress monitor
      launch - The associated Eclipse launch
      Returns:
      The workflow engine to use for this launch
      Throws:
      CoreException - the core exception
    • setupLogging

      protected ArrayList<LoggerAppenderStruct> setupLogging(org.apache.log4j.Level logLevel) throws CoreException
      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
      Throws:
      CoreException - the core exception
    • 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 configure
      logLevel - The log level to be used by the LOGGER to configure
      layout - 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

      protected WorkflowProcess getProcess(ILaunch launch)
      Instantiate the Eclipse process used by the workflow engine. Override this method to return a different process if you need support for debugging, etc.
      Parameters:
      launch - The ILaunch passed to this launch by Eclipse
      Returns:
      The process used to execute this launch
    • createWorkflowJob

      protected abstract IJob createWorkflowJob(WorkflowConfigurationType config, ILaunch launch) throws CoreException
      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
      launch - The eclipse ILaunch associated to the workflow, needed to setup debugging if the workflow supports it
      Returns:
      The main workflow job to be executed by the workflow engine
      Throws:
      CoreException - the core exception
    • deriveConfiguration

      protected abstract WorkflowConfigurationType deriveConfiguration(ILaunchConfiguration configuration, String mode) throws CoreException
      This method is called as template method and has to be overriden by clients. Its purpose is to convert the Eclipse ILaunchConfiguration (which is basically an untyped hashmap) into a strongly typed configuration object needed by this workflow's main workflow job.
      Parameters:
      configuration - The ILaunchConfiguration to be converted into a strongly typed configuration object for the main workflow job
      mode - The mode of execution, can be either debug or run
      Returns:
      The strongly typed configuration object for the main workflow job
      Throws:
      CoreException - the core exception