|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.vinci.transport.BaseClient
org.apache.vinci.transport.VinciClient
public class VinciClient
Class for conjuring a Vinci service. Adds VNS resolution to BaseClient. Extends BaseClient with static "sendAndReceive" and "rpc" methods for convenient support of one-shot queries.
| Field Summary |
|---|
| Fields inherited from class org.apache.vinci.transport.BaseClient |
|---|
DEFAULT_CONNECT_TIMEOUT, DEFAULT_SOCKET_TIMEOUT |
| Constructor Summary | |
|---|---|
VinciClient()
Construct a new client WITHOUT opening a connection, using the VinciFrame factory to create return documents. |
|
VinciClient(java.lang.String service_name)
Construct a new client connected to the requested service, and uses a VinciFrame factory to create the return document type. |
|
VinciClient(java.lang.String service_name,
int connectTimeout)
Construct a new client connected to the requested service, and uses a VinciFrame factory to create the return document type. |
|
VinciClient(java.lang.String service_name,
TransportableFactory factory)
Constructs a new client connected to the requested service. |
|
VinciClient(java.lang.String service_name,
TransportableFactory factory,
int connectTimeout)
Constructs a new client connected to the requested service. |
|
VinciClient(java.lang.String service_name,
TransportableFactory factory,
VinciContext myContext)
|
|
VinciClient(java.lang.String service_name,
TransportableFactory factory,
VinciContext myContext,
int connectTimeout)
Constructs a new client connected to the requested service. |
|
VinciClient(java.lang.String service_name,
VinciContext myContext)
|
|
VinciClient(java.lang.String service_name,
VinciContext myContext,
int connectTimeout)
Constructs a new client connected to the requested service. |
|
VinciClient(TransportableFactory f)
Construct a new client WITHOUT opening a connection, using the specified factory to create return documents. |
|
| Method Summary | |
|---|---|
VinciContext |
getContext()
Get the context associated with this client. |
int |
getInstance()
Get the instance number of this service. |
int |
getLevel()
Get the priority level of the service to which this client is connected. |
java.lang.String |
getQualifiedServiceName()
Get the fully qualified name of this service. |
java.lang.String |
getServiceName()
|
protected boolean |
isSocketKeepAliveEnabled()
Gets wheter socket keepAlive is enabled. |
static void |
main(java.lang.String[] args)
|
void |
open(java.lang.String service_name)
Connects the client to the specified service as delegated by VNS. |
protected void |
reopen(java.lang.Exception e)
|
static VinciFrame |
rpc(Transportable in,
java.lang.String service_name)
Same as VinciClient.sendAndReceive(Transportable) except for return type. |
static VinciFrame |
rpc(Transportable in,
java.lang.String service_name,
int timeout)
Same as VinciClient.sendAndReceive(Transportable, service_name) except it also takes a timeout value. |
static VinciFrame |
rpc(Transportable in,
java.lang.String service_name,
int timeout,
int connect_timeout)
Same as VinciClient.sendAndReceive(Transportable, service_name) except it also takes socket read and socket connect timeout values. |
static Transportable |
sendAndReceive(Transportable in,
java.lang.String service_name,
TransportableFactory factory)
Convenience method for "one-shot"/single-query connections. |
static Transportable |
sendAndReceive(Transportable in,
java.lang.String service_name,
TransportableFactory factory,
int socket_timeout)
Convenience method for "one-shot"/single-query connections. |
static Transportable |
sendAndReceive(Transportable in,
java.lang.String service_name,
TransportableFactory factory,
int socket_timeout,
int connect_timeout)
Convenience method for "one-shot"/single-query connections. |
void |
setContext(VinciContext c)
Set the VinciContext to be used by this client. |
| Methods inherited from class org.apache.vinci.transport.BaseClient |
|---|
close, getHeader, getHost, getPort, getSocket, getSocketTimeout, isOpen, open, open, open, receive, rpc, rpc, rpc, send, sendAndReceive, sendAndReceive, sendAndReceive, sendAndReceive, sendAndReceive, sendAndReceive, sendAndReceive, sendAndReceiveWork, sendAndReceiveWork, setConnectTimeout, setRetry, setSocketTimeout, setTransportableFactory |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public VinciClient(java.lang.String service_name)
throws ServiceDownException,
VNSException
service_name - The name of the service to connect to.
java.lang.IllegalStateException - if no VNS_HOST has been specified.
ServiceDownException
VNSException
public VinciClient(java.lang.String service_name,
TransportableFactory factory)
throws ServiceDownException,
VNSException
service_name - The name of the service to connect to.factory - The factory used for creating return documents of desired type.
java.lang.IllegalStateException - if no VNS_HOST has been specified.
ServiceDownException
VNSException
public VinciClient(java.lang.String service_name,
TransportableFactory factory,
VinciContext myContext)
throws ServiceDownException,
VNSException
java.lang.IllegalStateException - if no VNS_HOST has been specified.
ServiceDownException
VNSException
public VinciClient(java.lang.String service_name,
VinciContext myContext)
throws ServiceDownException,
VNSException
java.lang.IllegalStateException - if no VNS_HOST has been specified.
ServiceDownException
VNSException
public VinciClient(java.lang.String service_name,
int connectTimeout)
throws ServiceDownException,
VNSException
service_name - The name of the service to connect to.connectTimeout - The number of milliseconds that will elapse before a connect attempt fails.
java.lang.IllegalStateException - if no VNS_HOST has been specified.
ServiceDownException
VNSException
public VinciClient(java.lang.String service_name,
TransportableFactory factory,
int connectTimeout)
throws ServiceDownException,
VNSException
service_name - The name of the service to connect to.factory - The factory used for creating return documents of desired type.connectTimeout - The number of milliseconds that will elapse before a connect attempt fails.
java.lang.IllegalStateException - if no VNS_HOST has been specified.
ServiceDownException
VNSException
public VinciClient(java.lang.String service_name,
TransportableFactory factory,
VinciContext myContext,
int connectTimeout)
throws ServiceDownException,
VNSException
java.lang.IllegalStateException - if no VNS_HOST has been specified.
ServiceDownException
VNSException
public VinciClient(java.lang.String service_name,
VinciContext myContext,
int connectTimeout)
throws ServiceDownException,
VNSException
java.lang.IllegalStateException - if no VNS_HOST has been specified.
ServiceDownException
VNSExceptionpublic VinciClient()
public VinciClient(TransportableFactory f)
| Method Detail |
|---|
public int getLevel()
public int getInstance()
public static Transportable sendAndReceive(Transportable in,
java.lang.String service_name,
TransportableFactory factory)
throws java.io.IOException,
ServiceException,
ServiceDownException,
VNSException
java.lang.IllegalStateException - if the VNS host has not been specified.
java.io.IOException
ServiceException
ServiceDownException
VNSException
public static Transportable sendAndReceive(Transportable in,
java.lang.String service_name,
TransportableFactory factory,
int socket_timeout)
throws java.io.IOException,
ServiceException
java.lang.IllegalStateException - if the VNS host has not been specified.
java.io.IOException
ServiceException
public static Transportable sendAndReceive(Transportable in,
java.lang.String service_name,
TransportableFactory factory,
int socket_timeout,
int connect_timeout)
throws java.io.IOException,
ServiceException
java.lang.IllegalStateException - if the VNS host has not been specified.
java.io.IOException
ServiceExceptionpublic VinciContext getContext()
public void setContext(VinciContext c)
public java.lang.String getQualifiedServiceName()
public java.lang.String getServiceName()
public void open(java.lang.String service_name)
throws ServiceDownException,
VNSException
serviceName - The name of the service to connect to.
ServiceDownException - Thrown when either (1) VNS is inaccessible or (2) none of the servers registered
under serviceName are accessible.
VNSException - Thrown when VNS is accessible but reports an error, which should almost always
indicate that the requested service is not registered.
java.lang.IllegalStateException - if no VNS_HOST has been specified.
protected void reopen(java.lang.Exception e)
throws java.io.IOException
reopen in class BaseClientjava.io.IOExceptionprotected boolean isSocketKeepAliveEnabled()
isSocketKeepAliveEnabled in class BaseClient
public static VinciFrame rpc(Transportable in,
java.lang.String service_name)
throws java.io.IOException,
ServiceException,
ServiceDownException,
VNSException
java.lang.IllegalStateException - if the VNS host has not been specified.
java.io.IOException
ServiceException
ServiceDownException
VNSException
public static VinciFrame rpc(Transportable in,
java.lang.String service_name,
int timeout)
throws java.io.IOException,
ServiceException,
ServiceDownException,
VNSException
java.io.IOException
ServiceException
ServiceDownException
VNSException
public static VinciFrame rpc(Transportable in,
java.lang.String service_name,
int timeout,
int connect_timeout)
throws java.io.IOException,
ServiceException,
ServiceDownException,
VNSException
java.io.IOException
ServiceException
ServiceDownException
VNSException
public static void main(java.lang.String[] args)
throws java.lang.Exception
java.lang.Exception
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||