stella.net
Class ParameterServer

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.ErrorServer
                                  extended by stella.net.ParameterServer
All Implemented Interfaces:
Cloneable, Runnable, Remote, Caster, ClusterDepending, ErrorCaster, ErrorProcessing, RmiErrorCaster, CancelRunnable, ExitCleaning, Initializable, LocalizedSupplying, PropertySupplying, ResourceSupplying, RmiCaster, RmiPropertyBearing

public class ParameterServer
extends ErrorServer
implements ErrorCaster, ClusterDepending

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

As the parameter server runs within the master mind, local error casting is enabled.


Nested Class Summary
protected  class ParameterServer.ParameterHandler
          The helper class to run the protocol for ascii-based parameter exchanges.
 
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_TIMEOUT
          The key for join-time on cancel.
private static ThreadGroup parameterGroup
          The thread group commands run in.
private  ParameterServer.ParameterHandler request
          The handler for dealing with parameter queries.
private  ParameterClustering set
          The reference to the parameters served.
 
Fields inherited from class stella.net.ErrorServer
KEY_BIND, KEY_BINDNAME
 
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_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
ParameterServer(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 registerCluster(ParameterClustering toserve)
          Registers the set of parameters served by this parameter server.
 void startServer()
          Starts the server.
 
Methods inherited from class stella.net.ErrorServer
exit, init, processError
 
Methods inherited from class stella.net.ReceiverServer
getAsociatedThread, getBufferSize, getHandlerPriority, getReceiverName, getServerPort, getServerPriority, initReceiverServer, maxTimeToCancel, 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 stella.ErrorCaster
addErrorListener, removeErrorListener
 
Methods inherited from interface stella.rmi.RmiErrorCaster
addRmiErrorListener, removeRmiErrorListener
 
Methods inherited from interface util.rmi.RmiCaster
bindToRegistry, isValid, unbindFromRegistry
 
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_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

set

private ParameterClustering set
The reference to the parameters served.


parameterGroup

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


request

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

Constructor Detail

ParameterServer

public ParameterServer(Map prop)
                throws RemoteException
Constructs a new parameter server. The server thread must be started explicetly with a call to startServer(). SocketParameters should be added prior to starting the parameter server, otherwise synchronization on the look-up table may cause time delays.

Throws:
RemoteException
Method Detail

registerCluster

public void registerCluster(ParameterClustering toserve)
Registers the set of parameters served by this parameter server.

Specified by:
registerCluster in interface ClusterDepending

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 ParameterServer.ParameterHandler thread witch performs the actual communication.

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