stella.sensor
Class AbstractWeatherSurveyor
java.lang.Object
util.PropertyContainer
util.rmi.RmiPropertyContainer
util.rmi.AbstractRmiCaster
stella.sensor.AbstractWeatherSurveyor
- All Implemented Interfaces:
- Cloneable, Remote, Caster, ClusterDepending, Parameter, WeatherSurveying, Trigger, WeatherCaster, ExitCleaning, Initializable, PropertyBearing, RmiCaster, RmiPropertyBearing, StatusProviding
- Direct Known Subclasses:
- WeatherStation
public abstract class AbstractWeatherSurveyor
- extends AbstractRmiCaster
- implements WeatherSurveying
An abstract implementation of the WeatherSurveying interface.
This
class extends CastingContainer to implement the
stella.rmi.RmiPropertyBearing interface and provides a
single-argument
constructor, with a Map object as the argument.
Normally, concrete implementations of this class will also implement the
RmiWeatherReporting interface.
To make construction out of a properties file more convenient,
a static createWeatherSurveyor(java.util.Map) method is given.
For convenience, the method required by the weather caster are already
implemented. Subclasses may use the notifyWeatherListener(stella.sensor.WeatherEvent) method
for passing a weather event to the listeners.
|
Field Summary |
private List |
list
The registered listeners. |
|
Constructor Summary |
protected |
AbstractWeatherSurveyor(Map prop)
Constructs a new weather watching instance with the specified
properties. |
| Methods inherited from class util.rmi.AbstractRmiCaster |
bindAlternate, bindToRegistry, bindToRegistry, bindToRegistry, casterExit, casterExit, exit, getBindName, getBindName, isValid, unbindFromRegistry, unbindFromRegistry |
| Methods inherited from class util.PropertyContainer |
augment, augment, augment, clone, createFrom, createFrom, createFrom, defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsEnums, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsMap, getAsObject, getAsObject, getLocalClassLoader, getLocalized, getLocalized, getLocalizedString, getLocalizedString, getProperties, getPropertiesToKey, getPropertiesToKey, getProperty, getResource, getResourceAsStream, getResourceFromKey, getResources, has, init, isNew, keyCreate, keyCreate, parseObject, reload, reload, removeProperty, rescanned, setObject, setProperties, setProperty, stringProperties, toString |
| Methods inherited from interface util.PropertyBearing |
defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsObject, getAsObject, getLocalized, getProperties, getProperty, getResource, getResourceAsStream, getResources, has, parseObject, removeProperty, setObject, setProperty, stringProperties |
list
private List list
- The registered listeners.
AbstractWeatherSurveyor
protected AbstractWeatherSurveyor(Map prop)
- Constructs a new weather watching instance with the specified
properties. The
PropertyBearing.KEY_CLASS is always mapped when this
constructer is used.
createWeatherSurveyor
public static final WeatherSurveying createWeatherSurveyor(Map prop)
- Constructs a new weather watching instance using the mapping of the
PropertyBearing.KEY_CLASS to the class name to derive the class to instantiate.
If this property is defined, a new WeatherSurveying
instance with the stated
class name is created, the supplied properties used as an argument in
the constructor. Can throw a lot of exceptions if unsuccessful.
addWeatherListener
public void addWeatherListener(WeatherListener add)
- Adds a weather listener to this weather surveyer.
- Specified by:
addWeatherListener in interface WeatherCaster
removeWeatherListener
public void removeWeatherListener(WeatherListener remove)
- Removes a weather listener from this weather surveyor.
- Specified by:
removeWeatherListener in interface WeatherCaster
notifyWeatherListener
protected void notifyWeatherListener(WeatherEvent we)
- Notifies all registered WeatherListeners. This method parses
through the Vector of WeatherListeners and passes the argument to their
weatherChanged method.
- Parameters:
we - The WeatherEvent to pass to the Listeners.
status
public String status()
- Basic implementeation of the status method. Returns the
PropertyContainer.toString() value. Subclasses should override this basic
behaviour.