stella.sensor
Class AbstractWeatherSurveyor

java.lang.Object
  extended by util.PropertyContainer
      extended by util.rmi.RmiPropertyContainer
          extended by util.rmi.AbstractRmiCaster
              extended by 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.


Nested Class Summary
 
Nested classes/interfaces inherited from class util.PropertyContainer
PropertyContainer.URLResource
 
Nested classes/interfaces inherited from interface stella.sensor.WeatherSurveying
WeatherSurveying.DataBlock
 
Field Summary
private  List list
          The registered listeners.
 
Fields inherited from class util.rmi.AbstractRmiCaster
ALTERNATEHOST, ALTERNATEPORT, KEY_BINDNAME, KEY_EXPORTPORT, KEY_REGISTRYHOST, KEY_REGISTRYPORT
 
Fields inherited from class util.PropertyContainer
KEY_LISTSEPARATOR, KEY_LOCALECOUNTRY, KEY_LOCALELANGUAGE, KEY_MAPKEYVALUECHAR, KEY_MAPSEPARATOR, KEY_NOINITONCREATE, KEY_RESOURCEBUNDLES
 
Fields inherited from interface util.PropertyBearing
CONFIG, KEY_CLASS, KEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOME
 
Constructor Summary
protected AbstractWeatherSurveyor(Map prop)
          Constructs a new weather watching instance with the specified properties.
 
Method Summary
 void addWeatherListener(WeatherListener add)
          Adds a weather listener to this weather surveyer.
static 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.
protected  void notifyWeatherListener(WeatherEvent we)
          Notifies all registered WeatherListeners.
 void removeWeatherListener(WeatherListener remove)
          Removes a weather listener from this weather surveyor.
 String status()
          Basic implementeation of the status method.
 
Methods inherited from class util.rmi.AbstractRmiCaster
bindAlternate, bindToRegistry, bindToRegistry, bindToRegistry, casterExit, casterExit, exit, getBindName, getBindName, isValid, unbindFromRegistry, unbindFromRegistry
 
Methods inherited from class util.rmi.RmiPropertyContainer
containsRemoteProperty, getRemoteProperties, getRemoteProperty, setRemoteProperty
 
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 class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface stella.sensor.WeatherSurveying
getAllSensors, getCurrentlyRetarding, getCurrentWeather, getSensor, registerSensorDriver, startSensors
 
Methods inherited from interface util.StatusProviding
provideStatus
 
Methods inherited from interface stella.ClusterDepending
registerCluster
 
Methods inherited from interface stella.Trigger
getElapsedToggleTime, getLastToggleTime, getTrigger, isTrue, setTrigger, toggleTrigger
 
Methods inherited from interface stella.Parameter
get, getFormatted, getName, getString, set
 
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
 
Methods inherited from interface util.Initializable
init
 

Field Detail

list

private List list
The registered listeners.

Constructor Detail

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.

Method Detail

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.