org.objectweb.jeremie.binding.moa
Class UnicastRemoteObject

java.lang.Object
  extended by java.rmi.server.RemoteObject
      extended by java.rmi.server.RemoteStub
          extended by org.objectweb.jeremie.binding.moa.UnicastRemoteObject
All Implemented Interfaces:
Serializable, Remote
Direct Known Subclasses:
JRMIReferenceImpl

public class UnicastRemoteObject
extends RemoteStub

Provides an implementation of UnicastRemoteObject, multiple instances of which are managed together by an object adapter.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Constructor Summary
protected UnicastRemoteObject()
          Creates a UnicastRemoteObject and exports it.
protected UnicastRemoteObject(int port)
          Creates a UnicastRemoteObject and exports it with the given port.
 
Method Summary
static RemoteStub export(Remote impl, org.objectweb.jonathan.apis.kernel.Context hints, JRMIBFactory binder)
          Exports the given remote object to the object adapter, and then recursively to the given binding factory.
static RemoteStub exportObject(Remote impl)
          Exports the given remote object.
static RemoteStub exportObject(Remote impl, int port)
          Exports the given remote object with a given port.
 int hashCode()
           
static Remote toStub(Remote impl)
          Returns the Jeremie stub for the given remote object.
static boolean unexportObject(Remote impl, boolean force)
          Unexports the specified remote object.
static void unexportObject(Remote impl, JRMIBFactory binder)
          Unexports the given remote object from the object adapter and the given binding factory.
protected  Object writeReplace()
          Returns the stub object corresponding to this UnicastRemoteObject.
 
Methods inherited from class java.rmi.server.RemoteStub
setRef
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UnicastRemoteObject

protected UnicastRemoteObject()
                       throws RemoteException
Creates a UnicastRemoteObject and exports it.

Throws:
RemoteException - if something goes wrong.

UnicastRemoteObject

protected UnicastRemoteObject(int port)
                       throws RemoteException
Creates a UnicastRemoteObject and exports it with the given port.

Parameters:
port - the port number on which to export this UnicastRemoteObject.
Throws:
RemoteException - if something goes wrong.
Method Detail

hashCode

public int hashCode()
Overrides:
hashCode in class RemoteObject

writeReplace

protected Object writeReplace()
                       throws ObjectStreamException
Returns the stub object corresponding to this UnicastRemoteObject.

Throws:
ObjectStreamException - if something goes wrong.

exportObject

public static RemoteStub exportObject(Remote impl)
                               throws RemoteException
Exports the given remote object.

Parameters:
impl - the remote object to export.
Returns:
a stub corresponding to the remote object.
Throws:
RemoteException - if something goes wrong.

exportObject

public static RemoteStub exportObject(Remote impl,
                                      int port)
                               throws RemoteException
Exports the given remote object with a given port.

Parameters:
impl - the remote object to export;
port - the port number with which to export the remote object.
Returns:
a stub corresponding to the remote object.
Throws:
RemoteException - if something goes wrong.

export

public static RemoteStub export(Remote impl,
                                org.objectweb.jonathan.apis.kernel.Context hints,
                                JRMIBFactory binder)
                         throws RemoteException
Exports the given remote object to the object adapter, and then recursively to the given binding factory.

Parameters:
impl - the remote object to be exported;
hints - other data that may be useful for the export;
binder - a binding factory.
Returns:
a stub corresponding to the remote object.
Throws:
java.rmi - RemoteException if something goes wrong.
RemoteException

unexportObject

public static boolean unexportObject(Remote impl,
                                     boolean force)
                              throws NoSuchObjectException
Unexports the specified remote object. If the boolean parameter is true, the object is unexported even if there are pending calls or calls in progress. If the boolean parameter is false, the unexported only if there are no pending calls or calls in progress.

The force mechanism is not implemented yet.

Parameters:
obj - the remote object to be unexported;
force - whether the object should be forcibly unexported or not.
Returns:
whether the unexport operation succeeded or not.
Throws:
NoSuchObjectException

unexportObject

public static void unexportObject(Remote impl,
                                  JRMIBFactory binder)
                           throws NoSuchObjectException
Unexports the given remote object from the object adapter and the given binding factory.

Parameters:
impl - the remote object to unexport;
binder - a binding factory.
Throws:
NoSuchObjectException

toStub

public static Remote toStub(Remote impl)
                     throws NoSuchObjectException
Returns the Jeremie stub for the given remote object. The remote object must previously have been exported to Jeremie, otherwise an exception is raised.

Parameters:
impl - the remote object whose stub is required
Returns:
the Jeremie stub for the remote object
Throws:
NoSuchObjectException - if the remote object had not been previously exported to Jeremie.