151b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski/* 251b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved. 351b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 451b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * 551b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * This code is free software; you can redistribute it and/or modify it 651b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * under the terms of the GNU General Public License version 2 only, as 751b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * published by the Free Software Foundation. Oracle designates this 851b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * particular file as subject to the "Classpath" exception as provided 951b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * by Oracle in the LICENSE file that accompanied this code. 1051b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * 1151b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * This code is distributed in the hope that it will be useful, but WITHOUT 1251b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1351b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1451b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * version 2 for more details (a copy is included in the LICENSE file that 1551b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * accompanied this code). 1651b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * 1751b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * You should have received a copy of the GNU General Public License version 1851b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * 2 along with this work; if not, write to the Free Software Foundation, 1951b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2051b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * 2151b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2251b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * or visit www.oracle.com if you need additional information or have any 2351b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * questions. 2451b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski */ 2551b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski 2651b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebskipackage javax.sql; 2751b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski 2851b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebskiimport java.sql.*; 2951b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski 3051b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski/** 3151b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * The facility that a disconnected <code>RowSet</code> object calls on 3251b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * to populate itself with rows of data. A reader (an object implementing the 3351b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * <code>RowSetReader</code> interface) may be registered with 3451b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * a <code>RowSet</code> object that supports the reader/writer paradigm. 3551b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * When the <code>RowSet</code> object's <code>execute</code> method is 3651b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * called, it in turn calls the reader's <code>readData</code> method. 3751b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * 3851b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * @since 1.4 3951b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski */ 4051b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski 4151b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebskipublic interface RowSetReader { 4251b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski 4351b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski /** 4451b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * Reads the new contents of the calling <code>RowSet</code> object. 4551b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * In order to call this method, a <code>RowSet</code> 4651b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * object must have implemented the <code>RowSetInternal</code> interface 4751b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * and registered this <code>RowSetReader</code> object as its reader. 4851b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * The <code>readData</code> method is invoked internally 4951b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * by the <code>RowSet.execute</code> method for rowsets that support the 5051b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * reader/writer paradigm. 5151b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * 5251b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * <P>The <code>readData</code> method adds rows to the caller. 5351b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * It can be implemented in a wide variety of ways and can even 5451b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * populate the caller with rows from a nonrelational data source. 5551b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * In general, a reader may invoke any of the rowset's methods, 5651b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * with one exception. Calling the method <code>execute</code> will 5751b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * cause an <code>SQLException</code> to be thrown 5851b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * because <code>execute</code> may not be called recursively. Also, 5951b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * when a reader invokes <code>RowSet</code> methods, no listeners 6051b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * are notified; that is, no <code>RowSetEvent</code> objects are 6151b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * generated and no <code>RowSetListener</code> methods are invoked. 6251b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * This is true because listeners are already being notified by the method 6351b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * <code>execute</code>. 6451b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * 6551b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * @param caller the <code>RowSet</code> object (1) that has implemented the 6651b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * <code>RowSetInternal</code> interface, (2) with which this reader is 6751b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * registered, and (3) whose <code>execute</code> method called this reader 6851b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * @exception SQLException if a database access error occurs or this method 6951b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski * invokes the <code>RowSet.execute</code> method 7051b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski */ 7151b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski void readData(RowSetInternal caller) throws SQLException; 7251b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski 7351b1b6997fd3f980076b8081f7f1165ccc2a4008Piotr Jastrzebski} 74