Bees v0.5.0 API

bees.core
Class ExtendedProtocolSession

java.lang.Object
  |
  +--bees.core.ProtocolSession
        |
        +--bees.core.ExtendedProtocolSession
All Implemented Interfaces:
ExternalCapsuleReceiver
Direct Known Subclasses:
DiscoveryProtocolSession, DLProtocolSession, HealthSession, IDTranslatorSession, LivenessSession, PathfinderSession

public class ExtendedProtocolSession
extends ProtocolSession

An ExtendedProtocolSession is a ProtocolSession that provides functionality for tracking interested applications and managing the addition and removal of neighbors.


Field Summary
static int METHOD_ADD_NEIGHBOR
          Add a neighbor object to the protocol.
static int METHOD_ERROR
          Report an error.
static int METHOD_NONE
          Null method identifier.
static int METHOD_REGISTER
          Register an application with the protocol.
static int METHOD_REM_NEIGHBOR
          Remove a neighbor object from the protocol.
static int METHOD_REPLY
          Flag indicating that the message is a reply to another message.
static int METHOD_UNREGISTER
          Unregister an application from a protocol.
static int METHOD_USER
          The start of user messages.
static IntegerPermission REGISTER_TIMEOUT
          Timeout for registered applications.
 
Fields inherited from class bees.core.ProtocolSession
neighbors
 
Constructor Summary
ExtendedProtocolSession()
          Construct an empty ExtendedProtocolSession.
 
Method Summary
 void addNeighbor(Node node, ExternalCapsule ec, NeighborImpl ni)
          Handle a neighbor addition.
 java.util.Hashtable getInterests()
           
 java.util.Hashtable getNeighbors()
           
 void notifyInterests(ExternalCapsule ec)
          Broadcast an ExternalCapsule to any interested applications.
 void receive(Node node, ExternalCapsule ec)
          Call back used to handle a newly received ExternalCapsule.
 void register(Node node, ExternalCapsule cap, ExternalChannel ec)
          Handle a registration.
 void removeNeighbor(Node node, ExternalCapsule ec, NeighborImpl ni)
          Handle a neighbor removal.
 void reply(ExternalChannel channel, int method)
          Send a reply to a specific application.
 void reply(ExternalChannel channel, int method, java.lang.Throwable th)
          Send a reply to a specific application.
 java.lang.String toString()
           
 void unregister(Node node, ExternalCapsule cap, ExternalChannel ec)
          Handle an unregistration.
protected  void userReceive(Node node, int method, ExternalCapsule ec)
           
 
Methods inherited from class bees.core.ProtocolSession
addNeighbor, attachNeighbor, detachNeighbor, getByteArray, getCache, removeNeighbor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

REGISTER_TIMEOUT

public static IntegerPermission REGISTER_TIMEOUT
Timeout for registered applications.

METHOD_NONE

public static final int METHOD_NONE
Null method identifier.

METHOD_ERROR

public static final int METHOD_ERROR
Report an error.

METHOD_REGISTER

public static final int METHOD_REGISTER
Register an application with the protocol.

METHOD_UNREGISTER

public static final int METHOD_UNREGISTER
Unregister an application from a protocol.

METHOD_ADD_NEIGHBOR

public static final int METHOD_ADD_NEIGHBOR
Add a neighbor object to the protocol.

METHOD_REM_NEIGHBOR

public static final int METHOD_REM_NEIGHBOR
Remove a neighbor object from the protocol.

METHOD_USER

public static final int METHOD_USER
The start of user messages.

METHOD_REPLY

public static final int METHOD_REPLY
Flag indicating that the message is a reply to another message.
Constructor Detail

ExtendedProtocolSession

public ExtendedProtocolSession()
Construct an empty ExtendedProtocolSession.
Method Detail

getNeighbors

public java.util.Hashtable getNeighbors()

getInterests

public java.util.Hashtable getInterests()
Returns:
The table of external interests.

notifyInterests

public void notifyInterests(ExternalCapsule ec)
Broadcast an ExternalCapsule to any interested applications.
Parameters:
ec - The ExternalCapsule to broadcast.

reply

public void reply(ExternalChannel channel,
                  int method,
                  java.lang.Throwable th)
Send a reply to a specific application.
Parameters:
channel - The destination for the reply.
method - The method send a reply for.
th - An exception or NULL if the operation succeeded.

reply

public void reply(ExternalChannel channel,
                  int method)
Send a reply to a specific application.
Parameters:
channel - The destination for the reply.
method - The method send a reply for.

register

public void register(Node node,
                     ExternalCapsule cap,
                     ExternalChannel ec)
Handle a registration.
Parameters:
node - The current node.
cap - The ExternalCapsule containing the registration message.
ec - The ExternalChannel that should be registered.

unregister

public void unregister(Node node,
                       ExternalCapsule cap,
                       ExternalChannel ec)
Handle an unregistration.
Parameters:
node - The current node.
cap - The ExternalCapsule containing the unregistration message.
ec - The ExternalChannel that should be unregistered.

addNeighbor

public void addNeighbor(Node node,
                        ExternalCapsule ec,
                        NeighborImpl ni)
Handle a neighbor addition.
Parameters:
node - The current node.
cap - The ExternalCapsule containing the message.
ni - The NeighborImpl that should be added.

removeNeighbor

public void removeNeighbor(Node node,
                           ExternalCapsule ec,
                           NeighborImpl ni)
Handle a neighbor removal.
Parameters:
node - The current node.
cap - The ExternalCapsule containing the message.
ni - The NeighborImpl that should be removed.

receive

public void receive(Node node,
                    ExternalCapsule ec)
Description copied from interface: ExternalCapsuleReceiver
Call back used to handle a newly received ExternalCapsule.
Overrides:
receive in class ProtocolSession
Following copied from interface: bees.core.ExternalCapsuleReceiver
Parameters:
node - The Node object for this domain.
ec - The newly received ExternalCapsule.

userReceive

protected void userReceive(Node node,
                           int method,
                           ExternalCapsule ec)

toString

public java.lang.String toString()
Overrides:
toString in class ProtocolSession

Bees v0.5.0 API

This documentation is Copyright (C) 2002 The University of Utah. All Rights Reserved. See the individual source files for distribution terms.
Documentation, software, and mailing lists for Bees v0.5.0 can be found at the Janos Project: http://www.cs.utah.edu/flux/janos/