4.1

Table Of Contents
Create Instances of the PluginWatcher Class
You create a plug-in watcher to watch a workflow trigger by instantiating the PluginWatcher class. When the
event that the workflow trigger defines occurs, the plug-in watcher notifies any workflows that are waiting
for that event.
The PluginWatcher class defines a constructor that you can use to create plug-in watcher instances. The
PluginWatcher class defines methods to obtain or set the name of the workflow trigger to watch and a timeout
period.
Prerequisites
n
Set up the plug-in watcher implementation class.
n
Declare a public constructor to instantiate the plug-in watcher implementation.
Procedure
1 Create one or more instances of the PluginWatcher class with which to register the workflow triggers to
monitor.
The SolarSystemWatchersManager class creates a hashtable to contain all of the PluginWatcher instances.
private final Map<String, PluginWatcher> watchers = new Hashtable<String, PluginWatcher>();
2 Obtain watcher instances by calling the PluginWatcher.getId() method.
The SolarSystemWatchersManager class defines a method that adds a PluginWatcher instance to the
hashtable of PluginWatcher instances.
public void addWatcher(PluginWatcher watcher) {
synchronized (watchers) {
watchers.put(watcher.getId(), watcher);
}
}
3 (Optional) Remove watcher instances after an event occurs.
The SolarSystemWatchersManager class defines a method that removes a PluginWatcher instance from the
hashtable of PluginWatcher instances.
public void removeWatcher(String watcherId) {
synchronized (watchers) {
watchers.remove(watcherId);
}
}
You created instances of the PluginWatcher class to watch workflow triggers for events.
What to do next
Register the watcher instances with IPluginPublisher instances to publish the watchers to the Orchestrator
notification mechanism.
Publish Plug-In Watchers
You implement the IPluginPublisher interface to publish plug-in watchers to the Orchestrator notification
mechanism.
When a workflow trigger starts an event in the plugged-in technology, a plug-in watcher that watches that
trigger and that is registered with an IPluginPublisher instance notifies any waiting workflows that the event
has occurred.
Chapter 7 Developing Plug-Ins
VMware, Inc. 177