|
||||||||||
| 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
stella.environment.EnvironmentMaster
public final class EnvironmentMaster
The master program running at the environment control. It comprises roof
control and a weather station. The environment master is not directly
controling the weather station or the roof but merely acts as a high-level
control device and speaks to the waether station via the
WeatherSurveying interface and to the roof 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 roof 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 roof 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 roof 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 method.
For implementations where the weather station and the roof 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 roof operator and the weather surveyer. If this key is not
set, the ShelterMaster.KEY_WEATHERDRIVER and the #KEY_ROOFDRIVER are used
to specify two different drivers for the roof 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 roof
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_STARTUPROOF is read and the actual position of the roof is
compared to the desired position. Possible values of
#KEY_STARTUPROOF are:
close to close the roof if found open at boot, open to open
the roof if found close, indifferent if the roof should be left
in whatever state encountered. See also #ROOF_OPEN,
#ROOF_CLOSE, and #ROOF_INDIFFERENT.
If the weather station is hosted on the same machine as the roof control
it may be advisable to directly link bad-weather events to a close-roof
command, in case of lost connection to the SCS. If this behaviour is
desired, the ShelterMaster.KEY_DIRECTCLOSE key should point to true. For
direct opening, the ShelterMaster.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 roof 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 List<String> |
cachelist
A list of all cache values we should register to. |
private static boolean |
DEFBIND
The default binding behavior of the building control. |
private static String |
DEFBINDNAME
The default binding name of the environment master. |
private static long |
DEFCLOSETIME
The default timeout on total close, 5min. |
private static String |
DEFLIGHTSWITCH
The default name of the light switch. |
private static long |
DEFOPENTIME
The default timeout on total open, 5min. |
private static long |
DEFPOWERTIME
The default power switching time, 5 sec. |
private static long |
DEFRESETTIME
The default limit switch reset time, 5 sec. |
private static String |
DEFROOFINFO
The default pollerkeys to listen to for roof info. |
static String |
KEY_POWERTIME
The key for the time required for power chances. |
static String |
KEY_RESETTIME
The key for the time required for limit switch resets. |
static String |
KEY_ROOFINFO
The poller-cache keys to the roof info. |
private PollingRS485Server |
roofrs485
The RS485-server delivering cache-changed events. |
| Fields inherited from class stella.environment.ShelterMaster |
|---|
KEY_CHECK, KEY_CHECKINTERVALL, KEY_CLOSESHELTER, KEY_CLOSETIME, KEY_DIRECTCLOSE, KEY_DIRECTOPEN, KEY_LIGHTSWITCH, KEY_NIGHTREMAIN, KEY_NIGHTTIME, KEY_OPENSHELTER, KEY_OPENTIME, KEY_SHELTER, KEY_SHELTERDRIVER, KEY_STARTUPSHELTER, KEY_WEATHER, KEY_WEATHERDRIVER, shelter, SHELTER_CLOSE, SHELTER_INDIFFERENT, SHELTER_OPEN |
| 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_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 | |
|---|---|
EnvironmentMaster(Map<String,String> prop)
Constructs a new environment master. |
|
| Method Summary | |
|---|---|
boolean |
automatic()
Enables automatic roof operation. |
boolean |
closeLeft()
Closes the left roof if in manual mode. |
boolean |
closeRight()
Closes the right roof if in manual mode. |
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. |
protected ErrorEvent |
getLastError()
Returns the last error event generated during a command subroutine. |
private void |
init2a()
Third init step. |
protected boolean |
initializeMaster()
Initializes the environment. |
void |
initStep(int curstep)
The initializing section. |
static void |
main(String[] arg)
Starts the environment master with the given properties. |
boolean |
manual()
Disables automatic roof operation. |
void |
newValue(CacheChangedEvent cce)
Signals that the cache value linked to one of the roof info modules has changed its value. |
boolean |
openLeft()
Opens the left roof if in manual mode. |
boolean |
openRight()
Opens the left roof if in manual mode. |
protected boolean |
parkMaster()
Parks the environment, first part. |
boolean |
powerOff()
Powers down the roof if in manual mode. |
boolean |
powerOn()
Powers up the roof if in manual mode. |
protected boolean |
processCommand(CommandEvent cmd,
int acknr)
Process the command. |
double |
rescanned(String key,
String old,
String newval)
On reload, we throw an exception if the driver changed, but not if the configuration of the driver changed. |
protected boolean |
resetMaster()
Resets the environment. |
void |
shutdownWatchdogs()
Disables watchdogs in all drivers if they are subclasses of WatchdogRS485Server. |
| Methods inherited from class stella.environment.ShelterMaster |
|---|
accepts, close, direct, exit, open, quit, reload, setDirectClose, setDirectOpen, statusMaster, weatherChanged |
| 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.ShelterControlling |
|---|
close, open, quit, setDirectClose, setDirectOpen |
| Methods inherited from interface stella.rmi.ListenerControlling |
|---|
external, getStatus, initialize, park, reset, setPassive |
| Methods inherited from interface util.Reloadable |
|---|
reload |
| 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_POWERTIME
public static final String KEY_RESETTIME
public static final String KEY_ROOFINFO
private static final boolean DEFBIND
private static final String DEFBINDNAME
private static final String DEFROOFINFO
private static final long DEFOPENTIME
private static final long DEFCLOSETIME
private static final long DEFPOWERTIME
private static final long DEFRESETTIME
private static final String DEFLIGHTSWITCH
private PollingRS485Server roofrs485
private List<String> cachelist
| Constructor Detail |
|---|
public EnvironmentMaster(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 ShelterMastercurstep - The current initialization depth.private void init2a()
public double rescanned(String key,
String old,
String newval)
rescanned in interface Reloadablerescanned in class GenericMasterpublic void newValue(CacheChangedEvent cce)
cachelist) and the new value of the
cache. Receivers can catch these status events and use them to
e.g. update an JRoofView display.
newValue in interface CacheChangedListener
public boolean openLeft()
throws RemoteException
RoofOperating.openLeft() method.
openLeft in interface BuildingControllingRemoteException
public boolean openRight()
throws RemoteException
RoofOperating.openRight() method.
openRight in interface BuildingControllingRemoteException
public boolean closeRight()
throws RemoteException
RoofOperating.closeRight() method.
closeRight in interface BuildingControllingRemoteException
public boolean closeLeft()
throws RemoteException
RoofOperating.closeLeft() method.
closeLeft in interface BuildingControllingRemoteException
public boolean powerOn()
throws RemoteException
RoofOperating.powerOn() method.
powerOn in interface BuildingControllingRemoteException
public boolean powerOff()
throws RemoteException
RoofOperating.powerOff() method.
powerOff in interface BuildingControllingRemoteException
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 ShelterMasterRemoteException
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 ShelterMasterRemoteException
public void shutdownWatchdogs()
throws RemoteException
WatchdogRS485Server. This happens automatically during
ShelterMaster.quit() if the WatchdogRS485Server.KEY_RESETONCLOSE
property points to true. Different to manual action, this method resets
all watchdogs on any driver, not only the roof driver.
shutdownWatchdogs in interface BuildingControllingRemoteExceptionprotected int getAcknowledgeNumber(CommandEvent cmd)
getAcknowledgeNumber in class ShelterMaster
protected long getCompletionTime(CommandEvent cmd,
int acknr)
getCompletionTime in class ShelterMastercmd - The command to process.acknr - The number of the acknowledge that will be sent back.protected ErrorEvent getLastError()
getLastError in class GenericMaster
protected boolean processCommand(CommandEvent cmd,
int acknr)
RoofOperating
instance only.
processCommand in class ShelterMasterprotected boolean resetMaster()
resetMaster in class GenericMasterprotected boolean parkMaster()
parkMaster in class GenericMasterprotected boolean initializeMaster()
initializeMaster in class GenericMaster
public static void main(String[] arg)
throws RemoteException
RemoteException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||