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 aTransformationCache
, 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 Summary
Constructors Modifier Constructor Description protected
AbstractQVTOExecutor(ModelTransformationCache knownTransformations, QVToModelCache knownModels)
Initializes a new instance of theAbstractQVTOExecutor
class with the given parameters.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.eclipse.m2m.qvt.oml.util.Log
createLog()
Creates the Log that shall be used during execution of the transformation.protected 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.boolean
executeTransformation(URI transformationURI)
Attempts to execute the transformation that corresponds to the given URI.boolean
executeTransformation(QvtoModelTransformation modelTransformation)
Template method to execute a QVTo transformation.protected org.eclipse.m2m.qvt.oml.ExecutionDiagnostic
executeTransformationInternal(QvtoModelTransformation modelTransformation)
protected QVToModelCache
getAvailableModels()
Gets the underlying model cache used by this instance.protected ModelTransformationCache
getAvailableTransformations()
Gets the underlying transformation cache used by this instance.protected boolean
handleExecutionResult(org.eclipse.m2m.qvt.oml.ExecutionDiagnostic executionResult)
Last step of the#executeTransformation(TransformationData)
template method.protected org.eclipse.m2m.qvt.oml.ExecutionContext
setupExecutionContext()
This method is called prior to#doExecution(TransformationData, ExecutionContext, ModelExtent[])
within the#executeTransformation(TransformationData)
template method.protected org.eclipse.m2m.qvt.oml.ModelExtent[]
setupModelExtents(QvtoModelTransformation transformation)
First step of the#executeTransformation(TransformationData)
template method.
-
-
-
Constructor Detail
-
AbstractQVTOExecutor
protected AbstractQVTOExecutor(ModelTransformationCache knownTransformations, QVToModelCache knownModels)
Initializes a new instance of theAbstractQVTOExecutor
class with the given parameters.- Parameters:
knownTransformations
- AnTransformationCache
which contains all transformation that can be executed by this instance, might be empty.knownModels
- AQVToModelCache
that contains all models that can serve as a transformation parameter.- Throws:
NullPointerException
- If either parameter isnull
.
-
-
Method Detail
-
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)
Attempts to execute the transformation that corresponds to the given URI.- Parameters:
transformationURI
- AnURI
that points to a QVTo transformation.- Returns:
- A boolean that indicates whether the transformation succeeded.
- Throws:
NullPointerException
- In case the given URI isnull
.IllegalArgumentException
- In case the transformation is not known, i.e., not stored in the internal cache.- See Also:
#executeTransformation(TransformationData)
,#AbstractQVTOExecutor(TransformationCache, QVToModelCache)
-
executeTransformation
public final boolean executeTransformation(QvtoModelTransformation modelTransformation)
Template method to execute a QVTo transformation. Within this method, the following (primitive) steps are conducted:- The required model
ModelExtents
are created:#setupModelExtents(TransformationData)
- The
ExecutionContext
is setup:setupExecutionContext()
- The transformation is executed:
#doExecution(TransformationExecutor, ExecutionContext, ModelExtent[])
- 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
- TheTransformationData
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 casetransformationData == null
- The required model
-
executeTransformationInternal
protected org.eclipse.m2m.qvt.oml.ExecutionDiagnostic executeTransformationInternal(QvtoModelTransformation modelTransformation)
-
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
- TheTransformationData
that represents the transformation to execute.context
- TheExecutionContext
to use for execution, result ofsetupExecutionContext()
params
- TheModelExtent
s 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:
#doExecution(TransformationData, ExecutionContext, ModelExtent[])
-
setupExecutionContext
protected org.eclipse.m2m.qvt.oml.ExecutionContext setupExecutionContext()
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 theLog
to be in use.- Returns:
- A fully-fledged
ExecutionContext
. - See Also:
#doExecution(TransformationData, ExecutionContext, ModelExtent[])
-
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 withinsetupExecutionContext()
.- Returns:
- The
Log
to use during the execution of the transformation.
This default implementation always returnsnew 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
- TheTransformationData
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:
#doExecution(TransformationData, ExecutionContext, ModelExtent[])
-
-