All Packages  This Package  Class Hierarchy  Class Search  Index

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

  Summary

public class  Address
     extends java.lang.Object
{
          // Fields 4
     private final int anAddress;
     private static boolean gaveFactory;
     private final InetAddress iNetHostAddr;
     private final int iNetPort;

          // Constructors 2
     Address(Address);
     Address(int, InetAddress, int);

          // Methods 7
     public static int fromString(String) throws AddressFormatException;
     public static AddressFactory getAddressFactory();
     public static String toString(int);

     public int getANAddress();
     InetAddress iNetAddr();
     int iNetPort();
     public String toString();
}

An address object hides the details and implementation of addressing in Janos. Addresses can only be created through an AddressFactory. Only one instance of AddressFactory is created, to control who is allowed to create Addresses.

An Address has two parts a logical "active network" address and an underlying physical address. The physical address in this implementation of Address is an InetAddress and a UDP port number.

This implementation uses an IP host:port pair to indentify the underlying address. The Active address is a 32-bit IP-like number.

Address objects are immutable. They must be immutable because anyone(?) can read them out of routing tables..


  Cross Reference

Returned By:
AddressFactory.newAddress(), CommSpaceElement.getAddress(), AddressFactory.newAddress(), RouteEntry.getPhysicalNext()





  Fields

· gaveFactory

Summary  |  Top
   private static boolean gaveFactory

Flag to indicate if the factory has been given out or not. Once the factory has been created, no more are created.


· iNetHostAddr

Summary  |  Top
   private final InetAddress iNetHostAddr


· iNetPort

Summary  |  Top
   private final int iNetPort


· anAddress

Summary  |  Top
   private final int anAddress


  Constructors

· Address

Summary  |  Top

   Address(int anAddress, 
           InetAddress iNetHostAddr, 
           int iNetPort) 

Construct a new Address. The address has two parts an "active address" and an "internet address". The "active address" is a 32-bit integer. The "internet address" consists of an java.net.InetAddress and an iNetPort number.

XXX replace the InetAddress with a string that will be decoded by the Janos core...



· Address

Summary  |  Top
   Address(Address other) 


  Methods

· getAddressFactory

Summary  |  Top
   public static AddressFactory getAddressFactory() 

First caller wins. The first caller of this method gets a handle on the AddressFactory. Subsequent callers get diddly. Weak-ass access control, thank you very much.

XXX implications of the 'static'-ness of this method?



· getANAddress

Summary  |  Top
   public int getANAddress() 


· iNetAddr

Summary  |  Top
   InetAddress iNetAddr() 


· iNetPort

Summary  |  Top
   int iNetPort() 


· toString

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


· toString

Summary  |  Top
   public static String toString(int a) 

Generate a string representation of the given address. Generates standard dotted-quad notation.



· fromString

Summary  |  Top
   public static int fromString(String name)  throws AddressFormatException

Generate a 32-bit integer from the given string address. The string must be a dotted-quad.

Throws: AddressFormatException
if there aren't 4 parts, any of the 4 parts don't parse, or are out of range.


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