All Libraries | This Library | Package | Class | Use | Tree | Deprecated | Index | Grand Index | Help
|  | Components |
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

*** This class provides Binary Compatibility only, not Source Compatibility ***

## com.sas.net.rmi
Class AbstractRemoteObjectExporter

    com.sas.net.rmi.AbstractRemoteObjectExporter

All Implemented Interfaces:
  RemoteObjectExporterInterface

Direct Known Subclasses:
  ActivatableExporter, UnicastRemoteObjectExporter

    public abstract class AbstractRemoteObjectExporter

implements RemoteObjectExporterInterface

An abstract base class providing base implementations to export/unexport a remote object to/from the RMI system.

A concrete subclass must implement the following methods which are abstractly defined by this class:

1. `exportObject()`
2. `unexportObject()`

The following subclasses provide concrete implementations of these abstract behaviors:

- `ActivatableExporter` to export an activatable object
- `UnicastRemoteObjectExporter` to export a unicast remote object. Some code examples are provided to illustrate usage of the UnicastRemoteObjectExporter.

Note that remote object implementation classes which do not extend `UnicastRemoteObject` must assume the responsibility for the correct semantics of the hashCode, equals, and toString methods inherited from the Object class, so that they behave appropriately for remote objects.

Since:
  9.1.3
See Also:
  `ActivatableExporter`, `UnicastRemoteObjectExporter`

Constructor Summary
`AbstractRemoteObjectExporter(java.rmi.Remote remoteObject, int portNumber, java.rmi.server.RMIClientSocketFactory rmiClientSocketFactory, java.rmi.server.RMIServerSocketFactory rmiServerSocketFactory, boolean isForcibleUnexport)` Constructs an instance specifying the server and client socket factories.

Method Summary
`java.rmi.Remote` | `exportObject()` Exports the remote object returning the remote object's stub.
`protected abstract java.rmi.Remote` | `exportObject(java.rmi.Remote remoteObject, int port, java.rmi.server.RMIClientSocketFactory rmiClientSocketFactory, java.rmi.server.RMIServerSocketFactory rmiServerSocketFactory)` Exports the remote object returning the remote object's stub.
`java.rmi.Remote` | `getExportedRemoteObjectStub()` Gets the remote object that has been exported to the RMI system using the `exportObject()` method.
`int` | `getPortNumber()` Gets the port number on which the remote object should be exported.
`java.rmi.Remote` | `getRemotableObject()` Gets the remote object that is to be exported to the RMI system.
`java.rmi.server.RMIClientSocketFactory` | `getRMIClientSocketFactory()` Gets the RMI client socket factory.
`java.rmi.server.RMIServerSocketFactory` | `getRMIServerSocketFactory()` Gets the RMI server socket factory.
`boolean` | `isExported()` Determines whether the remote object is currently exported.
`boolean` | `isForcibleUnexport()` Determines whether the exported remote object should be forcibly unexported.
`void` | `setIsForcibleUnexport(boolean isForcibleUnexport)` Determines whether the exported remote object should be forcibly unexported.
`boolean` | `unexportObject()` Unexports the remote object from the RMI system.
`protected abstract boolean` | `unexportObject(java.rmi.Remote remoteObject, boolean isForcibleUnexport)` Unexports the remote object previously exported using the `exportObject()` method.

Constructor Detail

### AbstractRemoteObjectExporter

    public AbstractRemoteObjectExporter(java.rmi.Remote remoteObject,
                                        int portNumber,
                                        java.rmi.server.RMIClientSocketFactory rmiClientSocketFactory,
                                        java.rmi.server.RMIServerSocketFactory rmiServerSocketFactory,
                                        boolean isForcibleUnexport)
                                 throws java.lang.IllegalArgumentException

  Constructs an instance specifying the server and client socket factories.

  Parameters:
    `remoteObject` - The remote object that may be exported to the RMI system to create a remote object stub. Ensure that the remote object implementation correctly implements hashCode, equals, and toString methods to ensure correct behavior by the remote object.
    `portNumber` - Port on which the object should be exported. Specify `Constants.PORT_ANONYMOUS` to designate an anonymous port or a value greater than `0` to designate a well-known port.
    `rmiClientSocketFactory` - The client-side RMI socket factory is used to create sockets to make calls to the remote object or `null` if using the default.
    `rmiServerSocketFactory` - The server-side RMI socket factory is used to create sockets to receive remote calls or `null` if using the default.
    `isForcibleUnexport` - Specify `true` if the remote object should be unexported without regard to whether there are any active or pending remote calls or `false` if the remote object should not be unexported if there are active or pending calls.
  Throws:
    `java.lang.IllegalArgumentException` - if an invalid remote object or port number is specified.

Method Detail

### exportObject

    public final java.rmi.Remote exportObject()
                                       throws java.rmi.RemoteException

  Exports the remote object returning the remote object's stub.

  This is a template method which calls `exportObject(Remote, int, RMIClientSocketFactory, RMIServerSocketFactory)` passing the subclass implementation the object that is to be exported to the RMI system, the port, and the RMI socket factories.

  Specified by:
    `exportObject` in interface `RemoteObjectExporterInterface`
  Returns:
    Exported remote object's stub. The stub will always be non-`null`.
  Throws:
    `java.rmi.RemoteException` - if unable to unexport the remote object.
  See Also:
    `RemoteObjectExporterInterface.unexportObject()`, `RemoteObjectExporterInterface.isExported()`, `RemoteObjectExporterInterface.getExportedRemoteObjectStub()`

