Meaningless Drivel is fun!*
The moose likes Other JSE/JEE APIs and the fly likes javax.script Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "javax.script " Watch "javax.script " New topic
Author

javax.script

Claude Cundiff
Ranch Hand

Joined: Mar 20, 2008
Posts: 78
Hello everyone! Happy New Year!

I have terminal emulator with a built in script editor that is similar to Visual Basic. However, the scripting language is proprietary. I'd like to wrap this script engine with the javax.script package.

However, I'm not sure where to begin. I don't even know the name of the scripting engine. I'm thinking I will probably have to implement all the interfaces.

Has anyone had a similar problem? Any advice would be greatly appreciated.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19541
    
  16

Originally posted by Claude Cundiff:
However, I'm not sure where to begin. I don't even know the name of the scripting engine. I'm thinking I will probably have to implement all the interfaces.

I'm afraid so. My 1.6.0_11 JRE only has support for JavaScript; anything else would have to be added from 3rd party libraries or manually written.

Although I have no experience with the entire package, it looks like all you need to do is implement ScriptEngineFactory, and the classes it needs to return. The first seems to be quite easy, it's ScriptEngine that will be harder. Fortunately there is AbstractScriptEngine that does some of the work for you, but the bindings and evaluation you will have to do yourself.


You could try to search for examples of (open source) script engines to see how they've done it. That's all the advice I can give you.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24166
    
  30

As it turns out, I am working on an implementation for Jess right now. There's not that much to it, really. There are many example engines available here, and if you have any specific questions, I can try to help.

I started with the ScriptEngineFactory class to get a feel for things; I think that's a good approach. If you're using any decent IDE, it can generate stubs for all the methods you need to implement.
[ January 02, 2009: Message edited by: Ernest Friedman-Hill ]

[Jess in Action][AskingGoodQuestions]
Claude Cundiff
Ranch Hand

Joined: Mar 20, 2008
Posts: 78
Thank you! With this info, let me see how far I can get.

Wish me luck
Claude Cundiff
Ranch Hand

Joined: Mar 20, 2008
Posts: 78
It looks like the scripting langauge is Visual Basic for Applications (VBA)...
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19541
    
  16

Then it would surprise me if there is no 3rd party library that already supports the VBA engine.
Claude Cundiff
Ranch Hand

Joined: Mar 20, 2008
Posts: 78
Again, I do apologize for my ignorance.

The terminal emulator is RUMBA. When I go to
C:\Program Files\NetManage\Rumba\System\ScriptEngine,

I see
WDScript.exe
dlgdsn32.exe
vse.exe
vsp.exe
Enable40.dll
NMFTPDLL.dll
nmolbn.dll
nmvbhcn.dll
RumbaScriptAT.dll
VSRecorder.dll
NMFTPLog.bin
KBDMAP.CFG
AttachGlobConst.gbl
nmvbhcn.gbl
nmdialn.inc
VBA.LIA
vbabin.lia

Does this help?
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18115
    
    8

According to the Micro Focus site, the scripting language is "VBA-Compatible". I'm not sure what that means but there's a link immediately below where it says that entitled "Click here to order now or request more information".
Claude Cundiff
Ranch Hand

Joined: Mar 20, 2008
Posts: 78
Unfortunetly, I tried contacting them with no luck. Our company doesn't have any agreements with NetManage.

...we shall see what happens.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: javax.script
 
Similar Threads
How to call Javascript function from an Application.
Making formula configurable
need to calculate formulae given as string expression.
Where do I get java-engine.jar to make new ScriptEngineManager().getEngineByName("java"); work
Calling Javascript function from Java Code