Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » Re:[ATL]Launching ATL programmatically
Re:[ATL]Launching ATL programmatically [message #1621] Tue, 19 December 2006 08:12 Go to next message
Eclipse UserFriend
Originally posted by: dorazio.nicola.yahoo.it

Hi Freddy,
I look your example, but I don't know why my error came from.

Why java cannot resolve path if I see by debug that the value of
function input = amh.loadModel("IN", emfmm1, inputm_url.openStream());
are all ok? Why when the program goes into this function when it call
the class URI.class return a null value?

This is my console output
java.lang.NullPointerException
at
org.eclipse.emf.ecore.plugin.EcorePlugin.resolvePlatformReso urcePath(EcorePlugin.java:132)
at
org.eclipse.emf.ecore.resource.impl.URIConverterImpl.createP latformResourceInputStream(URIConverterImpl.java:538)
at
org.eclipse.emf.ecore.resource.impl.URIConverterImpl.createI nputStream(URIConverterImpl.java:442)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.getPackageForURI(X MLHandler.java:1674)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.getFactoryForPrefi x(XMLHandler.java:1568)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObjectByType (XMLHandler.java:717)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.createTopObject(XM LHandler.java:779)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XML Handler.java:462)
at
org.eclipse.emf.ecore.xmi.impl.XMIHandler.processElement(XMI Handler.java:65)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHa ndler.java:449)
at
org.eclipse.emf.ecore.xmi.impl.SAXWrapper.startElement(SAXWr apper.java:73)
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser .startElement(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator. startElement(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS cannerImpl.scanStartElement(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerIm pl$ContentDispatcher.scanRootElementHook(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS cannerImpl$FragmentContentDispatcher.dispatch(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS cannerImpl.scanDocument(Unknown
Source)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuratio n.parse(Unknown
Source)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuratio n.parse(Unknown
Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(U nknown
Source)
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser .parse(Unknown
Source)
at javax.xml.parsers.SAXParser.parse(Unknown Source)
at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl. java:140)
at
org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLRes ourceImpl.java:169)
at
org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(Resour ceImpl.java:977)
at
org.atl.engine.repositories.emf4atl.ASMEMFModel.loadASMEMFMo del(ASMEMFModel.java:167)
at
org.atl.eclipse.engine.AtlEMFModelHandler.loadModel(AtlEMFMo delHandler.java:77)
at ATLExample.launchTransformation(ATLExample.java:64)
at ATLExample.run(ATLExample.java:97)
at Main.main(Main.java:21)

My transformation runs great by graphic interface... I don't know why
there is so much problem from java.

please help me..

Best regard

Nicola D'Orazio
Re: [ATL]Launching ATL programmatically [message #1635 is a reply to message #1621] Tue, 19 December 2006 10:34 Go to previous messageGo to next message
Frédéric Jouault is currently offline Frédéric JouaultFriend
Messages: 572
Registered: July 2009
Senior Member
Hello,

Your problem seems to be that you run EMF outside of Eclipse but try to
have it resolve an Eclipse platform path nonetheless.
What is the path of the model you are trying to open?

Another solution would be to try one of the other
AtlEMFModelHandler.loadModel methods.
For instance, using an InputStream:
loadModel(name, metamodel, new FileInputStream("<file path>"))

Note that you may still want to use an EMF URI so that inter-model
references (e.g., for UML models using UML profiles) are resolved
correctly. However, you have to make sure not to use an Eclipse platform
path.


Frédéric Jouault


Nicola D'Orazio wrote:
> Hi Freddy,
> I look your example, but I don't know why my error came from.
>
> Why java cannot resolve path if I see by debug that the value of
> function input = amh.loadModel("IN", emfmm1, inputm_url.openStream());
> are all ok? Why when the program goes into this function when it call
> the class URI.class return a null value?
>
> This is my console output
> java.lang.NullPointerException
> at
> org.eclipse.emf.ecore.plugin.EcorePlugin.resolvePlatformReso urcePath(EcorePlugin.java:132)
>
> at
> org.eclipse.emf.ecore.resource.impl.URIConverterImpl.createP latformResourceInputStream(URIConverterImpl.java:538)
>
> at
> org.eclipse.emf.ecore.resource.impl.URIConverterImpl.createI nputStream(URIConverterImpl.java:442)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.getPackageForURI(X MLHandler.java:1674)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.getFactoryForPrefi x(XMLHandler.java:1568)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObjectByType (XMLHandler.java:717)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.createTopObject(XM LHandler.java:779)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XML Handler.java:462)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMIHandler.processElement(XMI Handler.java:65)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHa ndler.java:449)
> at
> org.eclipse.emf.ecore.xmi.impl.SAXWrapper.startElement(SAXWr apper.java:73)
> at
> com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser .startElement(Unknown
> Source)
> at
> com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator. startElement(Unknown
> Source)
> at
> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS cannerImpl.scanStartElement(Unknown
> Source)
> at
> com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerIm pl$ContentDispatcher.scanRootElementHook(Unknown
> Source)
> at
> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS cannerImpl$FragmentContentDispatcher.dispatch(Unknown
> Source)
> at
> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS cannerImpl.scanDocument(Unknown
> Source)
> at
> com.sun.org.apache.xerces.internal.parsers.XML11Configuratio n.parse(Unknown
> Source)
> at
> com.sun.org.apache.xerces.internal.parsers.XML11Configuratio n.parse(Unknown
> Source)
> at
> com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(U nknown Source)
> at
> com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser .parse(Unknown
> Source)
> at javax.xml.parsers.SAXParser.parse(Unknown Source)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl. java:140)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLRes ourceImpl.java:169)
>
> at
> org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(Resour ceImpl.java:977)
>
> at
> org.atl.engine.repositories.emf4atl.ASMEMFModel.loadASMEMFMo del(ASMEMFModel.java:167)
>
> at
> org.atl.eclipse.engine.AtlEMFModelHandler.loadModel(AtlEMFMo delHandler.java:77)
>
> at ATLExample.launchTransformation(ATLExample.java:64)
> at ATLExample.run(ATLExample.java:97)
> at Main.main(Main.java:21)
>
> My transformation runs great by graphic interface... I don't know why
> there is so much problem from java.
>
> please help me..
>
> Best regard
>
> Nicola D'Orazio
Re: [ATL]Launching ATL programmatically [message #1648 is a reply to message #1635] Tue, 19 December 2006 11:47 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dorazio.nicola.yahoo.it

Frédéric Jouault wrote:
> Hello,
>
> Your problem seems to be that you run EMF outside of Eclipse but try to
> have it resolve an Eclipse platform path nonetheless.
> What is the path of the model you are trying to open?

is a path located under the eclipse workspace

>
> Another solution would be to try one of the other
> AtlEMFModelHandler.loadModel methods.
> For instance, using an InputStream:
> loadModel(name, metamodel, new FileInputStream("<file path>"))

I try it but the error is the same...

>
> Note that you may still want to use an EMF URI so that inter-model
> references (e.g., for UML models using UML profiles) are resolved
> correctly. However, you have to make sure not to use an Eclipse platform
> path.
>

Sorry but I don't understand this part of the message

>
> Frédéric Jouault

Thank you for your reply

Best regard
Nicola D'Orazio
Re: [ATL]Launching ATL programmatically [message #2764 is a reply to message #1635] Mon, 25 December 2006 02:48 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cb.infocity.de

Hello,

i also would like to run my atl transformations from java.
I got two of them i need to run.:-))

OK first i would like to show you the use-case.

1. The user draw some activity-diagram with MagicDraw and use MD export UML2
XMI EMF function.
2. User now has 3 .uml2 files wich are UML2.1.0.0 based. The first uml2-file
is the model which was exported. the other were metamodels in uml2 format we
do not care about them
Only the first file is importend for user and us.
3. After the user has exported the files it start my java application. for
example : camil.java
4. Now some GUI-Programm appear. Here the user first choose the UML Model
using filechooser.
This needs to be our IN model. The metamodel will be set automatic. I
want to set it by URI from UML2.1.0.0 plugin.
5. Now the user choose again some value let's say "Value 1" or "Value2" from
dropdown menue. This value is our .atl file which need to be run.
Well if user choose value1 then test.atl will be set to run. If value2
then anothertest.atl will be set to run.
6. The OUT model the user MUST NOT CHOOSE.!!!! I want set it inside the
code. Which means that the metamodels for OUT will also be set automatic
inside code.
7. The user press some "Start" button.
8. Some Box like "Transformation successful" appears. Or Error during
transformation.


OK it's something like that :-)) Well the problem is that i got two
transforamtions.
1. IN : UML2 and OUT : selection
2. IN : selection , UML2 and OUT : UML2


So yes the OUT of the first transformation is IN in the second one.:-)
But the user should ONLY do the steps as showed above.:-))
So he's not choosing the IN models after the first transformation again :-)

