stella.rmi
Class DummyToO

java.lang.Object
  extended by java.rmi.server.RemoteObject
      extended by java.rmi.server.RemoteServer
          extended by java.rmi.server.UnicastRemoteObject
              extended by stella.rmi.DummyToO
All Implemented Interfaces:
Serializable, Remote, SchedulerControlling, TargetOfOpportunity, RmiStatusProviding

public class DummyToO
extends UnicastRemoteObject
implements TargetOfOpportunity

Dummy implementation of the TargetOfOportunity interface. Simply returns required values and outputs info to stdout if called on the necessary routines.

See Also:
Serialized Form

Field Summary
(package private)  Map<String,String[]> grb
           
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Constructor Summary
DummyToO()
           
 
Method Summary
 boolean addTarget(TargetDefinition newtd)
          Adds a single target.
 Collection<String> getActive()
          Returns all active IDs.
 Collection<TargetDefinition> getAllTargets()
          Returna a list of all targets accessible.
 TargetDefinition getTarget(String name)
          Returns a single target specified by its name.
 String getTelescope()
          Returns the telescope id this scheduler refers to.
 List<String> listAllTargets()
          List all target names available to this scheduler.
static void main(String[] arg)
           
 boolean reloadTargets()
          Reloads targets to get to a pre-defined state.
 void removeAllTargets()
          Removes all targets from the scheduler's list.
 boolean removeTarget(String name)
          Removes the target from the scheduler's list.
 boolean removeToo(String name)
          Removes the target from the scheduler's list.
 Object rmiProvideStatus()
          Returns the status of the caster as an unspecified object.
 Serializable rmiTooStatus(String id)
          Returns a short description of the status of the GRB targets.
 boolean triggerGrb(String id, double ra, double de, double exptime, boolean interrupt)
          This method triggers a new GRB observation.
 boolean triggerToo(String id, String templ, double ra, double de, double exptime, boolean interrupt)
          This method triggers a new GRB observation.
 boolean updateToo(String id, String field, Object to)
          If a GRB target of the stated ID has been created by a trigger, this method can be used to change critical GrbTarget fields from their default values.
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStub
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

grb

Map<String,String[]> grb
Constructor Detail

DummyToO

public DummyToO()
         throws RemoteException
Throws:
RemoteException
Method Detail

triggerGrb

public boolean triggerGrb(String id,
                          double ra,
                          double de,
                          double exptime,
                          boolean interrupt)
                   throws RemoteException
Description copied from interface: TargetOfOpportunity
This method triggers a new GRB observation. The ID supplied must be an internal unique identifier (the string version of a count number suffices). Position of the GRB is given in degrees, J2000.0. The exposure time is the initial exposure time. If the interrupt flag is set, the ongoing observation is stopped, the data is lost.

Server-side, a new GrbTarget out of a template is generated, with the critical information (ra, de, exptime) filled in after instantiation.

Specified by:
triggerGrb in interface TargetOfOpportunity
Parameters:
id - A unique identifier for the GRB, can be a count number.
ra - The right ascension of the GRB, degrees, J2000.0
de - The declination of the GRB, degrees, J2000.0.
exptime - The initial exposure time in seconds.
interrupt - If true, ongoing observation should be canceled.
Returns:
True, if the new target could be created.
Throws:
RemoteException

triggerToo

public boolean triggerToo(String id,
                          String templ,
                          double ra,
                          double de,
                          double exptime,
                          boolean interrupt)
                   throws RemoteException
Description copied from interface: TargetOfOpportunity
This method triggers a new GRB observation. The ID supplied must be an internal unique identifier (the string version of a count number suffices). Position of the GRB is given in degrees, J2000.0. The exposure time is the initial exposure time. If the interrupt flag is set, the ongoing observation is stopped, the data is lost.

Server-side, a new GrbTarget out of a template is generated, with the critical information (ra, de, exptime) filled in after instantiation.

Specified by:
triggerToo in interface TargetOfOpportunity
Parameters:
id - A unique identifier for the GRB, can be a count number.
templ - A resource description that describes the ToO to use.
ra - The right ascension of the GRB, degrees, J2000.0
de - The declination of the GRB, degrees, J2000.0.
exptime - The initial exposure time in seconds.
interrupt - If true, ongoing observation should be canceled.
Returns:
True, if the new target could be created.
Throws:
RemoteException

