Home » Archived » M2M (model-to-model transformation) » [ATL] (3.0) New JAVA ATL3.0 launch procedure?!
| | | |
Re: [ATL] (3.0) New JAVA ATL3.0 launch procedure?! [message #99112 is a reply to message #99098] |
Fri, 06 February 2009 15:09 |
William Piers Messages: 301 Registered: July 2009 |
Senior Member |
|
|
Hello,
Answers below:
Tristan FAURE a écrit :
> oops sorry it seems it exists is this extension :
> org.eclipse.m2m.atl.service.core.transformation is able to do what i
> meant ?
>
No, this plugin is an old one, it is no more maintained.
> Tristan FAURE a écrit :
>> Hi !
>>
>> I've downloaded with CVS last source of ATL and it's very good to
>> provide example for code transformation
>>
Note that to ensure that you use the good plugins you can use the psf
files to download plugins.
http://wiki.eclipse.org/ATL/User_Guide#Install_ATL_from_CVS
The ATL3.0 builds also contains the examples, directly deployable using
the example wizard.
ATL 3.0.0M5 has been uploaded today, so feel free to test it!
http://www.eclipse.org/modeling/download.php?file=/modeling/ m2m/atl/downloads/drops/3.0.0/S200902051237/m2m-atl-SDK-3.0. 0M5.zip
>> but is it planned to provide a service for creating an equivalent of
>> org.eclipse.m2m.atl.examples.public2private.ui plugin depending of
>> user ATL file ?
>>
The first intent of the public2private example was to provide a concrete
and working example of a programmatical use of ATL.
Now, it's clear that this kind of example (not only refactoring) is a
common case for many users, so we certainly will have to provide this
extension.
But I can't say exactly when for the moment :-)
Best regards,
William
>> or creating extension point referencing asm file and file extension
>> able to launch atl transformations ?
>>
>> William Piers a écrit :
>>> Hello,
>>>
>>> Answers below:
>>>
>>> Skander a écrit :
>>>> Hi, Does anybody know how to launch an ATL transformation with the
>>>> new ATL3.0 libraries. I had a JAVA code that worked well, and i want
>>>> to update it to this new ATL3.0 version.
>>>> What seems not to work anymore is all the ATLEMFModelHandler
>>>> operations (save, load, getMof..).
>>>
>>> In the RegularVM (old virtual machine) context, those operations are
>>> now located in the ASMModelLoader class (and subclasses).
>>>
>>>> Anybody knows about these modifications?!
>>>>
>>>
>>> There is now an example of java launching that you can directly
>>> install using the wizard:
>>> new->example->atl->public2private
>>>
>>> This example adds a popup when right-clicking on UML2 models and
>>> launches the refining public2private transformation (privatize public
>>> fields and generate getters/setters).
>>>
>>> Note that the new launching interface allow to launch both EMFVM and
>>> RegularVM, using same code. But you still can directly use the
>>> RegularVM api if you simply want to update your java code.
>>>
>>> Do not hesitate to ask if you encounter problems !
>>>
>>> Best regards,
>>>
>>> William
|
|
| |
Re: [ATL] (3.0) New JAVA ATL3.0 launch procedure?! [message #99359 is a reply to message #99274] |
Wed, 11 February 2009 08:51 |
William Piers Messages: 301 Registered: July 2009 |
Senior Member |
|
|
Hello,
Skander a écrit :
> hi, do you have an example where you launch a transformation with an
> output model that has its own metamodel and with external helper libraries.
Sorry, not for the moment.
> I tried to adapt the public2private but i still have some problems,
> especially with the last parameter of the launch method:
>
> launcher.launch(ILauncher.RUN_MODE, new NullProgressMonitor() , options,
> new Object[] {asmURL.openStream()});
>
> I do not use the same initilization as the example publi2private :
>
> static {
> // ATL public2private transformation
> Bundle bundle =
> Platform.getBundle("org.eclipse.m2m.atl.examples.public2private ");
> asmURL = bundle.getEntry("transformation/Public2Private.asm"); ..
> }
>
> because my transformation file (.asm) is described by (c:/..../trans.asm)
>
>
>
The first parameter is an InputStream, so you can try this way:
InputStream is = new FileInputStream(new File(c:/..../trans.asm));
//using java 1.4
launcher.launch(ILauncher.RUN_MODE, new NullProgressMonitor() ,
options, new Object[]{is};
//using java 1.5
launcher.launch(ILauncher.RUN_MODE, new NullProgressMonitor() ,
options, is);
And to include libraries:
launcher.addLibraries("LibraryName", libraryInputStream);
Best regards,
William
|
|
|
Re: [ATL] (3.0) New JAVA ATL3.0 launch procedure?! [message #99389 is a reply to message #99359] |
Wed, 11 February 2009 11:03 |
Skander TURKI Messages: 130 Registered: July 2009 |
Senior Member |
|
|
hello,
my question in this post is : "do i have to write the input file path in a
special way?"
i have tried this code:
try
{
ILauncher launcher = null;
launcher = CoreService.getLauncher("EMF-specific VM"); //$NON-NLS-1$
launcher.initialize(Collections.<String, Object> emptyMap());
inMetamodel = factory.newReferenceModel();
injector.inject(inMetamodel, "http://www.eclipse.org/uml2/2.1.0/UML");
IModel inModel = factory.newModel(inMetamodel);
File file = new File ("D:\\A....\\MARTE_XUPV2P.uml");
injector.inject(inModel, file.getPath());
launcher.addInOutModel(inModel, "IN", "UML2");
outputMetamodel = factory.newReferenceModel();
injector.inject(outputMetamodel, "http:///AADL/core");
IModel outModel = factory.newModel(outputMetamodel);
launcher.addOutModel(outModel, "OUT" , "AAXL");
InputStream is = new FileInputStream(new File("/Trans.asm"));
launcher.launch(ILauncher.RUN_MODE, new NullProgressMonitor() , options,
is);
extractor.extract(outModel, "/res/result.aaxl");
}
catch (Exception e)
{
e.printStackTrace();
}
///// But the injector.inject returns a file not found exception when i
give a relatif input file name, and returns a unknown protocol exception
when i give the absolute path of the file. do i have to write the file
path in a special way?
Thanks
|
|
|
Re: [ATL] (3.0) New JAVA ATL3.0 launch procedure?! [message #99433 is a reply to message #99389] |
Wed, 11 February 2009 14:21 |
Skander TURKI Messages: 130 Registered: July 2009 |
Senior Member |
|
|
I finally could launch a simple transformation without libraries with this
code:
try
{
ILauncher launcher = null;
launcher = CoreService.getLauncher("EMF-specific VM"); //$NON-NLS-1$
launcher.initialize(Collections.<String, Object> emptyMap());
inMetamodel = factory.newReferenceModel();
injector.inject(inMetamodel, "http://www.eclipse.org/uml2/2.1.0/UML");
IModel inModel = factory.newModel(inMetamodel);
URL url = new URL("file://d:\\AA......ple\\MARTE_XUPV2P.uml");
injector.inject(inModel, url);
launcher.addInOutModel(inModel, "IN", "UML2");
outputMetamodel = factory.newReferenceModel();
injector.inject(outputMetamodel, "http:///AADL/core");
IModel outModel = factory.newModel(outputMetamodel);
launcher.addOutModel(outModel, "OUT" , "AAXL");
InputStream is = new
FileInputStream("d:\\AA...\\OneLevelMarteToAAXL_V2.asm");
launcher.launch(ILauncher.RUN_MODE, new NullProgressMonitor() , options,
is);
//
// Saving model
URL outUrl=new URL("file://d:\\AAD....le\\result.aaxl");
extractor.extract(outModel, outUrl);
}
catch (Exception e)
{
e.printStackTrace(); }
I'll try the one with the libraries now...
|
|
|
Re: [ATL] (3.0) New JAVA ATL3.0 launch procedure?! [message #99447 is a reply to message #99389] |
Wed, 11 February 2009 14:38 |
William Piers Messages: 301 Registered: July 2009 |
Senior Member |
|
|
Hello,
To clarify the various paths notation, I wrote a small wiki section
here:
http://wiki.eclipse.org/ATL/Developer_Guide#EMFInjector_.2F_ EMFExtractor_usage
Best regards,
William
Skander a écrit :
> hello,
> my question in this post is : "do i have to write the input file path in
> a special way?"
> i have tried this code:
>
> try
> {
> ILauncher launcher = null;
> launcher = CoreService.getLauncher("EMF-specific VM"); //$NON-NLS-1$
> launcher.initialize(Collections.<String, Object> emptyMap());
>
> inMetamodel = factory.newReferenceModel();
> injector.inject(inMetamodel, "http://www.eclipse.org/uml2/2.1.0/UML");
> IModel inModel = factory.newModel(inMetamodel);
> File file = new File ("D:\\A....\\MARTE_XUPV2P.uml");
> injector.inject(inModel, file.getPath());
> launcher.addInOutModel(inModel, "IN", "UML2");
>
> outputMetamodel = factory.newReferenceModel();
> injector.inject(outputMetamodel, "http:///AADL/core");
> IModel outModel = factory.newModel(outputMetamodel);
> launcher.addOutModel(outModel, "OUT" , "AAXL");
>
> InputStream is = new FileInputStream(new File("/Trans.asm"));
> launcher.launch(ILauncher.RUN_MODE, new NullProgressMonitor() ,
> options, is);
>
> extractor.extract(outModel, "/res/result.aaxl");
> }
> catch (Exception e)
> {
> e.printStackTrace(); }
>
>
> ///// But the injector.inject returns a file not found exception when i
> give a relatif input file name, and returns a unknown protocol exception
> when i give the absolute path of the file. do i have to write the file
> path in a special way?
> Thanks
>
|
|
| | | | | |
EMF-specific VM for ATL 2.02 ? [message #99832 is a reply to message #99433] |
Thu, 12 February 2009 23:56 |
Eclipse User |
|
|
|
Originally posted by: svent..gmail.com
Skander wrote:
> I finally could launch a simple transformation without libraries with this
> code:
> try
> {
> ILauncher launcher = null;
> launcher = CoreService.getLauncher("EMF-specific VM"); //$NON-NLS-1$
Sorry for being offtopic.
I am new to ATL and I am still using ATL 2.02. My question is whether I
can programmatically use "EMF-specific VM" instead of the Regular VM with
ATL 2.02, too ?
I am using the "ATLLauncher" Class for starting my ATL transformation
programmatically.
Regards,
Sven
|
|
| |
Re: [ATL] (3.0) New JAVA ATL3.0 launch procedure?! [message #99941 is a reply to message #99622] |
Fri, 13 February 2009 15:03 |
Skander TURKI Messages: 130 Registered: July 2009 |
Senior Member |
|
|
hi,
i try to add an outPut model with this method:
private void addOutputModel(ILauncher launcher, String metaModelURI,
String metaModelName, String outputPath, String
modelName)
throws Exception
{
IReferenceModel outputMetamodel;
Map <String,Object> factoryOptions = new HashMap<String, Object>();
factoryOptions.put("modelHandlerName", "EMF");
factoryOptions.put("modelName", metaModelName);
factoryOptions.put("path", metaModelURI);
outputMetamodel = factory.newReferenceModel(factoryOptions);
injector.inject(outputMetamodel, metaModelURI);
factoryOptions = new HashMap<String, Object>();
factoryOptions.put("newModel", "true");
factoryOptions.put("modelName", modelName);
factoryOptions.put("path", outputPath);
outModel = factory.newModel(outputMetamodel, factoryOptions);
((RegularVMLauncher)launcher).addOutModel(outModel, modelName,
metaModelName);
}
I could add the model without any problems but i get this error message :
No type named 'AadlSpec' in metamodel '<unnamed>'
Like if the metamodel name was not correctly loaded (AADL in this case).
I have almost the same method (addInputModel) for input models but
everything works well for those.
Do you have any idea?
|
|
|
Re: [ATL] (3.0) New JAVA ATL3.0 launch procedure?! [message #99956 is a reply to message #99941] |
Fri, 13 February 2009 16:22 |
William Piers Messages: 301 Registered: July 2009 |
Senior Member |
|
|
The LauncherService class defines utilities method to launch a
transformation with "classic" parameters (model names, model paths, etc.).
Note that if you are working with the CVS HEAD version
(http://wiki.eclipse.org/ATL/User_Guide#Install_ATL_from_CVS), there is
a simplified launch method which directly takes the defaults factories
and injectors. This was not available in 3.0M5 build but I think it
could be useful in your case.
You can see the AtlLaunchConfigurationDelegate, or ATLNonRegression
tests to see how it works.
Best regards,
William
Skander a écrit :
> hi,
> i try to add an outPut model with this method:
> private void addOutputModel(ILauncher launcher, String metaModelURI,
> String metaModelName, String outputPath, String
> modelName)
> throws Exception {
> IReferenceModel outputMetamodel;
> Map <String,Object> factoryOptions = new HashMap<String, Object>();
> factoryOptions.put("modelHandlerName", "EMF");
> factoryOptions.put("modelName", metaModelName);
> factoryOptions.put("path", metaModelURI);
> outputMetamodel = factory.newReferenceModel(factoryOptions);
> injector.inject(outputMetamodel, metaModelURI);
>
> factoryOptions = new HashMap<String, Object>();
> factoryOptions.put("newModel", "true");
> factoryOptions.put("modelName", modelName);
> factoryOptions.put("path", outputPath);
> outModel = factory.newModel(outputMetamodel, factoryOptions);
> ((RegularVMLauncher)launcher).addOutModel(outModel, modelName,
> metaModelName);
> }
>
> I could add the model without any problems but i get this error message :
> No type named 'AadlSpec' in metamodel '<unnamed>'
>
> Like if the metamodel name was not correctly loaded (AADL in this case).
> I have almost the same method (addInputModel) for input models but
> everything works well for those.
> Do you have any idea?
>
|
|
|
Re: [ATL] (3.0) New JAVA ATL3.0 launch procedure?! [message #100060 is a reply to message #99956] |
Mon, 16 February 2009 14:52 |
William Piers Messages: 301 Registered: July 2009 |
Senior Member |
|
|
The latest build integrates the new launch method:
http://www.eclipse.org/modeling/download.php?file=/modeling/ m2m/atl/downloads/drops/3.0.0/I200902160913/m2m-atl-SDK-I200 902160913.zip
Best regards,
William
William Piers a écrit :
> The LauncherService class defines utilities method to launch a
> transformation with "classic" parameters (model names, model paths, etc.).
>
> Note that if you are working with the CVS HEAD version
> (http://wiki.eclipse.org/ATL/User_Guide#Install_ATL_from_CVS), there is
> a simplified launch method which directly takes the defaults factories
> and injectors. This was not available in 3.0M5 build but I think it
> could be useful in your case.
>
> You can see the AtlLaunchConfigurationDelegate, or ATLNonRegression
> tests to see how it works.
>
> Best regards,
>
> William
>
> Skander a écrit :
>> hi,
>> i try to add an outPut model with this method:
>> private void addOutputModel(ILauncher launcher, String metaModelURI,
>> String metaModelName, String outputPath, String
>> modelName)
>> throws Exception {
>> IReferenceModel outputMetamodel;
>> Map <String,Object> factoryOptions = new HashMap<String, Object>();
>> factoryOptions.put("modelHandlerName", "EMF");
>> factoryOptions.put("modelName", metaModelName);
>> factoryOptions.put("path", metaModelURI);
>> outputMetamodel = factory.newReferenceModel(factoryOptions);
>> injector.inject(outputMetamodel, metaModelURI);
>> factoryOptions = new HashMap<String, Object>();
>> factoryOptions.put("newModel", "true");
>> factoryOptions.put("modelName", modelName);
>> factoryOptions.put("path", outputPath);
>> outModel = factory.newModel(outputMetamodel, factoryOptions);
>> ((RegularVMLauncher)launcher).addOutModel(outModel, modelName,
>> metaModelName);
>> }
>>
>> I could add the model without any problems but i get this error message :
>> No type named 'AadlSpec' in metamodel '<unnamed>'
>>
>> Like if the metamodel name was not correctly loaded (AADL in this case).
>> I have almost the same method (addInputModel) for input models but
>> everything works well for those.
>> Do you have any idea?
>>
>
|
|
| |
Goto Forum:
Current Time: Thu Apr 25 02:12:49 GMT 2024
Powered by FUDForum. Page generated in 0.04252 seconds
|