Class AbstractQVTOExecutor

java.lang.Object
org.palladiosimulator.simulizar.reconfiguration.qvto.AbstractQVTOExecutor
Direct Known Subclasses:
QVTOExecutor

public abstract class AbstractQVTOExecutor extends Object
This class is intended to be the base of all classes that wish to execute QVTo transformations. The set of transformations that can be executed are passed to each instance upon construction in terms of a TransformationCache, as well as the set of model that can serve as transformation parameters.
Subclasses can re-implement the steps of the #executeTransformation(TransformationData) template method to adapt the process of execution.
  • Constructor Details

    • AbstractQVTOExecutor

      protected AbstractQVTOExecutor(ModelTransformationCache knownTransformations, QVToModelCache knownModels)
      Initializes a new instance of the AbstractQVTOExecutor class with the given parameters.
      Parameters:
      knownTransformations - An TransformationCache which contains all transformation that can be executed by this instance, might be empty.
      knownModels - A QVToModelCache that contains all models that can serve as a transformation parameter.
      Throws:
      NullPointerException - If either parameter is null.
  • Method Details

    • getAvailableTransformations

      protected ModelTransformationCache getAvailableTransformations()
      Gets the underlying transformation cache used by this instance.
      Returns:
      The TransformationCache which contains all transformations that can be executed by this instance.
    • getAvailableModels

      protected QVToModelCache getAvailableModels()
      Gets the underlying model cache used by this instance.
      Returns:
      The QVToModelCache which contains all models that can serve as parameters.
    • executeTransformation

      public boolean executeTransformation(URI transformationURI, de.uka.ipd.sdq.scheduler.resources.active.IResourceTableManager resourceTableManager)
      Attempts to execute the transformation that corresponds to the given URI.
      Parameters:
      transformationURI - An URI that points to a QVTo transformation.
      Returns:
      A boolean that indicates whether the transformation succeeded.
      Throws:
      NullPointerException - In case the given URI is null.
      IllegalArgumentException - In case the transformation is not known, i.e., not stored in the internal cache.
      See Also:
    • executeTransformation

      public final boolean executeTransformation(QvtoModelTransformation modelTransformation, de.uka.ipd.sdq.scheduler.resources.active.IResourceTableManager resourceTableManager)
      Template method to execute a QVTo transformation. Within this method, the following (primitive) steps are conducted:
      1. The required model ModelExtents are created: setupModelExtents(TransformationData)
      2. The ExecutionContext is setup: #setupExecutionContext()
      3. The transformation is executed: #doExecution(TransformationExecutor, ExecutionContext, ModelExtent[])
      4. The ExecutionDiagnostic that describes the execution result is processed: handleExecutionResult(ExecutionDiagnostic)

      Note, that all of the steps are implemented by this class, but are open to re-implementation by subclasses (apart from the execution step).
      Parameters:
      transformationData - The TransformationData which describes the transformation to be executed.
      Returns:
      The result of the last step, i.e., a boolean that indicates whether the transformation succeeded.
      Throws:
      NullPointerException - In case transformationData == null
    • executeTransformationInternal

      protected org.eclipse.m2m.qvt.oml.ExecutionDiagnostic executeTransformationInternal(QvtoModelTransformation modelTransformation, de.uka.ipd.sdq.scheduler.resources.active.IResourceTableManager resourceTableManager)
    • doExecution

      protected final org.eclipse.m2m.qvt.oml.ExecutionDiagnostic doExecution(QvtoModelTransformation modelTransformation, org.eclipse.m2m.qvt.oml.ExecutionContext context, org.eclipse.m2m.qvt.oml.ModelExtent[] params)
      Executes a transformation.
      Parameters:
      data - The TransformationData that represents the transformation to execute.
      context - The ExecutionContext to use for execution, result of #setupExecutionContext()
      params - The ModelExtents that hold the parameters of the transformation, result of setupModelExtents(TransformationData).
      Returns:
      An ExecutionDiagnostic which indicates the execution result status.
      See Also:
      • #executeTransformation(TransformationData)
    • handleExecutionResult

      protected boolean handleExecutionResult(org.eclipse.m2m.qvt.oml.ExecutionDiagnostic executionResult)
      Last step of the #executeTransformation(TransformationData) template method. Processes the result status of the execution and transforms it into a boolean value.
      Parameters:
      executionResult -
      Returns:
      true if the execution of the transformation is considered successful, false otherwise.
      See Also:
    • setupExecutionContext

      protected org.eclipse.m2m.qvt.oml.ExecutionContext setupExecutionContext(de.uka.ipd.sdq.scheduler.resources.active.IResourceTableManager resourceTableManager)
      This method is called prior to doExecution(TransformationData, ExecutionContext, ModelExtent[]) within the #executeTransformation(TransformationData) template method. It creates the execution context to be used for execution of the transformation. In particular, createLog() is called to obtain the Log to be in use.
      Returns:
      A fully-fledged ExecutionContext.
      See Also:
    • createLog

      protected org.eclipse.m2m.qvt.oml.util.Log createLog()
      Creates the Log that shall be used during execution of the transformation. This method is called within #setupExecutionContext().
      Returns:
      The Log to use during the execution of the transformation.
      This default implementation always returns new QVTOReconfigurationLogger(getClass()).
    • setupModelExtents

      protected org.eclipse.m2m.qvt.oml.ModelExtent[] setupModelExtents(QvtoModelTransformation transformation)
      First step of the #executeTransformation(TransformationData) template method. Examines the required transformation parameters and creates appropriate model extents.
      Parameters:
      modelTransformation - The TransformationData that represents the transformation to be executed.
      Returns:
      An array of ModelExtents, one for each parameter, in order of appearance.
      Throws:
      IllegalStateException - In case no fitting model could be found to create a model extent for an 'in' or 'inout' parameter.
      See Also: