org.eclipse.mofscript.runtime
Class ExecutionManager

java.lang.Object
  extended by org.eclipse.mofscript.runtime.ExecutionManager

public class ExecutionManager
extends java.lang.Object

Class responsible for managing the execution of a transformation

Author:
jol

Method Summary
static void addDebugListener(DebugListener dl)
           
 void addOutModelTypeMap(java.lang.String outParam, java.lang.String metaModelType)
           
 void addSourceModel(org.eclipse.emf.ecore.EObject model)
          Adds a source metamodel
 void clearModelTypeMap()
           
 void clearSourceMetaModels()
          Clears the source metamodel hash
 void clearTransformationModel()
          Clears the transformation proxy
 org.eclipse.emf.ecore.EObject createFeatureFromName(java.lang.String featureName, org.eclipse.emf.ecore.EPackage metamodel)
          Creates a classifier from a metamodel based on a name This is not really used - was for creating metamodel instances in a transformation.
 void executeTransformation()
          Executes a transformation
 org.eclipse.emf.ecore.EStructuralFeature findFeatureForEcoreConcept(java.lang.String ecoreConcept, java.lang.String feature)
          Looks for a feature from an ecore concept
 org.eclipse.emf.ecore.EStructuralFeature findFeatureForSourceConcept(java.lang.String metaModel, java.lang.String metamodelconcept, java.lang.String feature)
          Locates a feature for a given metamodel concept in the source metamodel
 org.eclipse.emf.ecore.EStructuralFeature findFeatureForSourceRootConcept_1002(java.lang.String metamodelName, java.lang.String feature)
           
 org.eclipse.emf.ecore.EStructuralFeature findFeatureForTargetConcept(java.lang.String metaModel, java.lang.String metamodelconcept, java.lang.String feature)
          Locates a feature for a given metamodel concept in the target metamodel
 org.eclipse.emf.ecore.EClass findMetaModelConcept(java.lang.String metaModelName, java.lang.String concept)
          Looks for either source or target metamodel concepts
 org.eclipse.emf.ecore.EClass findSourceMetaModelConcept(java.lang.String metaModelName, java.lang.String concept)
           
 org.eclipse.emf.ecore.EClass findTargetMetaModelConcept(java.lang.String metaModelName, java.lang.String concept)
           
 java.util.List getAllClassifiersForMetaModel(java.lang.String metaModel)
           
 java.util.List getAllClassifiersForPackage(org.eclipse.emf.ecore.EPackage pkg)
           
 java.util.List getAllClassifiersForSourceMetaModel(java.lang.String metaModel)
          Returns a list of all classifiers for a given meta model
 java.util.List getAllRulesForConcept(java.lang.String concept)
          Looks for all rules that applies to a certain concept
static java.util.Set getAllSuperRuleNames(MOFScriptTransformation transformation)
           
static java.util.Set getAllSuperRules(MOFScriptTransformation transformation)
           
 java.lang.String getBlockCommentTag()
           
 org.eclipse.emf.ecore.EClassifier getClassifierForPackage(org.eclipse.emf.ecore.EPackage pkg, java.lang.String clazzifierName)
           
static java.util.List<DebugListener> getDebugListeners()
           
 org.eclipse.emf.ecore.EPackage getDefaultMetaModel()
          Returns the "default" metamodel, which is always the first one
 org.eclipse.emf.ecore.EPackage getEcoreMetaModel()
           
static ExecutionManager getExecutionManager()
          Obtains (and creates) the singelton execution manager
 RuleExecutionStack getExecutionStack()
           
static org.eclipse.emf.ecore.EStructuralFeature getFeatureForClass(org.eclipse.emf.ecore.EClass clazz, java.lang.String feature)
          Retrieves a named features for a class.
 org.eclipse.emf.ecore.EObject getFeatureForName(java.lang.String featureName)
          Retrieves a feature object from the source metamodel (or one of the meta models) Currently uses the sourceMetaModel
