stella.environment
Class DomeMaster

java.lang.Object
  extended by util.PropertyContainer
      extended by util.PropertyResources
          extended by util.PropertyBundles
              extended by util.rmi.RmiPropertyContainer
                  extended by util.rmi.AbstractRmiListener
                      extended by stella.rmi.AbstractRmiCasterAndListener
                          extended by stella.rmi.ReceiverTorso
                              extended by stella.rmi.GenericMaster
                                  extended by stella.environment.ShelterMaster
                                      extended by stella.environment.DomeMaster
All Implemented Interfaces:
Cloneable, Remote, EventListener, Caster, ErrorSending, ErrorCaster, Alive, DomeControlling, ListenerControlling, RmiAcknowledgeCaster, RmiCommandListener, RmiDoneCaster, RmiErrorCaster, RmiParameterClustering, ShelterControlling, WeatherListener, ExitCleaning, Initializable, LocalizedSupplying, PropertySupplying, Reloadable, ResourceSupplying, RmiCaster, RmiEventListener, RmiListener, RmiPropertyBearing, TriggerableReload, StepInitializable

public final class DomeMaster
extends ShelterMaster
implements DomeControlling, Reloadable

The master program running at the environment control. It comprises dome control and a weather station. The environment master is not directly controling the weather station or the dome 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 DomeOperating 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 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 DEFCLOSEHATCHTIME
          The default timeout on total close, 5min.
private static long DEFCLOSESLITTIME
          The default timeout on total close, 5min.
private static long DEFFOLLOWTIME
          The default limit switch reset time, 5 sec.
private static long DEFHOMETIME
          The default limit switch reset time, 5 sec.
private static long DEFOPENHATCHTIME
          The default timeout on total open, 5min.
private static long DEFOPENSLITTIME
          The default timeout on total open, 5min.
private static long DEFPOWERTIME
          The default power switching time, 5 sec.
private static long DEFSTOPTIME
          The default limit switch reset time, 5 sec.
static String KEY_CLOSEHATCHTIME
          The time to close the hatch.
static String KEY_CLOSESLITTIME
          The time to close the slit
static String KEY_FOLLOWTIME
          The key for the time required for moving the dome to any position.
static String KEY_HOMETIME
          The key for the time required for homing.
static String KEY_OPENHATCHTIME
          The time to open tha hatch.
static String KEY_OPENSLITTIME
          The time to open the slit.
static String KEY_POWERTIME
          The key for the time required for power chances.
static String KEY_STOPTIME
          The key for the time required for homing.
 
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_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
DomeMaster(Map<String,String> prop)
          Constructs a new environment master.
 
Method Summary
 boolean closeHatch()
          Closes the hatch of the dome.
 boolean closeSlit()
          Closes the slit of the dome.
 boolean followDome(double ra, double de)
          Follows the dome at the sky position indicated.
 boolean followSun()
          Follows the the anti-solar position.
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.
 boolean homeDome()
          Moves the dome to its home position and stops there.
protected  boolean initializeMaster()
          Initializes the environment.
static void main(String[] arg)
          Starts the environment master with the given properties.
 boolean moveDome(double az)
          Moves the dome to the azimuth indicated and stops there.
 boolean openHatch()
          Opens the hatch of the dome.
 boolean openSlit()
          Opens the slit of the dome.
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.
protected  void quitMaster()
          Quits the environment, first part.
 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.
 boolean stopDome()
          Stops the dome.
 
Methods inherited from class stella.environment.ShelterMaster
accepts, automatic, close, direct, exit, initStep, manual, open, quit, reload, setDirectClose, setDirectOpen, statusMaster, weatherChanged
 
Methods inherited from class stella.rmi.GenericMaster
abortMaster, addErrorListener, addRmiErrorListener, createCommunicator, external, formatWithGlobals, getAllDrivers, getDriver, getHistorySql, getLastError, getObserveSql, getParameterByKey, getParameterByName, getParameterCluster, getParameterValueByKey, getParameterValueByName, getPermissionSql, getProposalSql, getStatus, getTargetSql, getTaskSql, getUnique, getUserSql, initialize, isAlive, isAuto, isManual, isPassive, park, reset, restartAllDrivers, restartNamedDriver, revert, rmiAddParameter, rmiCommand, rmiGet, rmiGetAllParameterNames, rmiRemoveParameter, rmiSet, setLastError, setParameterValueByKey, setParameterValueByName, setPassive, shutdown, zeroAllOmc
 
