|
||||||||||
| 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
public abstract class GenericMaster
A generic parent class for device masters. Carries a parameter set and
completion-times for Generic commands.
| Nested Class Summary | |
|---|---|
static class |
GenericMaster.Standalone
Standalone class that does not respond to commands, but provides a set of global variables and switches. |
| Nested classes/interfaces inherited from class stella.rmi.ReceiverTorso |
|---|
ReceiverTorso.CommandHandler |
| Nested classes/interfaces inherited from class util.PropertyResources |
|---|
PropertyResources.URLResource |
| Field Summary | |
|---|---|
private boolean |
auto
True, if we are in automatic mode. |
private static long |
DEFABORTTIME
The default abort time. |
private static boolean |
DEFAUTOMATIC
The default automatic-mode of the roof. |
private static long |
DEFCOMMTIME
The time to wait for the telescope to come up. |
private static long |
DEFINITTIME
The default init time. |
private static boolean |
DEFNODB
Normally, we allow db connections |
private static boolean |
DEFOVERRULEAUTO
Normally, commands are ignored in manual mode |
private static long |
DEFPARKTIME
The default park time. |
private static long |
DEFQUITTIME
The default quit time acknowledge. |
private static long |
DEFREAUTO
Per default we stay in manual until set to automatic again |
private static long |
DEFRESETTIME
The default reset time. |
private static long |
DEFSHUTDOWNDELAY
The default shutdown delay time, 5 sec. |
private static long |
DEFSTATUSTIME
The default status time. |
static String |
DEFUNIQUE
The default name of the unique name identifier string. |
private static int |
DRIVERPRIORITY
The priority of the driver exit. |
private Map<String,Driver> |
drivers
The mapping of driver names against the drivers of the master. |
private RmiCommandCaster |
externcaster
A reference to the caster, if we are in external listening mode. |
private HistorySql |
histsql
The history-db reference. |
static String |
KEY_ABORTTIME
Time for the abort command. |
static String |
KEY_AUTOMATIC
A key to the start-up mode automatic/manual. |
static String |
KEY_COMMTIME
The time to wait for the telescope to come up. |
static String |
KEY_COMMUNICATOR
The properties of the a telescope caster class. |
static String |
KEY_DRIVERS
The properties of the drivers served by this generic master. |
static String |
KEY_HISTORYDB
If special history-db properties are required. |
static String |
KEY_INITTIME
Time for the init command. |
static String |
KEY_NODB
If true, no dbs are inited. |
static String |
KEY_OBSERVEDB
If special observe-db properties are required. |
static String |
KEY_OVERRULEAUTO
If true, commands are also excepted in manual mode. |
static String |
KEY_PARKTIME
Time for the park command. |
static String |
KEY_PERMISSIONDB
If special permission-db properties are required. |
static String |
KEY_PROPOSALDB
If special proposal-db properties are required. |
static String |
KEY_QUITTIME
Time for the quit command. |
static String |
KEY_REAUTO
If non-null, the time intervall when we go back from manual to auto. |
static String |
KEY_RESETTIME
Time for the reset command. |
static String |
KEY_SET
The properties of the parameter set served by this generic master. |
static String |
KEY_SHUTDOWNDELAY
The time delay from receiving quit-command until orderly shutdown. |
static String |
KEY_STATUSTIME
Time for the status command. |
static String |
KEY_TARGETDB
If special target-db properties are required. |
static String |
KEY_TASKDB
If special task-db properties are required. |
static String |
KEY_UNIQUE
The unique name identifier string for acquire and guiding. |
static String |
KEY_USERDB
If special user-db properties are required. |
protected Date |
lastabort
Last date an abort command was received. |
private String |
lastdate
For naming of acquire/guide frames. |
private ErrorEvent |
lasterror
The error message generated during last command execution. |
protected Date |
lastinit
Last date an init command was received. |
protected Date |
lastpark
Last date an park command was received. |
protected Date |
lastreset
Last date an reset command was received. |
private ObserveSql |
observesql
The history-db reference. |
private boolean |
passive
If passive, all commands in automatic mode are answered with complete. |
private PermissionSql |
permsql
The history-db reference. |
private ProposalSql |
proposalsql
The history-db reference. |
private ParameterClustering |
set
The parameter cluster of the adapter. |
private static int |
SETPRIORITY
The priority of the set exit. |
private int |
targetcount
The target acquired at this date. |
private TargetSql |
targetsql
The history-db reference. |
private TaskSql |
tasksql
The history-db reference. |
protected TelescopeCaster |
telescope
If we have a communicator it is available after init1. |
private UserSql |
usersql
The history-db reference. |
| 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 |
GenericMaster(Map<String,String> prop)
Constructs a new generic master and defaults done times for Generic commands. |
| Method Summary | |
|---|---|
protected boolean |
abortMaster()
Method called to abort the device. |
void |
addErrorListener(ErrorListener ear)
If we register a new error listener, we check if we have current status messages. |
void |
addRmiErrorListener(RmiErrorListener ear)
If we register a new rmi-error listener, we check if we have current status messages. |
boolean |
automatic()
The automatic mode. |
protected boolean |
createCommunicator(String key)
(Re)creates the communicator. |
void |
exit()
Exits the master by first exiting the drivers, then exiting the parameter set and then commancing super.exit. |
boolean |
external(Remote caster)
Enrolls or deregisters from an external caster. |
protected String |
formatWithGlobals(String fill,
Map<String,Object> extern)
Formatting a fits file name from a place-holder supplied. |
protected int |
getAcknowledgeNumber(CommandEvent cmd)
Returns the number of acknowledge event to be sent back as a function of the command type. |
Collection<Driver> |
getAllDrivers()
Returns a collection of all drivers hosted. |
protected long |
getCompletionTime(CommandEvent cmd,
int acknr)
Returns the completion time for the specified command. |
Driver |
getDriver(String drivername)
Access to the driver of the given name. |
HistorySql |
getHistorySql()
Accesor to db table. |
protected ErrorEvent |
getLastError()
Returns the last error event generated during a command subroutine. |
ObserveSql |
getObserveSql()
Accesor to db table. |
Parameter |
getParameterByKey(String key)
Access to a parameter from its property key. |
Parameter |
getParameterByName(String name)
Access to a paramter by its name. |
protected ParameterClustering |
getParameterCluster()
Access to the entire parameter set for daughter classes. |
Object |
getParameterValueByKey(String key)
Access to a parameter value by the parameter key. |
Object |
getParameterValueByName(String name)
Access to a parameter value by the parameter name. |
PermissionSql |
getPermissionSql()
Accesor to db table. |
ProposalSql |
getProposalSql()
Accesor to db table. |
String |
getStatus()
Diverts to the statusMaster method. |
TargetSql |
getTargetSql()
Accesor to db table. |
TaskSql |
getTaskSql()
Accesor to db table. |
String |
getUnique()
Returns the value of the unique parameter, or, if this is not accessible a 'home-made' version of it. |
UserSql |
getUserSql()
Accesor to db table. |
private void |
init1()
Initialization, second step. |
private void |
init4()
The delayed, i.e. |
boolean |
initialize()
Calls initializeMaster() in the default implementation. |
protected abstract boolean |
initializeMaster()
Method called to init the device. |
void |
initStep(int curstep)
Initializes the parameter set served by the master. |
boolean |
isAlive()
An implementation of the Alive interface. |
protected boolean |
isAuto()
For daughters that have to check the automatic mode. |
protected boolean |
isManual()
For daughters that have to check the manual mode. |
protected boolean |
isPassive()
Returns the status of the passive flag. |
boolean |
manual()
Disables automatic operation. |
private boolean |
manual(long reauto)
|
boolean |
park()
Calls parkMaster(). |
protected abstract boolean |
parkMaster()
Method called to park the device. |
protected boolean |
processCommand(CommandEvent cmd,
int acknr)
Processes the given command. |
void |
quit()
Calls quitMaster(). |
protected void |
quitMaster()
Quits the master by deregistering it from the registry and calling shutdown() on the parent. |
double |
reload()
On reload, we always issue a reload to our parameter set and our drivers, too. |
private static boolean |
reopenDrivers(Collection<Driver> drvs)
Restarts a list of drivers by iteration through all instances and cumulating the failure flags. |
private static boolean |
reopenSingleDriver(Driver io)
Restarts a single driver by re-opening it. |
protected double |
rescanned(String key,
String old,
String newval)
Method provided for subclasses to make it public and thus become a Reloadable target. |
boolean |
reset()
calls resetMaster(). |
protected abstract boolean |
resetMaster()
Method called to reset the device. |
protected boolean |
restartAllDrivers()
Re-opens all drivers. |
protected boolean |
restartNamedDriver(String drivername)
Re-opens a single named driver. |
double |
revert()
We are triggerable for reload, but are we also reloadable? |
void |
rmiAddParameter(URL resource)
Adds a parameter that is loadable from the given resource. |
void |
rmiCommand(CommandEvent cmd)
We catch the first invocation with a new command to check if we are in a state that allows accepting of remote commands (i.e. |
Object |
rmiGet(String name)
Returns the parameter's value as an object. |
Set<String> |
rmiGetAllParameterNames()
Returns all names of the parameters this parameter set serves, tailored for rmi-access. |
void |
rmiRemoveParameter(String name)
Removes the parameter with the given name. |
Object |
rmiSet(String name,
Object to)
Sets the value of the parameter of the given name to the specified value. |
private void |
sendMasterStatus(Object tosend)
Checks the argument type and either wraps it into a generic Status event or, if it is already a status message, sends it as-is. |
protected void |
setLastError(ErrorEvent ee)
Sets the last error event occuring. |
Object |
setParameterValueByKey(String key,
Object newval)
Set a parameter value with the parameter key. |
Object |
setParameterValueByName(String name,
Object newval)
Set a parameter value with the parameter name. |
boolean |
setPassive(boolean inert)
Sets the passive flag to the desired state. |
protected void |
shutdown()
Quits the currently running java VM with a System.exit call. |
protected abstract Object |
statusMaster()
Method called to return the status. |
protected boolean |
zeroAllOmc()
Zero-points all motor controllers. |
| 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 util.rmi.RmiCaster |
|---|
bindToRegistry, isValid, unbindFromRegistry |
| Methods inherited from interface stella.ErrorCaster |
|---|
removeErrorListener |
| Methods inherited from interface stella.rmi.RmiCommandListener |
|---|
accepts |
| 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_COMMUNICATOR
public static final String KEY_COMMTIME
public static final String KEY_SET
public static final String KEY_UNIQUE
public static final String KEY_DRIVERS
public static final String KEY_ABORTTIME
public static final String KEY_INITTIME
public static final String KEY_RESETTIME
public static final String KEY_PARKTIME
public static final String KEY_QUITTIME
public static final String KEY_STATUSTIME
public static final String KEY_AUTOMATIC
public static final String KEY_REAUTO
public static final String KEY_OVERRULEAUTO
public static final String KEY_SHUTDOWNDELAY
public static final String KEY_NODB
public static final String KEY_HISTORYDB
public static final String KEY_TASKDB
public static final String KEY_TARGETDB
public static final String KEY_PROPOSALDB
public static final String KEY_USERDB
public static final String KEY_PERMISSIONDB
public static final String KEY_OBSERVEDB
private static final long DEFCOMMTIME
public static final String DEFUNIQUE
private static final long DEFABORTTIME
private static final long DEFINITTIME
private static final long DEFRESETTIME
private static final long DEFPARKTIME
private static final long DEFSTATUSTIME
private static final long DEFQUITTIME
private static final long DEFREAUTO
private static final boolean DEFAUTOMATIC
private static final boolean DEFOVERRULEAUTO
private static final long DEFSHUTDOWNDELAY
private static final boolean DEFNODB
private static final int DRIVERPRIORITY
private static final int SETPRIORITY
protected TelescopeCaster telescope
private Map<String,Driver> drivers
private ParameterClustering set
private ErrorEvent lasterror
private boolean auto
private RmiCommandCaster externcaster
private boolean passive
protected Date lastinit
protected Date lastpark
protected Date lastreset
protected Date lastabort
private HistorySql histsql
private TaskSql tasksql
private TargetSql targetsql
private ProposalSql proposalsql
private UserSql usersql
private PermissionSql permsql
private ObserveSql observesql
private String lastdate
private int targetcount
| Constructor Detail |
|---|
protected GenericMaster(Map<String,String> prop)
Generic commands. The parameter set is constructed in the
PropertyResources.init() section.
| Method Detail |
|---|
public void initStep(int curstep)
initStep in interface StepInitializableinitStep in class ReceiverTorsocurstep - The current initialization depth.private void init1()
protected boolean createCommunicator(String key)
private void init4()
protected String formatWithGlobals(String fill,
Map<String,Object> extern)
If unmatched parenthesis are encountered, the input string is returned.
public String getUnique()
public double revert()
throws RemoteException
revert in interface TriggerableReloadRemoteExceptionReloadablepublic ObserveSql getObserveSql()
public PermissionSql getPermissionSql()
public UserSql getUserSql()
public ProposalSql getProposalSql()
public TargetSql getTargetSql()
public TaskSql getTaskSql()
public HistorySql getHistorySql()
protected double rescanned(String key,
String old,
String newval)
reload() for
set-related changes.
rescanned in class ReceiverTorsopublic double reload()
reload in class PropertyContainerpublic Driver getDriver(String drivername)
public Collection<Driver> getAllDrivers()
protected boolean zeroAllOmc()
protected boolean restartAllDrivers()
#restartDriver.
protected boolean restartNamedDriver(String drivername)
private static boolean reopenDrivers(Collection<Driver> drvs)
private static boolean reopenSingleDriver(Driver io)
Cooldown interface, we wait the cool-down time returned by
Cooldown#getRestartCooldown before restarting it, otherwise we
proceed immediately. On resart, we synchronize on each driver instance.
public Parameter getParameterByName(String name)
public Parameter getParameterByKey(String key)
public Object getParameterValueByName(String name)
public Object getParameterValueByKey(String key)
public Object setParameterValueByName(String name,
Object newval)
public Object setParameterValueByKey(String key,
Object newval)
protected ParameterClustering getParameterCluster()
public boolean setPassive(boolean inert)
throws RemoteException
setPassive in interface ListenerControllingRemoteException
public boolean automatic()
throws RemoteException
RoofControlling#open.
automatic in interface ListenerControllingRemoteException
public boolean manual()
throws RemoteException
ReceiverTorso.unbindDefault() method and sets the automatic flag to false.
manual in interface ListenerControllingRemoteException
private boolean manual(long reauto)
throws RemoteException
RemoteException
public boolean external(Remote caster)
throws RemoteException
external in interface ListenerControllingRemoteException
public String getStatus()
throws RemoteException
statusMaster method.
getStatus in interface ListenerControllingRemoteException
public boolean initialize()
throws RemoteException
initializeMaster() in the default implementation.
initialize in interface ListenerControllingRemoteException
public boolean reset()
throws RemoteException
resetMaster().
reset in interface ListenerControllingRemoteException
public boolean park()
throws RemoteException
parkMaster().
park in interface ListenerControllingRemoteException
public void quit()
throws RemoteException
quitMaster().
quit in interface ListenerControllingRemoteExceptionprotected boolean isAuto()
auto flag is true and no external caster is
registered.
protected boolean isManual()
auto flag is false and no external caster is
registered.
public void rmiCommand(CommandEvent cmd)
throws RemoteException
rmiCommand in interface RmiCommandListenerrmiCommand in class ReceiverTorsocmd - The command to process.
RemoteException
public void addRmiErrorListener(RmiErrorListener ear)
throws RemoteException
addRmiErrorListener in interface RmiErrorCasteraddRmiErrorListener in class AbstractRmiCasterAndListenerRemoteExceptionpublic void addErrorListener(ErrorListener ear)
addErrorListener in interface ErrorCasteraddErrorListener in class AbstractRmiCasterAndListener
public boolean isAlive()
throws RemoteException
Alive interface. Watchdogs call this
method using rmi. If the method does not return true, either by returning
false or by throwing an exception, a reboot will occur.
In the actual version, this method immediately returns true without checking the status of the camera.
isAlive in interface AliveRemoteException
public Set<String> rmiGetAllParameterNames()
throws RemoteException
#getAllParameterNames and pipes the result
into a hash-set, which is guaranteed to be serializable.
rmiGetAllParameterNames in interface RmiParameterClusteringRemoteException
public Object rmiGet(String name)
throws RemoteException
#get.
rmiGet in interface RmiParameterClusteringRemoteException
public Object rmiSet(String name,
Object to)
throws RemoteException
rmiSet in interface RmiParameterClusteringRemoteException
public void rmiAddParameter(URL resource)
throws RemoteException
rmiAddParameter in interface RmiParameterClusteringRemoteException
public void rmiRemoveParameter(String name)
throws RemoteException
rmiRemoveParameter in interface RmiParameterClusteringRemoteExceptionprotected boolean isPassive()
protected int getAcknowledgeNumber(CommandEvent cmd)
getAcknowledgeNumber in class ReceiverTorso
protected long getCompletionTime(CommandEvent cmd,
int acknr)
getCompletionTime in class ReceiverTorsocmd - The command to process.acknr - The number of the acknowledge that will be sent back.
protected boolean processCommand(CommandEvent cmd,
int acknr)
The method returns true if the (sub)task was executed without an error.
If it returns false the appropriate error event must be ready for
retrival using the getLastError() method.
processCommand in class ReceiverTorsoprotected ErrorEvent getLastError()
processCommand(stella.CommandEvent, int) method returns false.
getLastError in class ReceiverTorsoprotected void setLastError(ErrorEvent ee)
protected boolean abortMaster()
protected abstract boolean resetMaster()
protected abstract boolean initializeMaster()
protected abstract boolean parkMaster()
protected abstract Object statusMaster()
ErrorEvent.protected void quitMaster()
shutdown() on the parent. If any exit-cleaning tasks have to be
performed, this method should be overriden.
protected void shutdown()
public void exit()
exit in interface ExitCleaningexit in class ReceiverTorsoprivate void sendMasterStatus(Object tosend)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||