Class AbstractQVTOExecutor
java.lang.Object
org.palladiosimulator.simulizar.reconfiguration.qvto.AbstractQVTOExecutor
- Direct Known Subclasses:
QVTOExecutor
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
Subclasses can re-implement the steps of the
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.-
Field Summary
-
Constructor Summary
ModifierConstructorDescriptionprotected
AbstractQVTOExecutor
(ModelTransformationCache knownTransformations, QVToModelCache knownModels) Initializes a new instance of theAbstractQVTOExecutor
class with the given parameters. -
Method Summary
Modifier and TypeMethodDescriptionprotected org.eclipse.m2m.qvt.oml.util.Log
Creates the Log that shall be used during execution of the transformation.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.boolean
executeTransformation
(URI transformationURI, de.uka.ipd.sdq.scheduler.resources.active.IResourceTableManager resourceTableManager, Map<String, Object> configParams) Attempts to execute the transformation that corresponds to the given URI.final boolean
executeTransformation
(QvtoModelTransformation modelTransformation, de.uka.ipd.sdq.scheduler.resources.active.IResourceTableManager resourceTableManager, Map<String, Object> configParams) Template method to execute a QVTo transformation.protected org.eclipse.m2m.qvt.oml.ExecutionDiagnostic
executeTransformationInternal
(QvtoModelTransformation modelTransformation, de.uka.ipd.sdq.scheduler.resources.active.IResourceTableManager resourceTableManager, Map<String, Object> configParams) protected QVToModelCache
Gets the underlying model cache used by this instance.protected ModelTransformationCache
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
(Map<String, Object> contextParams) This method is called prior todoExecution(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.
-
Field Details
-
KEY_RESOURCE_TABLE_MANAGER
- See Also:
-
-
Constructor Details
-
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 Details
-
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
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, Map<String, Object> configParams) 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, de.uka.ipd.sdq.scheduler.resources.active.IResourceTableManager resourceTableManager, Map<String, Object> configParams) 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, de.uka.ipd.sdq.scheduler.resources.active.IResourceTableManager resourceTableManager, Map<String, Object> configParams) -
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 of#setupExecutionContext()
params
- TheModelExtent
s that hold the parameters of the transformation, result ofsetupModelExtents(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(Map<String, Object> contextParams) This method is called prior todoExecution(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:
-
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 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:
-