All Packages  This Package  Class Hierarchy  Class Search  Index

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

  Summary

public abstract class  Application
     extends edu.utah.janos.ants.ants.Entity
{
          // Fields 6
     private static final int DEFAULTRLIMIT;
     private static final int DEFAULT_TTL;
     public static final String[] defaults;
     private Node node;
     protected short port;
     private int ttl;

          // Constructors 1
     public Application();

          // Methods 12
     public int getDefaultResources();
     public int getDefaultTTL();
     public int getPort();
     public void receive(Capsule);
     public boolean send(Capsule);
     public boolean send(Capsule, int);
     public void setArgs(KeyArgs) throws InvalidKeyArgsException;
     public void setDefaultResources(int);
     public void setDefaultTTL(int);
     void setNode(Node);
     public abstract void start() throws Exception;
     public Node thisNode();
}

Abstract node application. An Application is an end-point for capsules. Capsules are sent and received via the Node associated with the Application.

Applications understand the '-port' KeyArg for setting their port address on the Node.

Applications are started after the Node has completed initialization.

Author:
David Wetherall


  Cross Reference

Extended By:
Application, DynamicRouteApp





  Fields

· defaults

Summary  |  Top
   public static final String[] defaults

Default KeyArgs for an application. Sets port to 0.


· node

Summary  |  Top
   private Node node

The Node associated with this application. All Capsules are sent via and recieved from this Node.

See Also: setNode, getNode


· DEFAULTRLIMIT

Summary  |  Top
   private static final int DEFAULTRLIMIT
Note: DEFAULTRLIMIT is deprecatedPlease use DEFAULT_TTL instead.

The default default resource limit for packets sent by an Application.


· DEFAULT_TTL

Summary  |  Top
   private static final int DEFAULT_TTL

The default TTL for packets sent by this application.


· ttl

Summary  |  Top
   private int ttl

The default resource limit for Capsules sent by this application.

See Also: setDefaultResources, getDefaultResources


· port

Summary  |  Top
   protected short port

The port for this application. This is the identifier by which remote nodes can send capsules to this application: the address determines the Node, and the port determines the application.

Set by the '-port' KeyArg. Defaults to 0.

See Also: attachApplication


  Constructors

· Application

Summary  |  Top

   public Application() 

All applications must have a no-arg constructor as the Node invokes Class.newInstance() to create the application.



  Methods

· getDefaultTTL

Summary  |  Top
   public int getDefaultTTL() 


· setDefaultTTL

Summary  |  Top
   public void setDefaultTTL(int ttl) 


· getDefaultResources

Summary  |  Top
   public int getDefaultResources() 
Note: getDefaultResources() is deprecateduse getDefaultTTL()



· setDefaultResources

Summary  |  Top
   public void setDefaultResources(int r) 
Note: setDefaultResources() is deprecateduse setDefaultTTL(int)



· getPort

Summary  |  Top
   public int getPort() 


· thisNode

Summary  |  Top
   public Node thisNode() 

Return the Node interface customized for this application.



· setNode

Summary  |  Top
   void setNode(Node node) 

Assign the node interface to this application. Done only in AppBooster.run().

See Also: run



· send

Summary  |  Top
   public boolean send(Capsule cap, 
                       int ttl) 

Send the given capsule with the given resource limit.

The capsule is primed (that is, the 'from address' and ttl are set), and then sent via the associated Node.

Parameter Description
cap the Capsule to send. XXX state of Xdr?
ttl the TTL to give the Capsule.

See Also: send, prime



· send

Summary  |  Top
   public boolean send(Capsule cap) 

Send the given capsule.

The capsule is primed with the default TTL (this.ttl) then, the capsule is sent via the associated Node.

See Also: ttl, prime, send



· receive

Summary  |  Top
   public void receive(Capsule cap) 

Callback for packets that are delivered to this application. This does nothing, so the default behavior for the application is to drop delivered packets on the floor.

Parameter Description
cap the Capsule that got delivered. XXX state of Xdr?



· start

Summary  |  Top
   public abstract void start()  throws Exception

Start this Application rolling. This is invoked once by the Node after it has been initialized.

Note that implementations of start should just set things up. If the application wants to do things like send packets, this function should start a new thread to do that. Creating a GUI and associating callbacks is a good thing to do here.

XXX mostly stuff that could just be done in the no-arg constructor, no?



· setArgs

Summary  |  Top
   public void setArgs(KeyArgs k)  throws InvalidKeyArgsException

Parse command line arguments for this application. Understands the -port option.

Overrides:
setArgs in class Entity

See Also: port, ManagedObject



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