Bees v0.5.0 API

apps.pathfinder
Class PathfinderSession

java.lang.Object
  |
  +--bees.core.ProtocolSession
        |
        +--bees.core.ExtendedProtocolSession
              |
              +--apps.pathfinder.PathfinderSession
All Implemented Interfaces:
ExternalCapsuleReceiver, NodeCache.EventHandler

public class PathfinderSession
extends ExtendedProtocolSession
implements NodeCache.EventHandler

PathfinderSession tracks any state global to the pathfinder protocol. Protocols using pathfinder as a companion will want to use the configure and configureRoot methods.


Fields inherited from class bees.core.ExtendedProtocolSession
METHOD_ADD_NEIGHBOR, METHOD_ERROR, METHOD_NONE, METHOD_REGISTER, METHOD_REM_NEIGHBOR, METHOD_REPLY, METHOD_UNREGISTER, METHOD_USER, REGISTER_TIMEOUT
 
Fields inherited from class bees.core.ProtocolSession
neighbors
 
Constructor Summary
PathfinderSession()
          Construct an empty PathfinderSession.
 
Method Summary
 void attachNeighbor(Node node, Neighbor neighbor)
          Call back used to attach receivers for this protocol's Capsules.
 IntegerPermission collected(Node node, ProtocolSession ps)
          This is called when this element is up for collection, the return value specifies the new expiration time.
 void configure(Node node, Capsule cap)
          Configure the session object.
 void configureRoot(Node node, Capsule cap)
          Configure the session object so that this is the root node.
 void detachNeighbor(Node node, Neighbor neighbor)
          Call back used to detach receivers for this protocol's Capsules.
 int getHops()
           
 Neighbor getRootNeighbor()
           
 boolean isRoot()
           
 void removed(Node node, ProtocolSession ps)
          This is called when the element is manually removed from from the cache.
 void setHops(int hops)
           
 java.lang.String toString()
           
 
Methods inherited from class bees.core.ExtendedProtocolSession
addNeighbor, getInterests, getNeighbors, notifyInterests, receive, register, removeNeighbor, reply, reply, unregister, userReceive
 
Methods inherited from class bees.core.ProtocolSession
addNeighbor, getByteArray, getCache, removeNeighbor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PathfinderSession

public PathfinderSession()
Construct an empty PathfinderSession.
Method Detail

getRootNeighbor

public Neighbor getRootNeighbor()
Returns:
The next neighbor on the path to the root node.

isRoot

public boolean isRoot()
Returns:
True if this node is the root, false otherwise.

configure

public void configure(Node node,
                      Capsule cap)
Configure the session object. This entails creating the parameters object and adding the ConfigurationCapsule to the NodeCache.
Parameters:
node - The current Node object.
cap - A valid Capsule with a "transformTo.apps.pathfinder.ConfigurationCapsule" permisson that can be used as a specializer value

configureRoot

public void configureRoot(Node node,
                          Capsule cap)
Configure the session object so that this is the root node.
Parameters:
node - The current Node object.
cap - A valid Capsule with a "transformTo.apps.pathfinder.ConfigurationCapsule" permisson that can be used as a specializer value.

getHops

public int getHops()
Returns:
The smallest number of hops to the root we've found so far.

setHops

public void setHops(int hops)
Parameters:
hops - The smallest number of hops to the root we've found so far.

attachNeighbor

public void attachNeighbor(Node node,
                           Neighbor neighbor)
Description copied from class: ProtocolSession
Call back used to attach receivers for this protocol's Capsules.
Overrides:
attachNeighbor in class ProtocolSession
See Also:
ProtocolSession.attachNeighbor(Node, Neighbor)

detachNeighbor

public void detachNeighbor(Node node,
                           Neighbor neighbor)
Description copied from class: ProtocolSession
Call back used to detach receivers for this protocol's Capsules.
Overrides:
detachNeighbor in class ProtocolSession
See Also:
ProtocolSession.detachNeighbor(Node, Neighbor)

removed

public void removed(Node node,
                    ProtocolSession ps)
Description copied from interface: NodeCache.EventHandler
This is called when the element is manually removed from from the cache.
Specified by:
removed in interface NodeCache.EventHandler
See Also:
NodeCache.EventHandler.removed(Node, ProtocolSession)

collected

public IntegerPermission collected(Node node,
                                   ProtocolSession ps)
Description copied from interface: NodeCache.EventHandler
This is called when this element is up for collection, the return value specifies the new expiration time. Null is returned if the element should really be collected.
Specified by:
collected in interface NodeCache.EventHandler
See Also:
NodeCache.EventHandler.collected(Node, ProtocolSession)

toString

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

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/