stella.sensor
Class AbstractDataCollector

java.lang.Object
  extended by util.PropertyContainer
      extended by stella.sensor.AbstractDataCollector
All Implemented Interfaces:
Cloneable, DataCollecting, Initializable, PropertyBearing
Direct Known Subclasses:
DatabaseCurrent, FileCurrent

public abstract class AbstractDataCollector
extends PropertyContainer
implements DataCollecting

An abstract implementation of the DataCollecting interface. It provides (protected) construction with a single properties argument and may thus be used as a progenitor for local data collectors. The static method createDataCollector(java.util.Map) to create DataCollecting or RmiDataCollecting instances out of property files returns an object which may be cast to the appropriate type.


Nested Class Summary
 
Nested classes/interfaces inherited from class util.PropertyContainer
PropertyContainer.URLResource
 
Field Summary
static String KEY_CLASS
          The key mapping to the data collector class name.
static String KEY_INTERVAL
          The key mapping to the notification interval.
static String KEY_RMIDATACOLLECT
          The key mapping to the remote data collector bind name.
 
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_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOME
 
Constructor Summary
protected AbstractDataCollector(Map prop)
          Constructs a new data collector with the specified properties.
 
Method Summary
static Object createDataCollector(Map prop)
          Constructs a new data collector instance using the mapping of the KEY_CLASS to the class name to derive the class to instantiate.
private static RmiDataCollecting createRmiDataCollector(Map pr)
          Returns a remote-enabled data collector instance.
 
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.DataCollecting
getInterval, processData
 

Field Detail

KEY_CLASS

public static final String KEY_CLASS
The key mapping to the data collector class name.

See Also:
Constant Field Values

KEY_RMIDATACOLLECT

public static final String KEY_RMIDATACOLLECT
The key mapping to the remote data collector bind name.

See Also:
Constant Field Values

KEY_INTERVAL

public static final String KEY_INTERVAL
The key mapping to the notification interval.

See Also:
Constant Field Values
Constructor Detail

AbstractDataCollector

protected AbstractDataCollector(Map prop)
Constructs a new data collector with the specified properties.

Method Detail

createDataCollector

public static final Object createDataCollector(Map prop)
Constructs a new data collector instance using the mapping of the KEY_CLASS to the class name to derive the class to instantiate. If this property is defined, a new DataCollecting instance with the stated class name is created, the supplied properties used as an argument in the constructor.
Remote instances of a data collector are characterized by the presence of the KEY_RMIDATACOLLECT key. In this case, the data collector is not constructed but rather looked up in the registry. The remote reference found is returned as an RmiDataCollecting instance.

If unsuccessful due to various pits prtesent, null is returned.

Returns:
An object that is either a DataCollecting or a RmiDataCollecting instance.

createRmiDataCollector

private static final RmiDataCollecting createRmiDataCollector(Map pr)
Returns a remote-enabled data collector instance. Different to the createDataCollector(java.util.Map) method, this method does not construct a new object, but retrieves the instance of a registry-bound RmiDataCollecting object via a registry lookup.

Returns:
The stub-implementation of an rmi data collector.