osl.nameservice.simple
Class DefaultName

java.lang.Object
  |
  +--osl.nameservice.simple.DefaultName

public class DefaultName
extends java.lang.Object
implements Name

This class defines an implementation of the Name interface for use in the "default" nameservice implementation. In the default implementation, a name is a PhysicalAddress/integer pair which identifies the creator of the name. This information may be used to track down the current location of the entity associated with the name when local name tables are invalidated.

Version:
$Revision: 1.7 $ ($Date: 1999/07/13 02:01:50 $)
See Also:
Name, NameService, DefaultNameService, Serialized Form

Constructor Summary
DefaultName()
          The default constructor.
DefaultName(PhysicalAddress cAddr, int cID)
          The default constructor for building legal names.
 
Method Summary
 boolean equals(java.lang.Object other)
          Determines whether two DefaultNames should be considered equal.
 int hashCode()
          Returns the hash code for this DefaultName.
 void readExternal(java.io.ObjectInput in)
          Deserialize into a new instnace of UDPAddress by reading from the given input stream.
 java.lang.String toString()
          The canonical toString method.
 void writeExternal(java.io.ObjectOutput out)
          Serialize the contents of this class to the output stream.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultName

public DefaultName()
The default constructor. Note that this constructor DOES NOT build a legal name.

DefaultName

public DefaultName(PhysicalAddress cAddr,
                   int cID)
The default constructor for building legal names. This constructor is protected so that it can't be spoofed by clients. Note that this constructor may be used to create a legal name as long as cAddr refers to the physical address of an existing DefaultNameService instance, and cID is unique relative to all other name IDs created by the nameservice cAddr.
Parameters:
cAddr - The PhysicalAddress of the creator of this name.
cID - The int ID which should be unique relative to all names created by cAddr.
Method Detail

toString

public java.lang.String toString()
The canonical toString method.
Overrides:
toString in class java.lang.Object

equals

public boolean equals(java.lang.Object other)
Determines whether two DefaultNames should be considered equal. Two names are equal if they have the same creator with the same integral id.
Parameters:
other - A reference to the other Object to which equality is being tested
Returns:
true if the names are equal, false otherwise.
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Returns the hash code for this DefaultName. The hash code for a default name is a combination of the hash codes of the address of its creator and its integral ID.
Returns:
An int representing the hash code for this object.
Overrides:
hashCode in class java.lang.Object

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Serialize the contents of this class to the output stream.
Parameters:
out - The OutputStream to which we should write this instance.

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Deserialize into a new instnace of UDPAddress by reading from the given input stream.

Parameters:
in - The InputStream from which we should deserialize this instance.
Throws:
java.io.IOException - Thrown if an I/O error is encountered while reading the input stream.
java.lang.ClassNotFoundException - Thrown if a class being deserialized from the input stream cannot be found by the class loader.
java.lang.ClassCastException - Thrown if a class deserialized from the input stream had an unexpected type.