All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class ninja.rmi.NinjaRemoteRef

java.lang.Object
   |
   +----ninja.rmi.NinjaRemoteRef

public class NinjaRemoteRef
extends Object
implements Serializable
NinjaRemoteRef is the client-side reference to a remote object. The NinjaRemoteRef is contained within the client-side stub (which has been obtained from the registry). Users shouldn't need to deal with the NinjaRemoteRef at all; it is made public simply so that the generated stubs can access it.

The idea is that the RMI server-side code instantiates the stub and creates a NinjaRemoteRef and shoves it into the stub. The stub is then handed to the registry, which passes it along to clients. Therefore, the methods in NinjaRemoteRef need to be accessible to the stub (to make remote calls) and to the Ninja RMI server code (to create the NinjaRemoteRef when exporting a NinjaRemoteObject).


Variable Index

 o commtype
 o objid
 o remotehost
 o remoteport

Constructor Index

 o NinjaRemoteRef()
 o NinjaRemoteRef(String, int, ObjID, int)
Creates a NinjaRemoteRef which points to the object on the given hostname and port with the given object ID.

Method Index

 o done(NinjaRemoteCall)
Finishes the remote method invocation.
 o get_commtype()
Returns the communications type of the connection used by this NinjaRemoteRef.
 o get_objid()
Returns the object ID which this NinjaRemoteRef refers to.
 o get_remotehost()
Returns the fully-qualified hostname of the machine which this NinjaRemoteRef connects to.
 o get_remoteport()
Returns the port number of the machine which this NinjaRemoteRef connects to.
 o getRefClass(ObjectOutput)
Used to obtain the classname of the remote reference for serialization purposes.
 o invoke(NinjaRemoteCall)
Invokes the method on the remote object for the given RemoteCall.
 o invoke(Remote, Method, Object[], long)
Invokes the given method with the given params on the remote object.
 o newCall(int, long)
Returns a NinjaRemoteCall, used by the stub to make method calls on the remote object.
 o readExternal(ObjectInput)
readExternal is called on the NinjaRemoteRef when the stub is serialized over the network.
 o remoteEquals(NinjaRemoteRef)
Determines if two NinjaRemoteRef's are equal - used by the stub.
 o remoteHashCode()
Returns a hashcode on the remote reference.
 o remoteToString()
Returns a string representing this remote reference.
 o writeExternal(ObjectOutput)
writeExternal is called on the NinjaRemoteRef when the stub is serialized over the network.

Variables

 o remotehost
 protected String remotehost
 o remoteport
 protected int remoteport
 o objid
 protected ObjID objid
 o commtype
 protected int commtype

Constructors

 o NinjaRemoteRef
 public NinjaRemoteRef()
 o NinjaRemoteRef
 public NinjaRemoteRef(String host,
                       int port,
                       ObjID oid,
                       int comm_type)
Creates a NinjaRemoteRef which points to the object on the given hostname and port with the given object ID. Used to manually bootstrap a client-side reference to a remote object (that is, without going through the registry).

Parameters:
host - The hostname to contact to call on this remote object.
port - The port to contact to call on this remote object.
oid - The ObjID corresponding to the remote object.
comm_type - One of NinjaExportData.RMI_COMM_TYPE_* values, specifying the communication semantics for the call.

Methods

 o invoke
 public Object invoke(Remote obj,
                      Method method,
                      Object params[],
                      long opnum) throws Exception
Invokes the given method with the given params on the remote object. Called by the client-side stub.

 o newCall
 public NinjaRemoteCall newCall(int opnum,
                                long hash) throws RemoteException
Returns a NinjaRemoteCall, used by the stub to make method calls on the remote object.

 o invoke
 public void invoke(NinjaRemoteCall call) throws Exception
Invokes the method on the remote object for the given RemoteCall. Used by the stub.

 o done
 public void done(NinjaRemoteCall call) throws RemoteException
Finishes the remote method invocation. Used by the stub.

 o getRefClass
 public String getRefClass(ObjectOutput out)
Used to obtain the classname of the remote reference for serialization purposes. Used by the stub.

 o remoteHashCode
 public int remoteHashCode()
Returns a hashcode on the remote reference. Used by the stub.

 o remoteEquals
 public boolean remoteEquals(NinjaRemoteRef obj)
Determines if two NinjaRemoteRef's are equal - used by the stub.

 o remoteToString
 public String remoteToString()
Returns a string representing this remote reference. Used by the stub.

 o writeExternal
 public void writeExternal(ObjectOutput out) throws IOException
writeExternal is called on the NinjaRemoteRef when the stub is serialized over the network.

 o readExternal
 public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal is called on the NinjaRemoteRef when the stub is serialized over the network.

 o get_remotehost
 public String get_remotehost()
Returns the fully-qualified hostname of the machine which this NinjaRemoteRef connects to.

 o get_remoteport
 public int get_remoteport()
Returns the port number of the machine which this NinjaRemoteRef connects to. This could be a TCP or a UDP port, depending on the value of get_commtype().

 o get_objid
 public ObjID get_objid()
Returns the object ID which this NinjaRemoteRef refers to. The object ID is a unique identifier for the remote object, and is checked on each remote method invocation to ensure that the correct client-side stub is being used to make remote calls. Some remote objects do not require the object ID to match.

 o get_commtype
 public int get_commtype()
Returns the communications type of the connection used by this NinjaRemoteRef. The commtype fields are defined in NinjaExportData.

See Also:
NinjaExportData

All Packages  Class Hierarchy  This Package  Previous  Next  Index