javax.rmi
public class PortableRemoteObject extends Object
An utility class for RMI/IDL server side object implementations. Server side implementation objects may inherit from this class, but this is not mandatory, as the needed methds are static. Server side implementations may choose to inherit from {@link ObjectImpl} or {@link Servant} instead.
The functionality of methods in this class is forwarded to the enclosed PortableRemoteObjectDelegate. This delegate can be altered by setting the system property "javax.rmi.CORBA.PortableRemoteObjectClass" to the name of the alternative class that must implement {@link PortableRemoteObjectDelegate}.
Constructor Summary | |
---|---|
protected | PortableRemoteObject()
The protected constructor calls {@link exportObject} (this).
|
Method Summary | |
---|---|
static void | connect(Remote target, Remote source)
Makes the remote object |
static void | exportObject(Remote object) Makes a server object ready for remote calls. |
static Object | narrow(Object object, Class narrowToInstaceOf)
Narrows the passed object to conform to the given interface or IDL type. |
static Remote | toStub(Remote targetImpl) Takes a server implementation object (name pattern *imp) and returns a stub object that can be used to access that server object (target), name (pattern _*_Stub). |
static void | unexportObject(Remote object)
Deregister a currently exported server object from the ORB runtimes. |
Throws: RemoteException if the exportObject(this) throws one.
Makes the remote object a_target
ready for remote
communication using the same communications runtime as for the passed
a_source
parameter. The a_target is connected to the same
ORB (and, if applicable, to the same {@link POA}) as the a_source.
Parameters: a_target the target to connect to ORB, must be an instance of either {@link ObjectImpl} (Stubs and old-style ties) or {@link Tie}. a_source the object, providing the connection information, must be an instance of either {@link ObjectImpl} (Stubs and old-style ties) or {@link Servant} (the next-generation Ties supporting {@link POA}).
Throws: RemoteException if the target is already connected to another ORB.
Makes a server object ready for remote calls. The subclasses of PortableRemoteObject do not need to call this method, as it is called by the constructor.
This method only creates a tie object and caches it for future usage. The created tie does not have a delegate or an ORB associated.
Parameters: object the object to export.
Throws: RemoteException if export fails due any reason.
Parameters: object the object like CORBA Object, Stub or Remote that must be narrowed to the given interface. narrowToInstaceOf the class of the interface to that the object must be narrowed.
Returns: On success, an object of type narrowTo or null, if narrowFrom = null.
Throws: ClassCastException if no narrowing is possible.
Takes a server implementation object (name pattern *imp) and returns a stub object that can be used to access that server object (target), name (pattern _*_Stub). The returned stub is not connected to any ORB and must be explicitly connected using {@link #connect}.
The method signature prevents it from returning stubs that does not implement Remote (ClassCastException will be thrown).
Parameters: target a server side object implementation.
Returns: a stub object that can be used to access that server object.
Throws: NoSuchObjectException if a stub class cannot be located by supposed name pattern, or an instance of stub fails to be instantiated. ClassCastException if the stub class can be located, but it does not inherit from Remote. BAD_PARAM if the name of the passed class does not match the implementation name pattern (does not end by 'Impl').
Parameters: object the object to unexport.
Throws: NoSuchObjectException if the passed object is not currently exported.