Somewhere in your kermeta code you can call a groovy expression stored in a string. For example:
var args :kermeta::utils::Hashtable<kermeta::standard::String, kermeta::standard::Object> init kermeta::utils::Hashtable<kermeta::standard::String, kermeta::standard::Object>.new args.put("self", self) args.put("anotherParam", "someString") var res1 :kermeta::standard::Object init extern org::kermeta::extra::groovyembedded::GroovyEmbedder.run("println 'Hello GroovyWorld! ' +self' '+anotherParam; return 'foo';", args) stdio.writeln(res1.toString)
Where
args
can store object coming from Kermeta and be accessed by the groovy
script. In the above sample,
self
is mapped to a Groovy argument named self, and some string is
mapped to a Groovy argument named anotherParam. Both are printed on
the standard output. The return can be used to send back data to
the Kermeta side in
res1
. Another way to send back data would be to simply
send an object in
an argument and change its content from Groovy.