VMware Cloud Community
StefanSchnell
Enthusiast
Enthusiast
Jump to solution

Easier Way to Detect Rhino Engine Version

Aria uses the JavaScript engine Rhino, this becomes visible in the section Scripting Engine of the current Key Features of the Orchestrator Platform. I do not find a way to detect the used version of the Rhino engine via a method call or similar, so I performed a manual detection via available functions. To evaluate this I looked at the changes in the releases of the Rhino engine. From release 1.7R5 to release 1.7.6, for example, the method string.trimLeft() was added. I used this method to try a simple test.

 

Rhino 1.7.14
js> "   Hello World   ".trimLeft();
Hello World   
js> quit();

Rhino 1.7 release 5 2015 01 29
js> "   Hello World   ".trimLeft();
js: uncaught JavaScript runtime exception: TypeError: Cannot find funtion trimLeft in object    Hello Word   .
js> quit();

 

As you can see, the current version supports the method trimLeft(), whereas version 1.7R5 does not support this method. This is also displayed in the vRA.

StefanSchnell_0-1669015470611.png

Besed on this result we can assume with high probability that vRA version 8.11 uses Rhino Engine version <= 1.7R5. The documentation describes that the Orchestrator 7.6 uses Rhino Engine version 1.7R4, in the document vrealize-orchestrator-76-developers-guide.pdf. The current key features of the Orchestrator platform talks, in the Scripting engine section, about the Mozilla Rhino JavaScript engine, without any version information.

Is there an easier way to detect the used version of the Rhino JavaScript engine?

In my opinion it should be possible to detect the Rhino version with the following script sequence:

var Context = org.mozilla.javascript.Context;
var currentContext = Context.getCurrentContext();
var rhinoVersion = currentContext.getImplementationVersion();
System.log(rhinoVersion);

You can find here the documentation of the Rhino classes.

StefanSchnell_0-1671081979686.png

But for this it is necessary to set the access to the Java classes.

Here is the result of a search of the pattern rhino*.jar:

StefanSchnell_0-1671112261784.png

 


More interesting information at blog.stschnell.de

0 Kudos
1 Solution

Accepted Solutions
StefanSchnell
Enthusiast
Enthusiast
Jump to solution

With a tiny modification of the JavaScript code and the access to the package org.mozilla.javascript all works well.

StefanSchnell_0-1671273190896.png

var context = new org.mozilla.javascript.Context();
var currentContext = context.getCurrentContext();
var rhinoVersion = currentContext.getImplementationVersion();
System.log(rhinoVersion);

Great to know how it is possible to detect the version of used Rhino engine.


More interesting information at blog.stschnell.de

View solution in original post

1 Reply
StefanSchnell
Enthusiast
Enthusiast
Jump to solution

With a tiny modification of the JavaScript code and the access to the package org.mozilla.javascript all works well.

StefanSchnell_0-1671273190896.png

var context = new org.mozilla.javascript.Context();
var currentContext = context.getCurrentContext();
var rhinoVersion = currentContext.getImplementationVersion();
System.log(rhinoVersion);

Great to know how it is possible to detect the version of used Rhino engine.


More interesting information at blog.stschnell.de