All Packages  This Package  Class Hierarchy  Class Search  Index

Class edu.utah.janos.ants.ants.Node
java.lang.Object
   |
   +----edu.utah.janos.ants.ants.Node

  Summary

public class  Node
     extends java.lang.Object
{
          // Fields 8
     private final Hashtable GIDtoCodeGroup;
     private final Hashtable MIDtoCapsuleClass;
     private final int address;
     private static final Hashtable applications;
     private final Hashtable nameToCapsuleClass;
     private final CommSpaceHandle neighbors;
     private final Hashtable outChannels;
     final UnknownMidPackets unknownMidPackets;

          // Constructors 1
     Node(Flow, CommSpaceHandle, int, UnknownMidPackets);

          // Methods 23
     static void attachApplication(Application, int) throws AttachException;
     static Node currentNode();

     private void addOutChannel(int, Address);
     public boolean deliverToApp(Capsule, int);
     TypeID findMID(String);
     TypeID findPID(String);
     public int getAddress();
     private void getNeighbors();
     public String getPhysicalAddress();
     public RouteTable getRouteTable();
     public void log(int, String);
     CapsuleClass lookupCapsuleClass(TypeID);
     CodeGroup lookupCodeGroup(TypeID);
     void publishCapsuleClass(CapsuleClass) throws DuplicateCapsuleClassException;
     void publishCodeGroup(CodeGroup);
     public void register(Protocol);
     public boolean routeForNode(Capsule, int);
     public boolean send(Capsule);
     public void shutdown();
     public void sleep(int) throws InterruptedException;
     public Thread threadStart(Runnable);
     public long time();
     public String toString();
}

The per-flow Node interface.

An instance of Node is created in the context of each Application and protocol. %AUTHOR_PAT% %AUTHOR_CKH%


  Cross Reference

Returned By:
Application.thisNode(), Booster.setupLocalNode(), Extension.thisNode(), Node.currentNode()





  Fields

· address

Summary  |  Top
   private final int address


· outChannels

Summary  |  Top
   private final Hashtable outChannels


· neighbors

Summary  |  Top
   private final CommSpaceHandle neighbors


· unknownMidPackets

Summary  |  Top
   final UnknownMidPackets unknownMidPackets


· GIDtoCodeGroup

Summary  |  Top
   private final Hashtable GIDtoCodeGroup

Maps groupsIDs to CodeGroups.


· MIDtoCapsuleClass

Summary  |  Top
   private final Hashtable MIDtoCapsuleClass

Maps MIDs to CapsuleClasses.


· nameToCapsuleClass

Summary  |  Top
   private final Hashtable nameToCapsuleClass

Maps name to CapsuleClass. This table is used to supply a PID or MID given the name of a CapsuleClass.


· applications

Summary  |  Top
   private static final Hashtable applications

XXX this is static. That is bad, and wrong. It shouldn't be static any more as app ports are Flow-private. XXX probably should only allocate this on demand.


  Constructors

· Node

Summary  |  Top

   Node(Flow flow, 
        CommSpaceHandle neighbors, 
        int address, 
        UnknownMidPackets unknownMidPackets) 

Construct a node. A node is only constructed by the boot routine in PrimordialNode, AppBooster or ProtocolBooster.



  Methods

· getAddress

Summary  |  Top
   public int getAddress() 

Return the logical 32-bit IP-like "active" address for this Node.

Returns:
the 32-bit IP-like "active" address of this Node


· getPhysicalAddress

Summary  |  Top
   public String getPhysicalAddress() 


· currentNode

Summary  |  Top
   static Node currentNode() 

Return the Node interface associated with the current flow.

XXX This method is a hack and should go away once we get free reign to re-write the basic ANTS interfaces.



· getNeighbors

Summary  |  Top
   private void getNeighbors() 

Lookup the neighbor table and construct outchans to each neighbor.



· addOutChannel

Summary  |  Top
   private void addOutChannel(int logicalAddress, 
                              Address physicalAddress) 


· register

Summary  |  Top
   public void register(Protocol p) 

Called by applications that want to instantiate a locally originiating protocol.

This is a public interface that we really can't change.



· deliverToApp

Summary  |  Top
   public boolean deliverToApp(Capsule cap, 
                               int port) 

Deliver the given capsule to the Application on the given port number.

XXX access control?

Throws: NoSuchApplicationError
if the port doesn't have an app listening on it.


· send

Summary  |  Top
   public boolean send(Capsule cap) 


· threadStart

Summary  |  Top
   public Thread threadStart(Runnable r) 


· routeForNode

Summary  |  Top
   public boolean routeForNode(Capsule cap, 
                               int destination) 


· publishCapsuleClass

Summary  |  Top
   void publishCapsuleClass(CapsuleClass cc)  throws DuplicateCapsuleClassException

Publish the given CapsuleClass in both the name -> cc map and the MID -> cc map.

Parameter Description
cc the CapsuleClass to publish. Must have a name and methodID defined.

Throws: DuplicateCapsuleClassException
if a CC is already registered under the cc's name.


· publishCodeGroup

Summary  |  Top
   void publishCodeGroup(CodeGroup group) 


· findMID

Summary  |  Top
   TypeID findMID(String name) 


· findPID

Summary  |  Top
   TypeID findPID(String name) 


· lookupCapsuleClass

Summary  |  Top
   CapsuleClass lookupCapsuleClass(TypeID mid) 


· lookupCodeGroup

Summary  |  Top
   CodeGroup lookupCodeGroup(TypeID gid) 


· attachApplication

Summary  |  Top
   static void attachApplication(Application app, 
                                 int port)  throws AttachException


· sleep

Summary  |  Top
   public void sleep(int millis)  throws InterruptedException


· shutdown

Summary  |  Top
   public void shutdown() 


· time

Summary  |  Top
   public long time() 


· log

Summary  |  Top
   public void log(int level, 
                   String msg) 


· getRouteTable

Summary  |  Top
   public RouteTable getRouteTable() 


· toString

Summary  |  Top
   public String toString() 
Overrides:
toString in class Object


All Packages  This Package  Class Hierarchy  Class Search  Index
Freshly brewed Java API Documentation automatically generated with polardoc Version 1.0.7