stella.rmi
Class FitsRelay

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.FitsRelay
All Implemented Interfaces:
Cloneable, Remote, EventListener, RmiErrorListener, ExitCleaning, Initializable, LocalizedSupplying, PropertySupplying, ResourceSupplying, RmiEventListener, RmiListener, RmiPropertyBearing

public class FitsRelay
extends AbstractRmiListener
implements RmiErrorListener

An rmi-error listener that listens for FitsWrittn status messages and relays them to a server listening on a special port, as defined in the properties.


Nested Class Summary
static class FitsRelay.Rmi
          Test by sending the path of the first command line argument to a local server.
 
Nested classes/interfaces inherited from class util.PropertyResources
PropertyResources.URLResource
 
Field Summary
private  boolean bound
          Ture, if successfully registered to at least one listener.
private static int DEFSERVERPORT
          The default server port.
static String KEY_RMIERROR
          The key denoting a comma-separated list of rmi-error casters.
static String KEY_SERVERHOST
          The key denoting the server host name.
static String KEY_SERVERPORT
          The key denoting the server port on the specified host.
 
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.ResourceSupplying
KEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOME
 
Fields inherited from interface util.PropertySupplying
CONFIG, KEY_CLASS
 
Constructor Summary
FitsRelay(Map<String,String> prop)
          We create a new error relay and start binding to the error casters in the init section.
 
Method Summary
protected  boolean deregisterAtCaster(RmiCaster rmi, Class service)
          Deregisters at caster.
 void init()
          We create a new list of local error listeners and start registering at the remote error casters.
 boolean isBound()
          Return true, if we are bound to at least one error caster.
private  void register(String list, Class casterclass)
          Registers at a caster list.
protected  boolean registerAtCaster(RmiCaster rmi, Class service)
          Registers at the specified caster if the caster is one of the four possible caster instances this class listens to.
private  void relayFitsFile(File exist)
          We start a thread to return immediately.
 void rmiErrorOccured(ErrorEvent ee)
          We pass the error received to our listeners.
 
Methods inherited from class util.rmi.AbstractRmiListener
allBound, blockBinding, blockBinding, disconnect, exit, 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, toString
 
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.ResourceSupplying
getResource, getResourceAsStream, getResources
 
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
 

Field Detail

KEY_RMIERROR

public static final String KEY_RMIERROR
The key denoting a comma-separated list of rmi-error casters.

See Also:
Constant Field Values

KEY_SERVERHOST

public static final String KEY_SERVERHOST
The key denoting the server host name.

See Also:
Constant Field Values

KEY_SERVERPORT

public static final String KEY_SERVERPORT
The key denoting the server port on the specified host.

See Also:
Constant Field Values

DEFSERVERPORT

private static final int DEFSERVERPORT
The default server port.

See Also:
Constant Field Values

bound

private boolean bound
Ture, if successfully registered to at least one listener.

Constructor Detail

FitsRelay

public FitsRelay(Map<String,String> prop)
          throws RemoteException
We create a new error relay and start binding to the error casters in the init section.

Throws:
RemoteException
Method Detail

init

public void init()
We create a new list of local error listeners and start registering at the remote error casters.

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

isBound

public boolean isBound()
Return true, if we are bound to at least one error caster.


rmiErrorOccured

public void rmiErrorOccured(ErrorEvent ee)
                     throws RemoteException
We pass the error received to our listeners.

Specified by:
rmiErrorOccured in interface RmiErrorListener
Throws:
RemoteException

registerAtCaster

protected boolean registerAtCaster(RmiCaster rmi,
                                   Class service)
Registers at the specified caster if the caster is one of the four possible caster instances this class listens to.

Specified by:
registerAtCaster in class AbstractRmiListener
Returns:
True, if this listener can register at the specified caster

deregisterAtCaster

protected boolean deregisterAtCaster(RmiCaster rmi,
                                     Class service)
Deregisters at caster. Simply checks if the caster handed over is of one of the four supported types and removes itself from its listener list. Note that this can also mean de-registering from casters we never registered to because this info is lost.

Specified by:
deregisterAtCaster in class AbstractRmiListener
Returns:
True, if this listener can deregister at the specified caster

register

private void register(String list,
                      Class casterclass)
Registers at a caster list.


relayFitsFile

private void relayFitsFile(File exist)
We start a thread to return immediately.