ANTS v2.0 API

ants.core
Class Protocol

java.lang.Object
  |
  +--ants.core.Protocol
Direct Known Subclasses:
ants.core.BuiltinProtocol, DanteProtocol, DynamicRouteProtocol, MobileProtocol, MulticastProtocol, PingProtocol, PongProtocol, StatsProtocol, StatsProtocol

public class Protocol
extends java.lang.Object

Base class for all protocols. Intended to be subclassed for each user-defined protocol for the purpose of collecting capsules into a protocol and registering it at the local node. A Protocol object is a short-lived object used only for defining a new protocol. After the protocol is defined and registered with the node it may be thrown away. This class could more effectively be called "ProtocolDescription".

A protocol is organized into a collection of CodeGroups where each CodeGroup contains one or more CapsuleClasses. Unlike the Protocol object, CodeGroup and CapsuleClass objects are long-lived and must be kept in a cache on a node for the node to be able to process the protocol.

A protocol is intially registered at an end node. Classes are loaded from the local file system to define the protocol. When a capsule is sent from a protocol, the receiving node (probably) won't have the code to process it. The receiving node will then send a request for a specific CapsuleClass to the node which sent the capsule. The node will respond with the relevant CodeGroup which contains the requested class. Note that the receving node will never ask for a Protocol object it just uses CodeGroups and CapsuleClasses. There is no useful state in a Protocol object.

This class should probably be abstract, but its used as a concrete class for weak reasons in a number of test cases.

To define a protocol requires definining the relevant CodeGroups and the CapsuleClasses contained in each CodeGroup. For example:

 public class MulticastProtocol extends Protocol
 {
   public MulticastProtocol()
   {
     startProtocolDefn();
  
     startGroupDefn();
     addCapsule("apps.MulticastCapsule");
     endGroupDefn();
  
     startGroupDefn();
     addCapsule("apps.MulticastSubscribeCapsule");
     endGroupDefn();
  
     endProtocolDefn();
   }
 }
 
XXX This class defines a new protocol with two code groups....

Author:
David Wetherall, Utah Janos Team
See Also:
CodeGroup, CapsuleClass

Constructor Summary
Protocol()
           
 
Method Summary
 java.lang.String toString()
          Return a string representation of this Protocol.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Protocol

public Protocol()
Method Detail

toString

public java.lang.String toString()
Return a string representation of this Protocol.
Overrides:
toString in class java.lang.Object
Returns:
A string.

ANTS v2.0 API

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