org.openorb.orb.rmi
Class PortableRemoteObjectDelegateImpl

java.lang.Object
  |
  +--org.openorb.orb.rmi.PortableRemoteObjectDelegateImpl
All Implemented Interfaces:
javax.rmi.CORBA.PortableRemoteObjectDelegate

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

This class provides a default implementation for javax.rmi.PortableRemoteObjectDelegate

Author:
Jerome Daniel

Constructor Summary
PortableRemoteObjectDelegateImpl()
           
 
Method Summary
 void connect(java.rmi.Remote target, java.rmi.Remote source)
          This method makes the remote object target ready for remote communication using the same communications runtime as source.
 void exportObject(java.rmi.Remote obj)
          A call to this method with no objects exported creates a non-daemon thread wich keeps the java virtual machine alive until all exported objects have been unexported by calling unexportObject.
 java.lang.Object narrow(java.lang.Object obj, java.lang.Class newClass)
          This method takes an object reference or an object of an RMI/IDL abstract interface type and attemps to narrow it to conform to the given newClass RMI/IDL type.
 java.rmi.Remote toStub(java.rmi.Remote obj)
          This method takes a server implementation object and returns a stubobject that can be used to access that server object.
 java.lang.Object uncheckedNarrow(java.lang.Object obj, java.lang.Class newClass)
          This method takes an object reference or an object of an RMI/IDL abstract interface type and attemps to narrow it to conform to the given newClass RMI/IDL type.
 void unexportObject(java.rmi.Remote obj)
          This method is used to deregister a currently exported server object from the ORB runtimes, 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

PortableRemoteObjectDelegateImpl

public PortableRemoteObjectDelegateImpl()
Method Detail

exportObject

public void exportObject(java.rmi.Remote obj)
                  throws java.rmi.RemoteException
A call to this method with no objects exported creates a non-daemon thread wich keeps the java virtual machine alive until all exported objects have been unexported by calling unexportObject.
Specified by:
exportObject in interface javax.rmi.CORBA.PortableRemoteObjectDelegate
Parameters:
obj - The remote object to export.
Throws:
java.rmi.RemoteException - When obj is already exported or obj is a Stub.

toStub

public java.rmi.Remote toStub(java.rmi.Remote obj)
                       throws java.rmi.NoSuchObjectException
This method takes a server implementation object and returns a stubobject that can be used to access that server object. The argument object must currently be exported, either because it is a subclass f PortableRemoteObject or be virtue of a previous call to PortableRemoteObject.exportObject.
Specified by:
toStub in interface javax.rmi.CORBA.PortableRemoteObjectDelegate
Parameters:
obj - The object to create a stub for.
Returns:
The stub for the object obj.
Throws:
java.rmi.NoSuchObjectException - When no Tie could be found for obj.

unexportObject

public void unexportObject(java.rmi.Remote obj)
                    throws java.rmi.NoSuchObjectException
This method is used to deregister a currently exported server object from the ORB runtimes, 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 - When no Tie could be found for obj.

narrow

public java.lang.Object narrow(java.lang.Object obj,
                               java.lang.Class newClass)
                        throws java.lang.ClassCastException
This method takes an object reference or an object of an RMI/IDL abstract interface type and attemps to narrow it to conform to the given newClass RMI/IDL type.
Specified by:
narrow in interface javax.rmi.CORBA.PortableRemoteObjectDelegate
Parameters:
obj - The object to narrow.
newClass - The type to which to narrow the object to.
Returns:
The narrowed object.
Throws:
java.lang.ClassCastException - When obj can't be narrowed.

uncheckedNarrow

public java.lang.Object uncheckedNarrow(java.lang.Object obj,
                                        java.lang.Class newClass)
                                 throws java.lang.ClassCastException
This method takes an object reference or an object of an RMI/IDL abstract interface type and attemps to narrow it to conform to the given newClass RMI/IDL type. This operation always succeeds because no _is_a is sent to the server.
Parameters:
obj - The object to narrwo.
newClass - The type to narrwo the object to.
Returns:
The narrowed object.
Throws:
java.lang.ClassCastException - When obj can't be narrowed.

connect

public void connect(java.rmi.Remote target,
                    java.rmi.Remote source)
             throws java.rmi.RemoteException
This method makes the remote object target ready for remote communication using the same communications runtime as source.
Specified by:
connect in interface javax.rmi.CORBA.PortableRemoteObjectDelegate
Parameters:
target - The target object to connect to the source's ORB.
source - The source object to take the ORB from.
Throws:
java.rmi.RemoteException - When the source object is not exported or the target is already exported.