Package org.acplt.oncrpc.server
Class OncRpcServerStub
java.lang.Object
org.acplt.oncrpc.server.OncRpcServerStub
- Direct Known Subclasses:
jportmap
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
FieldsModifier and TypeFieldDescriptionArray containing program and version numbers tuples this server is willing to handle.protected ObjectNotification flag for signalling the server to stop processing incomming remote procedure calls and to shut down.Array containing ONC/RPC server transport objects which describe what transports an ONC/RPC server offers for handling ONC/RPC calls. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose(OncRpcServerTransport[] transports) Close all transports listed in a set of server transports.Get the character encoding for deserializing strings.voidregister(OncRpcServerTransport[] transports) Register a set of server transports with the local portmapper.booleanregisterAuthenticationScheme(OncRpcServerAuthScheme authenticationScheme) Registers a custom authentication scheme to the authentication scheme repository of this ONC/RPC server stub.voidrun()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.voidrun(OncRpcServerTransport[] transports) Process incomming remote procedure call requests from all specified transports.voidsetCharacterEncoding(String characterEncoding) Set the character encoding for deserializing strings.voidNotify the RPC server to stop processing of remote procedure call requests as soon as possible.voidunregister(OncRpcServerTransport[] transports) Unregister a set of server transports from the local portmapper.
-
Field Details
-
transports
Array containing ONC/RPC server transport objects which describe what transports an ONC/RPC server offers for handling ONC/RPC calls. -
info
Array containing program and version numbers tuples this server is willing to handle. -
shutdownSignal
Notification flag for signalling the server to stop processing incomming remote procedure calls and to shut down.
-
-
Constructor Details
-
OncRpcServerStub
public OncRpcServerStub()
-
-
Method Details
-
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.- Throws:
OncRpcException- if the portmapper can not be contacted successfully.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
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
Process incomming remote procedure call requests from all specified transports. To end processing and to shut the server down signal theshutdownSignalobject. Note that the thread on whichrun()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 theclose(org.acplt.oncrpc.server.OncRpcServerTransport[])method of the server. -
unregister
Unregister a set of server transports from the local portmapper.- Parameters:
transports- Array of server transport objects to unregister.- Throws:
OncRpcException- with a reason ofOncRpcException.RPC_FAILEDif 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
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.
-
registerAuthenticationScheme
Registers a custom authentication scheme to the authentication scheme repository of this ONC/RPC server stub.- Parameters:
authenticationScheme- A custom authentication scheme.- Returns:
- true, if the passed authentication scheme has been added to the list of custom authentication schemes, false, if either nullhas been passed or there is already an authentication scheme registered for the authentication type of the passed one.
-
setCharacterEncoding
Set the character encoding for deserializing strings.- Parameters:
characterEncoding- the encoding to use for deserializing strings. Ifnull, the system's default encoding is to be used.
-
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.
-