stella.rmi
Class GenericAccess

java.lang.Object
  extended by util.CommandLineParser
      extended by stella.rmi.GenericAccess
Direct Known Subclasses:
BuildingAccess, CalibrationAccess, CcdAccess, DomeAccess, GuiderAccess, TelescopeAccess, WifsipAccess

public class GenericAccess
extends CommandLineParser

A small class allowing command-line controled access to rmi-object implementing the ListenerControlling interface. In the basic functionality, only the methods in ListenerControlling are supported, but subclasses should augment the functionality to acces a wider variety of methods, like BuildingAccess. Due to the use of a CommandLineParser the sequence of the arguments and switches is arbitrary.

See Also:
CommandLineParser

Nested Class Summary
 
Nested classes/interfaces inherited from class util.CommandLineParser
CommandLineParser.Test
 
Field Summary
static String FOOT
          A footer usage message.
static String ONESWITCHES
          The zero-argument command line switches understood.
static Map<String,String> USE
          A human-readable description of the switches.
static String ZEROSWITCHES
          The zero-argument command line switches understood.
 
Constructor Summary
GenericAccess()
          Constructs a new listener shifter.
 
Method Summary
static void main(String[] arg)
          Register and/or deregisters a listener from a given caster.
 boolean processFor(Class me)
          Processes the command line arguments after parsing.
protected  boolean processSwitches(Remote listener)
          Process the command line switches found.
protected static Remote scanFor(Class instance)
          Scans the local registry for bindings of the approriate type.
 
Methods inherited from class util.CommandLineParser
getArguments, getCommandLine, getCommands, getRegisteredSwitches, hasAnySwitch, hasSwitch, hasSwitch, haveAllSwitches, parse, printCommandLine, registerLine, registerSwitches, setCommands, staticUsage, usage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ZEROSWITCHES

public static final String ZEROSWITCHES
The zero-argument command line switches understood.

See Also:
Constant Field Values

ONESWITCHES

public static final String ONESWITCHES
The zero-argument command line switches understood.

See Also:
Constant Field Values

USE

public static Map<String,String> USE
A human-readable description of the switches.


FOOT

public static final String FOOT
A footer usage message.

See Also:
Constant Field Values
Constructor Detail

GenericAccess

public GenericAccess()
Constructs a new listener shifter. The switches understood are readily added to the command line parser.

Method Detail

processFor

public boolean processFor(Class me)
                   throws RemoteException,
                          NotBoundException,
                          MalformedURLException
Processes the command line arguments after parsing. The argument is the instance on which we should act if no explicit link to the command line is given

Returns:
True on success.
Throws:
RemoteException
NotBoundException
MalformedURLException

scanFor

protected static Remote scanFor(Class instance)
                         throws RemoteException,
                                NotBoundException
Scans the local registry for bindings of the approriate type.

Throws:
RemoteException
NotBoundException

processSwitches

protected boolean processSwitches(Remote listener)
                           throws RemoteException
Process the command line switches found. If the remote reference handed over is a ListenerControlling and one of the switches defined in ONESWITCHES is given, the appropriate method of the listener control is called. Note that the command line must be parsed before calling this method.
Implementation note: If both processable arguments, -r and -d are given, the deregistering at the caster is processed first.

Returns:
True on success.
Throws:
RemoteException

main

public static void main(String[] arg)
                 throws ParseException,
                        RemoteException,
                        NotBoundException,
                        MalformedURLException
Register and/or deregisters a listener from a given caster. The order of the listener and the switches is not strict.

Throws:
ParseException
RemoteException
NotBoundException
MalformedURLException