src/java.sql.rowset/share/classes/javax/sql/rowset/package-info.java
changeset 50444 db65921e9a9b
parent 47216 71c04702a3d5
child 54057 687e10fefa11
equal deleted inserted replaced
50443:8e56de95ce10 50444:db65921e9a9b
       
     1 /*
       
     2  * Copyright (c)  2017, 2018, 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 /**
       
    27  * Standard interfaces and base classes for JDBC <code>RowSet</code>
       
    28  * implementations. This package contains interfaces and classes
       
    29  * that a standard <code>RowSet</code> implementation either implements or extends.
       
    30  *
       
    31  * <h2>Table of Contents</h2>
       
    32  * <ul>
       
    33  * <li><a href="#pkgspec">1.0 Package Specification</a>
       
    34  * <li><a href="#stdrowset">2.0 Standard RowSet Definitions</a>
       
    35  * <li><a href="#impl">3.0 Implementer's Guide</a>
       
    36  * <li><a href="#relspec">4.0 Related Specifications</a>
       
    37  * <li><a href="#reldocs">5.0 Related Documentation</a>
       
    38  * </ul>
       
    39  *
       
    40  * <h3><a id="pkgspec">1.0 Package Specification</a></h3>
       
    41  * This package specifies five standard JDBC <code>RowSet</code> interfaces.
       
    42  * All five extend the
       
    43  * <a href="{@docRoot}/java.sql/javax/sql/RowSet.html">RowSet</a> interface described in the JDBC 3.0
       
    44  * specification.  It is anticipated that additional definitions
       
    45  * of more specialized JDBC <code>RowSet</code> types will emerge as this technology
       
    46  * matures. Future definitions <i>should</i> be specified as subinterfaces using
       
    47  * inheritance similar to the way it is used in this specification.
       
    48  * <p>
       
    49  * <i>Note:</i> The interface definitions provided in this package form the basis for
       
    50  * all compliant JDBC <code>RowSet</code> implementations. Vendors and more advanced
       
    51  * developers who intend to provide their own compliant <code>RowSet</code> implementations
       
    52  * should pay particular attention to the assertions detailed in specification
       
    53  * interfaces.
       
    54  *
       
    55  * <h3><a id="stdrowset">2.0 Standard RowSet Definitions</a></h3>
       
    56  * <ul>
       
    57  * <li><a href="JdbcRowSet.html"><b><code>JdbcRowSet</code></b></a> - A wrapper around
       
    58  * a <code>ResultSet</code> object that makes it possible to use the result set as a
       
    59  * JavaBeans&trade; component. Thus,
       
    60  * a <code>JdbcRowSet</code> object can be a Bean that any tool
       
    61  * makes available for assembling an application as part of a component based
       
    62  * architecture. A <code>JdbcRowSet</code> object is a connected <code>RowSet</code>
       
    63  * object, that is, it
       
    64  * <b>must</b> continually maintain its connection to its data source using a JDBC
       
    65  * technology-enabled driver ("JDBC driver"). In addition, a <code>JdbcRowSet</code>
       
    66  * object provides a fully updatable and scrollable tabular
       
    67  * data structure as defined in the JDBC 3.0 specification.
       
    68  *
       
    69  * <li><a href="CachedRowSet.html">
       
    70  * <b><code>CachedRowSet</code>&trade;</b></a>
       
    71  *  - A <code>CachedRowSet</code> object is a JavaBeans&trade;
       
    72  * component that is scrollable, updatable, serializable, and generally disconnected from
       
    73  * the source of its data. A <code>CachedRowSet</code> object
       
    74  * typically contains rows from a result set, but it can also contain rows from any
       
    75  * file with a tabular format, such as a spreadsheet. <code>CachedRowSet</code> implementations
       
    76  * <b>must</b> use the <code>SyncFactory</code> to manage and obtain pluggable
       
    77  * <code>SyncProvider</code> objects to provide synchronization between the
       
    78  * disconnected <code>RowSet</code> object and the originating data source.
       
    79  * Typically a <code>SyncProvider</code> implementation relies upon a JDBC
       
    80  * driver to obtain connectivity to a particular data source.
       
    81  * Further details on this mechanism are discussed in the <a
       
    82  * href="spi/package-summary.html"><code>javax.sql.rowset.spi</code></a> package
       
    83  * specification.
       
    84  *
       
    85  * <li><a href="WebRowSet.html"><b><code>WebRowSet</code></b></a> - A
       
    86  * <code>WebRowSet</code> object is an extension of <code>CachedRowSet</code>
       
    87  * that can read and write a <code>RowSet</code> object in a well formed XML format.
       
    88  * This class calls an <a href="spi/XmlReader.html"><code>XmlReader</code></a> object
       
    89  * (an extension of the <a href="{@docRoot}/java.sql/javax/sql/RowSetReader.html"><code>RowSetReader</code></a>
       
    90  * interface) to read a rowset in XML format. It calls an
       
    91  * <a href="spi/XmlWriter.html"><code>XmlWriter</code></a> object (an extension of the
       
    92  * <a href="{@docRoot}/java.sql/javax/sql/RowSetWriter.html"><code>RowSetWriter</code></a> interface)
       
    93  * to write a rowset in XML format. The reader and writer required by
       
    94  * <code>WebRowSet</code> objects are provided by the
       
    95  * <code>SyncFactory</code> in the form of <code>SyncProvider</code>
       
    96  * implementations. In order to ensure well formed XML usage, a standard generic XML
       
    97  * Schema is defined and published at
       
    98  * <a href="http://java.sun.com/xml/ns/jdbc/webrowset.xsd">
       
    99  * <code>http://java.sun.com/xml/ns/jdbc/webrowset.xsd</code></a>.
       
   100  *
       
   101  * <li><a href="FilteredRowSet.html"><b><code>FilteredRowSet</code></b></a> - A
       
   102  * <code>FilteredRowSet</code> object provides filtering functionality in a programmatic
       
   103  * and extensible way. There are many instances when a <code>RowSet</code> <code>object</code>
       
   104  * has a need to provide filtering in its contents without sacrificing the disconnected
       
   105  * environment, thus saving the expense of having to create a connection to the data source.
       
   106  * Solutions to this need vary from providing heavyweight full scale
       
   107  * SQL query abilities, to portable components, to more lightweight
       
   108  * approaches. A <code>FilteredRowSet</code> object consumes
       
   109  * an implementation of the <a href="Predicate.html"><code>Predicate</code></a>
       
   110  * interface, which <b>may</b> define a filter at run time. In turn, a
       
   111  * <code>FilteredRowSet</code> object is tasked with enforcing the set filter for both
       
   112  * inbound and outbound read and write operations. That is, all filters can be
       
   113  * considered as bi-directional. No standard filters are defined;
       
   114  * however, sufficient mechanics are specified to permit any required filter to be
       
   115  * implemented.
       
   116  *
       
   117  * <li><a href="JoinRowSet.html"><b><code>JoinRowSet</code></b></a> - The <code>JoinRowSet</code>
       
   118  * interface  describes a mechanism by which relationships can be established between
       
   119  * two or more standard <code>RowSet</code> implementations. Any number of <code>RowSet</code>
       
   120  * objects can be added to a <code>JoinRowSet</code> object provided  the <code>RowSet</code>objects
       
   121  * can be related  in a SQL <code>JOIN</code> like fashion. By definition, the SQL <code>JOIN</code>
       
   122  * statement  is used to combine the data contained in two (<i>or more</i>) relational
       
   123  * database tables based upon a common attribute. By establishing and then enforcing
       
   124  * column matches, a <code>JoinRowSet</code> object establishes relationships between
       
   125  * <code>RowSet</code> instances without the need to touch the originating data source.
       
   126  * </ul>
       
   127  *
       
   128  * <h3><a id="impl">3.0 Implementer's Guide</a></h3>
       
   129  * Compliant implementations of JDBC <code>RowSet</code> Implementations
       
   130  * <b>must</b> follow the assertions described in this specification. In accordance
       
   131  * with the terms of the <a href="http://www.jcp.org">Java Community Process</a>, a
       
   132  * Test Compatibility Kit (TCK) can be licensed to ensure compatibility with the
       
   133  * specification. The following paragraphs outline a number of starting points for
       
   134  * implementers of the standard JDBC <code>RowSet</code> definitions. Implementers
       
   135  * should also consult the <i>Implementer's Guide</i> in the <a
       
   136  * href="spi/package-summary.html">javax.sql.rowset.spi</a> package for guidelines
       
   137  * on <a href="spi/SyncProvider.html"><code>SyncProvider</code></a> implementations.
       
   138  *
       
   139  * <ul>
       
   140  * <li><b>3.1 Constructor</b>
       
   141  * <p>
       
   142  *   All <code>RowSet</code> implementations <strong>must</strong> provide a
       
   143  * no-argument constructor.
       
   144  * </li>
       
   145  * <li><b>3.2 Role of the <code>BaseRowSet</code> Class</b>
       
   146  * <p>
       
   147  * A compliant JDBC <code>RowSet</code> implementation <b>must</b> implement one or more
       
   148  * standard interfaces specified in this package and <b>may</b> extend the
       
   149  * <a href="BaseRowSet.html"><code>BaseRowSet</code></a> abstract class. For example, a
       
   150  * <code>CachedRowSet</code> implementation must implement the <code>CachedRowSet</code>
       
   151  * interface and extend the <code>BaseRowSet</code> abstract class. The
       
   152  * <code>BaseRowSet</code> class provides the standard architecture on which all
       
   153  * <code>RowSet</code> implementations should be built, regardless of whether the
       
   154  * <code>RowSet</code> objects exist in a connected or disconnected environment.
       
   155  * The <code>BaseRowSet</code> abstract class provides any <code>RowSet</code> implementation
       
   156  * with its base functionality, including property manipulation and event notification
       
   157  * that is fully compliant with <a href="http://java.sun.com/products/javabeans">JavaBeans</a>
       
   158  * component requirements. As an example, all implementations provided in the
       
   159  * reference implementations (contained in the <code>com.sun.rowset</code> package) use
       
   160  * the <code>BaseRowSet</code> class as a basis for their implementations.
       
   161  * <P>
       
   162  * The following table illustrates the features that the <code>BaseRowSet</code>
       
   163  * abstract class provides.
       
   164  * <blockquote>
       
   165  *   <table class="striped" style="vertical-align:top; width:75%">
       
   166  *     <caption>Features in <code>BaseRowSet</code></caption>
       
   167  *         <thead>
       
   168  *           <tr>
       
   169  *             <th scope="col">Feature</th>
       
   170  *             <th scope="col">Details</th>
       
   171  *           </tr>
       
   172  *         </thead>
       
   173  *         <tbody>
       
   174  *           <tr>
       
   175  *             <th scope="row">Properties</th>
       
   176  *             <td>Provides standard JavaBeans property manipulation
       
   177  * mechanisms to allow applications to get and set <code>RowSet</code> command and
       
   178  * property  values. Refer to the   documentation of the <code>javax.sql.RowSet</code>
       
   179  * interface  (available in the JDBC 3.0 specification) for more details on
       
   180  * the standard  <code>RowSet</code> properties.</td>
       
   181  *           </tr>
       
   182  *           <tr>
       
   183  *             <th scope="row">Event notification</th>
       
   184  *             <td>Provides standard JavaBeans event notifications
       
   185  * to registered event listeners. Refer to the documentation of <code>javax.sql.RowSetEvent</code>
       
   186  * interface (available in the JDBC 3.0 specification) for
       
   187  * more details on how  to register and handle standard RowSet events generated
       
   188  * by  compliant implementations.</td>
       
   189  *           </tr>
       
   190  *           <tr>
       
   191  *             <th scope="row">Setters for a RowSet object's command</th>
       
   192  *             <td>Provides a complete set of setter methods
       
   193  *                for setting RowSet command parameters.</td>
       
   194  *           </tr>
       
   195  *           <tr>
       
   196  *             <th scope="row">Streams</th>
       
   197  *             <td>Provides fields for storing of stream instances
       
   198  * in addition to providing a set of constants for stream type designation.</td>
       
   199  *           </tr>
       
   200  *     </tbody>
       
   201  *   </table>
       
   202  *   </blockquote>
       
   203  *
       
   204  * <li><b>3.3 Connected RowSet Requirements</b>
       
   205  * <p>
       
   206  * The <code>JdbcRowSet</code> describes a <code>RowSet</code> object that <b>must</b> always
       
   207  * be connected to the originating data source. Implementations of the <code>JdbcRowSet</code>
       
   208  * should ensure that this connection is provided solely by a JDBC driver.
       
   209  * Furthermore, <code>RowSet</code> objects that are implementations of the
       
   210  * <code>JdbcRowSet</code> interface and are therefore operating in a connected environment
       
   211  * do not use the <code>SyncFactory</code> to obtain a <code>RowSetReader</code> object
       
   212  * or a <code>RowSetWriter</code> object. They can safely rely on the JDBC driver to
       
   213  * supply their needs by virtue of the presence of an underlying updatable and scrollable
       
   214  * <code>ResultSet</code> implementation.
       
   215  *
       
   216  * <li>
       
   217  * <b>3.4 Disconnected RowSet Requirements</b>
       
   218  * <p>
       
   219  * A disconnected <code>RowSet</code> object, such as a <code>CachedRowSet</code> object,
       
   220  * <b>should</b> delegate
       
   221  * connection management to a <code>SyncProvider</code> object provided by the
       
   222  * <code>SyncFactory</code>. To ensure fully disconnected semantics, all
       
   223  * disconnected <code>RowSet</code> objects <b>must</b> ensure
       
   224  * that the original connection made to the data source to populate the <code>RowSet</code>
       
   225  * object is closed to permit the garbage collector to recover and release resources. The
       
   226  * <code>SyncProvider</code> object ensures that the critical JDBC properties are
       
   227  * maintained in order to re-establish a connection to the data source when a
       
   228  * synchronization is required. A disconnected <code>RowSet</code> object should
       
   229  * therefore ensure that no
       
   230  * extraneous references remain on the <code>Connection</code> object.
       
   231  *
       
   232  * <li><b>3.5 Role of RowSetMetaDataImpl</b>
       
   233  * <p>
       
   234  * The <code>RowsetMetaDataImpl</code> class is a utility class that provides an implementation of the
       
   235  * <a href="{@docRoot}/java.sql/javax/sql/RowSetMetaData.html">RowSetMetaData</a> interface, supplying standard setter
       
   236  * method implementations for metadata for both connected and disconnected
       
   237  * <code>RowSet</code> objects. All implementations are free to use this standard
       
   238  * implementation but are not required to do so.
       
   239  *
       
   240  * <li><b>3.6 RowSetWarning Class</b>
       
   241  * <p>
       
   242  * The <code>RowSetWarning</code> class provides warnings that can be set
       
   243  * on <code>RowSet</code> implementations.
       
   244  * Similar to <a href="{@docRoot}/java.sql/java/sql/SQLWarning.html">SQLWarning</a> objects,
       
   245  * <code>RowSetWarning</code>  objects are silently chained to the object whose method
       
   246  * caused the warning to be thrown. All <code>RowSet</code> implementations <b>should</b>
       
   247  * ensure that this chaining occurs if a warning is generated and also ensure that the
       
   248  * warnings are available via the <code>getRowSetWarnings</code> method defined in either
       
   249  * the <code>JdbcRowSet</code> interface or the <code>CachedRowSet</code> interface.
       
   250  * After a warning has been retrieved with one of the
       
   251  * <code>getRowSetWarnings</code> methods, the <code>RowSetWarning</code> method
       
   252  * <code>getNextWarning</code> can be called on it to retrieve any warnings that might
       
   253  * be chained on it.  If a warning is returned, <code>getNextWarning</code> can be called
       
   254  * on it, and so on until there are no more warnings.
       
   255  *
       
   256  * <li><b>3.7 The Joinable Interface</b>
       
   257  * <P>
       
   258  * The <code>Joinable</code> interface provides both connected and disconnected
       
   259  * <code>RowSet</code> objects with the capability to be added to a
       
   260  * <code>JoinRowSet</code> object in an SQL <code>JOIN</code> operation.
       
   261  * A <code>RowSet</code> object that has  implemented the <code>Joinable</code>
       
   262  * interface can set a match column, retrieve a match column, or unset a match column.
       
   263  * A <code>JoinRowSet</code> object can then use the <code>RowSet</code> object's
       
   264  * match column as a basis for adding the <code>RowSet</code> object.
       
   265  * </li>
       
   266  *
       
   267  * <li><b>3.8 The RowSetFactory Interface</b>
       
   268  *   <p>
       
   269  *       A <code>RowSetFactory</code> implementation <strong>must</strong>
       
   270  *       be provided.
       
   271  * </li>
       
   272  * </ul>
       
   273  *
       
   274  * <h3><a id="relspec">4.0 Related Specifications</a></h3>
       
   275  * <ul>
       
   276  * <li><a href="https://jcp.org/en/jsr/detail?id=221">JDBC 4.3 Specification</a>
       
   277  * <li><a href="http://www.w3.org/XML/Schema">XML Schema</a>
       
   278  * </ul>
       
   279  *
       
   280  * <h3><a id="reldocs">5.0 Related Documentation</a></h3>
       
   281  * <ul>
       
   282  * <li><a href="http://docs.oracle.com/javase/tutorial/jdbc/basics/rowset.html">
       
   283  * JDBC RowSet Tutorial</a>
       
   284  *</ul>
       
   285  */
       
   286 package javax.sql.rowset;