uka.karmi.rmi.server
Class RemoteObject

java.lang.Object
  extended byuka.karmi.rmi.server.RemoteObject
All Implemented Interfaces:
PatchableRoot, Remote
Direct Known Subclasses:
UnicastRemoteObject

public class RemoteObject
extends java.lang.Object
implements Remote, PatchableRoot

RemoteObject is the base class for remotely accessible objects. The only remote object implementation currently supported is the UnicastRemoteObject.

Author:
Bernhard Haumacher, Christian Nester
See Also:
UnicastRemoteObject

Field Summary
 RemoteServerRef serverRef
          A reference to the remote server that is responsible for this object.
 
Constructor Summary
protected RemoteObject()
           
 
Method Summary
static RemoteStub buildStub(java.lang.String stubName, SingleRemoteClientRef clientRef)
           
 boolean equals(java.lang.Object obj)
           
 java.lang.Object getOwner()
          Return the root object this object belongs to.
 int hashCode()
          Here we have an incompatible situation with Sun's RMI.
 java.lang.String toString()
           
 java.lang.String toStringMembers()
           
static Remote toStub(Remote obj)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

serverRef

public transient RemoteServerRef serverRef
A reference to the remote server that is responsible for this object. The reference object must set this reference when the object is exported. This reference is transient. A deserialized remote object is not exported any longer. This reference is public to allow custom technologies and DGCs to access it. It should not be used in user applications.

Constructor Detail

RemoteObject

protected RemoteObject()
Method Detail

hashCode

public int hashCode()
Here we have an incompatible situation with Sun's RMI. KaRMI's RemoteObject is server side only. KaRMI stubs do not extend RemoteObject. The following equality and hash code rules are implemented:

If stubs are compared or hashCode is called on a stub, the corresponding RemoteClientRefs decide if the stubs are considered equal and calc the hash code.

Two stubs should be considered equal, if they reference the same remote object. This is the same behavior that is implemented in Sun's RMI. If the remote object does only implement the remote interface and is not subclass of RemoteObject, it depends on the implementation of equals() and hashCode(), how equality is treated.

If the remote object is subclass of RemoteObject, and it is exported, the remote serverRef is responsible for hash code and equality. The serverRef should implement the behavior, that the remote object and its stubs are all equal and return the same hashCode.

=> If a RemoteObject is exported with a UnicastServerReference, it always gains this behavior because the serverRef provides it.

In Sun's RMI you can export your RemoteObject as UnicastRemoteObject but it does not gain this behaviour unless the object is a subclass of UnicastRemoteObject.

In KaRMI the following simple rule is implemented:

The RemoteServerRef is responsible for the implementation of equals() and hashCode() if the remote object extends RemoteObject. It doesn't matter how it was exported!!!


equals

public boolean equals(java.lang.Object obj)

getOwner

public final java.lang.Object getOwner()
Description copied from interface: PatchableRoot
Return the root object this object belongs to. The replicated state of a replicated object extends to all objects that are reacheable through non-transient references from the replicated root object. The traversal ends at objects implementing PatchableRoot, if the PatchableRoot.getOwner() method returns another object than the current replicated object.

Specified by:
getOwner in interface PatchableRoot
See Also:
PatchableRoot.getOwner()

toStringMembers

public java.lang.String toStringMembers()

toString

public java.lang.String toString()

toStub

public static Remote toStub(Remote obj)
                     throws NoSuchObjectException
Throws:
NoSuchObjectException

buildStub

public static RemoteStub buildStub(java.lang.String stubName,
                                   SingleRemoteClientRef clientRef)
                            throws RemoteException
Throws:
RemoteException