Methods inherited from class stella.rmi.ReceiverTorso
addRmiAcknowledgeListener, addRmiDoneListener, bindDefault, containsRemoteProperty, deregisterAtCaster, equals, getRemoteProperties, getRemoteProperty, hashCode, notifyAcknowledgeListener, notifyDoneListener, registerAtCaster, removeRmiAcknowledgeListener, removeRmiDoneListener, sendAllPrematureDone, sendPrematureDone, setRemoteProperty, toString, unbindDefault
 
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
automatic, external, getStatus, initialize, manual, 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

KEY_POWERTIME

public static final String KEY_POWERTIME
The key for the time required for power chances.

See Also:
Constant Field Values

KEY_HOMETIME

public static final String KEY_HOMETIME
The key for the time required for homing.

See Also:
Constant Field Values

KEY_STOPTIME

public static final String KEY_STOPTIME
The key for the time required for homing.

See Also:
Constant Field Values

KEY_FOLLOWTIME

public static final String KEY_FOLLOWTIME
The key for the time required for moving the dome to any position.

See Also:
Constant Field Values

KEY_OPENHATCHTIME

public static final String KEY_OPENHATCHTIME
The time to open tha hatch.

See Also:
Constant Field Values

KEY_OPENSLITTIME

public static final String KEY_OPENSLITTIME
The time to open the slit.

See Also:
Constant Field Values

KEY_CLOSEHATCHTIME

public static final String KEY_CLOSEHATCHTIME
The time to close the hatch.

See Also:
Constant Field Values

KEY_CLOSESLITTIME

public static final String KEY_CLOSESLITTIME
The time to close the slit

See Also:
Constant Field Values

DEFBIND

private static final boolean DEFBIND
The default binding behavior of the building control.

See Also:
Constant Field Values

DEFBINDNAME

private static final String DEFBINDNAME
The default binding name of the environment master.

See Also:
Constant Field Values

DEFOPENHATCHTIME

private static final long DEFOPENHATCHTIME
The default timeout on total open, 5min.

See Also:
Constant Field Values

DEFOPENSLITTIME

private static final long DEFOPENSLITTIME
The default timeout on total open, 5min.

See Also:
Constant Field Values

DEFCLOSEHATCHTIME

private static final long DEFCLOSEHATCHTIME
The default timeout on total close, 5min.

See Also:
Constant Field Values

DEFCLOSESLITTIME

private static final long DEFCLOSESLITTIME
The default timeout on total close, 5min.

See Also:
Constant Field Values

DEFPOWERTIME

private static final long DEFPOWERTIME
The default power switching time, 5 sec.

See Also:
Constant Field Values

DEFHOMETIME

private static final long DEFHOMETIME
The default limit switch reset time, 5 sec.

See Also:
Constant Field Values

DEFSTOPTIME

private static final long DEFSTOPTIME
The default limit switch reset time, 5 sec.

See Also:
Constant Field Values

DEFFOLLOWTIME

private static final long DEFFOLLOWTIME
The default limit switch reset time, 5 sec.

See Also:
Constant Field Values
Constructor Detail

DomeMaster

public DomeMaster(Map<String,String> prop)
           throws RemoteException
Constructs a new environment master. Sets default values for the properties if not given. Initializing of the helper classes is done in the PropertyResources.init() method. As common in final, rmi-enabled classes, the environment master calls exportObject on the UnicastRemoteObject server class.

Throws:
RemoteException
Method Detail

rescanned

public 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.

Specified by:
rescanned in interface Reloadable
Overrides:
rescanned in class GenericMaster

powerOn

public boolean powerOn()
                throws RemoteException
Powers up the roof if in manual mode. Directly invokes the DomeOperating.powerOn() method.

Specified by:
powerOn in interface DomeControlling
Returns:
True if power-up was successful.
Throws:
RemoteException

powerOff

public boolean powerOff()
                 throws RemoteException