static java.util.List getFeaturesForClass(org.eclipse.emf.ecore.EClass clazz)
          Fetches all features (structural features) of a class, including inherited ones Also fetches features of un
 FileResourcesType getFileModel()
          The file model is only populated when the "useFileModel" property is set.
 org.eclipse.emf.ecore.EPackage getMetaModel(java.lang.String name)
           
 java.util.Vector<org.eclipse.emf.ecore.EObject> getMetaModelConcept(java.lang.String concept)
          Looks at any metamodel for a class with that name
 org.eclipse.emf.ecore.EClassifier getMetaModelReference(java.lang.String refName)
          Looks for a classifier from a metamodel
static java.util.List getMMTokens(org.eclipse.emf.ecore.EPackage metaModel)
          Returns a list of strings containing the names of the concepts defined in the metamodel given in the input parameter
 MOFScriptModelFactory getModelFactory()
           
 MOFScriptTransformation getMofScript2TextTransformation()
          Returns the model representation of the MOFScript to Text transformation
 MOFScriptTransformation getMofScriptAspectTransformation()
           
static java.lang.String getObjectAttributeValue(org.eclipse.emf.ecore.EObject object, java.lang.String featureName)
          Returns the value of a given attribute for a specific object
static java.lang.String getObjectNameValue(org.eclipse.emf.ecore.EObject object)
          Returns the value of the 'name' attribute for a specific object
 java.util.Collection<org.eclipse.emf.ecore.EObject> getOutputModels()
           
 java.util.Vector getProducedResources()
           
 java.lang.Object getRealObject(java.lang.Object mightBeProxy)
          checks if an object is a proxy and resolves it
 org.eclipse.emf.ecore.resource.Resource getResource(org.eclipse.emf.common.util.URI uri)
          Returns a resource based on a URI
 org.eclipse.emf.ecore.resource.ResourceSet getResourceSet()
           
 java.lang.String getRootDirectory()
           
 org.eclipse.emf.ecore.EPackage getSourceMetaModel(java.lang.String name)
          Returns a named metamodel
 java.lang.String getSourceMetaModelName(int index)
          Gets the name of the source metamodels based on their index
 java.util.List getSourceMMTokens()
           
 org.eclipse.emf.ecore.EObject getSourceModel(java.lang.String metaModelRef)
           
 org.eclipse.emf.ecore.EPackage getTargetMetaModel(java.lang.String name)
           
 TransformationProxy getTransformationProxy()
           
 TransformationRule getTransformationRule2(java.lang.String name, java.lang.String possibleScope, java.lang.String ownerTransformation)
          Deprecated.  
 java.util.Collection getTransformationRules(java.lang.String name, java.lang.String possibleScope, java.lang.String ownerTransformation)
          Returns all rules with the same name
 MOFScriptSpecification getTransformationSpecification()
           
 boolean getUMLIsAvailable()
          Gets the property for UML2 availability
 boolean getUseTraceability()
           
 void loadSourceModel(java.io.File sourceFile)
          Loads the source model from a file into the set of models needed to perform a transformation The source model needs to be in accordance with the source meta model
 void loadTransformationModel(java.io.File sourcefile)
          Loads a transformation model from a file
 org.eclipse.emf.ecore.EPackage lookupAndAddSourceMetaModel(java.lang.String mmName, java.lang.String mmUri)
          Looks up a given metamodel and adds it to the metamodel and name caches
 void lookupAndAddSourceMetaModelsFromParameterList(java.util.List paramList)
           
 org.eclipse.emf.ecore.EPackage lookupAndAddTargetMetaModel(java.lang.String mmName, java.lang.String mmUri)
          Looks up a given metamodel and adds it to the metamodel and name caches
 java.util.Hashtable lookupMetaModels()
          Looks up metamodels
 org.eclipse.emf.ecore.EPackage lookupPackageRegistry_111(java.lang.String name)
          Looks up a package name from the package registry
 org.eclipse.emf.ecore.EPackage lookupResourceMetaModel(java.lang.String mmUri)
          Looks for a metamodel based on it's URI
 org.eclipse.emf.ecore.EPackage lookupResourceMetaModelByName(java.lang.String name)
          Looks up a metamodel based on a name
 void messageEvent(java.lang.String message)
          Prints message to console
