[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.amw] Re: Refactoring deprecated AM3 branch and AMW model handler to use ATL 3.0 API

Hi Juan Pedro,

Juan Pedro Silva a écrit :
Thank you very much, Hugo.
I ended up with this piece of code (let me know if you consider it appropriated):


try
{
//AtlVM.getVM(vm).launch(asmUrl, libs, models, params, superimps, options);
//AtlLauncher.getDefault().launch(asmUrl, libs, models, params, superimps, options);
ASM asm = new ASMXMLReader().read(new BufferedInputStream(asmUrl.openStream())); superimps.add(0, asm); //New ILauncher.launch(..) method takes a list of modules where the first module of the set is overriden by the next ones
ILauncher atlL = CoreService.getLauncher(ATLLaunchConstants.REGULAR_VM_NAME); atlL.launch(ILauncher.RUN_MODE, new NullProgressMonitor(), options, superimps);
} catch (IOException e)
{
ATLLogger.log(Level.SEVERE, e.getLocalizedMessage(), e);
} catch (ATLCoreException e) {
ATLLogger.log(Level.SEVERE, e.getLocalizedMessage(), e);
e.printStackTrace();
}


I will do a partial test of my refactorization with an AMW refactorization I'm also performing (it may take a while, though, as I have other thing in hand).
Perhaps (if you already have test suites for AM3) you may like me to send it to you so you could start testing it already?. Just let me know.

Unfortunately, as we are not continuing the development of these plug-ins anymore, we don't have such a test suite. However, one simple way of validating your new implementation is to manually test each of the injectors, extractors, and other converters (concerning KM3, ATL, XML, etc) on a given set of files/models/metamodels. Thus, you will be able to ensure that the general behavior of these plug-ins has not been altered.


Similarly, for AMW, you can try to run some of the use cases available from the AMW website using both ATL 3.0 and your new implementation of the AMW model handler.


How is everyone in EDM-Nantes?, send my regards. Merçi ;-),

Everything goes well at EMN. Thanks!

Cheers,

Hugo

              Juan Pedro


Hugo Bruneliere escribió:
Hi Juan,

Juan Pedro Silva a écrit :
Hi Hugo, thank you for your support.
If I take the mentioned approach, the following instruction:

AtlVM.getVM(vm).launch(asmUrl, libs, models, params, superimps, options);

Is no longer supported (AtlVM is no longer there in ATL 3.0), so I need a suggestion in how to rewrite that instruction.
These alternatives might work, but not sure which is best:


RegularVMLauncher.launch(java.lang.String mode,
org.eclipse.core.runtime.IProgressMonitor monitor,
java.util.Map<java.lang.String,java.lang.Object> options,
java.lang.Object... modules);


or

AtlLauncher.getDefault().launch(java.net.URL asmurl, java.util.Map libraries, java.util.Map models, java.util.Map asmParams, java.util.List superimpose, java.util.Map options)

The first alternative is using the regular VM, but parameters are not the same, and as documentation is scarce, I don't know how to convert them.
On the other side, the second alternative takes the same parameters, but my feeling is that it will use the new VM (as it is the default one), and not regular VM.
There may be other (more correct) alternatives, but I'm not acquainted with the new API, and those are the ones I found so far.
Do you have any suggestions for this instruction?.

In order to get the launcher of the Regular VM (but which conforms to the new ILauncher interface), you can use the "getLauncher()" method of the org.eclipse.m2m.atl.core.service.CoreService class:


ILauncher atlLauncher = CoreService.getLauncher(ATLLaunchConstants.REGULAR_VM_NAME);
//of course, ATLLaunchConstants.EMF_VM_NAME also exists
atlLauncher.launch(...);
Cheers,


Hugo


I'll love to contribute once I finish refactoring. Thanks for your help. Regards, Juan Pedro

Hugo Bruneliere escribió:
Hi Juan,

First, thank you very much for your contribution. I'm sure it will be used by many AM3 & ATL developers :-)

Juan Pedro Silva a écrit :
Hi everybody, I'm trying to rewrite some parts of AM3's deprecated packages branch to use ATL 3.0.
I have managed to modify most parts to use the new API, but I have doubts on a particular piece of code.
The code in hands is in class org.eclipse.gmt.am3.tools.ant.ATLModelTransformationTask, and is this one:


...
if(vm == null)
vm = AtlVM.ATLVM_REGULAR; ...
if (!debug.booleanValue())
AtlVM.getVM(vm).launch(asmUrl, libs, models, params, superimps, options);
...


I guess I can rewrite the first red line as
           vm = ATLLaunchConstants.REGULAR_VM_NAME;

but I don't believe this is the correct way to go, I think I should change the structure somehow.
Can anyone give me a pointer on this?.

From my point of view, what you propose is good because it keeps exactly the same behavior as the previous version. I don't think it is necessary to modify the current structure of the plugin, at least in a first time.


Of course, it would be great if you could contribute your upgrades by submitting a patch via Bugzilla!

Cheers,

Hugo

Thanks,
            Juan Pedro






--
-------------------------------------------------
Hugo Bruneliere - R&D Engineer
AtlanMod research team (INRIA & EMN) - Room B206
École des Mines de Nantes
4, rue Alfred Kastler
44307 Nantes Cedex 3 - France
Office: +33 (0)2 51 85 82 21
EMail: hugo.bruneliere@xxxxxxxx
-------------------------------------------------