|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectutil.PropertyContainer
util.PropertyResources
util.PropertyBundles
util.rmi.RmiPropertyContainer
util.rmi.AbstractRmiListener
stella.rmi.AbstractRmiCasterAndListener
stella.rmi.ReceiverTorso
stella.rmi.GenericMaster
stella.environment.ShelterMaster
public abstract class ShelterMaster
The master program running at the environment control. It comprises shelter
control and a weather station. The environment master is not directly
controling the weather station or the shelter but merely acts as a
high-level
control device and speaks to the waether station via the
WeatherSurveying interface and to the shelter via the
RoofOperating interface. Since version 1.1 also the command
handling abilities (RmiCommandListener,
RmiAcknowledgeCaster and
RmiDoneCaster) are embedded within the environment
master rather than within the shelter receiver.
To allow remote control of the environment this class supports building
control via the BuildingControlling interface.
This interface allows the
remote registering and deregistering of command casters and can thus be
used to change the shelter mode between automatic, when the command caster
is
the SCS, and manual, when the registered command caster is a launch box.
The principal idea is that the shelter may only have a single driver object
registered to itself, while the weather station can get an entire list of
driveres, all registered sequentially by calls to the weather station's
WeatherSurveying.registerSensorDriver(io.Driver) method.
For implementations where the weather station and the shelter control uses
the same hardware for reading sensors and operating relays, a common
driver can be used if the #KEY_COMMONDRIVER is present. In this
case, this single
driver is constructed and initialized once and then registered
at both, the shelter operator and the weather surveyer. If this key is not
set, the KEY_WEATHERDRIVER and the KEY_SHELTERDRIVER are
used
to specify two different drivers for the shelter operator (single driver
only)
and the weather surveyer (can be a list of drivers), respectively.
If the host is booted and the environment master is started for the first
time, the GenericMaster.KEY_AUTOMATIC key determines whether automatic shelter
control is immediately enabled: If this property is true the environment
master tries to register at the #KEY_ENVIRONMENTCASTER as a command
listener immediately after startup, otherwise no command caster is
registered at. If the environment master starts up in manual mode the
KEY_STARTUPSHELTER is read and the actual position of the shelter
is
compared to the desired position. Possible values of
KEY_STARTUPSHELTER are:
close to close the shelter if found open at boot, open to
open
the shelter if found close, indifferent if the shelter should be left
in whatever state encountered. See also SHELTER_OPEN,
SHELTER_CLOSE, and SHELTER_INDIFFERENT.
If the weather station is hosted on the same machine as the shelter control
it may be advisable to directly link bad-weather events to a close-shelter
command, in case of lost connection to the SCS. If this behaviour is
desired, the KEY_DIRECTCLOSE key should point to true. For
direct opening, the KEY_DIRECTOPEN may be used. Note that
direct linking is only enabled in automatic mode.
Note that the ReceiverTorso.KEY_BIND-key only determines if the environment
master should nail its building control ability to the rmi-registry. The
binding of the weather station and of the shelter receiver is determined
within
their own property files.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class stella.rmi.GenericMaster |
|---|
GenericMaster.Standalone |
| Nested classes/interfaces inherited from class stella.rmi.ReceiverTorso |
|---|
ReceiverTorso.CommandHandler |
| Nested classes/interfaces inherited from class util.PropertyResources |
|---|
PropertyResources.URLResource |
| Field Summary | |
|---|---|
private Timer |
checker
Timer to check nominal against actual state on automatic shelter ops. |
private TimerTask |
checkit
The task the does the ckeck. |
private static boolean |
DEFCHECK
The default nominal/actual check property. |
private static long |
DEFCHECKINTERVALL
The default check intervall, in ms. |
private static long |
DEFCLOSETIME
The default timeout on total close, 5min. |
private static boolean |
DEFDIRECTCLOSE
The default direct linkage between weather and shelter control. |
private static boolean |
DEFDIRECTOPEN
The default direct linkage between weather and shelter control. |
private static String |
DEFNIGHTREMAIN
The default name of the light switch. |
private static long |
DEFNIGHTTIME
The default minimum remaining night time. |
private static long |
DEFOPENTIME
The default timeout on total open, 5min. |
private static String |
DEFSHELTER
The default name of the shelter-operator properties file. |
private static String |
DEFSTARTUPSHELTER
The default nominal shelter condition on start-up. |
private static String |
DEFWEATHER
The default name of the weatherstation properties file. |
private boolean |
islisten
True, if listening to weather events. |
static String |
KEY_CHECK
If true, a repetitive check of nominal/actual shelter status is done. |
static String |
KEY_CHECKINTERVALL
The intervall between checks. |
static String |
KEY_CLOSESHELTER
The shelter trigger for open, if present. |
static String |
KEY_CLOSETIME
The key for the whole closing phase time (ms). |
static String |
KEY_DIRECTCLOSE
If pointing to true, bad weather sparks a close-shelter command. |
static String |
KEY_DIRECTOPEN
If pointing to true, bad weather sparks a close-shelter command. |
static String |
KEY_LIGHTSWITCH
The light-switch. |
static String |
KEY_NIGHTREMAIN
If given, shelters open only if at least KEY_NIGHTTIME left. |
static String |
KEY_NIGHTTIME
The minimum time in ms that must remain for automatic shelter open. |
static String |
KEY_OPENSHELTER
The shelter trigger for open, if present. |
static String |
KEY_OPENTIME
The key for the whole opening phase time (ms). |
static String |
KEY_SHELTER
The properties of the shelter command handler. |
static String |
KEY_SHELTERDRIVER
A key to the driver name of the shelter control. |
static String |
KEY_STARTUPSHELTER
A key to the default nominal condition of the shelter if manual. |
static String |
KEY_WEATHER
The properties of the weather station. |
static String |
KEY_WEATHERDRIVER
A key to the list of drivernames of the weather station. |
protected Sheltering |
shelter
The shelter command handler. |
static String |
SHELTER_CLOSE
Useful constant for close shelter at start-up. |
static String |
SHELTER_INDIFFERENT
Useful constant for open shelter at start-up. |
static String |
SHELTER_OPEN
Useful constant for open shelter at start-up. |
private static int |
SHELTERPRIORITY
The priority of the shelter exit. |
private WeatherSurveying |
weather
The weather station. |
private static int |
WEATHERPRIORITY
The priority of the weather exit. |
| Fields inherited from class stella.rmi.GenericMaster |
|---|
DEFUNIQUE, KEY_ABORTTIME, KEY_AUTOMATIC, KEY_COMMTIME, KEY_COMMUNICATOR, KEY_DRIVERS, KEY_HISTORYDB, KEY_INITTIME, KEY_NODB, KEY_OBSERVEDB, KEY_OVERRULEAUTO, KEY_PARKTIME, KEY_PERMISSIONDB, KEY_PROPOSALDB, KEY_QUITTIME, KEY_REAUTO, KEY_RESETTIME, KEY_SET, KEY_SHUTDOWNDELAY, KEY_STATUSTIME, KEY_TARGETDB, KEY_TASKDB, KEY_UNIQUE, KEY_USERDB, lastabort, lastinit, lastpark, lastreset, telescope |
| Fields inherited from class stella.rmi.ReceiverTorso |
|---|
KEY_BIND, KEY_BINDNAME, KEY_COMMANDCASTER, KEY_ERRORCOOL |
| Fields inherited from class util.rmi.AbstractRmiListener |
|---|
KEY_ALIVE, KEY_EXPORTPORT, KEY_INIT, KEY_LISTENERNAME, KEY_RETRY, KEY_RETRYSLEEP |
| Fields inherited from class util.PropertyBundles |
|---|
KEY_LOCALECOUNTRY, KEY_LOCALELANGUAGE, KEY_RESOURCEBUNDLES |
| Fields inherited from class util.PropertyResources |
|---|
KEY_NOINITONCREATE, localurl, locate, POSTFIX_DIR, POSTFIX_EXT, POSTFIX_FILE, POSTFIX_LIST, POSTFIX_URL, urlset |
| Fields inherited from class util.PropertyContainer |
|---|
KEY_LISTSEPARATOR, KEY_MAPKEYVALUECHAR, KEY_MAPSEPARATOR |
| Fields inherited from interface stella.rmi.RmiAcknowledgeCaster |
|---|
NAMING_EXTENSION |
| Fields inherited from interface stella.rmi.RmiDoneCaster |
|---|
NAMING_EXTENSION |
| Fields inherited from interface util.StepInitializable |
|---|
KEY_INITDEPTH |
| Fields inherited from interface util.ResourceSupplying |
|---|
KEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOME |
| Fields inherited from interface util.PropertySupplying |
|---|
CONFIG, KEY_CLASS |
| Constructor Summary | |
|---|---|
protected |
ShelterMaster(Map<String,String> prop)
Constructs a new environment master. |
| Method Summary | |
|---|---|
boolean |
accepts(CommandEvent ce)
Returns true if this receiver accepts commands of the type handed over as an argument. |
boolean |
automatic()
Enables automatic roof operation. |
boolean |
close()
Closes all roofs if in manual mode. |
protected void |
direct()
Enables direct close-roof events on bad weather situations (only in automatic mode). |
void |
exit()
Exits the environement master. |
protected int |
getAcknowledgeNumber(CommandEvent cmd)
Returns the number of acknowledge events produced for each command. |
protected long |
getCompletionTime(CommandEvent cmd,
int acknr)
Returns the individual completion times. |
private void |
init2()
Third init step. |
private void |
init5()
Delay the init method of the receiver torso until we finished the initialization of the environment master. |
void |
initStep(int curstep)
The initializing section. |
boolean |
manual()
Disables automatic roof operation. |
boolean |
open()
Opens all shelters if in manual mode. |
protected boolean |
processCommand(CommandEvent cmd,
int acknr)
Process the command. |
void |
quit()
Deregisters the environment master from the registry. |
double |
reload()
On reload, we also issue a reload to the shelter and the weather station, if those are reloadable. |
boolean |
setDirectClose(boolean dirclose)
Changes the value of the direct-access close flag. |
boolean |
setDirectOpen(boolean diropen)
Changes the value of the direct-access open flag. |
protected Object |
statusMaster()
The method actually delivering the status lines. |
void |
weatherChanged(WeatherEvent we)
The weather event receiving edge of the environment master. |
| Methods inherited from class stella.rmi.AbstractRmiCasterAndListener |
|---|
bindToRegistry, getBindName, isValid, notifyErrorListener, removeErrorListener, removeRmiErrorListener, sendError, sendError, sendError, sendStatus, sendStatus, sendStatus, unbindFromRegistry |
| Methods inherited from class util.rmi.AbstractRmiListener |
|---|
allBound, blockBinding, blockBinding, disconnect, getIP, getListenerName, isConnected, listenerName, releaseBinding, releaseBinding, startBinding, startBinding |
| Methods inherited from class util.PropertyBundles |
|---|
clone, getLocalized, getLocalized, getLocalizedString, getLocalizedString, loadResource |
| Methods inherited from class util.PropertyResources |
|---|
createFrom, createFrom, createFrom, getApplet, getAsResources, getLocalClassLoader, getPropertiesToKey, getPropertiesToKey, getResource, getResourceAsStream, getResourceFromKey, getResources, init, keyCreate, keyCreate, reload, setApplet |
| Methods inherited from class util.PropertyContainer |
|---|
augment, augment, augment, defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsEnums, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, isNew, parseObject, removeProperty, setObject, setProperties, setProperty, stringProperties |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface stella.rmi.ListenerControlling |
|---|
external, getStatus, initialize, park, reset, setPassive |
| Methods inherited from interface util.rmi.RmiCaster |
|---|
bindToRegistry, isValid, unbindFromRegistry |
| Methods inherited from interface stella.ErrorCaster |
|---|
removeErrorListener |
| Methods inherited from interface util.rmi.RmiEventListener |
|---|
getListenerName |
| Methods inherited from interface util.rmi.RmiListener |
|---|
disconnect, isConnected |
| Methods inherited from interface util.ResourceSupplying |
|---|
getResource, getResourceAsStream, getResources |
| Methods inherited from interface util.PropertySupplying |
|---|
defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, parseObject, removeProperty, setObject, setProperty, stringProperties |
| Methods inherited from interface util.Initializable |
|---|
init |
| Field Detail |
|---|
public static final String KEY_WEATHER
public static final String KEY_SHELTER
public static final String KEY_WEATHERDRIVER
public static final String KEY_SHELTERDRIVER
public static final String KEY_CHECK
public static final String KEY_CHECKINTERVALL
public static final String KEY_STARTUPSHELTER
public static final String KEY_DIRECTOPEN
public static final String KEY_DIRECTCLOSE
public static final String KEY_OPENTIME
public static final String KEY_CLOSETIME
public static final String KEY_OPENSHELTER
public static final String KEY_CLOSESHELTER
public static final String KEY_LIGHTSWITCH
public static final String KEY_NIGHTREMAIN
KEY_NIGHTTIME left.
public static final String KEY_NIGHTTIME
public static final String SHELTER_OPEN
public static final String SHELTER_CLOSE
public static final String SHELTER_INDIFFERENT
private static final String DEFWEATHER
private static final String DEFSHELTER
private static final boolean DEFCHECK
private static final long DEFCHECKINTERVALL
private static final String DEFSTARTUPSHELTER
private static final boolean DEFDIRECTOPEN
private static final boolean DEFDIRECTCLOSE
private static final long DEFOPENTIME
private static final long DEFCLOSETIME
private static final String DEFNIGHTREMAIN
private static final long DEFNIGHTTIME
private WeatherSurveying weather
private boolean islisten
protected Sheltering shelter
private Timer checker
private TimerTask checkit
private static final int WEATHERPRIORITY
private static final int SHELTERPRIORITY
| Constructor Detail |
|---|
protected ShelterMaster(Map<String,String> prop)
throws RemoteException
PropertyResources.init() method. As common in final, rmi-enabled classes,
the environment master calls exportObject on the
UnicastRemoteObject server class.
RemoteException| Method Detail |
|---|
public void initStep(int curstep)
initStep in interface StepInitializableinitStep in class GenericMastercurstep - The current initialization depth.private void init2()
private void init5()
public void exit()
ExitCleaning, their exit method
is called.
exit in interface ExitCleaningexit in class GenericMasterpublic double reload()
reload in class GenericMaster
public boolean accepts(CommandEvent ce)
throws RemoteException
EnvironmentCommands.
accepts in interface RmiCommandListenerRemoteException
public boolean open()
throws RemoteException
RoofOperating#open method.
open in interface ShelterControllingRemoteException
public boolean close()
throws RemoteException
RoofOperating#close method.
close in interface ShelterControllingRemoteException
public boolean automatic()
throws RemoteException
#registerAt method with the default command caster as
an argument. Additionally, an automatic flag is set, which is used if
direct bad-weather reaction is intended. If the roof driver has
watchdogs, they are enabled on automatic mode.
automatic in interface ListenerControllingautomatic in class GenericMasterRemoteException
public boolean manual()
throws RemoteException
#deregisterAt method with the default command caster as
an argument. Additionally, the automatic flag is unset, which is used if
direct bad-weather reaction is intended. If the roof driver has
watchdogs, they are reset on manual mode.
manual in interface ListenerControllingmanual in class GenericMasterRemoteException
public boolean setDirectOpen(boolean diropen)
throws RemoteException
setDirectOpen in interface ShelterControllingRemoteException
public boolean setDirectClose(boolean dirclose)
throws RemoteException
setDirectClose in interface ShelterControllingRemoteException
public void quit()
throws RemoteException
ExitCleaning or CancelRunnable their
appropriate exit methods are invoked. Note that cleaning registry
of these two helper classes is only done in their exit methods if
they exist.
quit in interface ListenerControllingquit in interface ShelterControllingquit in class GenericMasterRemoteExceptionprotected void direct()
RoofOperating interface. Please keep in mind that
direct interaction is only allowed in robotic i.e. robotic mode, see
weatherChanged(stella.sensor.WeatherEvent).
public void weatherChanged(WeatherEvent we)
direct() method. Here, the weather event is checked for bad
weather. If so, the shelter operator gets directly a signal to close the
shelter without waiting for a close-shelter from the default command
caster.
Note that closing of the shelter is only allowed in robotic mode.
weatherChanged in interface WeatherListenerprotected int getAcknowledgeNumber(CommandEvent cmd)
getAcknowledgeNumber in class GenericMaster
protected long getCompletionTime(CommandEvent cmd,
int acknr)
getCompletionTime in class GenericMastercmd - The command to process.acknr - The number of the acknowledge that will be sent back.
protected boolean processCommand(CommandEvent cmd,
int acknr)
RoofOperating
instance only.
processCommand in class GenericMasterprotected Object statusMaster()
GenericMaster.getStatus() method. This method
returns a list of status events.
statusMaster in class GenericMaster
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||