- What is Rhino Engine?
- Released 10 years ago
- ECMAScript 5.1 Specifications
- Rhino on GitHub
- Rhino Engine Limitations in vRO
- Access to additional Java Classes
- Javadoc for Rhino 1.7R4
- Additional Links
What is Rhino Engine?
Released 10 years ago
Released in 2012-06-18, Rhino 1.7R4 is almost prehistoric for today’s standards and that’s been always a point of discussion in the vRO Community.
While trying to look deep into its compatibility matrix with ES, I found this Kangax’s Compat-table which gives an excellent and detailed view of all the possible features that Rhino 1.7R4 supports. Click the link to know more.
ECMAScript 5.1 Specifications
This document will give you a very in-depth knowledge of the ECMAScript 5.1 that vRO leverages to understand the language better. Learn more at https://262.ecma-international.org/5.1.
You can download this document and read about all the fine details by yourself.
Rhino on GitHub
Currently, on GitHub page of Mozilla,
version 1.7R4 is not available. However, you may find some very old scripts that were written at the time of 1.7R4 as I can validate using web-achieve. You can explore their GitHub repo here.
Rhino Engine Limitations in vRO
When writing scripts for workflows, you must consider the following limitations of the Mozilla Rhino implementation in Orchestrator.
System.log(this);does not display the global object
thisin the same way as a standard Rhino implementation does.
- You can only call actions that return nonserializable objects from scripting, and not from workflows. To call an action that returns a nonserializable object, you must write a scriptable task element that calls the action by using the System.getModuleModuleName.action() method.
- Workflow validation does not check whether a workflow attribute type is different from an input type of an action or subworkflow. If you change the type of a workflow input parameter, for example from VIM3:VirtualMachine to VC:VirtualMachine, but you do not update any scriptable tasks or actions that use the original input type, the workflow validates but does not run.
Access to additional Java Classes
- Enter a name for the configuration file.
- Save the configuration file in a subdirectory of /data/vco/usr/lib/vco. The configuration file cannot be saved under another directory.
- Log in to Control Center as root.
- Click System Properties.
- Click New.
- In the Key text box, enter com.vmware.scripting.rhino-class-shutter-file.
- In the Value text box, enter vco/usr/lib/vco/your_configuration_file_subdirectory.
- In the Description text box, enter a description for the system property.
- Click Add.
- Click Save changes from the pop-up menu.A message indicates that you have saved successfully.
- Wait for the vRealize Orchestrator server to restart.
See an implementation example of accessing external Java classes by BlueCat here. Here, the code implements
. . . var testConfig = BCNProteusAPI.createAPIEntity(new java.lang.Long(0),configName,"","Configuration" ); var args = new Array( new java.lang.Long(0), testConfig ); configId = new java.lang.Long( BCNProteusAPI.call( profileName,"addEntity",args )); System.log( "New configuration was created, id=" + configId ); var addTFTPGroupArgs = new Array( configId, "tftpGroupName1", "" ); var tftpGroupId = new java.lang.Long( BCNProteusAPI.call(profileName,"addTFTPGroup", addTFTPGroupArgs ) ); System.log( "New TFTP Group was created, id=" + tftpGroupId ); . . .
Javadoc for Rhino 1.7R4
Use this link to compare features of modern JS engines. https://kangax.github.io/compat-table/es6/