Well making the gui-stuff is not the big problem. But i need some hints how
to start. What do i need? what do i set.?
I mean about the uml2.1.0.0 plugin. well it's installed in /eclipse/plugins
So do the user also need to install it there?. Nope i know he doesn't :-))
but i need to use the uml2.1.0.0.jar right.??

Well i also thought about that way.
First the user set the settings inside the GUI.
Then if the user press "Start" i export the settings to some .XML file and
then i use this xml-file for parameters for ant-script.
But would this be a good way??

frederic i read and found this:
You can find some details here:
http://wiki.eclipse.org/index.php/ATL_Howtos#How_do_I_launch _transformations_programmatically.3F

The source code of the ATL ant task could be an interesting example for
you of how to launch an ATL transformation programmatically
( http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.gmt/AM3 /org.eclipse.gmt.am3.tools.ant/src_ant/?root=Technology_Proj ect).


Well i guess that ATL ant task is that right i need or.??:-))
Well what i like on open-source is that it's open. but what i don't like is
"no-comments" inside the code.
As i took a look inside the code i do not understand it. I mean i can't find
the "places" i need.
I'm sure that "somewhere" there are places i need to fill-in what my user
choose from dropdown.
So i think "in general" my problem is allready solved.
I simply need to know how to use the code. right.?:-))

