org.objectweb.carol.cmi
Class ObjectId

java.lang.Object
  extended by org.objectweb.carol.cmi.ObjectId
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable, java.lang.Comparable

public class ObjectId
extends java.lang.Object
implements java.io.Externalizable, java.lang.Comparable

Each clustered remote object is uniquely identified by such a number. Two distinct clustered remote object do not have the same ObjectId.

Author:
Simon Nieuviarts
See Also:
Serialized Form

Constructor Summary
ObjectId()
          Default constructor
ObjectId(ClusterId serverId, ClusterId objId)
          Creates a new identifier
 
Method Summary
 int compareTo(java.lang.Object o)
          Compare two ObjectIds
 boolean equals(java.lang.Object o)
          Test if two ObjectIds are equals
 ClusterId getServerId()
          Get the ServerId associated with the current object
 int hashCode()
          Compute hashcode
static void main(java.lang.String[] args)
          Useful for tests only.
static ObjectId read(java.io.DataInput in)
          Read an ObjectId from the input stream
 void readExternal(java.io.ObjectInput in)
           
 java.lang.String toString()
           
 void write(java.io.DataOutput out)
          Write an ObjectId on the ouput stream
 void writeExternal(java.io.ObjectOutput out)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ObjectId

public ObjectId()
Default constructor


ObjectId

public ObjectId(ClusterId serverId,
                ClusterId objId)
Creates a new identifier

Parameters:
serverId - server id
objId - object id
Method Detail

hashCode

public int hashCode()
Compute hashcode

Overrides:
hashCode in class java.lang.Object
Returns:
hashcode

equals

public boolean equals(java.lang.Object o)
Test if two ObjectIds are equals

Overrides:
equals in class java.lang.Object
Parameters:
o - object to compare with this
Returns:
true if equals

compareTo

public int compareTo(java.lang.Object o)
Compare two ObjectIds

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
o - object to compare with this
Returns:
true if equals

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Specified by:
readExternal in interface java.io.Externalizable
Throws:
java.io.IOException
java.lang.ClassNotFoundException
See Also:
Externalizable.readExternal(java.io.ObjectInput)

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Specified by:
writeExternal in interface java.io.Externalizable
Throws:
java.io.IOException
See Also:
Externalizable.writeExternal(java.io.ObjectOutput)

read

public static ObjectId read(java.io.DataInput in)
                     throws java.io.IOException
Read an ObjectId from the input stream

Parameters:
in - input
Returns:
ObjectId
Throws:
java.io.IOException - if an I/O error occurs

write

public void write(java.io.DataOutput out)
           throws java.io.IOException
Write an ObjectId on the ouput stream

Parameters:
out - output
Throws:
java.io.IOException - if an I/O error occurs

getServerId

public ClusterId getServerId()
Get the ServerId associated with the current object

Returns:
ClusterId

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Useful for tests only.

Throws:
java.lang.Exception - Exception