stella.net
Class TestCaster

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.AbstractCommandLauncher
                              extended by stella.net.CasterClient
                                  extended by stella.net.TestCaster
All Implemented Interfaces:
Cloneable, Remote, Caster, CommandLaunching, ErrorCaster, ReplyDeliverer, RmiAcknowledgeCaster, RmiCommandCaster, RmiDoneCaster, RmiErrorCaster, ExitCleaning, Initializable, LocalizedSupplying, PropertySupplying, ResourceSupplying, RmiCaster, RmiPropertyBearing

public class TestCaster
extends CasterClient

This class test some capabilities of the caster class. It sends to a test receiver class test commands with command numbers 799. The replies received from the test receiver are piped to standard err.


Nested Class Summary
 
Nested classes/interfaces inherited from class stella.net.CasterClient
CasterClient.CommandSender
 
Nested classes/interfaces inherited from class util.PropertyResources
PropertyResources.URLResource
 
Field Summary
 
Fields inherited from class stella.net.CasterClient
KEY_ACKNOWLEDGETIMEOUT, KEY_ALARMGROUP, KEY_BIND, KEY_BUFFERSIZE, KEY_CASTERNAME, KEY_MAXWAITONCLOSE, KEY_PORT, KEY_RECEIVER, KEY_RETRYCOUNT, KEY_RETRYSLEEP
 
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 stella.rmi.RmiCommandCaster
NAMING_EXTENSION
 
Fields inherited from interface stella.rmi.RmiAcknowledgeCaster
NAMING_EXTENSION
 
Fields inherited from interface stella.rmi.RmiDoneCaster
NAMING_EXTENSION
 
Fields inherited from interface util.PropertySupplying
CONFIG, KEY_CLASS
 
Fields inherited from interface util.ResourceSupplying
KEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOME
 
Constructor Summary
TestCaster(Map ensure)
          Constructs a test caster.
 
Method Summary
private static CommandEvent generateRandomCommand(Object src)
          Generates one random command out of a list of possible command.
 CommandEvent getShutdownCommand()
          Returns the command that initiates a shutdown on the device or prepares it for a shutdown.
 boolean handles(CommandEvent ce)
          A test caster handles test commands.
 boolean isReady()
          Should always return true if socket connection is open.
static void main(String[] arg)
          For testing.
 
Methods inherited from class stella.net.CasterClient
addRmiAcknowledgeListener, addRmiCommandListener, addRmiDoneListener, announceInterest, castCommand, checkForward, close, exit, getAcknowledgeTimeOut, getAlarmGroup, getBufferSize, getClientName, getExitCommand, getPort, getReceiver, init, notifyAcknowledgeListener, notifyCommandListener, notifyDoneListener, recastCommand, registerReplySubscriber, removeRmiAcknowledgeListener, removeRmiCommandListener, removeRmiDoneListener
 
Methods inherited from class stella.AbstractCommandLauncher
createCommandLauncher
 
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 stella.ErrorCaster
addErrorListener, removeErrorListener
 
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
 
Methods inherited from interface util.ResourceSupplying
getResource, getResourceAsStream, getResources
 

Constructor Detail

TestCaster

public TestCaster(Map ensure)
           throws RemoteException
Constructs a test caster. Relies on default values for everything.

Throws:
RemoteException
Method Detail

handles

public boolean handles(CommandEvent ce)
A test caster handles test commands.

Specified by:
handles in interface CommandLaunching
Overrides:
handles in class CasterClient

isReady

public boolean isReady()
Description copied from class: CasterClient
Should always return true if socket connection is open.

Specified by:
isReady in interface CommandLaunching
Overrides:
isReady in class CasterClient

getShutdownCommand

public CommandEvent getShutdownCommand()
Description copied from interface: CommandLaunching
Returns the command that initiates a shutdown on the device or prepares it for a shutdown.


generateRandomCommand

private static final CommandEvent generateRandomCommand(Object src)
Generates one random command out of a list of possible command. This part is hard-coded but only meant for testing.


main

public static void main(String[] arg)
                 throws RemoteException,
                        IOException
For testing. First command line argument is the name of the receiver. If the receiver was successfully register test commands are sent to it. Between individual command this thread sleeps for an arbitrary period of up to 10 sec.

Throws:
RemoteException
IOException