The AMW Model Handler enables a better integration of ATL transformations and weaving models. It provides a set of primitives constantly needed when developing transformations that have weaving models as input or output.

+

The [[AMW]] Model Handler enables a better integration of [[ATL]] transformations and weaving models. It provides a set of primitives constantly needed when developing transformations that have weaving models as input or output.

−

In the [[ATL]] terminology, a model handler is a library providing primitives for handling models, such creating new models, or adding and deleting elements. See the [[ATL Model Handlers]] page to know the base model handlers provided by the ATL plug-ins.

+

In the [[ATL]] terminology, a model handler is a library providing primitives for handling models, such creating new models, or adding and deleting elements.

−

This model handler inherits from the ATL EMF ModelHandler, thus it supports all the base EMF primitives. It can be used for weaving models and for woven models as well. The model handler is being improved with new primitives, according to new user requirements. It will be separated in two different model handlers (one for the woven and one for the weaving models) in future versions.

+

This model handler is an extension to the ATL library of operations. It contributes to the extension point ''org.eclipse.m2m.atl.engine.emfvm.libextension''.

−

==Model Handler methods==

+

The class ''org.eclipse.gmt.weaver.transformation.operations.UtilOperation'' implements a set of helper methods that can be called when developing ATL transformations that have weaving models as input or as output. The methods can be used for weaving models and for woven models as well. The ''UtilOperation'' class is being improved with new primitives.

−

The AMW model handler provides methods that can be called on elements of a weaving model or on the elements of the woven models. They are explained below.

+

==Helper methods methods==

+

+

The AMW ''UtilOperation'' class provides methods that can be called on elements of a weaving model or on the elements of the woven models. They are explained below.

===Weaving models===

===Weaving models===

Line 51:

Line 53:

====getElementID====

====getElementID====

−

This method returns the identifier (ID) of a woven element. It is necessary to pass as parameter the related weaving model. In that way it is possible to find which ''WElementRef'' is used, and which adapter class is called. The adapter class is the implementation of the identification mechanisms. Ex.: [http://dev.eclipse.org/viewcvs/indextech.cgi/org.eclipse.gmt/AMW/org.eclipse.weaver/src/org/eclipse/weaver/providers/XMIIdentifierAdapter.java?view=markup XMIIdentifierAdapter], [http://dev.eclipse.org/viewcvs/indextech.cgi/org.eclipse.gmt/AMW/org.eclipse.weaver/src/org/eclipse/weaver/providers/GenericIdentifierAdapter.java?revision=1.2&view=markup GenericIdentifierAdapter].

+

This method returns the identifier (ID) of a woven element. It is necessary to pass as parameter the related weaving model. In that way it is possible to find which ''WElementRef'' is used, and which adapter class is called. The adapter class is the implementation of the identification mechanisms. Ex.: the [http://dev.eclipse.org/viewsvn/viewvc.cgi/plugins/trunk/org.eclipse.gmt.weaver/src/org/eclipse/gmt/weaver/providers/?diff_format=s&root=Modeling_AMW&pathrev=4 providers sources] contains implementations of these adapters, such as the ''XMIIdentifierAdapter'' and the ''GenericIdentifierAdapter''].

Example:

Example:

Line 65:

Line 67:

ref <- '''element.getElementID('IN')'''

ref <- '''element.getElementID('IN')'''

)

)

−

}

+

}

====getElementIDbyRefType====

====getElementIDbyRefType====

Line 117:

Line 119:

==Download and install==

==Download and install==

−

