stella.adapter
Class PilarTelescopeCaster

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
                                      extended by stella.adapter.PilarTelescopeCaster
All Implemented Interfaces:
Cloneable, Remote, EventListener, OffsetCaster, Caster, CommandLaunching, ErrorSending, ErrorCaster, ReplyDeliverer, RmiAcknowledgeListener, RmiCommandCaster, RmiDoneListener, RmiErrorCaster, AlarmHandler, ExitCleaning, Initializable, LocalizedSupplying, PropertySupplying, ResourceSupplying, RmiCaster, RmiEventListener, RmiListener, RmiPropertyBearing

public class PilarTelescopeCaster
extends TelescopeAuxiliaryCaster
implements OffsetCaster

A simple class that allows sending of offset-commands from the adapter 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 static long DEFDEGREETIMEOUT
          The default time-out for the OffsetTelescope command.
private static long DEFMINTIMEOUT
          The default time-out for the OffsetTelescope command.
static String KEY_DEGREETIMEOUT
          The time-out added per degree shift.
static String KEY_MINTIMEOUT
          The minimum time-out for non-successful command submission.
 
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 util.PropertySupplying
CONFIG, KEY_CLASS
 
Fields inherited from interface stella.rmi.RmiCommandCaster
NAMING_EXTENSION
 
Fields inherited from interface util.ResourceSupplying
KEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOME
 
Constructor Summary
PilarTelescopeCaster(Map<String,String> prop)
          Constructs a new adapter-to-telescope caster.
 
Method Summary
 boolean castOffsetAndWait(OffsetTelescope offset)
          Casts the offset command to the telescope and waits for notification on the appropriate done event.
 void castOffsetAtGuide(OffsetTelescope offset)
          Casts the offset command to the telescope during guiding phase.
 int getActiveOffsets()
          At guide, the guider task may want to know how many offsets are currently active to avoid overloading the telescope.
 long getTimeoutFor(TelescopeCommand ce)
          On some commands, we might be able to calculate a variable offset.
 
Methods inherited from class stella.util.TelescopeAuxiliaryCaster
castCommandAndWait, castCommandAndWait, castCommandNoWait, clearAll, getActiveCommands, getShutdownCommand, handles, init
 
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 stella.adapter.OffsetCaster
castCommandAndWait
 
Methods inherited from interface stella.CommandLaunching
castCommand, getClientName, getExitCommand, getShutdownCommand, handles, isReady, recastCommand
 
Methods inherited from interface stella.ReplyDeliverer
announceInterest, registerReplySubscriber
 
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.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.ResourceSupplying
getResource, getResourceAsStream, getResources
 

Field Detail

KEY_MINTIMEOUT

public static final String KEY_MINTIMEOUT
The minimum time-out for non-successful command submission.

See Also:
Constant Field Values

KEY_DEGREETIMEOUT

public static final String KEY_DEGREETIMEOUT
The time-out added per degree shift.

See Also:
Constant Field Values

DEFMINTIMEOUT

private static final long DEFMINTIMEOUT
The default time-out for the OffsetTelescope command.

See Also:
Constant Field Values

DEFDEGREETIMEOUT

private static final long DEFDEGREETIMEOUT
The default time-out for the OffsetTelescope command.

See Also:
Constant Field Values
Constructor Detail

PilarTelescopeCaster

public PilarTelescopeCaster(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 TelescopeAuxiliaryCaster.init() method.

Throws:
RemoteException
Method Detail

castOffsetAtGuide

public void castOffsetAtGuide(OffsetTelescope offset)
Casts the offset command to the telescope during guiding phase. We immedeately return to the guiding loop.

Specified by:
castOffsetAtGuide in interface OffsetCaster
Parameters:
offset - A OffsetTelescope command

getActiveOffsets

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

Specified by:
getActiveOffsets in interface OffsetCaster

castOffsetAndWait

public boolean castOffsetAndWait(OffsetTelescope offset)
Casts the offset command to the telescope and waits for notification on the appropriate done event. This method only returns if the final done event to this OffsetTelescope command was received or a time-out has occured. The time-out depends on the offset: to the minimal time-out KEY_MINTIMEOUT an offset-depending KEY_DEGREETIMEOUT is added by multiplying the second number with the desired offset in degrees. Note that we have access to the telescope altitude via the enclosing class.
The method returns true, if the done-event was received on time.

Specified by:
castOffsetAndWait in interface OffsetCaster
Parameters:
offset - A OffsetTelescope command
Returns:
True, if command was sent successful and done was received.

getTimeoutFor

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

Specified by:
getTimeoutFor in class TelescopeAuxiliaryCaster