public abstract class ShelterMaster extends GenericMaster implements ShelterControlling, WeatherListener
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.
GenericMaster.StandaloneReceiverTorso.CommandHandlerPropertyResources.Load, PropertyResources.URLResource| Modifier and Type | Field and Description |
|---|---|
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 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 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.
|
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, telescopeKEY_BIND, KEY_BINDNAME, KEY_COMMANDCASTER, KEY_ERRORCOOLKEY_ALIVE, KEY_EXPORTPORT, KEY_INIT, KEY_LISTENERNAME, KEY_RETRY, KEY_RETRYSLEEPKEY_NOINITONCREATE, POSTFIX_ALPHABET, POSTFIX_BYTES, POSTFIX_DIR, POSTFIX_EXT, POSTFIX_FILE, POSTFIX_LIST, POSTFIX_MODTIME, POSTFIX_URLKEY_LISTSEPARATOR, KEY_MAPKEYVALUECHAR, KEY_MAPSEPARATORNAMING_EXTENSIONNAMING_EXTENSIONKEY_INITDEPTHKEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOMECONFIG, KEY_CLASS| Modifier | Constructor and Description |
|---|---|
protected |
ShelterMaster(Map<String,String> prop)
Constructs a new environment master.
|
| Modifier and Type | Method and Description |
|---|---|
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(CommandEvent dummy)
The method actually delivering the status lines.
|
private void |
triggerShelterForOpen(boolean good) |
void |
weatherChanged(WeatherEvent we)
The weather event receiving edge of the environment master.
|
private boolean |
weatherDemandsClosed()
Return true if the current weather conditions demand for a shelter-close.
|
abortMaster, addErrorListener, addRmiErrorListener, createCommunicator, createCommunicator, external, formatWithGlobals, getAllDrivers, getDriver, getHistorySql, getObserveSql, getOffsetCaster, getParameterByKey, getParameterByName, getParameterCluster, getParameterValueByKey, getParameterValueByName, getPermissionSql, getProposalSql, getStatus, getTargetSql, getTaskSql, getUnique, getUniqueId, getUserSql, initialize, initializeMaster, isAlive, isAuto, isManual, isPassive, park, parkMaster, quitMaster, rescanned, reset, resetAlarm, resetAllDrivers, resetMaster, restartAllDrivers, revert, rmiAddParameter, rmiCommand, rmiGet, rmiGetAllParameterNames, rmiRemoveParameter, rmiSet, setLastError, setOff, setParameterValueByKey, setParameterValueByName, setPassive, shutdown, zeroAllOmcaddRmiAcknowledgeListener, addRmiDoneListener, bindDefault, containsRemoteProperty, deregisterAtCaster, equals, getLastError, getRemoteProperties, getRemoteProperty, hashCode, notifyAcknowledgeListener, notifyDoneListener, registerAtCaster, removeRmiAcknowledgeListener, removeRmiDoneListener, sendAllPrematureDone, sendPrematureDone, setRemoteProperty, toString, unbindDefaultbindToRegistry, getBindName, isValid, notifyErrorListener, removeErrorListener, removeRmiErrorListener, sendError, sendError, sendError, sendStatus, sendStatus, sendStatus, unbindFromRegistryallBound, blockBinding, blockBinding, disconnect, getIP, getListenerName, isConnected, listenerName, releaseBinding, releaseBinding, startBinding, startBindingclone, createFrom, createFrom, createFrom, createInstance, getApplet, getAsResources, getLocate, getPropertiesToKey, getPropertiesToKey, getResource, getResourceAsStream, getResourceFromKey, getResources, hasLocalURLs, initProperties, keyCreate, keyCreate, reload, setAppletaugment, augment, 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, parseObject, removeProperty, requires, setObject, setProperties, setProperty, stringPropertiesfinalize, getClass, notify, notifyAll, wait, wait, waitexternal, getStatus, initialize, park, reset, setPassivebindToRegistry, isValid, unbindFromRegistryremoveErrorListenergetListenerNamedisconnect, isConnecteddefaultBoolean, 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, stringPropertiespublic 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 String DEFNIGHTREMAIN
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
protected ShelterMaster(Map<String,String> prop) throws RemoteException
#init method. As common in final, rmi-enabled classes, the
environment master calls exportObject on the
UnicastRemoteObject server class.RemoteExceptionpublic void initStep(int curstep)
throws InitException
initStep in interface StepInitializableinitStep in class GenericMasterInitExceptionprivate 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 GenericMasterpublic boolean accepts(CommandEvent ce) throws RemoteException
EnvironmentCommands.accepts in interface RmiCommandListenerRemoteExceptionpublic boolean open()
throws RemoteException
Sheltering.open(boolean) method.open in interface ShelterControllingRemoteExceptionpublic boolean close()
throws RemoteException
Sheltering.close(boolean) method.close in interface ShelterControllingRemoteExceptionpublic 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 GenericMasterRemoteExceptionprivate boolean weatherDemandsClosed()
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 GenericMasterRemoteExceptionpublic boolean setDirectOpen(boolean diropen)
throws RemoteException
setDirectOpen in interface ShelterControllingRemoteExceptionpublic boolean setDirectClose(boolean dirclose)
throws RemoteException
setDirectClose in interface ShelterControllingRemoteExceptionpublic 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 WeatherListenerprivate void triggerShelterForOpen(boolean good)
good - If weather is clearprotected int getAcknowledgeNumber(CommandEvent cmd)
getAcknowledgeNumber in class GenericMasterprotected 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(CommandEvent dummy)
GenericMaster.getStatus() method. This method
returns a list of status events.statusMaster in class GenericMasterdummy - Non-null in automatic mode.