java.rmi.activation
Class SecureActivatable

java.lang.Object
  |
  +--java.rmi.activation.SecureActivatable

public final class SecureActivatable
extends java.lang.Object

Registers and exports a secure remote object that permits persistent access over time and that can be activated on demand by the system.

This class cannot be subclassed or instantiated; the static methods should simply be used as necessary in implementation classes or in code that exports remote objects.

The exported object can perform preinvocation access control and exercise control over parameter unmarshalling and result marshalling by implementing RemoteCallControl.

Threads executing incoming remote calls for secure remote objects can use the context methods in the SecureRemoteServer class.

Since:
1.4

Method Summary
static java.rmi.Remote exportObject(java.rmi.Remote obj, java.rmi.activation.ActivationID id, SecureExportDesc desc)
          Exports an object that has been activated, using the specified activation identifier and export descriptor, and returns a stub for the object.
static boolean inactive(java.rmi.activation.ActivationID id)
          Makes the object with the corresponding activation identifier inactive, if possible.
static java.rmi.Remote register(java.rmi.activation.ActivationDesc desc, SecurityConstraints activatorConstraints)
          Registers a new secure activatable object with the default activation system for this VM (as returned by ActivationGroup.getSystem) using the specified activation descriptor, before the activatable object has ever been created, and returns a stub for the object.
static java.rmi.Remote register(java.rmi.activation.ActivationSystem sys, java.rmi.activation.ActivationDesc desc, SecurityConstraints activatorConstraints)
          Registers a new secure activatable object with the specified activation system using the specified activation descriptor, before the activatable object has ever been created, and returns a stub for the object.
static boolean unexportObject(java.rmi.Remote obj, boolean force)
          Unexports a remote object.
static void unregister(java.rmi.activation.ActivationID id)
          Unregisters the activation descriptor associated with the specified activation identifier.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

register

public static java.rmi.Remote register(java.rmi.activation.ActivationDesc desc,
                                       SecurityConstraints activatorConstraints)
                                throws java.rmi.activation.ActivationException,
                                       java.rmi.RemoteException
Registers a new secure activatable object with the default activation system for this VM (as returned by ActivationGroup.getSystem) using the specified activation descriptor, before the activatable object has ever been created, and returns a stub for the object. The object will subsequently be activated on demand. The activatorConstraints are set as client constraints on the activation identifier contained in the returned stub.

The class specified in the activation descriptor must have a declared constructor that takes two parameters: an ActivationID and a MarshalledObject. This constructor is called by the activation group whenever an object is activated. The class also must be serializable, must not be abstract, and must have a serialization-compatible writeReplace method that returns the stub.

Parameters:
desc - the activation descriptor
activatorConstraints - the client constraints for the activation identifier contained in the returned stub, or null
Returns:
a stub for the object
Throws:
java.rmi.activation.ActivationException - if the default activation system cannot be obtained or does not implement RemoteSecurity, or the class specified in the activation descriptor cannot be loaded or does not have the required constructor or writeReplace method or is not serializable or is abstract, or the remote call to the activation system throws ActivationException
java.rmi.RemoteException - if a communication-related exception occurs
NullPointerException - if the activation descriptor is null

register

public static java.rmi.Remote register(java.rmi.activation.ActivationSystem sys,
                                       java.rmi.activation.ActivationDesc desc,
                                       SecurityConstraints activatorConstraints)
                                throws java.rmi.activation.ActivationException,
                                       java.rmi.RemoteException
Registers a new secure activatable object with the specified activation system using the specified activation descriptor, before the activatable object has ever been created, and returns a stub for the object. The object will subsequently be activated on demand. The activatorConstraints are set as client constraints on the activation identifier contained in the returned stub.

The class specified in the activation descriptor must have a declared constructor that takes two arguments: an ActivationID and a MarshalledObject. This constructor is called by the activation group whenever an object is activated. The class also must be serializable and must have a serialization-compatible writeReplace method that returns the stub.

