com.reuters.rc.db.adb
Class AdbRequest

java.lang.Object
  |
  +--com.reuters.rc.db.adb.AdbRequest
All Implemented Interfaces:
DbRequest

public class AdbRequest
extends java.lang.Object
implements DbRequest

This class represents a request sent to ADB. Each instance of this class is immutable - instances can be freely shared among threads. This class depends on DbManager to pick up transport/queue/timeout defaults. An easy way for the application to provide consistent transport/queue/timeout parameters across modules is to configure the DbManager once.

Author:
Jawaid Hakim.
See Also:
DbManager

Constructor Summary
AdbRequest(DbRequestStmt stmt)
          Constructor.
AdbRequest(DbRequestStmt[] stmts)
          Constructor.
AdbRequest(DbRequestStmt[] stmts, double timeout)
          Constructor.
AdbRequest(DbRequestStmt[] stmts, double timeout, java.lang.Object closure)
          Constructor.
AdbRequest(DbRequestStmt stmt, double timeout)
          Constructor.
AdbRequest(DbRequestStmt stmt, double timeout, java.lang.Object closure)
          Constructor.
 
Method Summary
 java.lang.Object getClosure()
          Get the closure argument.
 DbRequestStmt[] getRequest()
          Get the statement(s) associated with this request.
 double getTimeout()
          Get the maximum time interval for which to wait for reply.
 void send(java.lang.String sendSubject)
          Send the request to ADB without waiting for a reply.
 void send(java.lang.String sendSubject, java.lang.String replySubject)
          Send the request to ADB using the default transport.
 void send(com.tibco.tibrv.TibrvTransport rvTrans, java.lang.String sendSubject)
          Send the request to ADB without waiting for a reply.
 void send(com.tibco.tibrv.TibrvTransport rvTrans, java.lang.String sendSubject, java.lang.String replySubject)
          Send the request to ADB without waiting for a reply.
 DbReply sendRequest(java.lang.String sendSubject)
          Send the request to ADB and return the reply.
 void sendRequest(java.lang.String sendSubject, DbRequestCallback adbCb, java.lang.String replySubject)
          Async.
 DbReply sendRequest(com.tibco.tibrv.TibrvTransport rvTrans, java.lang.String sendSubject)
          Send the request to ADB and return the reply.
 void sendRequest(com.tibco.tibrv.TibrvTransport rvTrans, java.lang.String sendSubject, com.tibco.tibrv.TibrvQueue rvQueue, DbRequestCallback adbCb, java.lang.String replySubject)
          Async.
 void setReplySize(int replySize)
          This method is a NO-OP and exists to satisfy interface requirements.
 void setTimeout(double timeout)
          Set the maximum time interval for which to wait for reply.
 java.lang.String toPrettyPrintString()
          Pretty Print the request message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AdbRequest

public AdbRequest(DbRequestStmt stmt)
Constructor. A reference to the parameter is stored so be careful about modifying the data.
Parameters:
stmt - Request statement.

AdbRequest

public AdbRequest(DbRequestStmt stmt,
                  double timeout)
Constructor. A reference to the parameter is stored so be careful about modifying the data.
Parameters:
stmt - Request statement.
timeout - Maximum time interval - in seconds - for which to wait for reply in request/reply mode.

AdbRequest

public AdbRequest(DbRequestStmt stmt,
                  double timeout,
                  java.lang.Object closure)
Constructor. A reference to the parameter is stored so be careful about modifying the data.
Parameters:
stmt - Request statement.
timeout - Maximum time interval - in seconds - for which to wait for reply in request/reply mode.
closure - Closure argument. In asynchronous request/reply mode, the closure is returned with the response to the application callback.
See Also:
throws AdbException, DbRequestCallback

AdbRequest

public AdbRequest(DbRequestStmt[] stmts)
Constructor. A reference to the parameters is stored so be careful about modifying the data.
Parameters:
stmts - Request statements.

AdbRequest

public AdbRequest(DbRequestStmt[] stmts,
                  double timeout)
Constructor. A reference to the parameters is stored so be careful about modifying the data.
Parameters:
stmts - Request statements.
timeout - Maximum time interval - in seconds - for which to wait for reply in request/reply mode.

AdbRequest

public AdbRequest(DbRequestStmt[] stmts,
                  double timeout,
                  java.lang.Object closure)
Constructor. A reference to the parameters is stored so be careful about modifying the data.
Parameters:
stmts - Request statements.
timeout - Maximum time interval - in seconds - for which to wait for reply in request/reply mode.
closure - Closure argument. In asynchronous request/reply mode, the closure is returned with the response to the application callback.
See Also:
throws AdbException, DbRequestCallback
Method Detail

setReplySize

public void setReplySize(int replySize)
This method is a NO-OP and exists to satisfy interface requirements.
Specified by:
setReplySize in interface DbRequest
Following copied from interface: com.reuters.rc.db.DbRequest
Parameters:
size - the return batch size

getClosure

public final java.lang.Object getClosure()
Get the closure argument.
Specified by:
getClosure in interface DbRequest
Returns:
Closure argument

