Home » Archived » M2M (model-to-model transformation) » [ATL]Launching ATL programmatically problem
[ATL]Launching ATL programmatically problem [message #20547] |
Mon, 05 March 2007 14:59 |
Eclipse User |
|
|
|
Originally posted by: xxcs214.163.com
Dear all,
I am having problem with launching ATL from a program too, I use
Dennis's code,launcher transformation just like follows :
public class Test {
public static void main(String args[]){
String temp[]=new String[9];
temp[0]="--trans";
temp[1]=" file:///D:/runtime-EclipseApplication/Sample2/Book2Product.a sm";
temp[2]="--in";
temp[3]="IN= file:///D:/runtime-EclipseApplication/Sample2/models/book.xm l";
temp[4]="Book= file:///D:/runtime-EclipseApplication/Sample2/metamodels/boo k.ecore";
temp[5]="EMF";
temp[6]="OUT= file:///D:/runtime-EclipseApplication/Sample2/models/product .xml";
temp[7]="Product= file:///D:/runtime-EclipseApplication/Sample2/metamodels/pro duct.ecore";
temp[8]="EMF";
Main main=new Main();
main.main(temp);
}
}
but it occurs problems :
java.lang.IllegalArgumentException: resolve against non-hierarchical or
relative basejava.lang.IllegalArgumentException: resolve against
non-hierarchical or relative base
just like:[ATL]Problem while launching ATL programmatically
http://dev.eclipse.org/newslists/news.eclipse.modeling.m2m/m sg00224.html
>As far as I can see, the problem is caused by the URIs you pass. I don't use
>Windows, so I can't test if this works: try to replace "C:" by "C|" (pipe
>character), because the colon (:) may only occur once in a URI and separates
>the URI protocol ("file") from the rest. Hope this helps.
By the way ,it doesn't work as I have tried as Dennis said.
It seems still the URI's problem ,so how to define proper params, how to
resolve the URI's problem?
If anyone had already launched ATL from a program successfully, can you
give me an sampe,thanks very much, my mail : xxcs214@163.com.
Thanks in advance!
|
|
| |
Re: [ATL]Launching ATL programmatically problem [message #20565 is a reply to message #20556] |
Mon, 05 March 2007 15:55 |
Eclipse User |
|
|
|
Originally posted by: maher.lamari.lip6.fr
Hi Shan,
I think there is a problem with the paths we give on tarnsfromation, and
models.
1- there is also a problem in teh function loadModel, PLZ see below that I
omited resolve(cwd)
2- I turned the parsparam function to setTransfContext. you can set all the
parameters (String) by the path of each file. For example
String inputModelPath
" file:///D:/runtime-EclipseApplication/Sample2/models/book.xm l";
main.setTransfContext(transfPath,inputModelPath,
inputMetaModelPath,outputModelPath,outputMetaModelPath) ;
// run the transformation
main.run();
I hope it helps
Maher
------------------------------------------ 1--------------------
public static ASMModel loadModel(AtlModelHandler amh, String modelId,
ASMModel metaModel, String uri)
throws FileNotFoundException {
ASMModel model = null;
if (amh instanceof AtlEMFModelHandler) {
URI absURI = URI.createURI(uri) ; //.resolve(cwd);
model = ((AtlEMFModelHandler)amh).loadModel(
modelId, metaModel, absURI);
try {
Method getReferencedExtents =
model.getClass().getMethod("getReferencedExtents", null);
System.out.println("Referenced extents: " +
getReferencedExtents.invoke(model, null));
} catch (Exception e) {
System.out.println("The EMF4ATL version used does not
support referenced extents (multiple-file models)");
}
} else {
model = amh.loadModel(modelId, metaModel, new
FileInputStream(uri));
}
return model;
}
--------------------------------- 2 ------------------------------------
public void setTransfContext(String transfPath,
String inputModelPath,
String inputMetaModelPath,
String outputModelPath,
String outputMetaModelPath) {
try {
trans = new URL(transfPath);
} catch (MalformedURLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try {
addInputModel(
"IN=" + inputModelPath,
"UMLClass=" + inputMetaModelPath,
"EMF");
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try {
addOutputModel(
"OUT=" + outputModelPath,
"RDB=" + outputMetaModelPath,
"EMF");
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
-------------------------------------------------
"Shan" <xxcs214@163.com> a
|
|
| |
Goto Forum:
Current Time: Thu Dec 26 23:39:29 GMT 2024
Powered by FUDForum. Page generated in 0.04116 seconds
|