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 protectedAbstractQVTOExecutor(ModelTransformationCache knownTransformations, QVToModelCache knownModels)Initializes a new instance of theAbstractQVTOExecutorclass with the given parameters.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.eclipse.m2m.qvt.oml.util.LogcreateLog()Creates the Log that shall be used during execution of the transformation.protected 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)Attempts to execute the transformation that corresponds to the given URI.booleanexecuteTransformation(QvtoModelTransformation modelTransformation, de.uka.ipd.sdq.scheduler.resources.active.IResourceTableManager resourceTableManager)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)protected QVToModelCachegetAvailableModels()Gets the underlying model cache used by this instance.protected ModelTransformationCachegetAvailableTransformations()Gets 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(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.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 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 Detail
-
getAvailableTransformations
protected ModelTransformationCache getAvailableTransformations()
Gets the underlying transformation cache used by this instance.- Returns:
- The
TransformationCachewhich 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
QVToModelCachewhich 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- 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)
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)
-
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 of#setupModelExtents(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:
#doExecution(TransformationData, ExecutionContext, ModelExtent[])
-
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 theLogto 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 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:
#doExecution(TransformationData, ExecutionContext, ModelExtent[])
-
-