4.1

Table Of Contents
Prerequisites
You must have set up the plug-in, and defined <finder> elements and enumerations.
Procedure
1 Map a Java class from the plugged-in technology or from the plug-in implementation to a JavaScript class.
The SolarSystemEventGenerator class defines the events that Orchestrator can invoke in the solar system
application. The solar system vso.xml file maps the event generator class to a JavaScript class named
_SolarSystemEventGenerator. By setting the strict attribute to true, Orchestrator can only call the
methods from the SolarSystemEventGenerator class that are mapped in the vso.xml file. To allow scripting
to instantiate a class you use the create attribute.
<scripting-objects>
<object script-name="_SolarSystemEventGenerator"
java-class="com.vmware.orchestrator.api.sample.solarsystem.SolarSystemEventGenerator"
strict="true">
<description>The entry point to generate events</description>
[...]
</object>
[...]
</scripting-objects>
2 (Optional) If necessary, denote the JavaScript object as a singleton object.
In the solar system example, SolarSystemEventGenerator is a singleton object. The plug-in adaptor can
only create a single instance of the SolarSystemEventGenerator class. You can only call the methods of the
SolarSystemEventGenerator JavaScript object and cannot instantiate the class in Orchestrator scripts.
<singleton script-name="SolarSystemEventGenerator"
datasource="solar-datasource"/>
3 Map the methods in the Java class to methods in the Orchestrator JavaScript API in the
<object><methods> element.
The SolarSystemEventGenerator class defines a generateFlareEvent() method to generate solar flare
events. The solar system vso.xml maps this method to a JavaScript method of the same name, and sets its
parameters in the JavaScript method.
<methods>
<method script-name="generateFlareEvent" java-name="generateFlareEvent">
<description>Start a Solar Flare</description>
<parameters>
<parameter name="star" type="Star">The star which generates the event</parameter>
<parameter name="magnitude" type="number">The magnitude of the flare</parameter>
</parameters>
</method>
</methods>
4 Map the attributes of a Java class to JavaScript attributes in <object><attributes> elements.
The solar system vso.xml file maps the Java attributes of the Star object to attributes of the same name in
the Star JavaScript class in the Orchestrator JavaScript API.
<object script-name="Star" java-class="com.vmware.solarsystem.Star"
create="false" strict="true">
[...]
<attributes>
<attribute script-name="id" java-name="id" return-type="string">
The unique Id of the star</attribute>
vCenter Orchestrator Developer's Guide
200 VMware, Inc.