All Packages  This Package  Class Hierarchy  Class Search  Index

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

  Summary

public class  Node
     extends java.lang.Object
{
          // Fields 12
     private final Hashtable GIDtoCodeGroup;
     private final Hashtable MIDtoCapsuleClass;
     private final int address;
     private Application app;
     private NodeCache cache;
     private static final Hashtable globalAppsTable;
     private final int id;
     private static int idMax;
     private final Hashtable nameToCapsuleClass;
     private final CommSpaceHandle neighbors;
     private final Hashtable outChannels;
     final UnknownMidPackets unknownMidPackets;

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

          // Methods 32
     static Node currentNode();

     private OutChannel addOutChannel(int, Address);
     void attachApplication(Application) throws AttachException;
     public boolean deliverToApp(Capsule, int);
     void detachApplication(Application) throws AttachException;
     TypeID findMID(String);
     TypeID findPID(String);
     public int getAddress();
     public NodeCache getCache();
     private void getNeighbors();
     public String getPhysicalAddressSpec();
     public String getPhysicalProtocolSpec();
     public RouteTable getRouteTable();
     public String hostname();
     public int identity();
     public String identityString();
     public void log(int, String);
     public void log(int, Throwable);
     public void logStackTrace(int, Throwable);
     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 void threadStart(Runnable);
     public void threadStart(Runnable, String);
     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:
Janos Ministry of Development , Janos Ministry of Development


  Cross Reference

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





  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.


· globalAppsTable

Summary  |  Top
   private static final Hashtable globalAppsTable

XXX this is static. That is bad, and wrong. It needs to be a CommSpace so that flows can look applications up...

XXX probably should only allocate this on demand.

XXX MUCH CROSS-FLOW SHARING GOING ON THROUGH THIS TABLE.


· app

Summary  |  Top
   private Application app

A "list" of all the applications running on this Node (i.e., in this Flow.

Optimized for the current case of exactly one app per node...

Will be null in protocol-based flows.


· cache

Summary  |  Top
   private NodeCache cache

The per-flow NodeCache for leaving state between capsules.


· idMax

Summary  |  Top
   private static int idMax


· id

Summary  |  Top
   private final int id

Primitive node identifier hack.


  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


· getPhysicalProtocolSpec

Summary  |  Top
   public String getPhysicalProtocolSpec() 


· getPhysicalAddressSpec

Summary  |  Top
   public String getPhysicalAddressSpec() 


· 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 ANTSR interfaces. The "current node" should be an explicit paramter to those functions that need it.



· getNeighbors

Summary  |  Top
   private void getNeighbors() 

Lookup the neighbor table and construct outchans to each neighbor.



· addOutChannel

Summary  |  Top
   private OutChannel 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) 

Inject a given capsule into the network via the local node. This method is only called by Application#send(). Note that the capsule's evaluate() is responsible for routing...



· threadStart

Summary  |  Top
   public void threadStart(Runnable r) 


· threadStart

Summary  |  Top
   public void threadStart(Runnable r, 
                           String threadName) 


· routeForNode

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

Route a capsule for a particular destination. Note that there is no next hop to the current node, and it is therefore impossible to route to ourself. Since capsules are evaluated at the local node before being sent, it seems like a bad idea to allow them to route to the same node -- this would likely produce an infinite loop. XXX should be "sendToNode()"



· 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) 

Find a CapsuleClass for the given MID. CapsuleClasses are registered by publishCapsuleClass.

See Also: publishCapsuleClass



· lookupCodeGroup

Summary  |  Top
   CodeGroup lookupCodeGroup(TypeID gid) 


· attachApplication

Summary  |  Top
   void attachApplication(Application app)  throws AttachException

Attach the given "app" object at its port. An Exception (AttachException) is thrown if some app is already registered at the app's port.

If the app's port is zero then an available port number will be allocated for the application.

The app provided must be an app running on the current Node (i.e., in the current Flow). The app will automatically be de-registered when this Node is shutdown.



· detachApplication

Summary  |  Top
   void detachApplication(Application app)  throws AttachException


· getCache

Summary  |  Top
   public NodeCache getCache() 


· sleep

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


· shutdown

Summary  |  Top
   public void shutdown() 

Shutdown this Node. Just kills the flow.

Interface for shutting down the entire node isn't (yet) visible.



· hostname

Summary  |  Top
   public String hostname() 

Return the string name of the host machine.



· time

Summary  |  Top
   public long time() 

Return the current time in milliseconds.



· log

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


· log

Summary  |  Top
   public void log(int level, 
                   Throwable exception) 


· logStackTrace

Summary  |  Top
   public void logStackTrace(int level, 
                             Throwable exception) 


· getRouteTable

Summary  |  Top
   public RouteTable getRouteTable() 


· identity

Summary  |  Top
   public int identity() 

Return the host-local identity of this "node". Currently just the integer id of the instance. Should eventually be an identity associated with the Protocol/User.



· identityString

Summary  |  Top
   public String identityString() 

Return a String that identifies this Node. Useful for debugging traces.



· 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