org.objectweb.carol.rmi.multi
Class JrmpPRODelegate

java.lang.Object
  extended by org.objectweb.carol.rmi.multi.JrmpPRODelegate
All Implemented Interfaces:
javax.rmi.CORBA.PortableRemoteObjectDelegate

public class JrmpPRODelegate
extends java.lang.Object
implements javax.rmi.CORBA.PortableRemoteObjectDelegate

Class JrmpPRODelegate for the mapping between Rmi jrmp UnicastRemoteObject and PortableRemoteObject


Constructor Summary
JrmpPRODelegate()
          By default, this class is not used for Cmi.
JrmpPRODelegate(boolean usingCmi)
          Constructor
 
Method Summary
 void connect(java.rmi.Remote target, java.rmi.Remote source)
          Makes a Remote object ready for remote communication.
 void exportObject(java.rmi.Remote obj)
          Makes a server object ready to receive remote calls.
 java.lang.Object narrow(java.lang.Object narrowFrom, java.lang.Class narrowTo)
          Checks to ensure that an object of a remote or abstract interface type can be cast to a desired type.
 java.rmi.Remote toStub(java.rmi.Remote obj)
          Returns a stub for the given server object.
 void unexportObject(java.rmi.Remote obj)
          Deregisters a server object from the runtime, allowing the object to become available for garbage collection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JrmpPRODelegate

public JrmpPRODelegate(boolean usingCmi)
Constructor

Parameters:
usingCmi - this prodelegate will be used for CMI protocol

JrmpPRODelegate

public JrmpPRODelegate()
By default, this class is not used for Cmi. Cmi has to instantiated the other constructor

Method Detail

exportObject

public void exportObject(java.rmi.Remote obj)
                  throws java.rmi.RemoteException
Makes a server object ready to receive remote calls. Note that subclasses of PortableRemoteObject do not need to call this method, as it is called by the constructor.

Specified by:
exportObject in interface javax.rmi.CORBA.PortableRemoteObjectDelegate
Parameters:
obj - the server object to export.
Throws:
java.rmi.RemoteException - if export fails.

unexportObject

public void unexportObject(java.rmi.Remote obj)
                    throws java.rmi.NoSuchObjectException
Deregisters a server object from the runtime, allowing the object to become available for garbage collection.

Specified by:
unexportObject in interface javax.rmi.CORBA.PortableRemoteObjectDelegate
Parameters:
obj - the object to unexport.
Throws:
java.rmi.NoSuchObjectException - if the remote object is not currently exported.

connect

public void connect(java.rmi.Remote target,
                    java.rmi.Remote source)
             throws java.rmi.RemoteException
Makes a Remote object ready for remote communication. This normally happens implicitly when the object is sent or received as an argument on a remote method call, but in some circumstances it is useful to perform this action by making an explicit call. See the Stub#connect method for more information.

Specified by:
connect in interface javax.rmi.CORBA.PortableRemoteObjectDelegate
Parameters:
target - the object to connect.
source - a previously connected object.
Throws:
java.rmi.RemoteException - if source is not connected or if target is already connected to a different ORB than source.

narrow

public java.lang.Object narrow(java.lang.Object narrowFrom,
                               java.lang.Class narrowTo)
                        throws java.lang.ClassCastException
Checks to ensure that an object of a remote or abstract interface type can be cast to a desired type.

Specified by:
narrow in interface javax.rmi.CORBA.PortableRemoteObjectDelegate
Parameters:
narrowFrom - the object to check.
narrowTo - the desired type.
Returns:
an object which can be cast to the desired type.
Throws:
java.lang.ClassCastException - if narrowFrom cannot be cast to narrowTo.

toStub

public java.rmi.Remote toStub(java.rmi.Remote obj)
                       throws java.rmi.NoSuchObjectException
Returns a stub for the given server object.

Specified by:
toStub in interface javax.rmi.CORBA.PortableRemoteObjectDelegate
Parameters:
obj - the server object for which a stub is required. Must either be a subclass of PortableRemoteObject or have been previously the target of a call to exportObject(java.rmi.Remote).
Returns:
the most derived stub for the object.
Throws:
java.rmi.NoSuchObjectException - if a stub cannot be located for the given server object.