pages

Showing posts with label class. Show all posts
Showing posts with label class. Show all posts

Thursday, January 20, 2011

vCO - Access to Java Classes

By default JavaScript in vCO is limited to class subtree java.util.* . Please read vCenter Orchestrator Administration Guide 4.1 on page 69 before changing default settings.
Why changing default settings? In my case I want to unzip bundles in an offline repository only with vCO, not using 3rd party tools. The ZipFile object is direct accessible, but some methods are derived from classes in java.io.* and java.lang.Object. So I have to loosen the default restrictions, described on Page 69.

Step1:

create a text file e.g MyShutter.txt with following content:

java.io.*
java.util.*
java.lang.Object


Save this file at <VCO-install-folder>\Orchestrator\app-server\bin\MyShutter.txt. This folder already exists.

Step 2:

Stop VCO-Server
Edit vmo.properties (look in ...\app-server\server\vmo\conf) and add following line:

com.vmware.scripting.rhino-class-shutter-file=MyShutter.txt

I've tried to use here an absolute path e.g. C:/VCO/MyShutter.txt (nothing was mentioned in documentation). You will get an error (server.log) like this if doing so:

2011-01-20 16:52:31.540+0100 ERROR [MainScriptingObject] Cannot find rhino js shutter class file at location : C:\Program Files\VMware\Orchestrator\app-server\bin\VCOMyShutter.txt

Step 3:

Start VCO-Server
Run an example using an object from new accessible classes.
Check server.log
If your example fails, check
  • server.log for above error - maybe the shutter file was not found
  • object naming - so you not using import the object must be fully qualified - e.g. ZipFile object qualifies as java.util.zip.ZipFile
Feel free to leave comments or drop your questions.

Regards, Andreas