The Amw Model Handler plug-in ('''org.eclipse.gmt.weaver.amw4atl''') is available for download in the [http://dev.eclipse.org/viewcvs/indextech.cgi/org.eclipse.gmt/AMW/ AMW CVS], and in the [http://www.eclipse.org/gmt/amw/download/ development build] of AMW (binary version).

+

The UtilOperation class is implemented in the ''org.eclipse.gmt.weaver.transformation'' plug-in. So, this plug-in must be installed. To add user-defined methods, it is necessary to contribute to the ''org.eclipse.m2m.atl.engine.emfvm.libextension'' extension point. Below there is an example of how to declare it.

−

+

−

The plug-in must be checked out in the Eclipse workspace and a new Runtime Workspace must be launched. Then, the model handler is ready to use.

+

−

A binary release will be available in the next complete release of the AMW plug-ins.

[http://dev.eclipse.org/viewsvn/viewvc.cgi/plugins/trunk/org.eclipse.gmt.weaver.transformation/src/org/eclipse/gmt/weaver/transformation/operations/UtilOperation.java?view=markup&revision=22&root=Modeling_AMW&pathrev=22 org.eclipse.gmt.weaver.transformation.operations.UtilOperation] to understand how to create new helper methods.

[[Category:Modeling]]

[[Category:Modeling]]

Line 128:

Line 136:

[[Category:GMT]]

[[Category:GMT]]

[[Category:AMMA]]

[[Category:AMMA]]

+

[[Category:AMW]]

Latest revision as of 11:33, 17 December 2010

The AMW Model Handler enables a better integration of ATL transformations and weaving models. It provides a set of primitives constantly needed when developing transformations that have weaving models as input or output.

In the ATL terminology, a model handler is a library providing primitives for handling models, such creating new models, or adding and deleting elements.

This model handler is an extension to the ATL library of operations. It contributes to the extension point org.eclipse.m2m.atl.engine.emfvm.libextension.

The class org.eclipse.gmt.weaver.transformation.operations.UtilOperation implements a set of helper methods that can be called when developing ATL transformations that have weaving models as input or as output. The methods can be used for weaving models and for woven models as well. The UtilOperation class is being improved with new primitives.

getElementID

This method returns the identifier (ID) of a woven element. It is necessary to pass as parameter the related weaving model. In that way it is possible to find which WElementRef is used, and which adapter class is called. The adapter class is the implementation of the identification mechanisms. Ex.: the providers sources contains implementations of these adapters, such as the XMIIdentifierAdapter and the GenericIdentifierAdapter].

getElementIDbyRefType

This method returns the identifier (ID) of a woven element. In this method it is necessary to pass the type of element ref (that inherits from WElementRef) as parameter. The type of WElementRef specifies which identification mechanism is used. The WElementRefs are associated with adapters of identification mechanisms (see below). For instance, the ElementRefXMI is associated with the XMIIdentifierAdapter class. It returns the XMI ID.

This method is used when the user wants to create a new weaving model and he does not have yet the information concerning its identification mechanism.

setElementIDbyRefType

This method sets up the identifier (ID) of a model element. In this method it is necessary to pass the type of element ref (that inherits from WElementRef) as parameter. The type of WElementRef specifies which identification mechanism is used. The WElementRefs are associated with adapters of identification mechanisms (see below). For instance, the ElementRefXMI is associated with the XMIIdentifierAdapter class. It sets up the XMI ID.

The value of the new ID is passed as second parameter. It must be a string object, because it is the same value that should be saved in the ref attribute of the WElementRefs. If the second parameters is null (OclIsUndefined), the ID will be set up based on the value of the object.

This method is used when the user wants to set up the ID of an element and he does not have yet the information concerning its identification mechanism.

Creating an ATL launch configuration

The screenshot below shows how to set up an ATL launch configuration with the AMW model handler. The AMW handler will be available in the list of model handlers .

First the user sets up the input and output models . Then the user must select the weaving metamodel (e.g., mmw_weaving.core) or the woven metamodels (e.g., MOF), or both as shown below. Then select 'AMW', and click on the Select Model Handler button. AMW is shown in the third column of the Path Editor.

The transformation is ready to run.

Download and install

The UtilOperation class is implemented in the org.eclipse.gmt.weaver.transformation plug-in. So, this plug-in must be installed. To add user-defined methods, it is necessary to contribute to the org.eclipse.m2m.atl.engine.emfvm.libextension extension point. Below there is an example of how to declare it.