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
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractQVTOExecutor(ModelTransformationCache knownTransformations, QVToModelCache knownModels) Initializes a new instance of theAbstractQVTOExecutorclass with the given parameters. -
Method Summary
Modifier and TypeMethodDescriptionprotected org.eclipse.m2m.qvt.oml.util.LogCreates the Log that shall be used during execution of the transformation.protected final org.eclipse.m2m.qvt.oml.ExecutionDiagnosticdoExecution(QvtoModelTransformation modelTransformation, org.eclipse.m2m.qvt.oml.ExecutionContext context, org.eclipse.m2m.qvt.oml.ModelExtent[] params) Executes a transformation.booleanexecuteTransformation(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 booleanexecuteTransformation(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.ExecutionDiagnosticexecuteTransformationInternal(QvtoModelTransformation modelTransformation, de.uka.ipd.sdq.scheduler.resources.active.IResourceTableManager resourceTableManager, Map<String, Object> configParams) protected QVToModelCacheGets the underlying model cache used by this instance.protected ModelTransformationCacheGets the underlying transformation cache used by this instance.protected booleanhandleExecutionResult(org.eclipse.m2m.qvt.oml.ExecutionDiagnostic executionResult) Last step of the#executeTransformation(TransformationData)template method.protected org.eclipse.m2m.qvt.oml.ExecutionContextsetupExecutionContext(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 theAbstractQVTOExecutorclass with the given parameters.- Parameters:
knownTransformations- AnTransformationCachewhich contains all transformation that can be executed by this instance, might be empty.knownModels- AQVToModelCachethat 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
TransformationCachewhich contains all transformations that can be executed by this instance.
-
getAvailableModels
Gets the underlying model cache used by this instance.- Returns:
- The
QVToModelCachewhich 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- AnURIthat 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
ModelExtentsare created:setupModelExtents(TransformationData) - The
ExecutionContextis setup:#setupExecutionContext() - The transformation is executed:
#doExecution(TransformationExecutor, ExecutionContext, ModelExtent[]) - The
ExecutionDiagnosticthat 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- TheTransformationDatawhich 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- TheTransformationDatathat represents the transformation to execute.context- TheExecutionContextto use for execution, result of#setupExecutionContext()params- TheModelExtents that hold the parameters of the transformation, result ofsetupModelExtents(TransformationData).- Returns:
- An
ExecutionDiagnosticwhich 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:
trueif the execution of the transformation is considered successful,falseotherwise.- 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 theLogto 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
Logto 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- TheTransformationDatathat 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:
-