static void removeDebugListener(DebugListener dl)
           
 void setBlockCommentTag(java.lang.String blockCommentTag)
           
 void setFileMetaModelRepository(java.lang.String directory)
          Sets the metamodel repository location, and updates the cached registry
 void setRootDirectory(java.lang.String rootDir)
          Sets the root directory for output generation
 void setTraceabilityGenDir(java.lang.String traceGenDir)
           
 void setTransformationModel(MOFScriptTransformation transformation)
           
 void setTransformationProxy(TransformationProxy trProxy)
          Sets the transformation proxy
 void setTransformationSpecification(MOFScriptSpecification transformationSpec)
           
 void setUMLIsAvailable(boolean umlIsAvailable)
          Sets the property for UML2 availability
 void setUseFileModel(boolean useFileModel)
           
 void setUseLog(boolean useLog)
          Turns on/off the usage of logging in MOFScript
 void setUseTraceability(boolean useIt)
          Turns traceability functionality on / off
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getExecutionManager

public static ExecutionManager getExecutionManager()
Obtains (and creates) the singelton execution manager

Returns:

lookupMetaModels

public java.util.Hashtable lookupMetaModels()
Looks up metamodels

Returns:
A hashtable containing pairs of uris and names of metamodels

setFileMetaModelRepository

public void setFileMetaModelRepository(java.lang.String directory)
Sets the metamodel repository location, and updates the cached registry

Parameters:
directory -

setUseTraceability

public void setUseTraceability(boolean useIt)
Turns traceability functionality on / off

Parameters:
useIt -

setTraceabilityGenDir

public void setTraceabilityGenDir(java.lang.String traceGenDir)

getUseTraceability

public boolean getUseTraceability()
Returns:
The value of traceability management (is it on or off)

addDebugListener

public static void addDebugListener(DebugListener dl)
Parameters:
dl -

removeDebugListener

public static void removeDebugListener(DebugListener dl)
Parameters:
dl -

getDebugListeners

public static java.util.List<DebugListener> getDebugListeners()
Returns:

setBlockCommentTag

public void setBlockCommentTag(java.lang.String blockCommentTag)
Parameters:
blockCommentTag - Comment tag used infront of block start and end I.e. Java "//"

getBlockCommentTag

public java.lang.String getBlockCommentTag()

setUMLIsAvailable

public void setUMLIsAvailable(boolean umlIsAvailable)
Sets the property for UML2 availability

Parameters:
umlIsAvailable -

getUMLIsAvailable

public boolean getUMLIsAvailable()
Gets the property for UML2 availability

Returns:

setUseLog

public void setUseLog(boolean useLog)
Turns on/off the usage of logging in MOFScript

Parameters:
useLog -

getResource

public org.eclipse.emf.ecore.resource.Resource getResource(org.eclipse.emf.common.util.URI uri)
Returns a resource based on a URI

Parameters:
uri -
Returns:

getTransformationRule2

public TransformationRule getTransformationRule2(java.lang.String name,
                                                 java.lang.String possibleScope,
                                                 java.lang.String ownerTransformation)
Deprecated. 

Gets the first rule of a specific name

Parameters:
name -
possibleScope -
ownerTransformation -
Returns:

getTransformationRules

public java.util.Collection getTransformationRules(java.lang.String name,
                                                   java.lang.String possibleScope,
                                                   java.lang.String ownerTransformation)
Returns all rules with the same name

