4.0

Table Of Contents
Register the Event Listener with the Plugged-In Technology
To monitor events in a plugged-in technology, you must register the event listener from the plug-in with the
plugged-in technology and implement a notification handler.
An event listener requires access to the main class of the application to which it listens for events. An event
listener also requires an instance of the IPluginNotificationHandler interface from the Orchestrator plug-in
API, to send notifications to Orchestrator if the events occur.
Prerequisites
n
Set up the event listener implementation class.
n
Declare a public class that implements the java.util.EventListener interface.
n
Create an instance of the IPluginNotificationHandler interface.
Procedure
1 Create a public constructor to create event listener instances.
The solar system example creates a constructor that takes as parameters an instance of the
SolarSystemRepository class from the solar system application and an instance of the
IPluginNotificationHandler interface.
public SolarSystemEventListener(SolarSystemRepository solarSystemRepository,
IPluginNotificationHandler notificationHandler) {
}
2 Register an instance of the event listener with the plugged-in technology.
You register the event listener by using the listener registration mechanism that the plugged-in technology
defines.
The SolarSystemEventListener() constructor registers the event listener with the solar system application
by calling the SolarSystemRepository.registerListener() method.
public SolarSystemEventListener(SolarSystemRepository solarSystemRepository,
IPluginNotificationHandler notificationHandler) {
solarSystemRepository.registerListener(this);
}
3 Associate an instance of the IPluginNotificiationHandler interface to the event listener.
The SolarSystemEventListener() constructor uses the this Java keyword to add an instance of
IPluginNotificiationHandler to the event listener.
public SolarSystemEventListener(SolarSystemRepository solarSystemRepository,
IPluginNotificationHandler notificationHandler) {
solarSystemRepository.registerListener(this);
this.notificationHandler = notificationHandler;
}
You created an event listener that registers an event listener and a notification handler with the plugged-in
technology. The event listener listens for events in the plugged-in technology and sends notifications to
Orchestrator.
What to do next
Call the methods of the IPluginNotificationHandler interface to notify Orchestrator of events in the plugged-
in technology.
vCenter Orchestrator Developer's Guide
168 VMware, Inc.