Path: blob/master/src/java.sql.rowset/share/classes/javax/sql/rowset/package-info.java
40948 views
/*1* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425/**26* Standard interfaces and base classes for JDBC {@code RowSet}27* implementations. This package contains interfaces and classes28* that a standard {@code RowSet} implementation either implements or extends.29*30* <h2>Table of Contents</h2>31* <ul>32* <li><a href="#pkgspec">1.0 Package Specification</a>33* <li><a href="#stdrowset">2.0 Standard RowSet Definitions</a>34* <li><a href="#impl">3.0 Implementer's Guide</a>35* <li><a href="#relspec">4.0 Related Specifications</a>36* <li><a href="#reldocs">5.0 Related Documentation</a>37* </ul>38*39* <h3><a id="pkgspec">1.0 Package Specification</a></h3>40* This package specifies five standard JDBC {@code RowSet} interfaces.41* All five extend the42* <a href="{@docRoot}/java.sql/javax/sql/RowSet.html">RowSet</a> interface described in the JDBC 3.043* specification. It is anticipated that additional definitions44* of more specialized JDBC {@code RowSet} types will emerge as this technology45* matures. Future definitions <i>should</i> be specified as subinterfaces using46* inheritance similar to the way it is used in this specification.47* <p>48* <i>Note:</i> The interface definitions provided in this package form the basis for49* all compliant JDBC {@code RowSet} implementations. Vendors and more advanced50* developers who intend to provide their own compliant {@code RowSet} implementations51* should pay particular attention to the assertions detailed in specification52* interfaces.53*54* <h3><a id="stdrowset">2.0 Standard RowSet Definitions</a></h3>55* <ul>56* <li><a href="JdbcRowSet.html"><b>{@code JdbcRowSet}</b></a> - A wrapper around57* a {@code ResultSet} object that makes it possible to use the result set as a58* JavaBeans component. Thus,59* a {@code JdbcRowSet} object can be a Bean that any tool60* makes available for assembling an application as part of a component based61* architecture. A {@code JdbcRowSet} object is a connected {@code RowSet}62* object, that is, it63* <b>must</b> continually maintain its connection to its data source using a JDBC64* technology-enabled driver ("JDBC driver"). In addition, a {@code JdbcRowSet}65* object provides a fully updatable and scrollable tabular66* data structure as defined in the JDBC 3.0 specification.67*68* <li><a href="CachedRowSet.html">69* <b>{@code CachedRowSet}</b></a>70* - A {@code CachedRowSet} object is a JavaBeans71* component that is scrollable, updatable, serializable, and generally disconnected from72* the source of its data. A {@code CachedRowSet} object73* typically contains rows from a result set, but it can also contain rows from any74* file with a tabular format, such as a spreadsheet. {@code CachedRowSet} implementations75* <b>must</b> use the {@code SyncFactory} to manage and obtain pluggable76* {@code SyncProvider} objects to provide synchronization between the77* disconnected {@code RowSet} object and the originating data source.78* Typically a {@code SyncProvider} implementation relies upon a JDBC79* driver to obtain connectivity to a particular data source.80* Further details on this mechanism are discussed in the <a81* href="spi/package-summary.html">{@code javax.sql.rowset.spi}</a> package82* specification.83*84* <li><a href="WebRowSet.html"><b>{@code WebRowSet}</b></a> - A85* {@code WebRowSet} object is an extension of {@code CachedRowSet}86* that can read and write a {@code RowSet} object in a well formed XML format.87* This class calls an <a href="spi/XmlReader.html">{@code XmlReader}</a> object88* (an extension of the <a href="{@docRoot}/java.sql/javax/sql/RowSetReader.html">{@code RowSetReader}</a>89* interface) to read a rowset in XML format. It calls an90* <a href="spi/XmlWriter.html">{@code XmlWriter}</a> object (an extension of the91* <a href="{@docRoot}/java.sql/javax/sql/RowSetWriter.html">{@code RowSetWriter}</a> interface)92* to write a rowset in XML format. The reader and writer required by93* {@code WebRowSet} objects are provided by the94* {@code SyncFactory} in the form of {@code SyncProvider}95* implementations. In order to ensure well formed XML usage, a standard generic XML96* Schema is defined and published at97* <a href="http://xmlns.jcp.org/xml/ns//jdbc/webrowset.xsd">98* {@code http://xmlns.jcp.org/xml/ns//jdbc/webrowset.xsd}</a>.99*100* <li><a href="FilteredRowSet.html"><b>{@code FilteredRowSet}</b></a> - A101* {@code FilteredRowSet} object provides filtering functionality in a programmatic102* and extensible way. There are many instances when a {@code RowSet} {@code object}103* has a need to provide filtering in its contents without sacrificing the disconnected104* environment, thus saving the expense of having to create a connection to the data source.105* Solutions to this need vary from providing heavyweight full scale106* SQL query abilities, to portable components, to more lightweight107* approaches. A {@code FilteredRowSet} object consumes108* an implementation of the <a href="Predicate.html">{@code Predicate}</a>109* interface, which <b>may</b> define a filter at run time. In turn, a110* {@code FilteredRowSet} object is tasked with enforcing the set filter for both111* inbound and outbound read and write operations. That is, all filters can be112* considered as bi-directional. No standard filters are defined;113* however, sufficient mechanics are specified to permit any required filter to be114* implemented.115*116* <li><a href="JoinRowSet.html"><b>{@code JoinRowSet}</b></a> - The {@code JoinRowSet}117* interface describes a mechanism by which relationships can be established between118* two or more standard {@code RowSet} implementations. Any number of {@code RowSet}119* objects can be added to a {@code JoinRowSet} object provided the {@code RowSet}objects120* can be related in a SQL {@code JOIN} like fashion. By definition, the SQL {@code JOIN}121* statement is used to combine the data contained in two (<i>or more</i>) relational122* database tables based upon a common attribute. By establishing and then enforcing123* column matches, a {@code JoinRowSet} object establishes relationships between124* {@code RowSet} instances without the need to touch the originating data source.125* </ul>126*127* <h3><a id="impl">3.0 Implementer's Guide</a></h3>128* Compliant implementations of JDBC {@code RowSet} Implementations129* <b>must</b> follow the assertions described in this specification. In accordance130* with the terms of the <a href="http://www.jcp.org">Java Community Process</a>, a131* Test Compatibility Kit (TCK) can be licensed to ensure compatibility with the132* specification. The following paragraphs outline a number of starting points for133* implementers of the standard JDBC {@code RowSet} definitions. Implementers134* should also consult the <i>Implementer's Guide</i> in the <a135* href="spi/package-summary.html">javax.sql.rowset.spi</a> package for guidelines136* on <a href="spi/SyncProvider.html">{@code SyncProvider}</a> implementations.137*138* <ul>139* <li><b>3.1 Constructor</b>140* <p>141* All {@code RowSet} implementations <strong>must</strong> provide a142* no-argument constructor.143* </li>144* <li><b>3.2 Role of the {@code BaseRowSet} Class</b>145* <p>146* A compliant JDBC {@code RowSet} implementation <b>must</b> implement one or more147* standard interfaces specified in this package and <b>may</b> extend the148* <a href="BaseRowSet.html">{@code BaseRowSet}</a> abstract class. For example, a149* {@code CachedRowSet} implementation must implement the {@code CachedRowSet}150* interface and extend the {@code BaseRowSet} abstract class. The151* {@code BaseRowSet} class provides the standard architecture on which all152* {@code RowSet} implementations should be built, regardless of whether the153* {@code RowSet} objects exist in a connected or disconnected environment.154* The {@code BaseRowSet} abstract class provides any {@code RowSet} implementation155* with its base functionality, including property manipulation and event notification156* that is fully compliant with157* <a href="https://www.oracle.com/technetwork/java/javase/documentation/spec-136004.html">JavaBeans</a>158* component requirements. As an example, all implementations provided in the159* reference implementations (contained in the {@code com.sun.rowset} package) use160* the {@code BaseRowSet} class as a basis for their implementations.161* <P>162* The following table illustrates the features that the {@code BaseRowSet}163* abstract class provides.164* <blockquote>165* <table class="striped" style="vertical-align:top; width:75%">166* <caption>Features in {@code BaseRowSet}</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 manipulation177* mechanisms to allow applications to get and set {@code RowSet} command and178* property values. Refer to the documentation of the {@code javax.sql.RowSet}179* interface (available in the JDBC 3.0 specification) for more details on180* the standard {@code RowSet} properties.</td>181* </tr>182* <tr>183* <th scope="row">Event notification</th>184* <td>Provides standard JavaBeans event notifications185* to registered event listeners. Refer to the documentation of {@code javax.sql.RowSetEvent}186* interface (available in the JDBC 3.0 specification) for187* more details on how to register and handle standard RowSet events generated188* 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 methods193* for setting RowSet command parameters.</td>194* </tr>195* <tr>196* <th scope="row">Streams</th>197* <td>Provides fields for storing of stream instances198* 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} describes a {@code RowSet} object that <b>must</b> always207* be connected to the originating data source. Implementations of the {@code JdbcRowSet}208* should ensure that this connection is provided solely by a JDBC driver.209* Furthermore, {@code RowSet} objects that are implementations of the210* {@code JdbcRowSet} interface and are therefore operating in a connected environment211* do not use the {@code SyncFactory} to obtain a {@code RowSetReader} object212* or a {@code RowSetWriter} object. They can safely rely on the JDBC driver to213* supply their needs by virtue of the presence of an underlying updatable and scrollable214* {@code ResultSet} implementation.215*216* <li>217* <b>3.4 Disconnected RowSet Requirements</b>218* <p>219* A disconnected {@code RowSet} object, such as a {@code CachedRowSet} object,220* <b>should</b> delegate221* connection management to a {@code SyncProvider} object provided by the222* {@code SyncFactory}. To ensure fully disconnected semantics, all223* disconnected {@code RowSet} objects <b>must</b> ensure224* that the original connection made to the data source to populate the {@code RowSet}225* object is closed to permit the garbage collector to recover and release resources. The226* {@code SyncProvider} object ensures that the critical JDBC properties are227* maintained in order to re-establish a connection to the data source when a228* synchronization is required. A disconnected {@code RowSet} object should229* therefore ensure that no230* extraneous references remain on the {@code Connection} object.231*232* <li><b>3.5 Role of RowSetMetaDataImpl</b>233* <p>234* The {@code RowsetMetaDataImpl} class is a utility class that provides an implementation of the235* <a href="{@docRoot}/java.sql/javax/sql/RowSetMetaData.html">RowSetMetaData</a> interface, supplying standard setter236* method implementations for metadata for both connected and disconnected237* {@code RowSet} objects. All implementations are free to use this standard238* implementation but are not required to do so.239*240* <li><b>3.6 RowSetWarning Class</b>241* <p>242* The {@code RowSetWarning} class provides warnings that can be set243* on {@code RowSet} implementations.244* Similar to <a href="{@docRoot}/java.sql/java/sql/SQLWarning.html">SQLWarning</a> objects,245* {@code RowSetWarning} objects are silently chained to the object whose method246* caused the warning to be thrown. All {@code RowSet} implementations <b>should</b>247* ensure that this chaining occurs if a warning is generated and also ensure that the248* warnings are available via the {@code getRowSetWarnings} method defined in either249* the {@code JdbcRowSet} interface or the {@code CachedRowSet} interface.250* After a warning has been retrieved with one of the251* {@code getRowSetWarnings} methods, the {@code RowSetWarning} method252* {@code getNextWarning} can be called on it to retrieve any warnings that might253* be chained on it. If a warning is returned, {@code getNextWarning} can be called254* 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} interface provides both connected and disconnected259* {@code RowSet} objects with the capability to be added to a260* {@code JoinRowSet} object in an SQL {@code JOIN} operation.261* A {@code RowSet} object that has implemented the {@code Joinable}262* interface can set a match column, retrieve a match column, or unset a match column.263* A {@code JoinRowSet} object can then use the {@code RowSet} object's264* match column as a basis for adding the {@code RowSet} object.265* </li>266*267* <li><b>3.8 The RowSetFactory Interface</b>268* <p>269* A {@code RowSetFactory} 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*/286package javax.sql.rowset;287288289