updateToo

public boolean updateToo(String id,
                         String field,
                         Object to)
                  throws RemoteException
Description copied from interface: TargetOfOpportunity
If a GRB target of the stated ID has been created by a trigger, this method can be used to change critical GrbTarget fields from their default values. The caller has to ensure that the field and the ID is valid.

Specified by:
updateToo in interface TargetOfOpportunity
Parameters:
id - The id used on creation of the GRB.
field - The name of the field to be updated.
to - The new value of the field, possible a Number or String.
Returns:
True, if the field was updated successfully.
Throws:
RemoteException

removeToo

public boolean removeToo(String name)
                  throws RemoteException
Removes the target from the scheduler's list. The target is physically removed and cannot be restored except by re-adding it with the addTarget(stella.TargetDefinition) method.

Specified by:
removeToo in interface TargetOfOpportunity
Returns:
True, if a target was removed.
Throws:
RemoteException

getActive

public Collection<String> getActive()
                             throws RemoteException
Returns all active IDs.

Specified by:
getActive in interface TargetOfOpportunity
Returns:
a collection of ToO id's.
Throws:
RemoteException

rmiTooStatus

public Serializable rmiTooStatus(String id)
                          throws RemoteException
Returns a short description of the status of the GRB targets.

Specified by:
rmiTooStatus in interface TargetOfOpportunity
Throws:
RemoteException

addTarget

public boolean addTarget(TargetDefinition newtd)
                  throws RemoteException
Adds a single target. The argument is an already parsed target definition and must thus be serializable.

Specified by:
addTarget in interface SchedulerControlling
Returns:
True, if a target was added
Throws:
RemoteException

removeTarget

public boolean removeTarget(String name)
                     throws RemoteException
Removes the target from the scheduler's list. The target is physically removed and cannot be restored except by re-adding it with the addTarget(stella.TargetDefinition) method.

Specified by:
removeTarget in interface SchedulerControlling
Returns:
True, if a target was removed.
Throws:
RemoteException

removeAllTargets

public void removeAllTargets()
                      throws RemoteException
Removes all targets from the scheduler's list. The targets are physically removed and cannot be restored except by re-adding them.

Specified by:
removeAllTargets in interface SchedulerControlling
Throws:
RemoteException

reloadTargets

public boolean reloadTargets()
                      throws RemoteException
Reloads targets to get to a pre-defined state.

Specified by:
reloadTargets in interface SchedulerControlling
Returns:
True, if a targets were restored.
Throws:
RemoteException

getTarget

public TargetDefinition getTarget(String name)
                           throws RemoteException
Returns a single target specified by its name. As this target is passed via the RMI interface, it must be serializable.

Specified by:
getTarget in interface SchedulerControlling
Throws:
RemoteException

getAllTargets

public Collection<TargetDefinition> getAllTargets()
                                           throws RemoteException
Returna a list of all targets accessible. This collection might be long, and will be passed over the network, so be careful. Note that we return a collection here because there is no natural ordering on target definitions, thus nobody will ever intend to do natural-ordered sorting. Depending on the implementation, this collection may in fact be a list, though. Normal java implementations of collections are lists.

Specified by:
getAllTargets in interface SchedulerControlling
Throws:
RemoteException

listAllTargets

public List<String> listAllTargets()
                            throws RemoteException
List all target names available to this scheduler. This carries only the target's names and is thus not as demanding as getAllTargets(). Note that this method must return a list, because Strings have a natural ordering, thus it makes sense to return a list of strings rather than a collection to allow callers of this method to do sorting.

Specified by:
listAllTargets in interface SchedulerControlling
Throws:
RemoteException

getTelescope

public String getTelescope()
                    throws RemoteException
Returns the telescope id this scheduler refers to.

Specified by:
getTelescope in interface SchedulerControlling
Throws:
RemoteException

rmiProvideStatus

public Object rmiProvideStatus()
                        throws RemoteException
Description copied from interface: RmiStatusProviding
Returns the status of the caster as an unspecified object. This can be an ErrorEvent, a List or of simple string.

Specified by:
rmiProvideStatus in interface RmiStatusProviding
Throws:
RemoteException

main

public static void main(String[] arg)
                 throws Exception
Throws:
Exception