Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » launching application with command lines and passing parameters
launching application with command lines and passing parameters [message #24893] Thu, 22 March 2007 15:30 Go to next message
Eclipse UserFriend
Originally posted by: yassin_chkouri.yahoo.fr

Hello,
I arrive at launching my application starting from the command lines but
without passing the parameters and I can normally launch it with the use
of the parameters saved in a XML file . I wanted to make fusion between
the two i.e. launch my application starting from the order line and by
using the parameters saved in a XML file . but I have an error message
which I am not able to solve it, somebody can help me in this subject ?
Thanks in advance.
Error message :
/////////////////////////////////////////////////////
trans
file:/home/chkouri/workspace/arl/BipOptimisation/bipOptimisa tionPrefix_All.asm
libs
{libpib=file:/home/chkouri/workspace/arl/BipOptimisation/XML Helpers.asm}
models {OUT=OUT : bip, INXML=INXML : bipXML, bipXML=bipXML : MOF, bip=bip
: MOF, IN=IN : bip}params{}
WARNING: could not find model XML.
WARNING: could not find model XML.
WARNING: could not find model XML.
WARNING: could not find model XML.
WARNING: could not find model XML.
WARNING: could not find model XML.
WARNING: could not find model XML.
WARNING: could not find model XML.
WARNING: could not find model XML.
****** BEGIN Stack Trace
message: cannot find model XML
A.main() : ??#24 null
local variables = {self=Bip2Net : ASMModule}
local stack = []
A.__initmergedInsta1() : ??#9 28:9-28:20
local variables = {self=Bip2Net : ASMModule}
local stack = [Bip2Net : ASMModule, Sequence {}, Sequence {}]
****** END Stack Trace
****** BEGIN Stack Trace
exception:
java.lang.NullPointerException
at org.atl.engine.vm.ASMOperation.realExec(ASMOperation.java:26 5)
at org.atl.engine.vm.ASMOperation.exec(ASMOperation.java:155)
at org.atl.engine.vm.nativelib.ASMOclAny.invoke(ASMOclAny.java: 60)
at org.atl.engine.vm.nativelib.ASMOclAny.invoke(ASMOclAny.java: 50)
at org.atl.engine.vm.ASMOperation.realExec(ASMOperation.java:21 4)
at org.atl.engine.vm.ASMOperation.exec(ASMOperation.java:155)
at org.atl.engine.vm.ASMInterpreter.<init>(ASMInterpreter.java:276)
at org.atl.eclipse.engine.AtlLauncher.launch(AtlLauncher.java:9 8)
at org.atl.eclipse.engine.AtlLauncher.launch(AtlLauncher.java:7 0)
at org.atl.eclipse.engine.AtlLauncher.launch(AtlLauncher.java:5 3)
at org.atl.eclipse.engine.AtlLauncher.launch(AtlLauncher.java:4 9)
at ujf.verimag.bip.transfo.Main.run(Main.java:345)
at ujf.verimag.bip.transfo.Main.main(Main.java:77)
A.main() : ??#24 null
local variables = {self=Bip2Net : ASMModule}
local stack = []
A.__initmergedInsta1() : ??#9 28:9-28:20
local variables = {self=Bip2Net : ASMModule}
local stack = [Bip2Net : ASMModule, Sequence {}, Sequence {}]
****** END Stack Trace
Re: launching application with command lines and passing parameters [message #25255 is a reply to message #24893] Fri, 23 March 2007 22:07 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,

The XMLHelpers library that is available from the Eclipse website works
with the XML metamodel available from the Atlantic Zoo:
http://www.eclipse.org/gmt/am3/zoos/atlanticZoo/#XML
and assumes that this metamodel is loaded with the name "XML" in the
launch configuration.

Unless you wrote your own XMLHelpers, you need to follow this naming
convention and use "XML" instead of "bipXML".


Frédéric Jouault


yassin wrote:
> Hello,
> I arrive at launching my application starting from the command lines but
> without passing the parameters and I can normally launch it with the use
> of the parameters saved in a XML file . I wanted to make fusion between
> the two i.e. launch my application starting from the order line and by
> using the parameters saved in a XML file . but I have an error message
> which I am not able to solve it, somebody can help me in this subject ?
> Thanks in advance.
> Error message :
> /////////////////////////////////////////////////////
> trans
> file:/home/chkouri/workspace/arl/BipOptimisation/bipOptimisa tionPrefix_All.asm
> libs
> {libpib=file:/home/chkouri/workspace/arl/BipOptimisation/XML Helpers.asm}
> models {OUT=OUT : bip, INXML=INXML : bipXML, bipXML=bipXML : MOF,
> bip=bip : MOF, IN=IN : bip}params{}
> WARNING: could not find model XML.
> WARNING: could not find model XML.
> WARNING: could not find model XML.
> WARNING: could not find model XML.
> WARNING: could not find model XML.
> WARNING: could not find model XML.
> WARNING: could not find model XML.
> WARNING: could not find model XML.
> WARNING: could not find model XML.
> ****** BEGIN Stack Trace
> message: cannot find model XML
> A.main() : ??#24 null
> local variables = {self=Bip2Net : ASMModule}
> local stack = []
> A.__initmergedInsta1() : ??#9 28:9-28:20
> local variables = {self=Bip2Net : ASMModule}
> local stack = [Bip2Net : ASMModule, Sequence {}, Sequence {}]
> ****** END Stack Trace
> ****** BEGIN Stack Trace
> exception: java.lang.NullPointerException
> at org.atl.engine.vm.ASMOperation.realExec(ASMOperation.java:26 5)
> at org.atl.engine.vm.ASMOperation.exec(ASMOperation.java:155)
> at org.atl.engine.vm.nativelib.ASMOclAny.invoke(ASMOclAny.java: 60)
> at org.atl.engine.vm.nativelib.ASMOclAny.invoke(ASMOclAny.java: 50)
> at org.atl.engine.vm.ASMOperation.realExec(ASMOperation.java:21 4)
> at org.atl.engine.vm.ASMOperation.exec(ASMOperation.java:155)
> at org.atl.engine.vm.ASMInterpreter.<init>(ASMInterpreter.java:276)
> at org.atl.eclipse.engine.AtlLauncher.launch(AtlLauncher.java:9 8)
> at org.atl.eclipse.engine.AtlLauncher.launch(AtlLauncher.java:7 0)
> at org.atl.eclipse.engine.AtlLauncher.launch(AtlLauncher.java:5 3)
> at org.atl.eclipse.engine.AtlLauncher.launch(AtlLauncher.java:4 9)
> at ujf.verimag.bip.transfo.Main.run(Main.java:345)
> at ujf.verimag.bip.transfo.Main.main(Main.java:77)
> A.main() : ??#24 null
> local variables = {self=Bip2Net : ASMModule}
> local stack = []
> A.__initmergedInsta1() : ??#9 28:9-28:20
> local variables = {self=Bip2Net : ASMModule}
> local stack = [Bip2Net : ASMModule, Sequence {}, Sequence {}]
> ****** END Stack Trace
>
Re: launching application with command lines and passing parameters [message #25689 is a reply to message #25255] Mon, 26 March 2007 14:35 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: yassin_chkouri.yahoo.fr

Hi,
thank you for your answer, I made the correction that you give me, there
remains to me just only one problem: starting from java I can create a
file xml like “parameters.xml” and I want to inject this file to xml
model. you can help me in this subject ?
Re: [ATL] launching application with command lines and passing parameters [message #25713 is a reply to message #25689] Mon, 26 March 2007 19:03 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
Hi,

> thank you for your answer, I made the correction that you give me, there
> remains to me just only one problem: starting from java I can create a
> file xml like �parameters.xml� and I want to inject this file to xml
> model. you can help me in this subject ?

The following Howto entry tells you how to use the XML injector
"manually" from the contextual menu available on .xml files,
"automatically" using ant tasks, and it also tells you in which class it
is implemented (i.e., org.atl.engine.injectors.xml.XMLInjector):
http://wiki.eclipse.org/index.php/ATL_Howtos#How_can_I_handl e_arbitrary_XML_documents.3F

If you want to call this injector programmatically (i.e., from a Java
program), you need to:
- create a new instance of XMLInjector
- call the inject method with a new ASMModel, an InputStream on your
file, and a Map of parameters (e.g. java.util.Collections.EMPTY_MAP),

After the execution of this inject method, the ASMModel passed as
argument will contain the result of the injection.


Regards,

Frédéric Jouault

P.S.: Please remember to prefix the subjects of your posts with "[ATL]".
I forgot to add this prefix in my previous reply, but this is now
corrected in this post.
Re: [ATL] launching application with command lines and passing parameters [message #26076 is a reply to message #25713] Wed, 28 March 2007 09:30 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: yassin_chkouri.yahoo.fr

If you want to call this injector programmatically (i.e., from a Java
program), you need to:
- create a new instance of XMLInjector
- call the inject method with a new ASMModel, an InputStream on your file,
and a Map of parameters (e.g. java.util.Collections.EMPTY_MAP),

After the execution of this inject method, the ASMModel passed as argument
will contain the result of the injection.

Hi,
I already tested what you said to me but I am not able to make it turned,
I think there is a null value. and what do you want to say by: "call the
inject method with a new ASMModel" ?
code which I wrote:


XMLInjector inj = new XMLInjector();
InputStream inpt = new FileInputStream("parameters.XML");
ASMModel currentOutModel = (ASMModel)in.get("XML");
Map params = Collections.EMPTY_MAP;
inj.inject(currentOutModel, inpt,params);

Thanks in advance.
PS: Sorry for my english.
Re: [ATL] launching application with command lines and passing parameters [message #26241 is a reply to message #26076] Wed, 28 March 2007 12:54 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
Hi,

> I already tested what you said to me but I am not able to make it
> turned, I think there is a null value. and what do you want to say by:
> "call the inject method with a new ASMModel" ? code which I wrote:
> XMLInjector inj = new XMLInjector();
> InputStream inpt = new FileInputStream("parameters.XML");
> ASMModel currentOutModel = (ASMModel)in.get("XML");
> Map params = Collections.EMPTY_MAP;
> inj.inject(currentOutModel, inpt,params);

I think you would correct your problem by not passing a null value.

For instance, if the null value is the first argument of inject (i.e.,
currentOutModel in your case), then create a new model instead of
passing null.

Supposing amh is the variable pointing to your AtlModelHandler, and
xmlMM the variable pointing to your XML metamodel, you could write
something like:

currentOutModel = amh.newModel("MyXMLModel", xmlMM);


Regards,

Frédéric Jouault
Re: [ATL] launching application with command lines and passing parameters [message #27329 is a reply to message #26241] Mon, 02 April 2007 13:32 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: yassin_chkouri.yahoo.fr

Hi,
here my parameters:
--trans file:/home/chkouri/workspace/arl/BipOptimisation/Optimisatio n.asm
--in IN=waterflow2.model bip=bip.ecore EMF
--in parameters=parameters-XML.ecore XML=XML.ecore EMF
--out OUT=coucou.model bip=bip.ecore EMF
--lib
libpib=file:/home/chkouri/workspace/arl/BipOptimisation/XMLH elpers.asm

when i run my application with this parameters it works.
now i want to run my parameters with : --param id=i1,i2,i3
i take i1, i2 and i3, and i put them in XML file(parameters.XML).
my problem is : I want to inject the "parameters.XML" to XML model(with
java code). I make this code :

XMLInjector inj = new XMLInjector();
InputStream in = new FileInputStream("parameters.XML");

ASMModel currentInModel = emfamh.newModel("XML.ecore", emfmm);
Map params = Collections.EMPTY_MAP;
inj.inject(currentInModel,in,params);

when i run my application, there are no errors(because I always point on
"parameters-XML.ecore" the old one) and no injection
file("parameters-XML.ecore").

if you want more explanation you could ask me

Y.Chkouri
PS: Sorry for my english.
Re: [ATL] launching application with command lines and passing parameters [message #27353 is a reply to message #27329] Mon, 02 April 2007 15:15 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: yassin_chkouri.yahoo.fr

It works now, it misses only this line :
models.put("parameters",currentInModel);
thanks for your helps, especially Frédéric Jouault

M.Y.Chkouri
Re: [ATL] launching application with command lines and passing parameters [message #27823 is a reply to message #27329] Mon, 02 April 2007 15:23 Go to previous message
Frédéric Jouault is currently offline Frédéric JouaultFriend
Messages: 572
Registered: July 2009
Senior Member
Hi,

Do you still have the same NullPointerException?

Could you please post the stack trace?

Thanks.


Regards,

Frédéric Jouault


Chkouri yassin wrote:
> Hi,
> here my parameters: --trans
> file:/home/chkouri/workspace/arl/BipOptimisation/Optimisatio n.asm --in
> IN=waterflow2.model bip=bip.ecore EMF --in
> parameters=parameters-XML.ecore XML=XML.ecore EMF --out OUT=coucou.model
> bip=bip.ecore EMF --lib
> libpib=file:/home/chkouri/workspace/arl/BipOptimisation/XMLH elpers.asm
> when i run my application with this parameters it works.
> now i want to run my parameters with : --param id=i1,i2,i3
> i take i1, i2 and i3, and i put them in XML file(parameters.XML).
> my problem is : I want to inject the "parameters.XML" to XML model(with
> java code). I make this code :
>
> XMLInjector inj = new XMLInjector(); InputStream
> in = new FileInputStream("parameters.XML");
> ASMModel currentInModel =
> emfamh.newModel("XML.ecore", emfmm);
> Map params = Collections.EMPTY_MAP;
> inj.inject(currentInModel,in,params);
>
> when i run my application, there are no errors(because I always point on
> "parameters-XML.ecore" the old one) and no injection
> file("parameters-XML.ecore").
>
> if you want more explanation you could ask me
>
> Y.Chkouri
> PS: Sorry for my english.
>
>
Previous Topic:Re: Transforming UML2 models and profiles
Next Topic:ATM/AM3 installation
Goto Forum:
  


Current Time: Tue Mar 19 11:34:46 GMT 2024

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

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

Back to the top