View Javadoc
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.TibrvMsg; 21 22 /*** 23 * DbFactory defines all the interface methods that any Adb-like client needs 24 * to implement to supply the instances of their DbXXXXXXX interface implementations. 25 * 26 * This class is the single source for object creation. Application clients can set/get 27 * their particular choice of DbFactory implementation through the static methods of the 28 * DbManager class. 29 * 30 * @author Cavit Aydin 31 */ 32 public interface DbFactory 33 { 34 35 36 ///////////////////////////////////////////////////// 37 // Factory Methods for the DbRequest interface // 38 //////////////////////////////////////////////////// 39 40 /*** 41 * Get an instance of a DbRequest object. 42 * 43 * @param stmt request statement 44 * @return an instance of DbRequest object 45 * @see DbRequestStmt 46 */ 47 public DbRequest getRequest(DbRequestStmt stmt); 48 49 50 /*** 51 * Get an instance of a DbRequest object. 52 * 53 * @param stmt Request statement. 54 * @param timeout Maximum time interval - in seconds - for which to 55 * wait for reply in request/reply mode. 56 * @see DbRequest#sendRequest(TibrvTransport, String) 57 * @see DbRequest#sendRequest(String) 58 * @see DbRequestStmt 59 */ 60 public DbRequest getRequest(DbRequestStmt stmt, double timeout); 61 62 63 /*** 64 * Get an instance of a DbRequest object. 65 * 66 * @param stmt Request statement. 67 * @param timeout Maximum time interval - in seconds - for which to 68 * wait for reply in request/reply mode. 69 * @param closure Closure argument. 70 * @see DbRequest#sendRequest(TibrvTransport, String) 71 * @see DbRequest#sendRequest(String) 72 * @see DbRequestStmt 73 */ 74 public DbRequest getRequest(DbRequestStmt stmt, double timeout, Object closure); 75 76 /*** 77 * Get an instance of a DbRequest object. 78 * 79 * @param stmts Request statements. 80 * @see DbRequestStmt 81 */ 82 public DbRequest getRequest(DbRequestStmt[] stmts); 83 84 85 /*** 86 * Get an instance of a DbRequest object. 87 * 88 * @param stmts Request statements. 89 * @param timeout Maximum time interval - in seconds - for which to 90 * wait for reply in request/reply mode. 91 * @see DbRequest#sendRequest(TibrvTransport, String) 92 * @see DbRequest#sendRequest(String) 93 * @see DbRequestStmt 94 */ 95 public DbRequest getRequest(DbRequestStmt[] stmts, double timeout); 96 97 98 /*** 99 * Get an instance of a DbRequest object. 100 * 101 * @param stmts Request statements. 102 * @param timeout Maximum time interval - in seconds - for which to 103 * wait for reply in request/reply mode. 104 * @param closure Closure argument. 105 * @see DbRequest#sendRequest(TibrvTransport, String) 106 * @see DbRequest#sendRequest(String) 107 * @see DbRequestStmt 108 */ 109 public DbRequest getRequest(DbRequestStmt[] stmts, double timeout, Object closure); 110 111 112 //////////////////////////////////////////////////////// 113 // Factory Methods for the DbReply interface // 114 /////////////////////////////////////////////////////// 115 116 /*** 117 * Get an instance of a DbReply object. 118 * 119 * @param replyMsg Reply message from ADB. 120 */ 121 public DbReply getReply(TibrvMsg replyMsg); 122 123 124 125 //////////////////////////////////////////////////////// 126 // Factory Methods for the DbRequestStmt interface // 127 /////////////////////////////////////////////////////// 128 129 130 /*** 131 * Get an instance of a DbRequestStmt object. 132 * 133 * @param sql The SQL statement to execute on the ADB. 134 */ 135 public DbRequestStmt getRequestStmt(String sql); 136 137 138 /*** 139 * Get an instance of a DbRequestStmt object. 140 * 141 * @param sql The SQL statement to execute on the ADB. 142 * @param maxRows Maximum number of result rows returned from request. 143 */ 144 public DbRequestStmt getRequestStmt(String sql, int maxRows); 145 146 147 /*** 148 * Get an instance of a DbRequestStmt object 149 * 150 * @param sql The SQL statement to execute on the ADB. 151 * @param bind Bind data. 152 * @see DbRequestBind 153 */ 154 public DbRequestStmt getRequestStmt(String sql, DbRequestBind bind); 155 156 157 /*** 158 * Get an instance of a DbRequestStmt object 159 * 160 * @param sql The SQL statement to execute on the ADB. 161 * @param bind Bind data. 162 * @param maxRows Maximum number of result rows returned from request. 163 * @see DbRequestBind 164 */ 165 public DbRequestStmt getRequestStmt(String sql, DbRequestBind bind, int maxRows); 166 167 168 /*** 169 * Get an instance of a DbRequestStmt object 170 * 171 * @param sql The SQL statement to execute on the ADB. 172 * @param binds Bind data. 173 * @see DbRequestBind 174 */ 175 public DbRequestStmt getRequestStmt(String sql, DbRequestBind[] binds); 176 177 178 179 /*** 180 * Get an instance of a DbRequestStmt object 181 * 182 * @param sql The SQL statement to execute on the ADB. 183 * @param binds Bind data. 184 * @param maxRows Maximum number of result rows returned from request. 185 * @see DbRequestBind 186 */ 187 public DbRequestStmt getRequestStmt(String sql, DbRequestBind[] binds, int maxRows); 188 189 190 191 192 //////////////////////////////////////////////////////// 193 // Factory Methods for the DbRequestBind interface // 194 /////////////////////////////////////////////////////// 195 196 197 /*** 198 * Get an instance of a DbRequestStmt object. 199 * 200 * @param position Placeholder position. 201 * @param column Column name. 202 * @param data Column data. 203 */ 204 public DbRequestBind getRequestBind(int position, String column, Object data); 205 206 207 /*** 208 * Get an instance of a DbRequestStmt object. 209 * 210 * @param column Column name. 211 * @param data Column data. 212 */ 213 public DbRequestBind getRequestBind(String column, Object data); 214 215 216 /*** 217 * Get an instance of a DbRequestStmt object. 218 * 219 * @param position Placeholder position. 220 * @param data Column data. 221 */ 222 public DbRequestBind getRequestBind(int position, Object data); 223 224 225 226 227 //////////////////////////////////////////////////////// 228 // Factory Methods for the DbOpcode interface // 229 /////////////////////////////////////////////////////// 230 231 232 /*** 233 * Get an instance of a DbOpcode object that represents an Insert operation. 234 * 235 * @return DbOpcode instance 236 */ 237 public DbOpcode getInsertOpcode(); 238 239 240 /*** 241 * Get an instance of a DbOpcode object that represents a Delete operation. 242 * 243 * @return DbOpcode instance 244 */ 245 public DbOpcode getDeleteOpcode(); 246 247 /*** 248 * Get an instance of a DbOpcode object that represents an Update operation. 249 * 250 * @return DbOpcode instance 251 */ 252 public DbOpcode getUpdateOpcode(); 253 254 /*** 255 * Get an instance of a DbOpcode object that represents an Upsert operation. 256 * 257 * @return DbOpcode instance 258 */ 259 public DbOpcode getUpsertOpcode(); 260 261 /*** 262 * Get an instance of a DbOpcode object that represents an Unknown operation. 263 * 264 * @return DbOpcode instance 265 */ 266 public DbOpcode getUnknownOpcode(); 267 268 269 /*** 270 * Get the OpCode object corresponding to an integer opcode. Note 271 * that the integer values here are application specific. Subclasses 272 * are free to use any values they want. 273 * 274 * @param opCode an application specific opcode value as an integer 275 * @return DbOpcode instance 276 */ 277 public DbOpcode getOpcode(int opCode); 278 279 280 281 //////////////////////////////////////////////////////// 282 // Factory Methods for the PubMsg interface // 283 /////////////////////////////////////////////////////// 284 285 286 /*** 287 * Get an instance of a PubMsg object constructed from a Tibrv 288 * message. 289 * 290 * @param rvMsg the rvMsg that is published 291 * @return PubMsg instance 292 */ 293 public DbPubMsg getPubMsg(TibrvMsg rvMsg); 294 295 296 }

This page was automatically generated by Maven