Powers down the roof if in manual mode. Directly invokes the DomeOperating.powerOff() method.

Specified by:
powerOff in interface DomeControlling
Returns:
True if power-down was successful.
Throws:
RemoteException

followDome

public boolean followDome(double ra,
                          double de)
                   throws RemoteException
Follows the dome at the sky position indicated. Only in manual mode.

Specified by:
followDome in interface DomeControlling
Parameters:
ra - Right ascension of sky position in degrees, actual equ.
de - Declination of sky position in degrees, actual equ.
Returns:
True if power-down was successful.
Throws:
RemoteException

followSun

public boolean followSun()
                  throws RemoteException
Follows the the anti-solar position. Only in manual mode.

Specified by:
followSun in interface DomeControlling
Returns:
True if power-down was successful.
Throws:
RemoteException

moveDome

public boolean moveDome(double az)
                 throws RemoteException
Moves the dome to the azimuth indicated and stops there. Only in manual mode.

Specified by:
moveDome in interface DomeControlling
Parameters:
az - Astronomical azimuth (S=0, W=90) in degrees, actual equ.
Returns:
True if power-down was successful.
Throws:
RemoteException

homeDome

public boolean homeDome()
                 throws RemoteException
Moves the dome to its home position and stops there. Only in manual mode.

Specified by:
homeDome in interface DomeControlling
Returns:
True if power-down was successful.
Throws:
RemoteException

stopDome

public boolean stopDome()
                 throws RemoteException
Stops the dome. Allowed also in automatic mode as a emergency stop.

Specified by:
stopDome in interface DomeControlling
Returns:
True if power-down was successful.
Throws:
RemoteException

openSlit

public boolean openSlit()
                 throws RemoteException
Opens the slit of the dome. Only in manual mode.

Specified by:
openSlit in interface DomeControlling
Returns:
True if power-down was successful.
Throws:
RemoteException

openHatch

public boolean openHatch()
                  throws RemoteException
Opens the hatch of the dome. Only in manual mode.

Specified by:
openHatch in interface DomeControlling
Returns:
True if power-down was successful.
Throws:
RemoteException

closeSlit

public boolean closeSlit()
                  throws RemoteException
Closes the slit of the dome. Only in manual mode.

Specified by:
closeSlit in interface DomeControlling
Returns:
True if power-down was successful.
Throws:
RemoteException

closeHatch

public boolean closeHatch()
                   throws RemoteException
Closes the hatch of the dome. Only in manual mode.

Specified by:
closeHatch in interface DomeControlling
Returns:
True if power-down was successful.
Throws:
RemoteException

getAcknowledgeNumber

protected int getAcknowledgeNumber(CommandEvent cmd)
Returns the number of acknowledge events produced for each command. If the command is unknown an IllegalArgumentException is thrown.

Overrides:
getAcknowledgeNumber in class ShelterMaster

getCompletionTime

protected long getCompletionTime(CommandEvent cmd,
                                 int acknr)
Returns the individual completion times. If the command is unknown an IllegalArgumentException is thrown.

Overrides:
getCompletionTime in class ShelterMaster
Parameters:
cmd - The command to process.
acknr - The number of the acknowledge that will be sent back.

processCommand

protected boolean processCommand(CommandEvent cmd,
                                 int acknr)
Process the command. Except the status command, only roof commands are treated by the environment, as of current writing. Therefore, all commands call the appropriate methods in the DomeOperating instance only.

Overrides:
processCommand in class ShelterMaster

resetMaster

protected boolean resetMaster()
Resets the environment.

Specified by:
resetMaster in class GenericMaster

parkMaster

protected boolean parkMaster()
Parks the environment, first part. Roofs are closed.

Specified by:
parkMaster in class GenericMaster

quitMaster

protected void quitMaster()
Quits the environment, first part. Roofs are closed, power down

Overrides:
quitMaster in class GenericMaster

initializeMaster

protected boolean initializeMaster()
Initializes the environment.

Specified by:
initializeMaster in class GenericMaster

main

public static void main(String[] arg)
                 throws RemoteException
Starts the environment master with the given properties. Does not check for a running instance, thus starting the environment master multiple times may cause problems.

Throws:
RemoteException