Package org.acplt.oncrpc.server

## Class OncRpcServerStub

- java.lang.Object
- - org.acplt.oncrpc.server.OncRpcServerStub

- Direct Known Subclasses:
    `jportmap`

      public abstract class OncRpcServerStub
      extends java.lang.Object

  The abstract `OncRpcServerStub` class is the base class to build ONC/RPC-program specific servers upon. This class is typically only used by jrpcgen generated servers, which provide a particular set of remote procedures as defined in a x-file.
  Version:
    $Revision: 1.2 $ $Date: 2003/08/14 13:47:04 $ $State: Exp $ $Locker: $
  Author:
    Harald Albrecht

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `private java.lang.String` | `characterEncoding` | Encoding to use when deserializing strings or `null` if the system's default encoding should be used.
    `OncRpcServerTransportRegistrationInfo[]` | `info` | Array containing program and version numbers tuples this server is willing to handle.
    `protected java.lang.Object` | `shutdownSignal` | Notification flag for signalling the server to stop processing incomming remote procedure calls and to shut down.
    `OncRpcServerTransport[]` | `transports` | Array containing ONC/RPC server transport objects which describe what transports an ONC/RPC server offers for handling ONC/RPC calls.

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `OncRpcServerStub()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `close​(OncRpcServerTransport[] transports)` | Close all transports listed in a set of server transports.
    `java.lang.String` | `getCharacterEncoding()` | Get the character encoding for deserializing strings.
    `void` | `register​(OncRpcServerTransport[] transports)` | Register a set of server transports with the local portmapper.
    `void` | `run()` | All inclusive convenience method: register server transports with portmapper, then run the call dispatcher until the server is signalled to shut down, and finally deregister the transports.
    `void` | `run​(OncRpcServerTransport[] transports)` | Process incomming remote procedure call requests from all specified transports.
    `void` | `setCharacterEncoding​(java.lang.String characterEncoding)` | Set the character encoding for deserializing strings.
    `void` | `stopRpcProcessing()` | Notify the RPC server to stop processing of remote procedure call requests as soon as possible.
    `void` | `unregister​(OncRpcServerTransport[] transports)` | Unregister a set of server transports from the local portmapper.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### transports

          public OncRpcServerTransport[] transports

      Array containing ONC/RPC server transport objects which describe what transports an ONC/RPC server offers for handling ONC/RPC calls.

    - #### info

          public OncRpcServerTransportRegistrationInfo[] info

      Array containing program and version numbers tuples this server is willing to handle.

    - #### shutdownSignal

          protected java.lang.Object shutdownSignal

      Notification flag for signalling the server to stop processing incomming remote procedure calls and to shut down.

    - #### characterEncoding

          private java.lang.String characterEncoding

      Encoding to use when deserializing strings or `null` if the system's default encoding should be used.

  - ### Constructor Detail

    - #### OncRpcServerStub

          public OncRpcServerStub()

  - ### Method Detail

    - #### run

          public void run()
                   throws OncRpcException,
                          java.io.IOException

      All inclusive convenience method: register server transports with portmapper, then run the call dispatcher until the server is signalled to shut down, and finally deregister the transports.
      Throws:
        `OncRpcException` - if the portmapper can not be contacted successfully.
        `java.io.IOException` - if a severe network I/O error occurs in the server from which it can not recover (like severe exceptions thrown when waiting for now connections on a server socket).

    - #### register

          public void register​(OncRpcServerTransport[] transports)
                        throws OncRpcException

      Register a set of server transports with the local portmapper.
      Parameters:
        `transports` - Array of server transport objects to register, which will later handle incomming remote procedure call requests.
      Throws:
        `OncRpcException` - if the portmapper could not be contacted successfully.

    - #### run

          public void run​(OncRpcServerTransport[] transports)

      Process incomming remote procedure call requests from all specified transports. To end processing and to shut the server down signal the `shutdownSignal` object. Note that the thread on which `run()` is called will ignore any interruptions and will silently swallow them.
      Parameters:
        `transports` - Array of server transport objects for which processing of remote procedure call requests should be done.

    - #### stopRpcProcessing

          public void stopRpcProcessing()

      Notify the RPC server to stop processing of remote procedure call requests as soon as possible. Note that each transport has its own thread, so processing will not stop before the transports have been closed by calling the `close(org.acplt.oncrpc.server.OncRpcServerTransport[])` method of the server.

    - #### unregister

          public void unregister​(OncRpcServerTransport[] transports)
                          throws OncRpcException

      Unregister a set of server transports from the local portmapper.
      Parameters:
        `transports` - Array of server transport objects to unregister.
      Throws:
        `OncRpcException` - with a reason of `OncRpcException.RPC_FAILED` if the portmapper could not be contacted successfully. Note that it is not considered an error to remove a non-existing entry from the portmapper.

    - #### close

          public void close​(OncRpcServerTransport[] transports)

      Close all transports listed in a set of server transports. Only by calling this method processing of remote procedure calls by individual transports can be stopped. This is because every server transport is handled by its own thread.
      Parameters:
        `transports` - Array of server transport objects to close.

    - #### setCharacterEncoding

          public void setCharacterEncoding​(java.lang.String characterEncoding)

      Set the character encoding for deserializing strings.
      Parameters:
        `characterEncoding` - the encoding to use for deserializing strings. If `null`, the system's default encoding is to be used.

    - #### getCharacterEncoding

          public java.lang.String getCharacterEncoding()

      Get the character encoding for deserializing strings.
      Returns:
        the encoding currently used for deserializing strings. If `null`, then the system's default encoding is used.