4.1

Table Of Contents
4 Import any other classes that the event listener implementation requires.
In the solar system example, the event listener requires the following classes from the solar system
application:
import com.vmware.solarsystem.ISolarSystemListener;
import com.vmware.solarsystem.Planet;
import com.vmware.solarsystem.SolarSystemRepository;
5 Declare a public class for the event listener that implements the java.util.Eventlistener interface.
In the solar system example, the event listener declares the following class:
public class SolarSystemEventListener implements ISolarSystemListener {
}
The ISolarSystemListener class from the solar system application is a subclass of
java.util.Eventlistener.
6 Create an instance of the IPluginNotificationHandler interface.
The solar system event listener creates an IPluginNotificationHandler instance named
notficationHandler.
public class SolarSystemEventListener implements ISolarSystemListener {
IPluginNotificationHandler notficationHandler;
}
You set up the plug-in event listener class.
What to do next
Register the plug-in event listener with the plugged-in technology.
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) {
}
vCenter Orchestrator Developer's Guide
164 VMware, Inc.