stella.util
Class TelescopeAuxiliaryCaster

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.CasterTorso
                              extended by stella.rmi.TelescopeCaster
                                  extended by stella.util.TelescopeAuxiliaryCaster
All Implemented Interfaces:
Cloneable, Remote, EventListener, Caster, CommandLaunching, ErrorSending, ErrorCaster, ReplyDeliverer, RmiAcknowledgeListener, RmiCommandCaster, RmiDoneListener, RmiErrorCaster, AlarmHandler, ExitCleaning, Initializable, LocalizedSupplying, PropertySupplying, ResourceSupplying, RmiCaster, RmiEventListener, RmiListener, RmiPropertyBearing
Direct Known Subclasses:
GregorTelescopeCaster, PilarTelescopeCaster, WifsipTelescopeCaster

public abstract class TelescopeAuxiliaryCaster
extends TelescopeCaster

A simple class that allows sending of telescope commands from a generic master to the telescope. The main extension to the CasterClient is the ability to send a single command and wait until the final done is received or a #KEY_MINTIMEOUT, #KEY_DEGREETIMEOUT is surpassed. This is done by invoking castOffsetAndWait


Nested Class Summary
 
Nested classes/interfaces inherited from class stella.rmi.TelescopeCaster
TelescopeCaster.Test
 
Nested classes/interfaces inherited from class util.PropertyResources
PropertyResources.URLResource
 
Field Summary
private  List<ReplyEvent> offsets
          For locking on a reply.
private  ReplySubscriber reply
          The reply subscriber used for blocking command-sends.
private  Object wait
          A locking object.
 
Fields inherited from class stella.rmi.CasterTorso
KEY_ACKNOWLEDGECASTER, KEY_ACKNOWLEDGETIMEOUT, KEY_ALARMGROUP, KEY_BIND, KEY_DONECASTER
 
Fields inherited from class util.rmi.AbstractRmiListener
KEY_ALIVE, KEY_EXPORTPORT, KEY_INIT, KEY_LISTENERNAME, KEY_RETRY, KEY_RETRYSLEEP, KEY_SHUTDOWNDELAY
 
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.RmiCommandCaster
NAMING_EXTENSION
 
Fields inherited from interface util.PropertySupplying
CONFIG, KEY_CLASS
 
Fields inherited from interface util.ResourceSupplying
KEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOME
 
Constructor Summary
protected TelescopeAuxiliaryCaster(Map<String,String> prop)
          Constructs a new adapter-to-telescope caster.
 
Method Summary
 boolean castCommandAndWait(TelescopeCommand tc)
          Only used for manual acquire.
 boolean castCommandAndWait(TelescopeCommand tc, long timeout)
          Only used for manual acquire.
 void castCommandNoWait(TelescopeCommand tc)
          Casts the offset command to the telescope during guiding phase.
 void clearAll()
          Clears all cummulated reply events we are waiting for, but which have never been removed.
 int getActiveCommands()
          At guide, the guider task may want to know how many offsets are currently active to avoid overloading the telescope.
 CommandEvent getShutdownCommand()
          Returns null, never needed.
abstract  long getTimeoutFor(TelescopeCommand ce)
          On some commands, we might be able to calculate a variable offset.
 boolean handles(CommandEvent ce)
          This caster handles only OffsetTelescope move, focus and status commands.
 void init()
          Registers a new reply subscriber to this command sender.
 
Methods inherited from class stella.rmi.TelescopeCaster
getExitCommand
 
Methods inherited from class stella.rmi.CasterTorso
addRmiCommandListener, announceInterest, castCommand, deregisterAtCaster, exit, getAcknowledgeTimeOut, getAlarmGroup, getClientName, isReady, recastCommand, registerAtCaster, registerReplySubscriber, removeRmiCommandListener, rmiGotAcknowledge, rmiGotDone, setOff, toString
 
Methods inherited from class stella.rmi.AbstractRmiCasterAndListener
addErrorListener, addRmiErrorListener, 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, rescanned, startBinding, startBinding
 
Methods inherited from class util.rmi.RmiPropertyContainer
containsRemoteProperty, getRemoteProperties, getRemoteProperty, setRemoteProperty
 
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, 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, reload, removeProperty, setObject, setProperties, setProperty, stringProperties
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface util.rmi.RmiEventListener
getListenerName
 
Methods inherited from interface util.rmi.RmiListener
disconnect, isConnected
 
Methods inherited from interface util.rmi.RmiCaster
bindToRegistry, isValid, unbindFromRegistry
 
Methods inherited from interface stella.ErrorCaster
addErrorListener, removeErrorListener
 
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.ResourceSupplying
getResource, getResourceAsStream, getResources
 

Field Detail

reply

private ReplySubscriber reply
The reply subscriber used for blocking command-sends.


offsets

private List<ReplyEvent> offsets
For locking on a reply.


wait

private Object wait
A locking object.

Constructor Detail

TelescopeAuxiliaryCaster

protected TelescopeAuxiliaryCaster(Map<String,String> prop)
                            throws RemoteException
Constructs a new adapter-to-telescope caster. A reply-subscriber that is used for blocking command transfer is registered to the caster client in the init() method.

Throws:
RemoteException
Method Detail

init

public void init()
Registers a new reply subscriber to this command sender. This reply subscriber is used to block the in the #sendBlocking method.

Specified by:
init in interface Initializable
Overrides:
init in class CasterTorso

getActiveCommands

public int getActiveCommands()
At guide, the guider task may want to know how many offsets are currently active to avoid overloading the telescope.


clearAll

public void clearAll()
Clears all cummulated reply events we are waiting for, but which have never been removed.


getTimeoutFor

public abstract long getTimeoutFor(TelescopeCommand ce)
On some commands, we might be able to calculate a variable offset.


castCommandNoWait

public void castCommandNoWait(TelescopeCommand tc)
Casts the offset command to the telescope during guiding phase. We immedeately return to the guiding loop.

Parameters:
offset - A OffsetTelescope command

castCommandAndWait

public boolean castCommandAndWait(TelescopeCommand tc)
Only used for manual acquire.


castCommandAndWait

public boolean castCommandAndWait(TelescopeCommand tc,
                                  long timeout)
Only used for manual acquire.


getShutdownCommand

public CommandEvent getShutdownCommand()
Returns null, never needed.

Specified by:
getShutdownCommand in interface CommandLaunching
Overrides:
getShutdownCommand in class TelescopeCaster

handles

public boolean handles(CommandEvent ce)
This caster handles only OffsetTelescope move, focus and status commands. override if other behaviour needed.

Specified by:
handles in interface CommandLaunching
Overrides:
handles in class TelescopeCaster