Hello,
Currently I actively use BeanShell and am playing with JRuby under IS 6.0.1 SP2. For BeanShell, I have a service that creates and interpreter and evaluates a source string with an included external object and marking the variable for returns. The prereq here is that you have the interpreters jar files on your class path. Here is what I use for the eval:
[highlight=java]
{
IDataCursor idc = pipeline.getCursor();
bsh.Interpreter script = new bsh.Interpreter();
if(idc.first("script")){
String expression = (String) idc.getValue();
try{
if(idc.first("source")){
script.set("source", idc.getValue());
}
if(idc.first("return")){
String returned = (String) idc.getValue();
script.eval(expression);
idc.insertAfter("result", script.get(returned));
}else{
idc.insertAfter("result", script.eval(expression));
}
}catch(bsh.TargetError e){
Throwable et = e.getTarget();
idc.insertAfter("error", String.valueOf(et));
}catch(bsh.EvalError e){
idc.insertAfter("error", e.toString());
}
}
script = null;
}
[/highlight]
This is a rough way of doing it. Yes, I would like to do more free form development. There tends to be the issues of running the interpreter like speed and it existing as a sandbox, the klugde to pass in and out the pipeline or pipeline values.
I am in the early stages of trying to get Groovy to work in this manner. My big thing is that I want to be able to still do pure Java language programming and I don’t want any of those constructs to cause errors.
If BeanShell had a compiler (why not I don’t know), I would have been using that excusively for the time being.
One thing I want is to have everything working inline. I mean same compiler, jvm, editors for all I do.
As of now, to invoke a function (none compiled) that is visible in Developer, you will need the scaffolding I show above in each service you create. I have similar for my trials with JRuby with one custom class file. Good day.
Yemi Bedu
#webMethods#Flow-and-Java-services#Integration-Server-and-ESB