4.0

Table Of Contents
Moon.java Class
The Moon.java class extends CelestialBody to create moon objects.
The Moon class declares the following constructor and methods:
n
Moon() constructor, to create moon instances
n
getVolume() method, to return the volume of a moon
n
setVolume() method, to set the volume of a moon
n
getPlanetId() method, to return the identifier of the planet that this moon orbits
n
setPlanetId() method, to set the identifier of the planet that this moon orbits
ISolarSystemListener.java Class
The ISolarSystemListener.java class extends java.util.EventListener to create a listener that monitors
events in the solar system application.
The ISolarSystemListener class declares the following methods:
n
circumferenceChanged(), to monitor changes in the circumference of a planet
n
gravityChanged(), to monitor changes in the gravity of a planet
n
planetAdded(), to monitor the creation of new planets
n
planetRemoved(), to monitor the destruction of planets
SolarSystemEventHandler.java Class
The SolarSystemEventHandler.java class creates an array of ISolarSystemListener instances and defines
methods to handle the events that the ISolarSystemListener instances observe.
The SolarSystemEventHandler defines the following methods:
n
registerListener(), to add a listener to the array of ISolarSystemListener instances
n
unregisterListener(), to remove a listener from the array of ISolarSystemListener instances
n
fireCircumferenceChanged(), to register a change in the circumference of a planet
n
fireGravityChanged(), to register a change in the gravity of a planet
n
firePlanetAdded(), to register the creation of a planet
n
firePlanetRemoved(), to register the destruction of a planet
SolarSystemRepository.java Class
The SolarSystemRepository.java class implements all of the classes of the solar system application to create
an instance of a solar system.
When the solar system application runs, it creates a unique SolarSystemRepository instance that represents
Earth's solar system. The SolarSystemRepository starts a SolarSystemEventHandler instance to monitor events
in the solar system, and creates instances of the Star, Planet, and Moon classes that represent the Sun, Earth,
Mars, Titan, and so on. The SolarSystemRepository constructor calls the Star.addPlanet() and
Planet.addMoon() methods to add the planets to the Sun and the moons to the planets, and sets their respective
names, identifiers, and attributes.
vCenter Orchestrator Developer's Guide
156 VMware, Inc.