1 /***
2 * Copyright (c) 2002, Reuters America Inc. All rights reserved.<p>
3 * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following
4 * conditions are met:<p>
5 * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
6 * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer
7 * in the documentation and/or other materials provided with the distribution. Neither the name of Reuters America Inc. nor the
8 * names of its contributors may be used to endorse or promote products derived from this software without specific prior written
9 * permission.<p>
10 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
11 * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
12 * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
13 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
14 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
15 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.<p>
16 */
17
18 package com.reuters.rc.db;
19
20 import com.tibco.tibrv.*;
21
22 /***
23 * The DB request interface that abstracts out a clients interaction with
24 * any ADB-like server.
25 *
26 * @author Jawaid Hakim
27 * @author Cavit Aydin (converted to an interface)
28 */
29 public interface DbRequest
30 {
31
32 /***
33 * Get the closure argument.
34 * @return Closure argument
35 * @see #sendRequest(TibrvTransport, String)
36 */
37 public Object getClosure();
38
39
40
41 /***
42 * Get the maximum time interval for which to wait for reply.
43 * @return Maximum timeout interval - in seconds.
44 * @see #sendRequest(TibrvTransport, String)
45 */
46 public double getTimeout();
47
48
49 /***
50 * Set the maximum time interval for which to wait for reply.
51 * @param timeout Maximum time interval - in seconds - for which to
52 * wait for reply.
53 * @see #sendRequest(TibrvTransport, String)
54 */
55 public void setTimeout(double timeout);
56
57
58 /***
59 * Set the number of resultset rows in a DbReply object. If a non-zero (positive) value
60 * is set then the DbReply objects will contain at most that many resultset rows.
61 * Any other value will simply result in all the resultset rows grouped into
62 * one DbReply object. Note that the (ADB-like) server may not support this parameter,
63 * in which case it will just be ignored. <p>
64 *
65 * This parameter will only affect the send() and asynch sendRequest()
66 * methods. The synchronous sendRequest() call will always return all the resultset rows
67 * in one DbReply object.
68 * In the case of send() (where there is no callback and therefore no DbReply object), this parameter
69 * will affect the TibrvMsg object fired by the ADB-like server.
70 *
71 * @param size the return batch size
72 *
73 */
74 public void setReplySize(int size);
75
76
77 /***
78 * Get the requests statement(s) associated with this request.
79 * @return Request statement(s) associated with this request. A reference
80 * to the request statements is returned so be careful about modifying the
81 * data.
82 */
83 public DbRequestStmt[] getRequest();
84
85
86 /***
87 * Request/Reply. Send the request to ADB, wait for the reply until timeout
88 * period expires, and return the reply. If timeout occurs then an exception
89 * is thrown.
90 * @param rvTrans Transport used to send the request.
91 * @param sendSubject Send subject.
92 * @return Reply from ADB.
93 * @see #setTimeout(double)
94 * @see DbReply
95 * @see #sendRequest(String)
96 */
97 public DbReply sendRequest(TibrvTransport rvTrans, String sendSubject) throws DbBusinessException, DbSystemException;
98
99
100 /***
101 * Request/Reply. Send the request to ADB, wait for the reply until timeout
102 * period expires, and return the reply. The default transport is used to send
103 * the request.
104 * @param sendSubject Send subject.
105 * @return Reply from ADB.
106 * @see #setDefault(TibrvTransport)
107 * @see #setDefault(TibrvTransport, TibrvQueue)
108 * @see #setTimeout(double)
109 * @see DbReply
110 * @see #sendRequest(TibrvTransport, String)
111 */
112 public DbReply sendRequest(String sendSubject) throws DbBusinessException, DbSystemException;
113
114
115 /***
116 * Request. Send the request to ADB.
117 * @param rvTrans Transport used to send the request.
118 * @param sendSubject Send subject.
119 * @see #send(String)
120 */
121 public void send(TibrvTransport rvTrans, String sendSubject) throws DbBusinessException, DbSystemException;
122
123
124 /***
125 * Request. Send the request to ADB using the default transport.
126 * @param sendSubject Send subject.
127 * @see #setDefault(TibrvTransport)
128 * @see #setDefault(TibrvTransport, TibrvQueue)
129 * @see #send(TibrvTransport, String)
130 */
131 public void send(String sendSubject) throws DbBusinessException, DbSystemException;
132
133
134 /***
135 * Request.Send the request to ADB.
136 * @param rvTrans Transport.
137 * @param sendSubject Send subject.
138 * @param replySubject Reply subject.
139 * @see #send(String, String)
140 */
141 public void send(TibrvTransport rvTrans, String sendSubject, String replySubject) throws DbBusinessException, DbSystemException;
142
143
144 /***
145 * Request.Send the request to ADB using the default transport.
146 * @param sendSubject Send subject.
147 * @param replySubject Reply subject.
148 * @see #setDefault(TibrvTransport)
149 * @see #setDefault(TibrvTransport, TibrvQueue)
150 * @see #send(TibrvTransport, String, String)
151 */
152 public void send(String sendSubject, String replySubject) throws DbBusinessException, DbSystemException;
153
154
155 /***
156 * Async. Request/Reply. Send the request to ADB, get the reply asynchronously,
157 * and return the reply to callback. The application callback should destroy the
158 * TibrvListsner if it wishes to close the subscription.
159 * @param rvTrans Transport used to send the request.
160 * @param sendSubject Send subject.
161 * @param rvQueue Queue on which the reply is received. Caller must dispatch
162 * from this queue.
163 * @param adbCb Callback function.
164 * @param replySubject Listen for reply from ADB on this subject.
165 * @see DbReply
166 * @see DbRequestCallback
167 * @see sendRequest(String, DbRequestCallback, String)
168 */
169 public void sendRequest(TibrvTransport rvTrans, String sendSubject, TibrvQueue rvQueue, DbRequestCallback adbCb, String replySubject) throws DbBusinessException, DbSystemException;
170
171
172 /***
173 * Async. Request/Reply. Send the request to ADB, get the reply asynchronously,
174 * and return the reply to callback. The application callback should destroy the
175 * TibrvListsner if it wishes to close the subscription.
176 * @param sendSubject Send subject.
177 * @param adbCb Callback function.
178 * @param replySubject Listen for reply from ADB on this subject.
179 * @see DbReply
180 * @see DbRequestCallback
181 * @see #sendRequest(TibrvTransport, String, TibrvQueue, DbRequestCallback, String)
182 */
183 public void sendRequest(String sendSubject, DbRequestCallback adbCb, String replySubject) throws DbBusinessException, DbSystemException;
184
185
186 /***
187 * Pretty Print the request message.
188 * @return Pretty Printed value.
189 */
190 public String toPrettyPrintString();
191
192 }
193
This page was automatically generated by Maven