All Packages  This Package  Class Hierarchy  Class Search  Index

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

  Summary

final class  CapsuleClass
     extends java.lang.Object
{
          // Fields 6
     Class cl;
     private final byte[] code;
     final CodeGroup group;
     final TypeID methodID;
     private final String name;
     private final UserID tmp_userID;

          // Constructors 1
     CapsuleClass(CodeGroup, TypeID, String, byte[]) throws DuplicateCapsuleClassException;

          // Methods 8
     static TypeID computeMethodID(TypeID, TypeID, TypeID);

     boolean checkMethodID();
     final byte[] code();
     final int codeSize();
     final String name();
     TypeID protocolID();
     public String toString();
     UserID userID();
}

This class (along with CodeGroup) represents all the information about a type of capsule. Both are used only within ANTS. Protocol uses CapsuleClasses & CodeGroups during protocol registration. CapsuleChannels use `em during capsule execution/dispatch. The DL* classes use `em during dynamic code loading over the net.

A class can be loaded from two places:

CapsuleClass objects are only constructed in a two places:

The fields of this class have package access since a CapsuleClass may be in many different states of completion during code loading and protocol registration. XXX Actually, that's probably not true.


  Cross Reference

Returned By:
Node.lookupCapsuleClass()





  Fields

· code

Summary  |  Top
   private final byte[] code

The complete Class File this CapsuleClass represents.


· name

Summary  |  Top
   private final String name

The name of the class this CapsuleClass represents.


· cl

Summary  |  Top
   Class cl

The class this CapsuleClass represents, after its been loaded of course. XXX make private


· methodID

Summary  |  Top
   final TypeID methodID

Hash of the codeID + groupID + protocolID.

rename to capsuleID XXX make private.

See Also: computeMethodID


· group

Summary  |  Top
   final CodeGroup group

The CodeGroup this CapsuleClass is a part of. XXX make private.


· tmp_userID

Summary  |  Top
   private final UserID tmp_userID


  Constructors

· CapsuleClass

Summary  |  Top

   CapsuleClass(CodeGroup group, 
                TypeID methodID, 
                String name, 
                byte[] code)  throws DuplicateCapsuleClassException

Construct a CapsuleClass with the given group, mid, name, and code. The code may be an empty array of the right length which can be filled in later.

Throws: DuplicateCapsuleClassException
if a capsule class is already registered under this name.


  Methods

· code

Summary  |  Top
   final byte[] code() 

Get the underlying array of bytes for the Class this CapsuleClass represents.



· codeSize

Summary  |  Top
   final int codeSize() 

Get the size of the code for the Class this CapsuleClass represents.



· name

Summary  |  Top
   final String name() 

Get the name of this CapsuleClass. (Also happens to be the name of the Class this CapsuleClass represents...



· computeMethodID

Summary  |  Top
   static TypeID computeMethodID(TypeID codeID, 
                                 TypeID groupID, 
                                 TypeID protocolID) 

Compute a method ID based on a codeID, a groupID and protocolID.

Returns:
the computed TypeID.


· protocolID

Summary  |  Top
   TypeID protocolID() 

Fetch the ProtocolID associated with this CapsuleClass.



· userID

Summary  |  Top
   UserID userID() 


· checkMethodID

Summary  |  Top
   boolean checkMethodID() 

Check that this.methodID matches the computed method ID. Called as a security check after downloading a codegroup, to make sure that the code really is part of the protocol that it claims to belong to. This should not be called for locally defined protocols (i.e., builtin).

Returns:
true if they match

See Also: computeMethodID



· 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