Parameters:
name -
possibleScope -
ownerTransformation -
Returns:

getEcoreMetaModel

public org.eclipse.emf.ecore.EPackage getEcoreMetaModel()
Returns:
The ecore package

clearTransformationModel

public void clearTransformationModel()
Clears the transformation proxy


setTransformationProxy

public void setTransformationProxy(TransformationProxy trProxy)
Sets the transformation proxy

Parameters:
trProxy -

getTransformationProxy

public TransformationProxy getTransformationProxy()
Returns:
the current transformation model

setTransformationModel

public void setTransformationModel(MOFScriptTransformation transformation)
Parameters:
transformation -

setTransformationSpecification

public void setTransformationSpecification(MOFScriptSpecification transformationSpec)
Parameters:
transformationSpec -

getTransformationSpecification

public MOFScriptSpecification getTransformationSpecification()
Returns:
The transformation specification

setUseFileModel

public void setUseFileModel(boolean useFileModel)
Parameters:
useFileModel -

setRootDirectory

public void setRootDirectory(java.lang.String rootDir)
Sets the root directory for output generation

Parameters:
rootDir -

getRootDirectory

public java.lang.String getRootDirectory()
Returns:
The root directory

getModelFactory

public MOFScriptModelFactory getModelFactory()
Returns:
The mofscript model factory

getResourceSet

public org.eclipse.emf.ecore.resource.ResourceSet getResourceSet()
Returns:
the resource set

getExecutionStack

public RuleExecutionStack getExecutionStack()
Returns:
The execution stack

loadTransformationModel

public void loadTransformationModel(java.io.File sourcefile)
Loads a transformation model from a file


lookupPackageRegistry_111

public org.eclipse.emf.ecore.EPackage lookupPackageRegistry_111(java.lang.String name)
Looks up a package name from the package registry

Parameters:
name -
Returns:

clearSourceMetaModels

public void clearSourceMetaModels()
Clears the source metamodel hash


loadSourceModel

public void loadSourceModel(java.io.File sourceFile)
Loads the source model from a file into the set of models needed to perform a transformation The source model needs to be in accordance with the source meta model

Parameters:
sourceFile - the file to load the metamodel from

lookupResourceMetaModel

public org.eclipse.emf.ecore.EPackage lookupResourceMetaModel(java.lang.String mmUri)
Looks for a metamodel based on it's URI

Parameters:
mmUri -
Returns:

lookupResourceMetaModelByName

public org.eclipse.emf.ecore.EPackage lookupResourceMetaModelByName(java.lang.String name)
Looks up a metamodel based on a name

Parameters:
name -
Returns:

lookupAndAddSourceMetaModel

public org.eclipse.emf.ecore.EPackage lookupAndAddSourceMetaModel(java.lang.String mmName,
                                                                  java.lang.String mmUri)
Looks up a given metamodel and adds it to the metamodel and name caches

Parameters:
mmName -
mmUri -
Returns:

lookupAndAddTargetMetaModel

public org.eclipse.emf.ecore.EPackage lookupAndAddTargetMetaModel(java.lang.String mmName,
                                                                  java.lang.String mmUri)
Looks up a given metamodel and adds it to the metamodel and name caches

Parameters:
mmName -
mmUri -
Returns:

lookupAndAddSourceMetaModelsFromParameterList

public void lookupAndAddSourceMetaModelsFromParameterList(java.util.List paramList)

addSourceModel

public void addSourceModel(org.eclipse.emf.ecore.EObject model)
Adds a source metamodel

Parameters:
model -

getDefaultMetaModel

public org.eclipse.emf.ecore.EPackage getDefaultMetaModel()
Returns the "default" metamodel, which is always the first one

Returns:

getMetaModel

public org.eclipse.emf.ecore.EPackage getMetaModel(java.lang.String name)

getSourceMetaModel

public org.eclipse.emf.ecore.EPackage getSourceMetaModel(java.lang.String name)
Returns a named metamodel

