4.1

Table Of Contents
Prerequisites
n
Set up the plug-in watcher implementation class.
n
Declare a public constructor to instantiate the plug-in watcher implementation.
n
Create instances of the PluginWatcher class.
Procedure
1 Create an instance of the IPluginPublisher interface.
The SolarSystemWatchersManager class declares the following variable for the IPluginPublisher instance.
private IPluginPublisher pluginPublisher;
2 Define a method to add the IPluginPublisher instance to the plug-in adapter implementation.
The SolarSystemWatchersManager class declares the following method that the SolarSystemAdapter class
calls.
public void setPluginPublisher(IPluginPublisher pluginPublisher) {
this.pluginPublisher = pluginPublisher;
}
3 Define the event for which the watcher watches and that the publisher publishes to the Orchestrator
notification mechanism.
The SolarSystemWatchersManager class defines the starFlareEvent() method that takes a Star object and
a magnitude value as parameters. The starFlareEvent() method also gets the hashtable of watchers and
creates a list of watchers to remove from the hashtable after the event occurs.
public void starFlareEvent(String starid, double magnitude) {
synchronized (watchers) {
List<String> watchersToRemove = new Vector<String>();
}
}
4 Call the PluginWatcher.getTrigger() and PluginTrigger.getProperties() methods to obtain the
properties to watch in the trigger.
The SolarSystemWatchersManager.starFlareEvent() method extracts the STAR_ID and MAGNITUDE
properties from the trigger and adds them to a PluginWatcher instance in the hashtable.
public void starFlareEvent(String starid, double magnitude) {
synchronized (watchers) {
List<String> watchersToRemove = new Vector<String>();
for (PluginWatcher watcher : watchers.values()) {
Properties props = watcher.getTrigger().getProperties();
String wStarId = props.getProperty(SolarSystemTriggerGenerator.STAR_ID);
String wMagnitude = props.getProperty(SolarSystemTriggerGenerator.MAGNITUDE);
}
}
}
vCenter Orchestrator Developer's Guide
178 VMware, Inc.