stella.net
Class ErrorReceiver

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.ErrorReceiver
All Implemented Interfaces:
Cloneable, Runnable, Remote, ErrorProcessing, RmiErrorCaster, CancelRunnable, ExitCleaning, Initializable, LocalizedSupplying, PropertySupplying, ResourceSupplying, RmiCaster, RmiPropertyBearing

public class ErrorReceiver
extends ErrorServer

The ascii-error receiver. This class comprises all the necessary methods to read in ascii-versions of an ErrorEvent via a socket. It acts as a fully functional RMI-based ErrorCaster and can therefore be used as a converter from ascii-string-via-sockets to a fully RMI message caster. The details of the class functionality can be described as follows.


Nested Class Summary
protected  class ErrorReceiver.ErrorHandler
          Handles the error protocol.
static class ErrorReceiver.Run
          For test purposes.
 
Nested classes/interfaces inherited from class util.PropertyResources
PropertyResources.URLResource
 
Field Summary
private static long DEFAVAILABLE
          The default sleep interval between available queries.
private static ThreadGroup DEFERRORGROUP
          The thread group commands run in.
private static long DEFTIMEOUT
          The default sleep interval between available queries.
private  ThreadGroup errorgroup
          The thread group to use for error handlers.
static String KEY_AVAILABLE
          The key for sleep intervalls on available queries.
static String KEY_ERRORGROUP
          The key in the properties for the alarm thread group.
static String KEY_TIMEOUT
          The key for join-time on cancel.
private  Object lockread
          Used for locking during read.
private  ErrorReceiver.ErrorHandler receive
          The protocol handler for incoming errors.
 
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
ErrorReceiver(Map qualify)
          Constructs a new receiver with the specified properties.
 
Method Summary
 void cancel()
          Cancels the parameter server.
protected  void protocol(Socket client)
          The method to handle the communication from the error-sending client to this receiver.
 
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.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_ERRORGROUP

public static final String KEY_ERRORGROUP
The key in the properties for the alarm thread group.

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

KEY_AVAILABLE

public static final String KEY_AVAILABLE
The key for sleep intervalls on available queries.

See Also:
Constant Field Values

DEFTIMEOUT

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

See Also:
Constant Field Values

DEFERRORGROUP

private static final ThreadGroup DEFERRORGROUP
The thread group commands run in.


DEFAVAILABLE

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

See Also:
Constant Field Values

errorgroup

private ThreadGroup errorgroup
The thread group to use for error handlers.


receive

private ErrorReceiver.ErrorHandler receive
The protocol handler for incoming errors.


lockread

private Object lockread
Used for locking during read.

Constructor Detail

ErrorReceiver

public ErrorReceiver(Map qualify)
              throws RemoteException
Constructs a new receiver with the specified properties. Use of this constructor ensures no additional properties to be set.
This constructor exports the newly created error receiver to the registry as an unicast object.

Throws:
RemoteException
Method Detail

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 to handle the communication from the error-sending client to this receiver. It takes the client socket as an argument and spawns a ErrorReceiver.ErrorHandler thread that implements the error-receiving protocol. The priority the handler thread should run at is defined in the base class and is querried with the ReceiverServer.getHandlerPriority() method.
As soon as the handler is started this method returns, allowing the receiver to regain its listening stage quickly.

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