4.1

Table Of Contents
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.
Notify Orchestrator of Events in the Plugged-In Technology
Event listeners implement the IPluginNotificationHandler interface from the Orchestrator plug-in API to
notify Orchestrator of events in the plugged-in technology.
The IPluginNotificationHandler interface defines methods that you implement in the event listener to notify
Orchestrator of changes in state of the objects that the event listener monitors in the plugged-in technology.
The SolarSystemEventListener class monitors objects in a SolarSystemRepository instance for changes in state
that the following methods cause:
n
Planet.setCircumference(), that changes the circumference of a planet.
n
Planet.setGravity(), that changes the gravity of a planet.
n
Star.addPlanet(), that adds a planet to a star.
n
Star.removePlanet(), that removes a planet from a star.
The events that the SolarSystemEventListener class monitors are all events that the solar system application
defines.
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.
n
Register the event listener and the notification handler instances with the plugged-in technology.
Chapter 7 Developing Plug-Ins
VMware, Inc. 165