getTimeout

public final double getTimeout()
Get the maximum time interval for which to wait for reply.
Specified by:
getTimeout in interface DbRequest
Returns:
Maximum timeout interval - in seconds.

setTimeout

public final void setTimeout(double timeout)
Set the maximum time interval for which to wait for reply.
Specified by:
setTimeout in interface DbRequest
Parameters:
timeout - Maximum time interval - in seconds - for which to wait for reply.

getRequest

public final DbRequestStmt[] getRequest()
Get the statement(s) associated with this request.
Specified by:
getRequest in interface DbRequest
Returns:
Request statement(s) associated with this request. A reference to the request statements is returned so be careful about modifying the data.

sendRequest

public final DbReply sendRequest(com.tibco.tibrv.TibrvTransport rvTrans,
                                 java.lang.String sendSubject)
                          throws AdbBusinessException,
                                 AdbSystemException
Send the request to ADB and return the reply. Wait for the reply until timeout period expires. Throws exception if request times out.
Specified by:
sendRequest in interface DbRequest
Parameters:
rvTrans - Transport used to send the request.
sendSubject - Send subject.
Returns:
Reply from ADB.
See Also:
setTimeout(double)

sendRequest

public final DbReply sendRequest(java.lang.String sendSubject)
                          throws AdbBusinessException,
                                 AdbSystemException
Send the request to ADB and return the reply. Wait for the reply until timeout period expires. The default transport is used to send the request. Throws exception if no default transport has been registered or if request times out.
Specified by:
sendRequest in interface DbRequest
Parameters:
sendSubject - Send subject.
Returns:
Reply from ADB.
See Also:
#setDefault(TibrvTransport), setTimeout(double)

send

public final void send(com.tibco.tibrv.TibrvTransport rvTrans,
                       java.lang.String sendSubject)
                throws AdbBusinessException,
                       AdbSystemException
Send the request to ADB without waiting for a reply.
Specified by:
send in interface DbRequest
Parameters:
rvTrans - Transport used to send the request.
sendSubject - Send subject.

send

public final void send(java.lang.String sendSubject)
                throws AdbBusinessException,
                       AdbSystemException
Send the request to ADB without waiting for a reply. The default transport is used to send the request. Throws exception if no default transport has been registered or if request times out.
Specified by:
send in interface DbRequest
Parameters:
sendSubject - Send subject.
See Also:
#setDefault(TibrvTransport), #setDefault(TibrvTransport, TibrvQueue), send(TibrvTransport, String)

send

public final void send(com.tibco.tibrv.TibrvTransport rvTrans,
                       java.lang.String sendSubject,
                       java.lang.String replySubject)
                throws AdbBusinessException,
                       AdbSystemException
Send the request to ADB without waiting for a reply.
Specified by:
send in interface DbRequest
Parameters:
rvTrans - Transport.
sendSubject - Send subject.
replySubject - Reply subject.
See Also:
send(String, String)

send

public final void send(java.lang.String sendSubject,
                       java.lang.String replySubject)
                throws AdbBusinessException,
                       AdbSystemException
Send the request to ADB using the default transport.
Specified by:
send in interface DbRequest
Parameters:
sendSubject - Send subject.
replySubject - Reply subject.
See Also:
#setDefault(TibrvTransport), #setDefault(TibrvTransport, TibrvQueue), send(TibrvTransport, String, String)

sendRequest

public final void sendRequest(com.tibco.tibrv.TibrvTransport rvTrans,
                              java.lang.String sendSubject,
                              com.tibco.tibrv.TibrvQueue rvQueue,
                              DbRequestCallback adbCb,
                              java.lang.String replySubject)
                       throws AdbBusinessException,
                              AdbSystemException
Async. Request/Reply. Send the request to ADB, get the reply asynchronously, and return the reply to application callback. The application callback should destroy the TibrvListsner if it wishes to close the subscription.
Specified by:
sendRequest in interface DbRequest
Parameters:
rvTrans - Transport used to send the request.
sendSubject - Send subject.
rvQueue - Queue on which the reply is received. Caller must dispatch from this queue.
adbCb - Callback function.
replySubject - Listen for reply from ADB on this subject.
See Also:
DbRequestCallback

sendRequest

public final void sendRequest(java.lang.String sendSubject,
                              DbRequestCallback adbCb,
                              java.lang.String replySubject)
                       throws AdbBusinessException,
                              AdbSystemException
Async. Request/Reply. Send the request to ADB, get the reply asynchronously, and return the reply to callback. The application callback should destroy the TibrvListsner if it wishes to close the subscription.
Specified by:
sendRequest in interface DbRequest
Parameters:
sendSubject - Send subject.
adbCb - Callback function.
replySubject - Listen for reply from ADB on this subject.
See Also:
DbRequestCallback

toPrettyPrintString

public final java.lang.String toPrettyPrintString()
Pretty Print the request message.
Specified by:
toPrettyPrintString in interface DbRequest
Returns:
Pretty Printed value.


Copyright © 2002-2003 Reuters. All Rights Reserved.