Regards
Camil


"Fr
Re: [ATL]Launching ATL programmatically [message #2782 is a reply to message #1648] Tue, 26 December 2006 12:11 Go to previous message
Frédéric Jouault is currently offline Frédéric JouaultFriend
Messages: 572
Registered: July 2009
Senior Member
Hello,

I extended the related Howto with links to discussions threads related
to this issue:
http://wiki.eclipse.org/index.php/ATL_Howtos#How_do_I_launch _transformations_programmatically.3F

You may want to compare your approach to those discussed in these threads.

Additionally, there is now a link to Dennis'ATL command line tools,
which may better illustrate the situation than KM3Projector, which
actually runs in Eclipse.


Regards,

Frédéric Jouault


Nicola D'Orazio wrote:
> Frédéric Jouault wrote:
>> Hello,
>>
>> Your problem seems to be that you run EMF outside of Eclipse but try
>> to have it resolve an Eclipse platform path nonetheless.
>> What is the path of the model you are trying to open?
>
> is a path located under the eclipse workspace
>
>>
>> Another solution would be to try one of the other
>> AtlEMFModelHandler.loadModel methods.
>> For instance, using an InputStream:
>> loadModel(name, metamodel, new FileInputStream("<file path>"))
>
> I try it but the error is the same...
>
>>
>> Note that you may still want to use an EMF URI so that inter-model
>> references (e.g., for UML models using UML profiles) are resolved
>> correctly. However, you have to make sure not to use an Eclipse
>> platform path.
>>
>
> Sorry but I don't understand this part of the message
>
>>
>> Frédéric Jouault
>
> Thank you for your reply
>
> Best regard
> Nicola D'Orazio
Previous Topic:[ATL] accessing sub-package elements in metamodels
Next Topic:problem at lanunching ATL
Goto Forum:
  


Current Time: Fri Apr 26 03:06:11 GMT 2024

Powered by FUDForum. Page generated in 0.03453 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top