public class TelescopeError extends AbstractStatusRequestor implements ErrorCaster, Reloadable
TelescopeStatus errors to deduce
eventually occuring telescope errors. This is done by scanning the
TelescopeStatus.getErrors() return as a comma-separated list of
PILAR-specific errors. Each error encountered is matched to an internal
lookup-table of PILAR error-names to SCS error-classes in
KEY_TABLELIST or KEY_TABLEFILE.
If a match is found, an appropriate error class is instantiated and passed
to registered error-listeners (a error-handler presumably).As this parameter is of a polling-type, the cache-time of the parent class is used as the polling-time. The value of the parameter are the list of currently active errors.
PropertyResources.Load, PropertyResources.URLResource| Modifier and Type | Field and Description |
|---|---|
private static String |
DEFCOMMAND
The default class name of the status command to send.
|
static String |
DEFNAME
The default name of this parameter.
|
private static long |
DEFPOLLTIME
The default poll time.
|
private static String |
DEFTABLELIST
The home position of the telescope.
|
private static long |
DEFWAIT
The default wait time.
|
private List<ErrorListener> |
ear
The list of registered error listeners.
|
static String |
KEY_POLLTIME
The polling time.
|
static String |
KEY_TABLEFILE
The table of PILAR error-names to SCS error-classes.
|
static String |
KEY_TABLELIST
The table of PILAR error-names to SCS error-classes.
|
static String |
KEY_WAIT
The initial wait time.
|
private Map<String,ErrorEvent> |
pilar
The look-up table matching PILAR names to true error objects.
|
private Timer |
request
The timer used for issuing status requests.
|
KEY_COMMAND, KEY_DISABLE, KEY_TIMEOUTKEY_CACHEKEY_FORMAT, KEY_NAME, KEY_PRESERVE, UNKNOWNKEY_NOINITONCREATE, POSTFIX_ALPHABET, POSTFIX_BYTES, POSTFIX_DIR, POSTFIX_EXT, POSTFIX_FILE, POSTFIX_LIST, POSTFIX_MODTIME, POSTFIX_URLKEY_LISTSEPARATOR, KEY_MAPKEYVALUECHAR, KEY_MAPSEPARATORNAMING_EXTENSIONCONFIG, KEY_CLASSKEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOME| Constructor and Description |
|---|
TelescopeError(Map<String,String> prop)
Constructs a new telescope-error parameter.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addErrorListener(ErrorListener handler)
Registers an error event listener to this property container.
|
private void |
check()
Checks if the currently valid errors stored in the cache are recognized
and should spark a error-handler notification.
|
private Map<String,ErrorEvent> |
constructTable() |
void |
exit()
Exits this parameter.
|
Object |
getForError(ErrorEvent ee)
Returns the pilar-errors of the telescope deduced from a freshly
received
TelescopeStatus. |
void |
init()
Initializes the telescope error parameter.
|
protected boolean |
isStatusRequested(ErrorEvent ee)
Returns true if the error event received is of
TelescopeStatus |
protected void |
notifyErrorListeners(ErrorEvent ee)
Notifies all registered ErrorListeners.
|
boolean |
registerLauncher(CommandLaunching launch)
Registers the appropriate command caster that can handle the appropriate
request.
|
void |
removeErrorListener(ErrorListener handler)
Deregisters an error event listener from this property container.
|
double |
rescanned(String key,
String old,
String newval)
Returns zero if the polltime or wait period changed, reload the error
lookup table if the tablelist or file changed.
|
getUncached, registerErrorget, getCache, getCacheFormatted, setcreateParameter, delivers, getFormatted, getFormatted, getName, getPreserveFile, getString, getString, overrideDefaultName, register, setName, toStringclone, 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, reload, removeProperty, requires, setObject, setProperties, setProperty, stringPropertiesequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitreloadgetCache, getCacheFormatteddefaultBoolean, 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_WAIT
public static final String KEY_POLLTIME
public static final String KEY_TABLELIST
public static final String KEY_TABLEFILE
public static final String DEFNAME
private static final long DEFWAIT
private static final long DEFPOLLTIME
private static final String DEFTABLELIST
private static final String DEFCOMMAND
private Map<String,ErrorEvent> pilar
private List<ErrorListener> ear
private Timer request
public void init()
throws InitException
KEY_TABLEFILE property to load
a properties file, or, if this key is missing, the
KEY_TABLELIST is used to convert the mapped string to
a properties object with the Strings.propertize(java.lang.String) mthod.init in interface Initializableinit in class AbstractStatusRequestorInitExceptionpublic double rescanned(String key, String old, String newval)
rescanned in interface Reloadablerescanned in class AbstractStatusRequestorprivate Map<String,ErrorEvent> constructTable()
public boolean registerLauncher(CommandLaunching launch)
registerLauncher in interface StatusRequestingregisterLauncher in class AbstractStatusRequestorpublic Object getForError(ErrorEvent ee)
TelescopeStatus. This method should be followed by a
check() call which actually performs the test for errors.getForError in interface ErrorDependingParameterpublic void exit()
exit in interface ExitCleaningexit in class AbstractParameterpublic void addErrorListener(ErrorListener handler)
addErrorListener in interface ErrorCasterpublic void removeErrorListener(ErrorListener handler)
removeErrorListener in interface ErrorCasterprotected void notifyErrorListeners(ErrorEvent ee)
ee - The ErrorEvent to pass to the Listeners.protected boolean isStatusRequested(ErrorEvent ee)
TelescopeStatusisStatusRequested in class AbstractStatusRequestorprivate void check()