Hello all - We have a requirement with one of our developments that I was hoping some of you Java Buffs could provide some ideas regarding an elegant solution.
The problem that we are facing is that we have a large number of Java Scripts, and we do not want to create separate Custom Agents for each. Instead the agreed solution will be to write a single Custom Agent (Java Class) that is capable of calling an external scripting engine, such as a VBS Script.
Calling a VBS Script from Java is fairly trivial, and we can easily pass in the dynamic variables by appending it to the command that starts the VBS Script. However the complication arises about getting the return variables, for which there may be a number of.
We have discussed two solutions so far:
1) The scripting logic is fairly simple, it is basic conditional branching and basic string and arithmetic manipulation Therefore we could write our own scripting parser. However, given the time-frames involved, this is our leased preferred option
Does anyone here know of a more graceful solution? Are there any scripting engines that can handle passing values from and to Java classes in a much more elegant way? Or is there even a broader solution that I am overlooking?
Any feedback or advice would be greatly appreciated.
one way might be to write your custom
agent (CA) to check args.length at startup,
if 0, launch the vbscript file and close CA.
vbs does its stuff, then launches CA, this time supplying args (as strings), so now,
CA with args > 0, processes the args instead
of launching vbs.
sounds messy, but might work.
subject: Using Java with an external scripting engine