1 /* 2 * Copyright (c) 2017, 2020, 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} 28 * implementations. This package contains interfaces and classes 29 * that a standard {@code RowSet} 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} 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} 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} implementations. Vendors and more advanced 51 * developers who intend to provide their own compliant {@code RowSet} 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}</b></a> - A wrapper around 58 * a {@code ResultSet} object that makes it possible to use the result set as a 59 * JavaBeans™ component. Thus, 60 * a {@code JdbcRowSet} 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} object is a connected {@code RowSet} 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} 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}™</b></a> 71 * - A {@code CachedRowSet} object is a JavaBeans™ 72 * component that is scrollable, updatable, serializable, and generally disconnected from 73 * the source of its data. A {@code CachedRowSet} 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} implementations 76 * <b>must</b> use the {@code SyncFactory} to manage and obtain pluggable 77 * {@code SyncProvider} objects to provide synchronization between the 78 * disconnected {@code RowSet} object and the originating data source. 79 * Typically a {@code SyncProvider} 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}</a> package 83 * specification. 84 * 85 * <li><a href="WebRowSet.html"><b>{@code WebRowSet}</b></a> - A 86 * {@code WebRowSet} object is an extension of {@code CachedRowSet} 87 * that can read and write a {@code RowSet} object in a well formed XML format. 88 * This class calls an <a href="spi/XmlReader.html">{@code XmlReader}</a> object 89 * (an extension of the <a href="{@docRoot}/java.sql/javax/sql/RowSetReader.html">{@code RowSetReader}</a> 90 * interface) to read a rowset in XML format. It calls an 91 * <a href="spi/XmlWriter.html">{@code XmlWriter}</a> object (an extension of the 92 * <a href="{@docRoot}/java.sql/javax/sql/RowSetWriter.html">{@code RowSetWriter}</a> interface) 93 * to write a rowset in XML format. The reader and writer required by 94 * {@code WebRowSet} objects are provided by the 95 * {@code SyncFactory} in the form of {@code SyncProvider} 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://xmlns.jcp.org/xml/ns//jdbc/webrowset.xsd"> 99 * {@code http://xmlns.jcp.org/xml/ns//jdbc/webrowset.xsd}</a>. 100 * 101 * <li><a href="FilteredRowSet.html"><b>{@code FilteredRowSet}</b></a> - A 102 * {@code FilteredRowSet} object provides filtering functionality in a programmatic 103 * and extensible way. There are many instances when a {@code RowSet} {@code object} 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} object consumes 109 * an implementation of the <a href="Predicate.html">{@code Predicate}</a> 110 * interface, which <b>may</b> define a filter at run time. In turn, a 111 * {@code FilteredRowSet} 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}</b></a> - The {@code JoinRowSet} 118 * interface describes a mechanism by which relationships can be established between 119 * two or more standard {@code RowSet} implementations. Any number of {@code RowSet} 120 * objects can be added to a {@code JoinRowSet} object provided the {@code RowSet}objects 121 * can be related in a SQL {@code JOIN} like fashion. By definition, the SQL {@code JOIN} 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} object establishes relationships between 125 * {@code RowSet} 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} 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} 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}</a> implementations. 138 * 139 * <ul> 140 * <li><b>3.1 Constructor</b> 141 * <p> 142 * All {@code RowSet} implementations <strong>must</strong> provide a 143 * no-argument constructor. 144 * </li> 145 * <li><b>3.2 Role of the {@code BaseRowSet} Class</b> 146 * <p> 147 * A compliant JDBC {@code RowSet} 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}</a> abstract class. For example, a 150 * {@code CachedRowSet} implementation must implement the {@code CachedRowSet} 151 * interface and extend the {@code BaseRowSet} abstract class. The 152 * {@code BaseRowSet} class provides the standard architecture on which all 153 * {@code RowSet} implementations should be built, regardless of whether the 154 * {@code RowSet} objects exist in a connected or disconnected environment. 155 * The {@code BaseRowSet} abstract class provides any {@code RowSet} implementation 156 * with its base functionality, including property manipulation and event notification 157 * that is fully compliant with 158 * <a href="https://www.oracle.com/technetwork/java/javase/documentation/spec-136004.html">JavaBeans</a> 159 * component requirements. As an example, all implementations provided in the 160 * reference implementations (contained in the {@code com.sun.rowset} package) use 161 * the {@code BaseRowSet} class as a basis for their implementations. 162 * <P> 163 * The following table illustrates the features that the {@code BaseRowSet} 164 * abstract class provides. 165 * <blockquote> 166 * <table class="striped" style="vertical-align:top; width:75%"> 167 * <caption>Features in {@code BaseRowSet}</caption> 168 * <thead> 169 * <tr> 170 * <th scope="col">Feature</th> 171 * <th scope="col">Details</th> 172 * </tr> 173 * </thead> 174 * <tbody> 175 * <tr> 176 * <th scope="row">Properties</th> 177 * <td>Provides standard JavaBeans property manipulation 178 * mechanisms to allow applications to get and set {@code RowSet} command and 179 * property values. Refer to the documentation of the {@code javax.sql.RowSet} 180 * interface (available in the JDBC 3.0 specification) for more details on 181 * the standard {@code RowSet} properties.</td> 182 * </tr> 183 * <tr> 184 * <th scope="row">Event notification</th> 185 * <td>Provides standard JavaBeans event notifications 186 * to registered event listeners. Refer to the documentation of {@code javax.sql.RowSetEvent} 187 * interface (available in the JDBC 3.0 specification) for 188 * more details on how to register and handle standard RowSet events generated 189 * by compliant implementations.</td> 190 * </tr> 191 * <tr> 192 * <th scope="row">Setters for a RowSet object's command</th> 193 * <td>Provides a complete set of setter methods 194 * for setting RowSet command parameters.</td> 195 * </tr> 196 * <tr> 197 * <th scope="row">Streams</th> 198 * <td>Provides fields for storing of stream instances 199 * in addition to providing a set of constants for stream type designation.</td> 200 * </tr> 201 * </tbody> 202 * </table> 203 * </blockquote> 204 * 205 * <li><b>3.3 Connected RowSet Requirements</b> 206 * <p> 207 * The {@code JdbcRowSet} describes a {@code RowSet} object that <b>must</b> always 208 * be connected to the originating data source. Implementations of the {@code JdbcRowSet} 209 * should ensure that this connection is provided solely by a JDBC driver. 210 * Furthermore, {@code RowSet} objects that are implementations of the 211 * {@code JdbcRowSet} interface and are therefore operating in a connected environment 212 * do not use the {@code SyncFactory} to obtain a {@code RowSetReader} object 213 * or a {@code RowSetWriter} object. They can safely rely on the JDBC driver to 214 * supply their needs by virtue of the presence of an underlying updatable and scrollable 215 * {@code ResultSet} implementation. 216 * 217 * <li> 218 * <b>3.4 Disconnected RowSet Requirements</b> 219 * <p> 220 * A disconnected {@code RowSet} object, such as a {@code CachedRowSet} object, 221 * <b>should</b> delegate 222 * connection management to a {@code SyncProvider} object provided by the 223 * {@code SyncFactory}. To ensure fully disconnected semantics, all 224 * disconnected {@code RowSet} objects <b>must</b> ensure 225 * that the original connection made to the data source to populate the {@code RowSet} 226 * object is closed to permit the garbage collector to recover and release resources. The 227 * {@code SyncProvider} object ensures that the critical JDBC properties are 228 * maintained in order to re-establish a connection to the data source when a 229 * synchronization is required. A disconnected {@code RowSet} object should 230 * therefore ensure that no 231 * extraneous references remain on the {@code Connection} object. 232 * 233 * <li><b>3.5 Role of RowSetMetaDataImpl</b> 234 * <p> 235 * The {@code RowsetMetaDataImpl} class is a utility class that provides an implementation of the 236 * <a href="{@docRoot}/java.sql/javax/sql/RowSetMetaData.html">RowSetMetaData</a> interface, supplying standard setter 237 * method implementations for metadata for both connected and disconnected 238 * {@code RowSet} objects. All implementations are free to use this standard 239 * implementation but are not required to do so. 240 * 241 * <li><b>3.6 RowSetWarning Class</b> 242 * <p> 243 * The {@code RowSetWarning} class provides warnings that can be set 244 * on {@code RowSet} implementations. 245 * Similar to <a href="{@docRoot}/java.sql/java/sql/SQLWarning.html">SQLWarning</a> objects, 246 * {@code RowSetWarning} objects are silently chained to the object whose method 247 * caused the warning to be thrown. All {@code RowSet} implementations <b>should</b> 248 * ensure that this chaining occurs if a warning is generated and also ensure that the 249 * warnings are available via the {@code getRowSetWarnings} method defined in either 250 * the {@code JdbcRowSet} interface or the {@code CachedRowSet} interface. 251 * After a warning has been retrieved with one of the 252 * {@code getRowSetWarnings} methods, the {@code RowSetWarning} method 253 * {@code getNextWarning} can be called on it to retrieve any warnings that might 254 * be chained on it. If a warning is returned, {@code getNextWarning} can be called 255 * on it, and so on until there are no more warnings. 256 * 257 * <li><b>3.7 The Joinable Interface</b> 258 * <P> 259 * The {@code Joinable} interface provides both connected and disconnected 260 * {@code RowSet} objects with the capability to be added to a 261 * {@code JoinRowSet} object in an SQL {@code JOIN} operation. 262 * A {@code RowSet} object that has implemented the {@code Joinable} 263 * interface can set a match column, retrieve a match column, or unset a match column. 264 * A {@code JoinRowSet} object can then use the {@code RowSet} object's 265 * match column as a basis for adding the {@code RowSet} object. 266 * </li> 267 * 268 * <li><b>3.8 The RowSetFactory Interface</b> 269 * <p> 270 * A {@code RowSetFactory} implementation <strong>must</strong> 271 * be provided. 272 * </li> 273 * </ul> 274 * 275 * <h3><a id="relspec">4.0 Related Specifications</a></h3> 276 * <ul> 277 * <li><a href="https://jcp.org/en/jsr/detail?id=221">JDBC 4.3 Specification</a> 278 * <li><a href="http://www.w3.org/XML/Schema">XML Schema</a> 279 * </ul> 280 * 281 * <h3><a id="reldocs">5.0 Related Documentation</a></h3> 282 * <ul> 283 * <li><a href="http://docs.oracle.com/javase/tutorial/jdbc/basics/rowset.html"> 284 * JDBC RowSet Tutorial</a> 285 *</ul> 286 */ 287 package javax.sql.rowset;