stella.net
Class ParameterRelay

java.lang.Object
  extended by util.PropertyContainer
      extended by util.PropertyResources
          extended by util.PropertyBundles
              extended by util.rmi.RmiPropertyContainer
                  extended by util.rmi.AbstractRmiCaster
                      extended by stella.CastingContainer
                          extended by stella.net.ReceiverServer
                              extended by stella.net.ParameterRelay
All Implemented Interfaces:
Cloneable, Runnable, Remote, ErrorProcessing, CancelRunnable, ExitCleaning, Initializable, LocalizedSupplying, PropertySupplying, ResourceSupplying, RmiCaster, RmiPropertyBearing

public class ParameterRelay
extends ReceiverServer

A parameter server class. This class allows clients to connect to its listening port to query instances of RemoteParameters. The functionality is as follows.

The parameter relay runs as stand-alone.


Nested Class Summary
protected  class ParameterRelay.ParameterHandler
          The helper class to run the protocol for ascii-based parameter exchanges.
static class ParameterRelay.Run
          Runs the parameter realy.
 
Nested classes/interfaces inherited from class util.PropertyResources
PropertyResources.URLResource
 
Field Summary
private static long DEFTIMEOUT
          The default sleep interval between available queries.
static String KEY_HOST
          The key to the host where the registry runs.
static String KEY_TIMEOUT
          The key for join-time on cancel.
private  Map lookup
          The look-up table matching names to remote parameters.
private static ThreadGroup parameterGroup
          The thread group commands run in.
private  Registry registry
          The registry, where parameters are look-up.
private  ParameterRelay.ParameterHandler request
          The handler for dealing with parameter queries.
 
Fields inherited from class stella.net.ReceiverServer
DEFSERVERPORT, handlerGroup, KEY_BUFFERSIZE, KEY_HANDLERPRIORITY, KEY_HOSTADDRESS, KEY_LOGOUT, KEY_RECEIVERNAME, KEY_SERVERPORT, KEY_SERVERPRIORITY
 
Fields inherited from class util.rmi.AbstractRmiCaster
ALTERNATEHOST, ALTERNATEPORT, KEY_BINDNAME, KEY_EXPORTPORT, KEY_REGISTRYHOST, KEY_REGISTRYPORT
 
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
ParameterRelay(Map prop)
          Constructs a new parameter server.
 
Method Summary
 void cancel()
          Cancels the parameter server.
protected  void protocol(Socket client)
          The method called as soon as a connection is established.
 void startServer()
          Starts the server.
 
Methods inherited from class stella.net.ReceiverServer
exit, getAsociatedThread, getBufferSize, getHandlerPriority, getReceiverName, getServerPort, getServerPriority, init, initReceiverServer, maxTimeToCancel, processError, run
 
Methods inherited from class stella.CastingContainer
addErrorListener, addRmiErrorListener, isValid, notifyErrorListener, removeErrorListener, removeRmiErrorListener, sendError, sendError, sendError, sendStatus, sendStatus, sendStatus
 
Methods inherited from class util.rmi.AbstractRmiCaster
bindAlternate, bindToRegistry, bindToRegistry, bindToRegistry, casterExit, casterExit, getBindName, getBindName, unbindFromRegistry, unbindFromRegistry
 
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, rescanned, 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.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_HOST

public static final String KEY_HOST
The key to the host where the registry runs.

See Also:
Constant Field Values

KEY_TIMEOUT

public static final String KEY_TIMEOUT
The key for join-time on cancel.

See Also:
Constant Field Values

DEFTIMEOUT

private static final long DEFTIMEOUT
The default sleep interval between available queries.

See Also:
Constant Field Values

parameterGroup

private static final transient ThreadGroup parameterGroup
The thread group commands run in.


request

private ParameterRelay.ParameterHandler request
The handler for dealing with parameter queries.


lookup

private Map lookup
The look-up table matching names to remote parameters.


registry

private Registry registry
The registry, where parameters are look-up.

Constructor Detail

ParameterRelay

public ParameterRelay(Map prop)
               throws RemoteException
Constructs a new parameter server. The server thread must be started explicetly with a call to startServer().

Throws:
RemoteException
Method Detail

startServer

public void startServer()
Starts the server. The linked thread is already constructed in ReceiverServer.ReceiverServer(Map), which also sets the server priority.


cancel

public void cancel()
Cancels the parameter server. If a connection is currently active, it is first closed.

Specified by:
cancel in interface CancelRunnable
Overrides:
cancel in class ReceiverServer

protocol

protected void protocol(Socket client)
The method called as soon as a connection is established. It spwans a ParameterRelay.ParameterHandler thread witch performs the actual communication.

Specified by:
protocol in class ReceiverServer
Parameters:
client - The client socket.
See Also:
CommandReceiver, ErrorReceiver