Novell exteNd Messaging Platform 5.1

javax.rmi
Class PortableRemoteObject

java.lang.Object
  extended byjavax.rmi.PortableRemoteObject

public class PortableRemoteObject
extends Object

The PortableRemoteObject (PRO) is intended to act as a base class for RMI/IDL server implementation classes. The server side implementation may either inherit from PRO, or they may simply implement an RMI/IDL interface and then use the exportObject method to register themselves as a server object.


Method Summary
static void connect(Remote target, Remote source)
          Makes a Remote object ready for remote communication.
static void exportObject(Remote remote)
          Register the Remote implementation as a server object.
static Object narrow(Object obj, Class cl)
          Narrow the given object to the given type.
static Remote toStub(Remote remote)
          Get a Stub object that can be used to access the given Server object.
static void unexportObject(Remote remote)
          Unregister the Remote implementation as a server object.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

exportObject

public static void exportObject(Remote remote)
                         throws RemoteException
Register the Remote implementation as a server object. This makes the object ready for remote communication. Note that if the Remote extends the PortableRemoteObject, then it is not necessary to call this method, since it is already called by the constructor.

Parameters:
remote - the remote implementation to export
Throws:
RemoteException - export failed

unexportObject

public static void unexportObject(Remote remote)
                           throws NoSuchObjectException
Unregister the Remote implementation as a server object.

Parameters:
remote - server object to unexport
Throws:
NoSuchObjectException

toStub

public static Remote toStub(Remote remote)
                     throws NoSuchObjectException
Get a Stub object that can be used to access the given Server object. The argument must either be a subclass of PortableRemoteObject or have been previously the target of a call on PortableRemoteObject.exportObject(). The returned stub implements the same RMI/IDL remote interface as the implementation object. The toStub may be passed a stub, in which case it simply returns this stub.

Parameters:
remote - 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 PortableRemoteObject.exportObject. The server object must also be ready for remote communication, which may require use of the PortableRemoteObject.connect method if the object has not yet been passed as an argument on a remote method call.
Returns:
the stub for the server object
Throws:
NoSuchObjectException - can not instantiate the stub for the given object

narrow

public static Object narrow(Object obj,
                            Class cl)
                     throws ClassCastException
Narrow the given object to the given type. If the operation is successful, the result will be an object of the given tye. Otherwise, it throws an exception.

Parameters:
obj - the object to be narrowed
cl - the desired type
Returns:
an object which can be cast to the desired type
Throws:
ClassCastException

connect

public static void connect(Remote target,
                           Remote source)
                    throws 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.

Parameters:
target - the object to connect
source - a previously connected object
Throws:
RemoteException

Novell exteNd Messaging Platform 5.1

exteNd is a registered trademark of Novell, Inc.
Copyright 1998-2003 Novell, Inc. All Rights Reserved.