Bees v0.5.0 API

bees.core
Class ProtocolSession

java.lang.Object
  |
  +--bees.core.ProtocolSession
All Implemented Interfaces:
ExternalCapsuleReceiver
Direct Known Subclasses:
ExtendedProtocolSession

public class ProtocolSession
extends java.lang.Object
implements ExternalCapsuleReceiver

A ProtocolSession is an intermediary between a Protocol and an application. In addition, it can be used to maintain Protocol global state.


Field Summary
protected  java.util.Hashtable neighbors
          The set of neighbors added to the protocol.
 
Constructor Summary
ProtocolSession()
          Construct ProtocolSession object and a NodeCache.
 
Method Summary
 void addNeighbor(Node node, NeighborImpl ni)
          Add a neighbor to this session and any others in this flow.
 void attachNeighbor(Node node, Neighbor neighbor)
          Call back used to attach receivers for this protocol's Capsules.
 void detachNeighbor(Node node, Neighbor neighbor)
          Call back used to detach receivers for this protocol's Capsules.
 byte[] getByteArray(java.lang.String name)
          Get a raw byte array that was added to the Protocol.
 NodeCache getCache()
           
 void receive(Node node, ExternalCapsule ec)
          Call back used to handle a newly received ExternalCapsule.
 void removeNeighbor(Node node, NeighborImpl ni)
          Remove a neighbor from this session and any others in this flow.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

neighbors

protected final java.util.Hashtable neighbors
The set of neighbors added to the protocol.
Constructor Detail

ProtocolSession

public ProtocolSession()
Construct ProtocolSession object and a NodeCache.
Method Detail

getCache

public NodeCache getCache()
Returns:
The NodeCache for this session.

getByteArray

public byte[] getByteArray(java.lang.String name)
Get a raw byte array that was added to the Protocol.
Parameters:
name - The name of the byte array as given to the Protocol.
Returns:
The byte array matching the given name or null if it couldn't be found.

attachNeighbor

public void attachNeighbor(Node node,
                           Neighbor neighbor)
Call back used to attach receivers for this protocol's Capsules.
Parameters:
node - The current Node object.
neighbor - A standard neighbor object, which can be ignored if this protocol requires a special one.

detachNeighbor

public void detachNeighbor(Node node,
                           Neighbor neighbor)
Call back used to detach receivers for this protocol's Capsules.
Parameters:
node - The current Node object.
neighbor - The neighbor created for or used by this session.

addNeighbor

public void addNeighbor(Node node,
                        NeighborImpl ni)
Add a neighbor to this session and any others in this flow.
Parameters:
node - The current Node object.
ni - The NeighborImpl to be added to this flow.

removeNeighbor

public void removeNeighbor(Node node,
                           NeighborImpl ni)
Remove a neighbor from this session and any others in this flow.
Parameters:
node - The current Node object.
ni - The NeighborImpl to be removed from this flow.

receive

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

toString

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

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/