Adding / Using Scripting languages


How many of you here currently use a scripting language to aid in the composition of there services under Integration Server? An example would be to hook in JRuby to execute scripts through a service.

I like that this year many groups are trying to get there scripting languages in more mature and usuable states. One idea of mine was to try and switch the compiler (not JVM) with one that could use a more relaxed syntax.

Some of the popular languages are (in no particular order) Jython, JRuby, Kawa, Sisc, Pnuts, Groovy, Beanshell, Rhino and Nice to name a few. In this particular group at least Kawa, Pnuts, Jython, Rhino and Groovy also support compiling to bytecode.

So, what do you all think about hooking in such an environment? From here, we can talk about some good ways to add them to an existing environment. Also, note the extra complications that go with such an addition which may include extra error messages, lack of common support in some areas, binding dissimilarities with common libraries and tools. Waying the good with the bad will allow more people to chime in, be aware, and bless (instead of curse) the day they read this post. Good day.

Yemi Bedu


Interesting idea. Are you proposing that you build integration logic in one these tools instead of Flow or Java?

If so, a model that might work would be something like the WmDotNet package or the WmJBoss package in which methods coded in those environments were exposed and accessible as IS virtual services.

How would you “invoke” a scripting language function from IS?


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:

IDataCursor idc = pipeline.getCursor();

bsh.Interpreter script = new bsh.Interpreter();

    String expression = (String) idc.getValue();

            script.set("source", idc.getValue());
            String returned = (String) idc.getValue();
            idc.insertAfter("result", script.get(returned));
            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;

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