Parameters:
name -
Returns:

getTargetMetaModel

public org.eclipse.emf.ecore.EPackage getTargetMetaModel(java.lang.String name)
Parameters:
name -
Returns:

getSourceMetaModelName

public java.lang.String getSourceMetaModelName(int index)
Gets the name of the source metamodels based on their index


getSourceModel

public org.eclipse.emf.ecore.EObject getSourceModel(java.lang.String metaModelRef)
Parameters:
metaModelRef - The reference to the owner metamodel
Returns:
the source model object

executeTransformation

public void executeTransformation()
                           throws MofScriptExecutionException
Executes a transformation

Throws:
MofScriptExecutionException

getFileModel

public FileResourcesType getFileModel()
The file model is only populated when the "useFileModel" property is set.

Returns:
a file model representation of the files generated

getProducedResources

public java.util.Vector getProducedResources()
Returns:
A (String) list of produced resources (files) (their names)

getObjectAttributeValue

public static java.lang.String getObjectAttributeValue(org.eclipse.emf.ecore.EObject object,
                                                       java.lang.String featureName)
Returns the value of a given attribute for a specific object

Parameters:
object -
featureName -
Returns:

getObjectNameValue

public static java.lang.String getObjectNameValue(org.eclipse.emf.ecore.EObject object)
Returns the value of the 'name' attribute for a specific object

Parameters:
object - the object to find the name attribute value for
Returns:
the value of the 'name' attribute

getFeatureForName

public org.eclipse.emf.ecore.EObject getFeatureForName(java.lang.String featureName)
Retrieves a feature object from the source metamodel (or one of the meta models) Currently uses the sourceMetaModel

Parameters:
featureName -
Returns:

createFeatureFromName

public org.eclipse.emf.ecore.EObject createFeatureFromName(java.lang.String featureName,
                                                           org.eclipse.emf.ecore.EPackage metamodel)
Creates a classifier from a metamodel based on a name This is not really used - was for creating metamodel instances in a transformation.

Parameters:
featureName -
metamodel -
Returns:

getMMTokens

public static java.util.List getMMTokens(org.eclipse.emf.ecore.EPackage metaModel)
Returns a list of strings containing the names of the concepts defined in the metamodel given in the input parameter

Parameters:
metaModel - the metamodel to find the tokens for
Returns:
a list of tokens in string format

getSourceMMTokens

public java.util.List getSourceMMTokens()
Returns:
a list of tokens for the source metamodel

findMetaModelConcept

public org.eclipse.emf.ecore.EClass findMetaModelConcept(java.lang.String metaModelName,
                                                         java.lang.String concept)
Looks for either source or target metamodel concepts

Parameters:
metaModelName -
concept -
Returns:

findSourceMetaModelConcept

public org.eclipse.emf.ecore.EClass findSourceMetaModelConcept(java.lang.String metaModelName,
                                                               java.lang.String concept)
Parameters:
concept - a string containing the name og the concept to receive
Returns:
an EClass representation of the source metamodel concept defined in the parameter

findTargetMetaModelConcept

public org.eclipse.emf.ecore.EClass findTargetMetaModelConcept(java.lang.String metaModelName,
                                                               java.lang.String concept)
Parameters:
concept - a string containing the name og the concept to receive
Returns:
an EClass representation of the target metamodel concept defined in the parameter

getMetaModelConcept

public java.util.Vector<org.eclipse.emf.ecore.EObject> getMetaModelConcept(java.lang.String concept)
Looks at any metamodel for a class with that name

Parameters:
concept -
Returns:

findFeatureForSourceConcept

public org.eclipse.emf.ecore.EStructuralFeature findFeatureForSourceConcept(java.lang.String metaModel,
                                                                            java.lang.String metamodelconcept,
                                                                            java.lang.String feature)
Locates a feature for a given metamodel concept in the source metamodel


