[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [m2m-atl-dev] [ATL] org.eclipse.m2m.atl.engine.emfvm.libextension extension point
|
Thanks a lot for this complete answer.
2009/5/14 William Piers
<william.piers@xxxxxxx>
This extension point allow to modify the emfvm execution environment. Modifications are applied before the transformation launch. To register an operation, you must first create it (you can find examples in org.eclipse.m2m.atl.engine.emfvm.lib.ExecEnv), then use the ExecEnv#registerOperation(Object type, Operation oper, String name), where name is the operation name and type the context type of the operation.
The type defines on which elements the operation will be available. So to add an operation to an existing ATL type you have to refer to the java type the ATL type refers to. The mapping between java and atl types is defined into the org.eclipse.m2m.atl.engine.emfvm.lib.OclType class.
For instance, to add the operation myOp to the ATL "Sequence", you have to do:
Operation myOp = new Operation(<N: number of parameters, including self){
public Object exec(AbstractStackFrame frame) {
Object[] localVars = frame.getLocalVars();
String self = (String)localVars[0];
Object arg1 = localVars[1];
...
Object argN = localVars[N];
Object ret = null;
... <operation code here>
return ret;
}
}
execEnv.registerOperation(ArrayList.class, myOp, "myOp"); // ArrayList is mapped with the "Sequence" type in the emfvm
Best regards,
William
Pierre Kubryk a écrit :
Thanks for the response.
Is this the good way to solve my problem or am i obliged to use code like
((Map)ASMOclType.getVMOperations().get(context)).put(myOp.getName(), myOp);
?
2009/5/14 William Piers <william.piers@xxxxxxx <mailto:william.piers@xxxxxxx>>
Hello,
The .exsd files were not exported by the build... it has been
corrected on CVS and will be effective on the next ATL build.
Thanks for reporting it !
William
Pierre Kubryk a écrit :
Hi !
I am currently trying to extend the operations supported for a
given ATL type and i am searching for a clean way to do it.
I have found the org.eclipse.m2m.atl.engine.emfvm.libextension
extension point from the org.eclipse.m2m.atl.engine.emfvm
plug-in in version 3.0.0.v200905050615 when importing as
source code the atl plug-ins, but this extension doesn't seems
to have the related extension point schema (besides, there is
no schema folder in this plug-in and no .exsd).
Therefore i don't know if this extension point fit my problem
and i haven't found any documentation about this.
I tried to use the same extension point syntax than used in
org.eclipse.m2m.atl.engine :
<extension
point="org.eclipse.m2m.atl.engine.emfvm.libextension">
<libextension
class="some class implementing
org.eclipse.m2m.atl.engine.emfvm.lib.LibExtension"
name="xxx">
</libextension>
</extension>
but it doesn't work since the extension point is not detected
by eclipse when using the packaged plug-ins ( is supposed that
.exsd absence explain this issue).
If it is the good way to solve my problem, is there any solution ?
Best regards,
-- Pierre Kubryk
------------------------------------------------------------------------
_______________________________________________
m2m-atl-dev mailing list
m2m-atl-dev@xxxxxxxxxxx <mailto:m2m-atl-dev@xxxxxxxxxxx>
m2m-atl-dev@xxxxxxxxxxx <mailto:m2m-atl-dev@xxxxxxxxxxx>
_______________________________________________
m2m-atl-dev mailing list
m2m-atl-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/m2m-atl-dev
--
Pierre Kubryk