org.objectweb.david.libs.stub_factories.rmi
Class StubDelegate
java.lang.Object
|
+--org.objectweb.david.libs.stub_factories.rmi.StubDelegate
- All Implemented Interfaces:
- Constants, StubDelegate
- public class StubDelegate
- extends Object
- implements StubDelegate, Constants
This class provides an implementation for StubDelegate.
| Fields inherited from interface org.objectweb.david.libs.binding.orbs.Constants |
corba_object_id, corba_prefix, TC_any, TC_boolean, TC_char, TC_double, TC_float, TC_long, TC_longdouble, TC_longlong, TC_null, TC_Object, TC_octet, TC_Principal, TC_short, TC_string, tc_table, TC_TypeCode, TC_ulong, TC_ulonglong, TC_ushort, TC_void, TC_wchar, TC_wstring |
|
Constructor Summary |
StubDelegate()
Constructs a new StubDelegate instance. |
|
Method Summary |
void |
connect(Stub self,
ORB orb)
This method makes the stub ready for remote communication using the
specified ORB object. |
boolean |
equals(Stub self,
Object obj)
The equals method shall return true when used to compare stubs that
represent the same remote object.
|
int |
hashCode(Stub self)
This method shall return the same hashcode for all stubs that represent
the same remote object.
|
void |
readObject(Stub self,
ObjectInputStream s)
This method supports stub deserialization by restoring the IOR associated
with the stub. |
String |
toString(Stub self)
Returns a string representing the target object.
|
void |
writeObject(Stub self,
ObjectOutputStream s)
This method supports stub serialization by saving the IOR associated
with the stub. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
StubDelegate
public StubDelegate()
- Constructs a new StubDelegate instance.
hashCode
public int hashCode(Stub self)
- This method shall return the same hashcode for all stubs that represent
the same remote object.
This cannot be really implemented without a remote call. To avoid it, we use
a less strict specification. The hashcode used is the hashcode of the
stringified IOR of the stub.
- Specified by:
hashCode in interface StubDelegate
- Parameters:
self - the actual stub.- Returns:
- a hashcode for the target object.
equals
public boolean equals(Stub self,
Object obj)
- The equals method shall return true when used to compare stubs that
represent the same remote object.
This cannot be really implemented without a remote call. To avoid it, we use
a strictless specification: two stubs are equal if they have the same
stringified IOR.
- Specified by:
equals in interface StubDelegate
- Parameters:
self - the actual stub.obj - an object to compare the target with.- Returns:
- true if the target and obj represent the same object, false otherwise.
toString
public String toString(Stub self)
- Returns a string representing the target object.
This method shall return the same string for all stubs that represent the
same remote object.
This cannot be really implemented without a remote call. To avoid it, we use
a strictless specification: the toString() method returns the stringified IOR.
- Specified by:
toString in interface StubDelegate
- Parameters:
self - the actual stub.- Returns:
- a string representing the target object.
connect
public void connect(Stub self,
ORB orb)
throws RemoteException
- This method makes the stub ready for remote communication using the
specified ORB object.
- Specified by:
connect in interface StubDelegate
- Parameters:
self - the actual stub.orb - an ORB;- Throws:
RemoteException - if something goes wrong.
writeObject
public void writeObject(Stub self,
ObjectOutputStream s)
throws IOException
- This method supports stub serialization by saving the IOR associated
with the stub.
- Specified by:
writeObject in interface StubDelegate
- Parameters:
self - the actual stub.s - an ObjectOutputStream;- Throws:
IOException - if an IO error occurs.
readObject
public void readObject(Stub self,
ObjectInputStream s)
throws IOException,
ClassNotFoundException
- This method supports stub deserialization by restoring the IOR associated
with the stub.
- Specified by:
readObject in interface StubDelegate
- Parameters:
self - the actual stub.s - an ObjectInputStream;- Throws:
IOException - if an IO error occurs;ClassNotFoundException - if a class can't be found.