Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [ATL] AtlLaunch
[ATL] AtlLaunch [message #74001] Wed, 30 January 2008 18:04 Go to next message
wong is currently offline wongFriend
Messages: 54
Registered: July 2009
Member
Hello,

I downloaded the the Atllaunch example from the
http://wiki.eclipse.org/ATL_Howtos. Then change the parameter to my own
model. But I got a empty outputInstance after the launch the AtlLaunch.
All my models and ams script are tested. And there is no exception come
out on the console window.

My workplace info: Eclipse, Ecore, EMF.

???????

Thank you for any help.

Wong.
Re: [ATL] AtlLaunch [message #74058 is a reply to message #74001] Thu, 31 January 2008 11:28 Go to previous messageGo to next message
wong is currently offline wongFriend
Messages: 54
Registered: July 2009
Member
Hello,

I add the code here. It is a very basic transformation(From inputInstance
>> outputInstance), but I can not get it work. And no exception found Help
please.
I can put on ecore model and atl script well if you need.
------------------------------------------------------------ ---------------

import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.net.URL;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

import org.atl.eclipse.engine.AtlLauncher;
import org.atl.eclipse.engine.AtlModelHandler;
import org.atl.engine.vm.nativelib.ASMModel;

class ATLTransformations {


public static void main(String[] args) {

runATLTransformation();

}

public static void runATLTransformation() {


try {
AtlModelHandler emfamh =
AtlModelHandler.getDefault(AtlModelHandler.AMH_EMF);

URL asmurl = ATLTransformations.class.getResource("../DM2CG.asm");
ASMModel inputMetaModel = emfamh.loadModel("DOMAIN", emfamh.getMof(),
ATLTransformations.class.getResource("../Metamodels/skos2.ecore ").openStream());
ASMModel outputMetaModel = emfamh.loadModel("COURSE", emfamh.getMof(),
ATLTransformations.class.getResource("../Metamodels/Course.ecore ").openStream());
ASMModel inputInstance = emfamh.loadModel("inputInstance",
emfamh.getMof(),
ATLTransformations.class.getResource("../caviar.ecore").openStream());
ASMModel outputInstance;


Map<String, ASMModel> models = new HashMap<String, ASMModel>();

models.put(inputMetaModel.getName(), inputMetaModel);
models.put(outputMetaModel.getName(), outputMetaModel);
System.out.println("Trans MM: "+inputMetaModel.getName()+" >>>
"+outputMetaModel.getName());

models.put("IN", inputInstance); // input model
outputInstance = emfamh.newModel("coursexmi", outputMetaModel); //
output model
models.put("OUT", outputInstance);
System.out.println("Trans Instance: "+inputInstance.getName()+" >>>
"+outputInstance.getName());

Map params = Collections.EMPTY_MAP;
Map libs = Collections.EMPTY_MAP;

System.out.println("ASM: "+asmurl.getPath());

AtlLauncher.getDefault().launch(asmurl, libs, models, params);

OutputStream out = new FileOutputStream(new
File("C:/workspaceEclipse/Antworks/bin/zzzz.xmi"));
AtlModelHandler.getHandler(outputMetaModel).saveModel(output Instance,out);
System.out.println(outputInstance);
out.flush();
out.close();

} catch (Exception e) {
e.printStackTrace();
}

}


}

-----------------------------------------------------------
Thank you for your help.

Wong.
Re: [ATL] AtlLauncher [message #74094 is a reply to message #74058] Thu, 31 January 2008 14:40 Go to previous messageGo to next message
wong is currently offline wongFriend
Messages: 54
Registered: July 2009
Member
Hello,

Following is my ANT script. I just want use the Atllauncher to do the same
thing. But my code no error, no exception, and NO working.

----------------------------------------------
<project name="f1-project" default="dm2cg">

<target name="loadModels">
<!-- Load XML metamodel-->
<am3.loadModel modelHandler="EMF" name="COURSEMETA" metamodel="MOF"
path="Metamodels/Course.ecore"/>
<!--Load CAVIAr Metamodel-->
<am3.loadModel modelHandler="EMF" name="DOMAINMETA" metamodel="MOF"
path="Metamodels/skos2.ecore"/>

<am3.loadModel modelHandler="EMF" name="domainXmi"
metamodel="DOMAINMETA" path="caviar.ecore"/>
</target>


<target name="dm2cg" depends="loadModels">

<am3.atl path="DM2CG.asm">
<inModel name="IN" model="domainXmi"/>
<inModel name="DOMAIN" model="DOMAINMETA"/>
<inModel name="COURSE" model="COURSEMETA"/>

<outModel name="OUT" model="courseXmi" metamodel="COURSEMETA"/>
</am3.atl>

<am3.saveModel model="courseXmi" path="coursexmi.xmi"/>

</target>
</project>

-------------------------------------------------------

Thank you for any help.

Wong.
Re: [ATL] AtlLauncher [message #74203 is a reply to message #74094] Fri, 01 February 2008 13:49 Go to previous messageGo to next message
wong is currently offline wongFriend
Messages: 54
Registered: July 2009
Member
Hello,

I appreciate that if anybody could even paste his working code which do
the samething as mine.

Thank you,
Wong.
Re: [ATL] AtlLauncher [message #74295 is a reply to message #74203] Tue, 05 February 2008 11:32 Go to previous messageGo to next message
William Piers is currently offline William PiersFriend
Messages: 297
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------010605050303010903050800
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 8bit

Hello,

I saw that you were using old atl plugins (org.atl.eclipse...). I invite
you to get the last ATL source code using CVS, in order to avoid some
bugs which have perhaps ever been corrected.
For launching ATL, there are no precise way to do it easily... We are
working on it, for next ATL versions.
At this time, you could take look at the atl test plugin, which launches
ATL programmatically :
http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.m2m/org .eclipse.m2m.atl/tests/org.eclipse.m2m.atl.tests/src/org/ecl ipse/m2m/atl/tests/util/TransfoLauncher.java?root=Modeling_P roject&sortdir=down&view=markup
This code is Eclipse-dependendant only for retrieving file paths.

Best regards,

William
wong a
Re: [ATL] AtlLauncher [message #74330 is a reply to message #74203] Tue, 05 February 2008 13:07 Go to previous messageGo to next message
Dennis Wagelaar is currently offline Dennis WagelaarFriend
Messages: 147
Registered: July 2009
Senior Member
wong wrote:
> Hello,
>
> I appreciate that if anybody could even paste his working code which do
> the samething as mine.
>
> Thank you,
> Wong.
>

I have some code for an Eclipse plugin that triggers two transformations:

http://ssel.vub.ac.be/viewvc/UML2CaseStudies/uml2cs-instantm essenger-config-editor/src/be/ac/vub/uml2cs/instantmessenger /popup/actions/GenerateBuildFileAction.java?revision=7299&am p;view=markup

Dennis
Re: [ATL] AtlLauncher [message #74544 is a reply to message #74295] Tue, 05 February 2008 21:07 Go to previous message
wong is currently offline wongFriend
Messages: 54
Registered: July 2009
Member
Hello,

Thank you for your reply. I updated all atl files to the newest version.
But I got this error. and Does the AtlLauncher work with eclipse 3.3 or I
have to use the 3.2 ?

Exception in thread "main" java.lang.NoClassDefFoundError:
org/eclipse/core/runtime/jobs/ISchedulingRule
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$000(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$000(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at
org.eclipse.m2m.atl.engine.AtlModelHandler.getDefault(AtlMod elHandler.java:55)
at JavaATL.ATLTransformations.runATLTransformation(JavaATL.java :51)
at JavaATL.ATLTransformations.main(JavaATL.java:43)

Thank you very much.
wong.
Previous Topic:Call atl ant script by java
Next Topic:[ATL & UML Modeler] Problem with modeler
Goto Forum:
  


Current Time: Sun Apr 11 23:05:12 GMT 2021

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

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

Back to the top