### unexportObject

    public final boolean unexportObject()
                                 throws java.rmi.NoSuchObjectException

  Unexports the remote object from the RMI system.

  This is a template method which calls `unexportObject(Remote exportedRemoteObject, boolean isForcibleUnexport)` passing the subclass implementation the remote object that was originally passed to the `exportObject(Remote, int, RMIClientSocketFactory, RMIServerSocketFactory)` and exported to the RMI system.

  Specified by:
    `unexportObject` in interface `RemoteObjectExporterInterface`
  Returns:
    `true` if the unexport operation was successfully completed.
  Throws:
    `java.rmi.NoSuchObjectException` - if unable to unexport the remote object.
  See Also:
    `RemoteObjectExporterInterface.exportObject()`, `RemoteObjectExporterInterface.isExported()`

### exportObject

    protected abstract java.rmi.Remote exportObject(java.rmi.Remote remoteObject,
                                                    int port,
                                                    java.rmi.server.RMIClientSocketFactory rmiClientSocketFactory,
                                                    java.rmi.server.RMIServerSocketFactory rmiServerSocketFactory)
                                             throws java.rmi.RemoteException

  Exports the remote object returning the remote object's stub. The returned stub should be unexported from the RMI system when it is no longer needed by the calling `unexportObject()` method.

  This method is only intended to be called by this abstract implementation's `exportObject()` method which will provide the appropriate parameters.

  Parameters:
    `remoteObject` - An object which implements a remote interface.
    `port` - The port on which the service should be exported. Specify `0` if you want to use an anonymous port.
    `rmiClientSocketFactory` - The RMI client socket factory or `null` if the default factory should be used.
    `rmiServerSocketFactory` - The RMI server socket factory or `null` if the default factory should be used.
  Returns:
    Exported remote object's stub or `null` if no object was exported.
  Throws:
    `java.rmi.RemoteException` - if unable to export the remote object.

### unexportObject

    protected abstract boolean unexportObject(java.rmi.Remote remoteObject,
                                              boolean isForcibleUnexport)
                                       throws java.rmi.NoSuchObjectException

  Unexports the remote object previously exported using the `exportObject()` method.

  This method is only intended to be called by this abstract implementation's `unexportObject()` method which will provide the appropriate parameters.

  Parameters:
    `remoteObject` - The remote object which was exported to the RMI system.
    `isForcibleUnexport` - `true` if the remote object's stub should be forcibly removed from the RMI system without regard to whether there are any active or pending calls. Specify `false` if the stub should not be unexported if there are active or pending calls.
  Returns:
    `true` if the unexport operation was successfully completed.
  Throws:
    `java.rmi.NoSuchObjectException` - if unable to unexport the remote object.

### getRemotableObject

    public final java.rmi.Remote getRemotableObject()

  Gets the remote object that is to be exported to the RMI system.

  Returns:
    remote object that is to be exported or `null` if an object implementing a remote interface has not been specified.

### getPortNumber

    public final int getPortNumber()

  Gets the port number on which the remote object should be exported.

  `Constants.PORT_ANONYMOUS` designates an anonymous port.

  Returns:
    Port number on which the remote object should be exported.

### isExported

    public final boolean isExported()

  Determines whether the remote object is currently exported.

  Specified by:
    `isExported` in interface `RemoteObjectExporterInterface`
  Returns:
    `true` if the remote object is currently exported.
  See Also:
    `RemoteObjectExporterInterface.exportObject()`, `RemoteObjectExporterInterface.unexportObject()`, `RemoteObjectExporterInterface.getExportedRemoteObjectStub()`

### isForcibleUnexport

    public final boolean isForcibleUnexport()

  Determines whether the exported remote object should be forcibly unexported.

  Returns:
    `true` if the exported remote object should be forcibly unexported.

### setIsForcibleUnexport

    public final void setIsForcibleUnexport(boolean isForcibleUnexport)

  Determines whether the exported remote object should be forcibly unexported.

  Parameters:
    `isForcibleUnexport` - `true` if the exported remote object should be forcibly unexported. A forcible unexport will forcibly drop all active connections to the remote object.

### getExportedRemoteObjectStub

    public final java.rmi.Remote getExportedRemoteObjectStub()

  Gets the remote object that has been exported to the RMI system using the `exportObject()` method.

  Specified by:
    `getExportedRemoteObjectStub` in interface `RemoteObjectExporterInterface`
  Returns:
    Remotable object that has been exported to the RMI system or `null` if an object is not currently exported.
  See Also:
    `RemoteObjectExporterInterface.exportObject()`, `RemoteObjectExporterInterface.isExported()`

### getRMIClientSocketFactory

    public final java.rmi.server.RMIClientSocketFactory getRMIClientSocketFactory()

  Gets the RMI client socket factory.

  Returns:
    RMI client-side socket factory that is used to create sockets to make calls to the remote object. Note that a `null` is returned if a default factory is desired.

### getRMIServerSocketFactory

    public final java.rmi.server.RMIServerSocketFactory getRMIServerSocketFactory()

  Gets the RMI server socket factory.

  Returns:
    RMI client-side socket factory that is used to create sockets to make calls to the remote object. Note that a `null` is returned if a default factory is desired.

*** This class provides Binary Compatibility only, not Source Compatibility ***

All Libraries | This Library | Package | Class | Use | Tree | Deprecated | Index | Grand Index | Help
|  | Components |
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2009 SAS Institute Inc. All Rights Reserved.