findFeatureForEcoreConcept

public org.eclipse.emf.ecore.EStructuralFeature findFeatureForEcoreConcept(java.lang.String ecoreConcept,
                                                                           java.lang.String feature)
Looks for a feature from an ecore concept

Parameters:
ecoreConcept -
feature -
Returns:

findFeatureForSourceRootConcept_1002

public org.eclipse.emf.ecore.EStructuralFeature findFeatureForSourceRootConcept_1002(java.lang.String metamodelName,
                                                                                     java.lang.String feature)
Parameters:
metamodelName -
feature -
Returns:

findFeatureForTargetConcept

public org.eclipse.emf.ecore.EStructuralFeature findFeatureForTargetConcept(java.lang.String metaModel,
                                                                            java.lang.String metamodelconcept,
                                                                            java.lang.String feature)
Locates a feature for a given metamodel concept in the target metamodel


getAllRulesForConcept

public java.util.List getAllRulesForConcept(java.lang.String concept)
Looks for all rules that applies to a certain concept

Parameters:
concept - The concept
Returns:

getMetaModelReference

public org.eclipse.emf.ecore.EClassifier getMetaModelReference(java.lang.String refName)
Looks for a classifier from a metamodel

Parameters:
refName -
Returns:

getFeaturesForClass

public static java.util.List getFeaturesForClass(org.eclipse.emf.ecore.EClass clazz)
Fetches all features (structural features) of a class, including inherited ones Also fetches features of un


getFeatureForClass

public static org.eclipse.emf.ecore.EStructuralFeature getFeatureForClass(org.eclipse.emf.ecore.EClass clazz,
                                                                          java.lang.String feature)
Retrieves a named features for a class. Also checks the upper supertype, in case this is a proxy

Parameters:
clazz -
feature -
Returns:

getAllClassifiersForSourceMetaModel

public java.util.List getAllClassifiersForSourceMetaModel(java.lang.String metaModel)
Returns a list of all classifiers for a given meta model

Returns:

getAllClassifiersForMetaModel

public java.util.List getAllClassifiersForMetaModel(java.lang.String metaModel)
Parameters:
metaModel -
Returns:

getAllClassifiersForPackage

public java.util.List getAllClassifiersForPackage(org.eclipse.emf.ecore.EPackage pkg)
Parameters:
pkg -
Returns:

getClassifierForPackage

public org.eclipse.emf.ecore.EClassifier getClassifierForPackage(org.eclipse.emf.ecore.EPackage pkg,
                                                                 java.lang.String clazzifierName)
Parameters:
pkg -
clazzifierName -
Returns:

getRealObject

public java.lang.Object getRealObject(java.lang.Object mightBeProxy)
checks if an object is a proxy and resolves it

Parameters:
mightBeProxy -
Returns:

getAllSuperRules

public static java.util.Set getAllSuperRules(MOFScriptTransformation transformation)
Parameters:
transformation -
Returns:
the set of all rules for supertypes of a transformation

getAllSuperRuleNames

public static java.util.Set getAllSuperRuleNames(MOFScriptTransformation transformation)
Parameters:
transformation -
Returns:
the name of all rules for supertypes of a transformation

getMofScript2TextTransformation

public MOFScriptTransformation getMofScript2TextTransformation()
Returns the model representation of the MOFScript to Text transformation

Returns:

getMofScriptAspectTransformation

public MOFScriptTransformation getMofScriptAspectTransformation()
Returns:

messageEvent

public void messageEvent(java.lang.String message)
Prints message to console

Parameters:
message -

addOutModelTypeMap

public void addOutModelTypeMap(java.lang.String outParam,
                               java.lang.String metaModelType)

clearModelTypeMap

public void clearModelTypeMap()

getOutputModels

public java.util.Collection<org.eclipse.emf.ecore.EObject> getOutputModels()
Returns:
The models produced by the latest transformation