1 /*
   2  * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package javax.sql.rowset;
  27 
  28 import java.sql.*;
  29 import javax.sql.*;
  30 import javax.naming.*;
  31 import java.io.*;
  32 import java.math.*;
  33 import org.xml.sax.*;
  34 
  35 /**
  36  * The standard interface that all implementations of a <code>WebRowSet</code>
  37  * must implement.
  38  * <P>
  39  * <h3>1.0 Overview</h3>
  40  * The <code>WebRowSetImpl</code> provides the standard
  41  * reference implementation, which may be extended if required.
  42  * <P>
  43  * The standard WebRowSet XML Schema definition is available at the following
  44  * URI:
  45  * <ul>
  46  * <pre>
  47  * <a href="http://java.sun.com/xml/ns/jdbc/webrowset.xsd">http://java.sun.com/xml/ns/jdbc/webrowset.xsd</a>
  48  * </pre>
  49  * </ul>
  50  * It describes the standard XML document format required when describing a
  51  * <code>RowSet</code> object in XML and must be used be all standard implementations
  52  * of the <code>WebRowSet</code> interface to ensure interoperability. In addition,
  53  * the <code>WebRowSet</code> schema uses specific SQL/XML Schema annotations,
  54  * thus ensuring greater cross
  55  * platform inter-operability. This is an effort currently under way at the ISO
  56  * organization. The SQL/XML definition is available at the following URI:
  57  * <ul>
  58  * <pre>
  59  * <a href="http://standards.iso.org/iso/9075/2002/12/sqlxml">http://standards.iso.org/iso/9075/2002/12/sqlxml</a>
  60  * </pre>
  61  * </ul>
  62  * The schema definition describes the internal data of a <code>RowSet</code> object
  63  * in three distinct areas:
  64  * <UL>
  65  * <li><b>properties</b></li>
  66  * These properties describe the standard synchronization provider properties in
  67  * addition to the more general <code>RowSet</code> properties.
  68  * <p>
  69  * <li><b>metadata</b></li>
  70  * This describes the metadata associated with the tabular structure governed by a
  71  * <code>WebRowSet</code> object. The metadata described is closely aligned with the
  72  * metadata accessible in the underlying <code>java.sql.ResultSet</code> interface.
  73  * <p>
  74  * <li><b>data</b></li>
  75  * This describes the original data (the state of data since the last population
  76  * or last synchronization of the <code>WebRowSet</code> object) and the current
  77  * data. By keeping track of the delta between the original data and the current data,
  78  * a <code>WebRowSet</code> maintains
  79  * the ability to synchronize changes in its data back to the originating data source.
  80  * </ul>
  81  * <P>
  82  * <h3>2.0 WebRowSet States</h3>
  83  * The following sections demonstrates how a <code>WebRowSet</code> implementation
  84  * should use the XML Schema to describe update, insert, and delete operations
  85  * and to describe the state of a <code>WebRowSet</code> object in XML.
  86  * <p>
  87  * <h4>2.1 State 1 - Outputting a <code>WebRowSet</code> Object to XML</h3>
  88  * In this example, a <code>WebRowSet</code> object is created and populated with a simple 2 column,
  89  * 5 row table from a data source. Having the 5 rows in a <code>WebRowSet</code> object
  90  * makes it possible to describe them in XML. The
  91  * metadata describing the various standard JavaBeans properties as defined
  92  * in the RowSet interface plus the standard properties defined in
  93  * the <code>CachedRowSet</code><sup><font size=-2>TM</font></sup> interface
  94  * provide key details that describe WebRowSet
  95  * properties. Outputting the WebRowSet object to XML using the standard
  96  * <code>writeXml</code> methods describes the internal properties as follows:
  97  * <PRE>
  98  * &lt;<font color=red>properties</font>&gt;
  99  *       &lt;<font color=red>command</font>&gt;select co1, col2 from test_table&lt;<font color=red>/command</font>&gt;
 100  *      &lt;<font color=red>concurrency</font>&gt;1&lt;<font color=red>/concurrency</font>&gt;
 101  *      &lt;<font color=red>datasource/</font>&gt;
 102  *      &lt;<font color=red>escape-processing</font>&gt;true&lt;<font color=red>/escape-processing</font>&gt;
 103  *      &lt;<font color=red>fetch-direction</font>&gt;0&lt;<font color=red>/fetch-direction</font>&gt;
 104  *      &lt;<font color=red>fetch-size</font>&gt;0&lt;<font color=red>/fetch-size</font>&gt;
 105  *      &lt;<font color=red>isolation-level</font>&gt;1&lt;<font color=red>/isolation-level</font>&gt;
 106  *      &lt;<font color=red>key-columns/</font>&gt;
 107  *      &lt;<font color=red>map/</font>&gt;
 108  *      &lt;<font color=red>max-field-size</font>&gt;0&lt;<font color=red>/max-field-size</font>&gt;
 109  *      &lt;<font color=red>max-rows</font>&gt;0&lt;<font color=red>/max-rows</font>&gt;
 110  *      &lt;<font color=red>query-timeout</font>&gt;0&lt;<font color=red>/query-timeout</font>&gt;
 111  *      &lt;<font color=red>read-only</font>&gt;false&lt;<font color=red>/read-only</font>&gt;
 112  *      &lt;<font color=red>rowset-type</font>&gt;TRANSACTION_READ_UNCOMMITED&lt;<font color=red>/rowset-type</font>&gt;
 113  *      &lt;<font color=red>show-deleted</font>&gt;false&lt;<font color=red>/show-deleted</font>&gt;
 114  *      &lt;<font color=red>table-name/</font>&gt;
 115  *      &lt;<font color=red>url</font>&gt;jdbc:thin:oracle&lt;<font color=red>/url</font>&gt;
 116  *      &lt;<font color=red>sync-provider</font>&gt;
 117  *              &lt;<font color=red>sync-provider-name</font>&gt;.com.rowset.provider.RIOptimisticProvider&lt;<font color=red>/sync-provider-name</font>&gt;
 118  *              &lt;<font color=red>sync-provider-vendor</font>&gt;Oracle Corporation&lt;<font color=red>/sync-provider-vendor</font>&gt;
 119  *              &lt;<font color=red>sync-provider-version</font>&gt;1.0&lt;<font color=red>/sync-provider-name</font>&gt;
 120  *              &lt;<font color=red>sync-provider-grade</font>&gt;LOW&lt;<font color=red>/sync-provider-grade</font>&gt;
 121  *              &lt;<font color=red>data-source-lock</font>&gt;NONE&lt;<font color=red>/data-source-lock</font>&gt;
 122  *      &lt;<font color=red>/sync-provider</font>&gt;
 123  * &lt;<font color=red>/properties</font>&gt;
 124  * </PRE>
 125  * The meta-data describing the make up of the WebRowSet is described
 126  * in XML as detailed below. Note both columns are described between the
 127  * <code>column-definition</code> tags.
 128  * <PRE>
 129  * &lt;<font color=red>metadata</font>&gt;
 130  *      &lt;<font color=red>column-count</font>&gt;2&lt;<font color=red>/column-count</font>&gt;
 131  *      &lt;<font color=red>column-definition</font>&gt;
 132  *              &lt;<font color=red>column-index</font>&gt;1&lt;<font color=red>/column-index</font>&gt;
 133  *              &lt;<font color=red>auto-increment</font>&gt;false&lt;<font color=red>/auto-increment</font>&gt;
 134  *              &lt;<font color=red>case-sensitive</font>&gt;true&lt;<font color=red>/case-sensitive</font>&gt;
 135  *              &lt;<font color=red>currency</font>&gt;false&lt;<font color=red>/currency</font>&gt;
 136  *              &lt;<font color=red>nullable</font>&gt;1&lt;<font color=red>/nullable</font>&gt;
 137  *              &lt;<font color=red>signed</font>&gt;false&lt;<font color=red>/signed</font>&gt;
 138  *              &lt;<font color=red>searchable</font>&gt;true&lt;<font color=red>/searchable</font>&gt;
 139  *              &lt;<font color=red>column-display-size</font>&gt;10&lt;<font color=red>/column-display-size</font>&gt;
 140  *              &lt;<font color=red>column-label</font>&gt;COL1&lt;<font color=red>/column-label</font>&gt;
 141  *              &lt;<font color=red>column-name</font>&gt;COL1&lt;<font color=red>/column-name</font>&gt;
 142  *              &lt;<font color=red>schema-name/</font>&gt;
 143  *              &lt;<font color=red>column-precision</font>&gt;10&lt;<font color=red>/column-precision</font>&gt;
 144  *              &lt;<font color=red>column-scale</font>&gt;0&lt;<font color=red>/column-scale</font>&gt;
 145  *              &lt;<font color=red>table-name/</font>&gt;
 146  *              &lt;<font color=red>catalog-name/</font>&gt;
 147  *              &lt;<font color=red>column-type</font>&gt;1&lt;<font color=red>/column-type</font>&gt;
 148  *              &lt;<font color=red>column-type-name</font>&gt;CHAR&lt;<font color=red>/column-type-name</font>&gt;
 149  *      &lt;<font color=red>/column-definition</font>&gt;
 150  *      &lt;<font color=red>column-definition</font>&gt;
 151  *              &lt;<font color=red>column-index</font>&gt;2&lt;<font color=red>/column-index</font>&gt;
 152  *              &lt;<font color=red>auto-increment</font>&gt;false&lt;<font color=red>/auto-increment</font>&gt;
 153  *              &lt;<font color=red>case-sensitive</font>&gt;false&lt;<font color=red>/case-sensitive</font>&gt;
 154  *              &lt;<font color=red>currency</font>&gt;false&lt;<font color=red>/currency</font>&gt;
 155  *              &lt;<font color=red>nullable</font>&gt;1&lt;<font color=red>/nullable</font>&gt;
 156  *              &lt;<font color=red>signed</font>&gt;true&lt;<font color=red>/signed</font>&gt;
 157  *              &lt;<font color=red>searchable</font>&gt;true&lt;<font color=red>/searchable</font>&gt;
 158  *              &lt;<font color=red>column-display-size</font>&gt;39&lt;<font color=red>/column-display-size</font>&gt;
 159  *              &lt;<font color=red>column-label</font>&gt;COL2&lt;<font color=red>/column-label</font>&gt;
 160  *              &lt;<font color=red>column-name</font>&gt;COL2&lt;<font color=red>/column-name</font>&gt;
 161  *              &lt;<font color=red>schema-name/</font>&gt;
 162  *              &lt;<font color=red>column-precision</font>&gt;38&lt;<font color=red>/column-precision</font>&gt;
 163  *              &lt;<font color=red>column-scale</font>&gt;0&lt;<font color=red>/column-scale</font>&gt;
 164  *              &lt;<font color=red>table-name/</font>&gt;
 165  *              &lt;<font color=red>catalog-name/</font>&gt;
 166  *              &lt;<font color=red>column-type</font>&gt;3&lt;<font color=red>/column-type</font>&gt;
 167  *              &lt;<font color=red>column-type-name</font>&gt;NUMBER&lt;<font color=red>/column-type-name</font>&gt;
 168  *      &lt;<font color=red>/column-definition</font>&gt;
 169  * &lt;<font color=red>/metadata</font>&gt;
 170  * </PRE>
 171  * Having detailed how the properties and metadata are described, the following details
 172  * how the contents of a <code>WebRowSet</code> object is described in XML. Note, that
 173  * this describes a <code>WebRowSet</code> object that has not undergone any
 174  * modifications since its instantiation.
 175  * A <code>currentRow</code> tag is mapped to each row of the table structure that the
 176  * <code>WebRowSet</code> object provides. A <code>columnValue</code> tag may contain
 177  * either the <code>stringData</code> or <code>binaryData</code> tag, according to
 178  * the SQL type that
 179  * the XML value is mapping back to. The <code>binaryData</code> tag contains data in the
 180  * Base64 encoding and is typically used for <code>BLOB</code> and <code>CLOB</code> type data.
 181  * <PRE>
 182  * &lt;<font color=red>data</font>&gt;
 183  *      &lt;<font color=red>currentRow</font>&gt;
 184  *              &lt;<font color=red>columnValue</font>&gt;
 185  *                      firstrow
 186  *              &lt;<font color=red>/columnValue</font>&gt;
 187  *              &lt;<font color=red>columnValue</font>&gt;
 188  *                      1
 189  *              &lt;<font color=red>/columnValue</font>&gt;
 190  *      &lt;<font color=red>/currentRow</font>&gt;
 191  *      &lt;<font color=red>currentRow</font>&gt;
 192  *              &lt;<font color=red>columnValue</font>&gt;
 193  *                      secondrow
 194  *              &lt;<font color=red>/columnValue</font>&gt;
 195  *              &lt;<font color=red>columnValue</font>&gt;
 196  *                      2
 197  *              &lt;<font color=red>/columnValue</font>&gt;
 198  *      &lt;<font color=red>/currentRow</font>&gt;
 199  *      &lt;<font color=red>currentRow</font>&gt;
 200  *              &lt;<font color=red>columnValue</font>&gt;
 201  *                      thirdrow
 202  *              &lt;<font color=red>/columnValue</font>&gt;
 203  *              &lt;<font color=red>columnValue</font>&gt;
 204  *                      3
 205  *              &lt;<font color=red>/columnValue</font>&gt;
 206  *      &lt;<font color=red>/currentRow</font>&gt;
 207  *      &lt;<font color=red>currentRow</font>&gt;
 208  *              &lt;<font color=red>columnValue</font>&gt;
 209  *                      fourthrow
 210  *              &lt;<font color=red>/columnValue</font>&gt;
 211  *              &lt;<font color=red>columnValue</font>&gt;
 212  *                      4
 213  *              &lt;<font color=red>/columnValue</font>&gt;
 214  *      &lt;<font color=red>/currentRow</font>&gt;
 215  * &lt;<font color=red>/data</font>&gt;
 216  * </PRE>
 217  * <h4>2.2 State 2 - Deleting a Row</h4>
 218  * Deleting a row in a <code>WebRowSet</code> object involves simply moving to the row
 219  * to be deleted and then calling the method <code>deleteRow</code>, as in any other
 220  * <code>RowSet</code> object.  The following
 221  * two lines of code, in which <i>wrs</i> is a <code>WebRowSet</code> object, delete
 222  * the third row.
 223  * <PRE>
 224  *     wrs.absolute(3);
 225  *     wrs.deleteRow();
 226  * </PRE>
 227  * The XML description shows the third row is marked as a <code>deleteRow</code>,
 228  *  which eliminates the third row in the <code>WebRowSet</code> object.
 229  * <PRE>
 230  * &lt;<font color=red>data</font>&gt;
 231  *      &lt;<font color=red>currentRow</font>&gt;
 232  *              &lt;<font color=red>columnValue</font>&gt;
 233  *                      firstrow
 234  *              &lt;<font color=red>/columnValue</font>&gt;
 235  *              &lt;<font color=red>columnValue</font>&gt;
 236  *                      1
 237  *              &lt;<font color=red>/columnValue</font>&gt;
 238  *      &lt;<font color=red>/currentRow</font>&gt;
 239  *      &lt;<font color=red>currentRow</font>&gt;
 240  *              &lt;<font color=red>columnValue</font>&gt;
 241  *                      secondrow
 242  *              &lt;<font color=red>/columnValue</font>&gt;
 243  *              &lt;<font color=red>columnValue</font>&gt;
 244  *                      2
 245  *              &lt;<font color=red>/columnValue</font>&gt;
 246  *      &lt;<font color=red>/currentRow</font>&gt;
 247  *      &lt;<font color=red>deleteRow</font>&gt;
 248  *              &lt;<font color=red>columnValue</font>&gt;
 249  *                      thirdrow
 250  *              &lt;<font color=red>/columnValue</font>&gt;
 251  *              &lt;<font color=red>columnValue</font>&gt;
 252  *                      3
 253  *              &lt;<font color=red>/columnValue</font>&gt;
 254  *      &lt;<font color=red>/deleteRow</font>&gt;
 255  *      &lt;<font color=red>currentRow</font>&gt;
 256  *              &lt;<font color=red>columnValue</font>&gt;
 257  *                      fourthrow
 258  *              &lt;<font color=red>/columnValue</font>&gt;
 259  *              &lt;<font color=red>columnValue</font>&gt;
 260  *                      4
 261  *              &lt;<font color=red>/columnValue</font>&gt;
 262  *      &lt;<font color=red>/currentRow</font>&gt;
 263  * &lt;<font color=red>/data</font>&gt;
 264  * </PRE>
 265  * <h4>2.3 State 3 - Inserting a Row</h4>
 266  * A <code>WebRowSet</code> object can insert a new row by moving to the insert row,
 267  * calling the appropriate updater methods for each column in the row, and then
 268  * calling the method <code>insertRow</code>.
 269  * <PRE>
 270  * wrs.moveToInsertRow();
 271  * wrs.updateString(1, "fifththrow");
 272  * wrs.updateString(2, "5");
 273  * wrs.insertRow();
 274  * </PRE>
 275  * The following code fragment changes the second column value in the row just inserted.
 276  * Note that this code applies when new rows are inserted right after the current row,
 277  * which is why the method <code>next</code> moves the cursor to the correct row.
 278  * Calling the method <code>acceptChanges</code> writes the change to the data source.
 279  *
 280  * <PRE>
 281  * wrs.moveToCurrentRow();
 282  * wrs.next();
 283  * wrs.updateString(2, "V");
 284  * wrs.acceptChanges();
 285  * :
 286  * </PRE>
 287  * Describing this in XML demonstrates where the Java code inserts a new row and then
 288  * performs an update on the newly inserted row on an individual field.
 289  * <PRE>
 290  * &lt;<font color=red>data</font>&gt;
 291  *      &lt;<font color=red>currentRow</font>&gt;
 292  *              &lt;<font color=red>columnValue</font>&gt;
 293  *                      firstrow
 294  *              &lt;<font color=red>/columnValue</font>&gt;
 295  *              &lt;<font color=red>columnValue</font>&gt;
 296  *                      1
 297  *              &lt;<font color=red>/columnValue</font>&gt;
 298  *      &lt;<font color=red>/currentRow</font>&gt;
 299  *      &lt;<font color=red>currentRow</font>&gt;
 300  *              &lt;<font color=red>columnValue</font>&gt;
 301  *                      secondrow
 302  *              &lt;<font color=red>/columnValue</font>&gt;
 303  *              &lt;<font color=red>columnValue</font>&gt;
 304  *                      2
 305  *              &lt;<font color=red>/columnValue</font>&gt;
 306  *      &lt;<font color=red>/currentRow</font>&gt;
 307  *      &lt;<font color=red>currentRow</font>&gt;
 308  *              &lt;<font color=red>columnValue</font>&gt;
 309  *                      newthirdrow
 310  *              &lt;<font color=red>/columnValue</font>&gt;
 311  *              &lt;<font color=red>columnValue</font>&gt;
 312  *                      III
 313  *              &lt;<font color=red>/columnValue</font>&gt;
 314  *      &lt;<font color=red>/currentRow</font>&gt;
 315  *      &lt;<font color=red>insertRow</font>&gt;
 316  *              &lt;<font color=red>columnValue</font>&gt;
 317  *                      fifthrow
 318  *              &lt;<font color=red>/columnValue</font>&gt;
 319  *              &lt;<font color=red>columnValue</font>&gt;
 320  *                      5
 321  *              &lt;<font color=red>/columnValue</font>&gt;
 322  *              &lt;<font color=red>updateValue</font>&gt;
 323  *                      V
 324  *              &lt;<font color=red>/updateValue</font>&gt;
 325  *      &lt;<font color=red>/insertRow</font>&gt;
 326  *      &lt;<font color=red>currentRow</font>&gt;
 327  *              &lt;<font color=red>columnValue</font>&gt;
 328  *                      fourthrow
 329  *              &lt;<font color=red>/columnValue</font>&gt;
 330  *              &lt;<font color=red>columnValue</font>&gt;
 331  *                      4
 332  *              &lt;<font color=red>/columnValue</font>&gt;
 333  *      &lt;<font color=red>/currentRow</font>&gt;
 334  * &lt;<font color=red>/date</font>&gt;
 335  * </PRE>
 336  * <h4>2.4 State 4 - Modifying a Row</h4>
 337  * Modifying a row produces specific XML that records both the new value and the
 338  * value that was replaced.  The value that was replaced becomes the original value,
 339  * and the new value becomes the current value. The following
 340  * code moves the cursor to a specific row, performs some modifications, and updates
 341  * the row when complete.
 342  * <PRE>
 343  * wrs.absolute(5);
 344  * wrs.updateString(1, "new4thRow");
 345  * wrs.updateString(2, "IV");
 346  * wrs.updateRow();
 347  * </PRE>
 348  * In XML, this is described by the <code>modifyRow</code> tag. Both the original and new
 349  * values are contained within the tag for original row tracking purposes.
 350  * <PRE>
 351  * &lt;<font color=red>data</font>&gt;
 352  *      &lt;<font color=red>currentRow</font>&gt;
 353  *              &lt;<font color=red>columnValue</font>&gt;
 354  *                      firstrow
 355  *              &lt;<font color=red>/columnValue</font>&gt;
 356  *              &lt;<font color=red>columnValue</font>&gt;
 357  *                      1
 358  *              &lt;<font color=red>/columnValue</font>&gt;
 359  *      &lt;<font color=red>/currentRow</font>&gt;
 360  *      &lt;<font color=red>currentRow</font>&gt;
 361  *              &lt;<font color=red>columnValue</font>&gt;
 362  *                      secondrow
 363  *              &lt;<font color=red>/columnValue</font>&gt;
 364  *              &lt;<font color=red>columnValue</font>&gt;
 365  *                      2
 366  *              &lt;<font color=red>/columnValue</font>&gt;
 367  *      &lt;<font color=red>/currentRow</font>&gt;
 368  *      &lt;<font color=red>currentRow</font>&gt;
 369  *              &lt;<font color=red>columnValue</font>&gt;
 370  *                      newthirdrow
 371  *              &lt;<font color=red>/columnValue</font>&gt;
 372  *              &lt;<font color=red>columnValue</font>&gt;
 373  *                      III
 374  *              &lt;<font color=red>/columnValue</font>&gt;
 375  *      &lt;<font color=red>/currentRow</font>&gt;
 376  *      &lt;<font color=red>currentRow</font>&gt;
 377  *              &lt;<font color=red>columnValue</font>&gt;
 378  *                      fifthrow
 379  *              &lt;<font color=red>/columnValue</font>&gt;
 380  *              &lt;<font color=red>columnValue</font>&gt;
 381  *                      5
 382  *              &lt;<font color=red>/columnValue</font>&gt;
 383  *      &lt;<font color=red>/currentRow</font>&gt;
 384  *      &lt;<font color=red>modifyRow</font>&gt;
 385  *              &lt;<font color=red>columnValue</font>&gt;
 386  *                      fourthrow
 387  *              &lt;<font color=red>/columnValue</font>&gt;
 388  *              &lt;<font color=red>updateValue</font>&gt;
 389  *                      new4thRow
 390  *              &lt;<font color=red>/updateValue</font>&gt;
 391  *              &lt;<font color=red>columnValue</font>&gt;
 392  *                      4
 393  *              &lt;<font color=red>/columnValue</font>&gt;
 394  *              &lt;<font color=red>updateValue</font>&gt;
 395  *                      IV
 396  *              &lt;<font color=red>/updateValue</font>&gt;
 397  *      &lt;<font color=red>/modifyRow</font>&gt;
 398  * &lt;<font color=red>/data</font>&gt;
 399  * </PRE>
 400  *
 401  * @see javax.sql.rowset.JdbcRowSet
 402  * @see javax.sql.rowset.CachedRowSet
 403  * @see javax.sql.rowset.FilteredRowSet
 404  * @see javax.sql.rowset.JoinRowSet
 405  */
 406 
 407 public interface WebRowSet extends CachedRowSet {
 408 
 409    /**
 410     * Reads a <code>WebRowSet</code> object in its XML format from the given
 411     * <code>Reader</code> object.
 412     *
 413     * @param reader the <code>java.io.Reader</code> stream from which this
 414     *        <code>WebRowSet</code> object will be populated
 415 
 416     * @throws SQLException if a database access error occurs
 417     */
 418     public void readXml(java.io.Reader reader) throws SQLException;
 419 
 420     /**
 421      * Reads a stream based XML input to populate this <code>WebRowSet</code>
 422      * object.
 423      *
 424      * @param iStream the <code>java.io.InputStream</code> from which this
 425      *        <code>WebRowSet</code> object will be populated
 426      * @throws SQLException if a data source access error occurs
 427      * @throws IOException if an IO exception occurs
 428      */
 429     public void readXml(java.io.InputStream iStream) throws SQLException, IOException;
 430 
 431    /**
 432     * Populates this <code>WebRowSet</code> object with
 433     * the contents of the given <code>ResultSet</code> object and writes its
 434     * data, properties, and metadata
 435     * to the given <code>Writer</code> object in XML format.
 436     * <p>
 437     * NOTE: The <code>WebRowSet</code> cursor may be moved to write out the
 438     * contents to the XML data source. If implemented in this way, the cursor <b>must</b>
 439     * be returned to its position just prior to the <code>writeXml()</code> call.
 440     *
 441     * @param rs the <code>ResultSet</code> object with which to populate this
 442     *        <code>WebRowSet</code> object
 443     * @param writer the <code>java.io.Writer</code> object to write to.
 444     * @throws SQLException if an error occurs writing out the rowset
 445     *          contents in XML format
 446     */
 447     public void writeXml(ResultSet rs, java.io.Writer writer) throws SQLException;
 448 
 449    /**
 450     * Populates this <code>WebRowSet</code> object with
 451     * the contents of the given <code>ResultSet</code> object and writes its
 452     * data, properties, and metadata
 453     * to the given <code>OutputStream</code> object in XML format.
 454     * <p>
 455     * NOTE: The <code>WebRowSet</code> cursor may be moved to write out the
 456     * contents to the XML data source. If implemented in this way, the cursor <b>must</b>
 457     * be returned to its position just prior to the <code>writeXml()</code> call.
 458     *
 459     * @param rs the <code>ResultSet</code> object with which to populate this
 460     *        <code>WebRowSet</code> object
 461     * @param oStream the <code>java.io.OutputStream</code> to write to
 462     * @throws SQLException if a data source access error occurs
 463     * @throws IOException if a IO exception occurs
 464     */
 465     public void writeXml(ResultSet rs, java.io.OutputStream oStream) throws SQLException, IOException;
 466 
 467    /**
 468     * Writes the data, properties, and metadata for this <code>WebRowSet</code> object
 469     * to the given <code>Writer</code> object in XML format.
 470     *
 471     * @param writer the <code>java.io.Writer</code> stream to write to
 472     * @throws SQLException if an error occurs writing out the rowset
 473     *          contents to XML
 474     */
 475     public void writeXml(java.io.Writer writer) throws SQLException;
 476 
 477     /**
 478      * Writes the data, properties, and metadata for this <code>WebRowSet</code> object
 479      * to the given <code>OutputStream</code> object in XML format.
 480      *
 481      * @param oStream the <code>java.io.OutputStream</code> stream to write to
 482      * @throws SQLException if a data source access error occurs
 483      * @throws IOException if a IO exception occurs
 484      */
 485     public void writeXml(java.io.OutputStream oStream) throws SQLException, IOException;
 486 
 487     /**
 488      * The public identifier for the XML Schema definition that defines the XML
 489      * tags and their valid values for a <code>WebRowSet</code> implementation.
 490      */
 491     public static String PUBLIC_XML_SCHEMA =
 492         "--//Oracle Corporation//XSD Schema//EN";
 493 
 494     /**
 495      * The URL for the XML Schema definition file that defines the XML tags and
 496      * their valid values for a <code>WebRowSet</code> implementation.
 497      */
 498     public static String SCHEMA_SYSTEM_ID = "http://java.sun.com/xml/ns/jdbc/webrowset.xsd";
 499 }