com.distinct.rpc
Class ClientGeneric

java.lang.Object
  |
  +--com.distinct.rpc.ClientGeneric
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
ClientHTTP, ClientSecureRPC, ClientTCP, ClientUDP

public abstract class ClientGeneric
extends java.lang.Object
implements java.io.Serializable

From this abstract class, the protocol client classes (TCP, UDP and HTTP) are derived. It declares the methods for connecting to a server and invoking it.

See Also:
JRPCClient, Serialized Form

Constructor Summary
ClientGeneric(java.net.InetAddress host, int prog, int vers)
          Generic part of protocol client creation.
 
Method Summary
abstract  void Call(int prog, int vers, int proc, XDRType in, XDRType out)
          Calls the server.
 void Call(int proc, XDRType in, XDRType out)
          Calls the server (if connected).
abstract  void close()
          Closes the connection and frees the socket resource.
 Auth getReturnedVerifier()
          Each incoming reply includes a verifier, containing information that may be used for future authentication.
 void setCredential(Auth credp)
          Each outgoing call includes a credential, containing a description of the identity of the caller and a verifier used for authenticating this identity.
abstract  void setResend(int milliseconds)
          Changes the timeout value for retransmission of the request (UDP only, default is 5s).
abstract  void setTimeout(int timeout)
          Changes the timeout value for waiting on server replies (default is 25s).
 void setVerifier(Auth verfp)
          Each outgoing call includes a credential, containing a description of the identity of the caller and a verifier used for authenticating this identity.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClientGeneric

public ClientGeneric(java.net.InetAddress host,
                     int prog,
                     int vers)
Generic part of protocol client creation.

Parameters:
host - The host on which the server lives.
prog - The program ID of the server as defined in the .x IDL file.
vers - The program version of the server as defined in the .x IDL file.
Method Detail

Call

public void Call(int proc,
                 XDRType in,
                 XDRType out)
          throws RPCError,
                 java.io.IOException
Calls the server (if connected).

Parameters:
proc - The ID of the request function as defined in the .x IDL file.
in - The input parameter (as it has to be marshalled it must be derived from XDRType).
out - The output parameter (as it has to be marshalled it must be derived from XDRType).
Throws:
java.io.IOException - When the call fails because the socket connetion fails.
RPCError - When the calls fails for any other reason.

Call

public abstract void Call(int prog,
                          int vers,
                          int proc,
                          XDRType in,
                          XDRType out)
                   throws RPCError,
                          java.io.IOException
Calls the server.

Parameters:
prog - The program ID of the server as defined in the .x IDL file.
vers - The program version of the server as defined in the .x IDL file.
proc - The ID of the request function as defined in the .x IDL file.
in - The input parameter (as it has to be marshalled it must be derived from XDRType).
out - The output parameter (as it has to be marshalled it must be derived from XDRType).
Throws:
java.io.IOException - When the call fails because the socket connetion fails.
RPCError - When the calls fails for any other reason.

close

public abstract void close()
Closes the connection and frees the socket resource.


setTimeout

public abstract void setTimeout(int timeout)
Changes the timeout value for waiting on server replies (default is 25s).

Parameters:
timeout - The new timeout value in ms (0 means no timeout at all, -1 means immediate return).

setResend

public abstract void setResend(int milliseconds)
Changes the timeout value for retransmission of the request (UDP only, default is 5s).

Parameters:
milliseconds - The new timeout value in ms.

setCredential

public void setCredential(Auth credp)
Each outgoing call includes a credential, containing a description of the identity of the caller and a verifier used for authenticating this identity. The exact semantics of the credential and verifier data depend on the authentication scheme used (AUTH_NULL, AUTH_SHORT, AUTH_UNIX or AUTH_DES). Default are an AUTH_NULL credential and an AUTH_NULL verifier (implemented by class com.distinct.rpc.Auth). This method changes this default and sets the credential object (a subclass of com.distinct.rpc.Auth) used for all subsequent calls of this client.

Parameters:
credp - The new credential used for subsequent calls.

setVerifier

public void setVerifier(Auth verfp)
Each outgoing call includes a credential, containing a description of the identity of the caller and a verifier used for authenticating this identity. The exact semantics of the credential and verifier data depend on the authentication scheme used (AUTH_NULL, AUTH_SHORT, AUTH_UNIX or AUTH_DES). Default are an AUTH_NULL credential and an AUTH_NULL verifier (implemented by class com.distinct.rpc.Auth). This method sets the verifier object (a subclass of com.distinct.rpc.Auth) used for all subsequent calls of this client.

Parameters:
verfp - The new verifier used for subsequent calls.

getReturnedVerifier

public Auth getReturnedVerifier()
Each incoming reply includes a verifier, containing information that may be used for future authentication. This method returns the verifier object (a subclass of com.distinct.rpc.Auth) provided by the most recent reply received by this client.

Returns:
The verifier from the most recent reply received.