netbula.ORPC

Class ClientGeneric


public class ClientGeneric
extends java.lang.Object

The ClientGeneric class is a wrapper for ClientTCP, ClientUDP and ClientHTTP classes. This class is used in the jrpcgen generated client code to call the server. Normally, one does not use this class directly.

Constructor Summary

ClientGeneric()
Construct a ClientGeneric object
ClientGeneric(InetAddress inetAddress, int prog, int ver, int port, String proto)
Construct a generic RPC client object
ClientGeneric(String hostname, String proto, int port, int prog, int ver)
Construct a generic RPC client object
ClientGeneric(String host_or_url, int prog, int ver, String proto)
Construct a generic RPC client object

Method Summary

void
call(int proc, XDT inarg, XDT outarg)
Make an RPC call via the underlying RPC client handle.
void
call_proc0()
Ping the RPC by calling procedure 0
boolean
close()
Close the RPC connection
boolean
connect()
Connect to the RPC server
Auth
getAuth()
RPCClient
getClient()
void
setAuth(Auth a)
Set authentication
void
setClient(RPCClient c)
Set the underlying client handle to a bound RPCClient object
void
setServer(String host, int proto)
When HTTP protocol is used, and the servlet/CGI is a proxy to a real RPC server, call this function to set the hostname of the real server and protocol to use for it.
void
setTimeout(int timeout)
Set the timeout value (in milliseconds) for the RPC calls

Constructor Details

ClientGeneric

public ClientGeneric()
Construct a ClientGeneric object

ClientGeneric

public ClientGeneric(InetAddress inetAddress,
                     int prog,
                     int ver,
                     int port,
                     String proto)
            throws rpc_err
Construct a generic RPC client object
Parameters:
inetAddress - Address of the server machine
prog - program number of the RPC service
ver - version number of the RPC service
port - port number of the RPC service
proto - "tcp" or "udp" only (no http)
Throws:
rpc_err -

ClientGeneric

public ClientGeneric(String hostname,
                     String proto,
                     int port,
                     int prog,
                     int ver)
            throws rpc_err
Construct a generic RPC client object
Parameters:
hostname - name of the server machine
proto - "tcp" or "udp" only (no http)
port - port number of the RPC service
prog - program number of the RPC service
ver - version number of the RPC service
Throws:
rpc_err -

ClientGeneric

public ClientGeneric(String host_or_url,
                     int prog,
                     int ver,
                     String proto)
            throws rpc_err
Construct a generic RPC client object
Parameters:
host_or_url - hostname.domain of the server machine, or the URL of the servlet or CGI program if proto is "http".
prog - program number of the RPC service
ver - version number of the RPC service
proto - "tcp" , "udp" or "http". For "http", one should call setServer() function to set the remote RPC server name, if the servlet/CGI is a proxy.
Throws:
rpc_err -

Method Details

call

public void call(int proc,
                 XDT inarg,
                 XDT outarg)
            throws rpc_err
Make an RPC call via the underlying RPC client handle. Normally, one does not use this low level function, but use the jrpcgen generated RPC client interface instead.
Parameters:
proc - Procecure number of the RPC
inarg - Input argument
outarg - Output which holds the results from the server

call_proc0

public void call_proc0()
            throws rpc_err
Ping the RPC by calling procedure 0

close

public boolean close()
Close the RPC connection

connect

public boolean connect()
            throws rpc_err
Connect to the RPC server

getAuth

public Auth getAuth()

getClient

public RPCClient getClient()
Returns:
The underlying RPCClient object

setAuth

public void setAuth(Auth a)
Set authentication

setClient

public void setClient(RPCClient c)
Set the underlying client handle to a bound RPCClient object

setServer

public void setServer(String host,
                      int proto)
            throws rpc_err
When HTTP protocol is used, and the servlet/CGI is a proxy to a real RPC server, call this function to set the hostname of the real server and protocol to use for it. Note: the servlet/CGI may perform translation of the hostname.
Parameters:
host - Remote server hostname
proto - Ask the proxy to use a particular protocol

setTimeout

public void setTimeout(int timeout)
Set the timeout value (in milliseconds) for the RPC calls