Parameters:
sys - the activation system
desc - the activation descriptor
activatorConstraints - the client constraints for the activation identifier contained in the returned stub, or null
Returns:
a stub for the object
Throws:
java.rmi.activation.ActivationException - if the activation system does not implement RemoteSecurity, or the class specified in the activation descriptor cannot be loaded or does not have the required constructor or writeReplace method or is not serializable or is abstract, or the remote call to the activation system throws ActivationException
java.rmi.RemoteException - if a communication-related exception occurs
NullPointerException - if the activation descriptor is null

inactive

public static boolean inactive(java.rmi.activation.ActivationID id)
                        throws java.rmi.activation.ActivationException,
                               java.rmi.RemoteException
Makes the object with the corresponding activation identifier inactive, if possible. If the object is currently exported and there are no pending or in-progress calls on the object, the object is unexported so that it can no longer receive incoming calls. If the object is successfully unexported, or if the object was already unexported, the activation group for this virtual machine is informed that the object is inactive, which in turn informs the activation monitor. The return value is true if the object has successfully been made inactive, and false if the object is currently exported and has pending or in-progress calls. If this call completes successfully, a subsequent activate request to the activator will cause the object to reactivate.
Parameters:
id - the activation identifier
Returns:
true if the object has successfully been made inactive, false if the object is currently exported and has pending or in-progress calls
Throws:
java.rmi.activation.UnknownObjectException - if object is not known (it may already be inactive)
java.rmi.activation.ActivationException - if the group is not active
java.rmi.RemoteException - if the activation monitor remote call fails
See Also:
unexportObject(java.rmi.Remote, boolean)

unregister

public static void unregister(java.rmi.activation.ActivationID id)
                       throws java.rmi.activation.ActivationException,
                              java.rmi.RemoteException
Unregisters the activation descriptor associated with the specified activation identifier. The previously associated object can no longer be activated using that activation identifier.
Parameters:
id - the activation identifier
Throws:
java.rmi.activation.UnknownObjectException - if the object is unknown
java.rmi.activation.ActivationException - if activation system is not running
java.rmi.RemoteException - if the activation system remote call fails

exportObject

public static java.rmi.Remote exportObject(java.rmi.Remote obj,
                                           java.rmi.activation.ActivationID id,
                                           SecureExportDesc desc)
                                    throws java.rmi.server.ExportException
Exports an object that has been activated, using the specified activation identifier and export descriptor, and returns a stub for the object. Any desired activator constraints already must have been set as client constraints on the activation identifier. The stub is usable by clients for as long as the object is registered with the activation system.

There is no automatic replacement of the stub for the implementation object during marshalling; the implementation class of the object must be serializable and must have a serialization-compatible writeReplace method that returns the stub.

Parameters:
obj - the secure activatable object
id - the activation id
desc - the export descriptor
Returns:
a stub for the object
Throws:
java.rmi.server.ExportException - if the implementation class of the specified object is not serializable or does not have the required writeReplace method, or a communication-related exception occurs
java.lang.SecurityException - if the client endpoint produced by any server endpoint in the export descriptor is not an instance of a trusted class
NullPointerException - if any parameter is null

unexportObject

public static boolean unexportObject(java.rmi.Remote obj,
                                     boolean force)
                              throws java.rmi.NoSuchObjectException
Unexports a remote object. If the force parameter is true, the object is forcibly unexported even if there are pending calls to the remote object or the remote object still has calls in progress. If the force parameter is false, the object is only unexported if there are no pending or in progress calls to the object. The return value is true if the object is unexported, and false otherwise.
Parameters:
obj - the secure remote object
force - if true, forcibly unexport the object
Returns:
true if the object is unexported; false otherwise
Throws:
java.rmi.NoSuchObjectException - if the remote object is not currently exported


Copyright © 2000 Sun Microsystems, Inc. All rights reserved