one.toys
Class RemoteSender

java.lang.Object
  |
  +--one.world.core.Component
        |
        +--one.toys.RemoteSender
All Implemented Interfaces:
Serializable

public final class RemoteSender
extends Component

Sends a remote event to a receiver every DELAY ms.

Usage:

      RemoteSender [name] [hostname] [port]
 

The name is the name of the event handler to send to. If no name is specified, "receiver" will be used. A hostname and port may optionally be specified. If no hostname is specified, the event will be routed through discovery rather than to a particular host.

Imported and Exported Event Handlers

Exported event handlers:

main
Handles environment events.

Imported event handlers:

request
The environment's request handler.

Version:
$Revision: 1.4 $
See Also:
RemoteReceiver, one.world.rep, Serialized Form

Inner classes inherited from class one.world.core.Component
Component.HandlerReference, Component.Importer
 
Field Summary
protected static int DELAY
          The delay between sending remote events (1000 ms).
 
Constructor Summary
RemoteSender(Environment env, SymbolicHandler resource)
          Creates a new remote event sender.
 
Method Summary
 ComponentDescriptor getDescriptor()
          Get the component descriptor.
static void init(Environment env, Object closure)
          Initialize the event sender.
 
Methods inherited from class one.world.core.Component
declareExported, declareImported, equals, eventHandlers, getDescriptor, getEnvironment, getLinkedHandlers, getLinkedNumber, getTimer, hasEventHandler, hashCode, isFullyLinked, isLinked, isSealed, link, link, run, seal, unbox, undeclare, unlink, wrap
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DELAY

protected static final int DELAY
The delay between sending remote events (1000 ms).
Constructor Detail

RemoteSender

public RemoteSender(Environment env,
                    SymbolicHandler resource)
Creates a new remote event sender.
Parameters:
env - The environment for the new instance.
resource - The remote resource to send events to.
Method Detail

getDescriptor

public ComponentDescriptor getDescriptor()
Get the component descriptor.
Overrides:
getDescriptor in class Component
Following copied from class: one.world.core.Component
Returns:
The component descriptor for this component.

init

public static void init(Environment env,
                        Object closure)
Initialize the event sender. The closure must be a string array that specifies

  1. The remote event receiver name (default is "receiver")
  2. The remote host name (discovery is used if no hostname is provided)
  3. The remote port (default is Constants.REP_PORT)

Parameters:
env - The environment to run in.
closure - The closure.
Throws:
IllegalArgumentException - Signals that the closure is not a string array or that the port is not an integer.


(C) Copyright 2001 UW CSE