diff --git a/src/java.sql.rowset/share/classes/javax/sql/rowset/package-info.java b/src/java.sql.rowset/share/classes/javax/sql/rowset/package-info.java
new file mode 100644
index 00000000000..1057b7e37ff
--- /dev/null
+++ b/src/java.sql.rowset/share/classes/javax/sql/rowset/package-info.java
@@ -0,0 +1,286 @@
+/*
+ * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * Standard interfaces and base classes for JDBC RowSet
+ * implementations. This package contains interfaces and classes
+ * that a standard RowSet implementation either implements or extends.
+ *
+ *
RowSet interfaces.
+ * All five extend the
+ * RowSet interface described in the JDBC 3.0
+ * specification. It is anticipated that additional definitions
+ * of more specialized JDBC RowSet types will emerge as this technology
+ * matures. Future definitions should be specified as subinterfaces using
+ * inheritance similar to the way it is used in this specification.
+ *
+ * Note: The interface definitions provided in this package form the basis for
+ * all compliant JDBC RowSet implementations. Vendors and more advanced
+ * developers who intend to provide their own compliant RowSet implementations
+ * should pay particular attention to the assertions detailed in specification
+ * interfaces.
+ *
+ *
JdbcRowSet - A wrapper around
+ * a ResultSet object that makes it possible to use the result set as a
+ * JavaBeans™ component. Thus,
+ * a JdbcRowSet object can be a Bean that any tool
+ * makes available for assembling an application as part of a component based
+ * architecture. A JdbcRowSet object is a connected RowSet
+ * object, that is, it
+ * must continually maintain its connection to its data source using a JDBC
+ * technology-enabled driver ("JDBC driver"). In addition, a JdbcRowSet
+ * object provides a fully updatable and scrollable tabular
+ * data structure as defined in the JDBC 3.0 specification.
+ *
+ * CachedRowSet™
+ * - A CachedRowSet object is a JavaBeans™
+ * component that is scrollable, updatable, serializable, and generally disconnected from
+ * the source of its data. A CachedRowSet object
+ * typically contains rows from a result set, but it can also contain rows from any
+ * file with a tabular format, such as a spreadsheet. CachedRowSet implementations
+ * must use the SyncFactory to manage and obtain pluggable
+ * SyncProvider objects to provide synchronization between the
+ * disconnected RowSet object and the originating data source.
+ * Typically a SyncProvider implementation relies upon a JDBC
+ * driver to obtain connectivity to a particular data source.
+ * Further details on this mechanism are discussed in the javax.sql.rowset.spi package
+ * specification.
+ *
+ * WebRowSet - A
+ * WebRowSet object is an extension of CachedRowSet
+ * that can read and write a RowSet object in a well formed XML format.
+ * This class calls an XmlReader object
+ * (an extension of the RowSetReader
+ * interface) to read a rowset in XML format. It calls an
+ * XmlWriter object (an extension of the
+ * RowSetWriter interface)
+ * to write a rowset in XML format. The reader and writer required by
+ * WebRowSet objects are provided by the
+ * SyncFactory in the form of SyncProvider
+ * implementations. In order to ensure well formed XML usage, a standard generic XML
+ * Schema is defined and published at
+ *
+ * http://java.sun.com/xml/ns/jdbc/webrowset.xsd.
+ *
+ * FilteredRowSet - A
+ * FilteredRowSet object provides filtering functionality in a programmatic
+ * and extensible way. There are many instances when a RowSet object
+ * has a need to provide filtering in its contents without sacrificing the disconnected
+ * environment, thus saving the expense of having to create a connection to the data source.
+ * Solutions to this need vary from providing heavyweight full scale
+ * SQL query abilities, to portable components, to more lightweight
+ * approaches. A FilteredRowSet object consumes
+ * an implementation of the Predicate
+ * interface, which may define a filter at run time. In turn, a
+ * FilteredRowSet object is tasked with enforcing the set filter for both
+ * inbound and outbound read and write operations. That is, all filters can be
+ * considered as bi-directional. No standard filters are defined;
+ * however, sufficient mechanics are specified to permit any required filter to be
+ * implemented.
+ *
+ * JoinRowSet - The JoinRowSet
+ * interface describes a mechanism by which relationships can be established between
+ * two or more standard RowSet implementations. Any number of RowSet
+ * objects can be added to a JoinRowSet object provided the RowSetobjects
+ * can be related in a SQL JOIN like fashion. By definition, the SQL JOIN
+ * statement is used to combine the data contained in two (or more) relational
+ * database tables based upon a common attribute. By establishing and then enforcing
+ * column matches, a JoinRowSet object establishes relationships between
+ * RowSet instances without the need to touch the originating data source.
+ * RowSet Implementations
+ * must follow the assertions described in this specification. In accordance
+ * with the terms of the Java Community Process, a
+ * Test Compatibility Kit (TCK) can be licensed to ensure compatibility with the
+ * specification. The following paragraphs outline a number of starting points for
+ * implementers of the standard JDBC RowSet definitions. Implementers
+ * should also consult the Implementer's Guide in the javax.sql.rowset.spi package for guidelines
+ * on SyncProvider implementations.
+ *
+ *
+ * All RowSet implementations must provide a
+ * no-argument constructor.
+ *
BaseRowSet Class
+ *
+ * A compliant JDBC RowSet implementation must implement one or more
+ * standard interfaces specified in this package and may extend the
+ * BaseRowSet abstract class. For example, a
+ * CachedRowSet implementation must implement the CachedRowSet
+ * interface and extend the BaseRowSet abstract class. The
+ * BaseRowSet class provides the standard architecture on which all
+ * RowSet implementations should be built, regardless of whether the
+ * RowSet objects exist in a connected or disconnected environment.
+ * The BaseRowSet abstract class provides any RowSet implementation
+ * with its base functionality, including property manipulation and event notification
+ * that is fully compliant with JavaBeans
+ * component requirements. As an example, all implementations provided in the
+ * reference implementations (contained in the com.sun.rowset package) use
+ * the BaseRowSet class as a basis for their implementations.
+ *
+ * The following table illustrates the features that the BaseRowSet
+ * abstract class provides.
+ *
+ *+ * + *+ *
+ *Features in + * + *BaseRowSet+ * + * + * + *Feature + *Details + *+ * + *Properties + *Provides standard JavaBeans property manipulation + * mechanisms to allow applications to get and set + *RowSetcommand and + * property values. Refer to the documentation of thejavax.sql.RowSet+ * interface (available in the JDBC 3.0 specification) for more details on + * the standardRowSetproperties.+ * + *Event notification + *Provides standard JavaBeans event notifications + * to registered event listeners. Refer to the documentation of + *javax.sql.RowSetEvent+ * interface (available in the JDBC 3.0 specification) for + * more details on how to register and handle standard RowSet events generated + * by compliant implementations.+ * + *Setters for a RowSet object's command + *Provides a complete set of setter methods + * for setting RowSet command parameters. + *+ * + * + *Streams + *Provides fields for storing of stream instances + * in addition to providing a set of constants for stream type designation. + *
+ * The JdbcRowSet describes a RowSet object that must always
+ * be connected to the originating data source. Implementations of the JdbcRowSet
+ * should ensure that this connection is provided solely by a JDBC driver.
+ * Furthermore, RowSet objects that are implementations of the
+ * JdbcRowSet interface and are therefore operating in a connected environment
+ * do not use the SyncFactory to obtain a RowSetReader object
+ * or a RowSetWriter object. They can safely rely on the JDBC driver to
+ * supply their needs by virtue of the presence of an underlying updatable and scrollable
+ * ResultSet implementation.
+ *
+ *
+ * A disconnected RowSet object, such as a CachedRowSet object,
+ * should delegate
+ * connection management to a SyncProvider object provided by the
+ * SyncFactory. To ensure fully disconnected semantics, all
+ * disconnected RowSet objects must ensure
+ * that the original connection made to the data source to populate the RowSet
+ * object is closed to permit the garbage collector to recover and release resources. The
+ * SyncProvider object ensures that the critical JDBC properties are
+ * maintained in order to re-establish a connection to the data source when a
+ * synchronization is required. A disconnected RowSet object should
+ * therefore ensure that no
+ * extraneous references remain on the Connection object.
+ *
+ *
+ * The RowsetMetaDataImpl class is a utility class that provides an implementation of the
+ * RowSetMetaData interface, supplying standard setter
+ * method implementations for metadata for both connected and disconnected
+ * RowSet objects. All implementations are free to use this standard
+ * implementation but are not required to do so.
+ *
+ *
+ * The RowSetWarning class provides warnings that can be set
+ * on RowSet implementations.
+ * Similar to SQLWarning objects,
+ * RowSetWarning objects are silently chained to the object whose method
+ * caused the warning to be thrown. All RowSet implementations should
+ * ensure that this chaining occurs if a warning is generated and also ensure that the
+ * warnings are available via the getRowSetWarnings method defined in either
+ * the JdbcRowSet interface or the CachedRowSet interface.
+ * After a warning has been retrieved with one of the
+ * getRowSetWarnings methods, the RowSetWarning method
+ * getNextWarning can be called on it to retrieve any warnings that might
+ * be chained on it. If a warning is returned, getNextWarning can be called
+ * on it, and so on until there are no more warnings.
+ *
+ *
+ * The Joinable interface provides both connected and disconnected
+ * RowSet objects with the capability to be added to a
+ * JoinRowSet object in an SQL JOIN operation.
+ * A RowSet object that has implemented the Joinable
+ * interface can set a match column, retrieve a match column, or unset a match column.
+ * A JoinRowSet object can then use the RowSet object's
+ * match column as a basis for adding the RowSet object.
+ *
+ * A RowSetFactory implementation must
+ * be provided.
+ *
RowSet
-implementations. This package contains interfaces and classes
-that a standard RowSet implementation either implements or extends.
-
-
-RowSet interfaces.
- All five extend the
-RowSet interface described in the JDBC 3.0
-specification. It is anticipated that additional definitions
-of more specialized JDBC RowSet types will emerge as this technology
-matures. Future definitions should be specified as subinterfaces using
-inheritance similar to the way it is used in this specification.
-
-Note: The interface definitions provided in this package form the basis for
-all compliant JDBC RowSet implementations. Vendors and more advanced
-developers who intend to provide their own compliant RowSet implementations
-should pay particular attention to the assertions detailed in specification
-interfaces.
-
-
JdbcRowSet - A wrapper around
-a ResultSet object that makes it possible to use the result set as a
-JavaBeans™ component. Thus,
-a JdbcRowSet object can be a Bean that any tool
-makes available for assembling an application as part of a component based
-architecture. A JdbcRowSet object is a connected RowSet
-object, that is, it
-must continually maintain its connection to its data source using a JDBC
-technology-enabled driver ("JDBC driver"). In addition, a JdbcRowSet
-object provides a fully updatable and scrollable tabular
-data structure as defined in the JDBC 3.0 specification.
-
-CachedRowSet™
- - A CachedRowSet object is a JavaBeans™
- component that is scrollable, updatable, serializable, and generally disconnected from
- the source of its data. A CachedRowSet object
-typically contains rows from a result set, but it can also contain rows from any
-file with a tabular format, such as a spreadsheet. CachedRowSet implementations
-must use the SyncFactory to manage and obtain pluggable
-SyncProvider objects to provide synchronization between the
-disconnected RowSet object and the originating data source.
-Typically a SyncProvider implementation relies upon a JDBC
-driver to obtain connectivity to a particular data source.
-Further details on this mechanism are discussed in the javax.sql.rowset.spi package
-specification.
-
-WebRowSet - A
-WebRowSet object is an extension of CachedRowSet
-that can read and write a RowSet object in a well formed XML format.
-This class calls an XmlReader object
-(an extension of the RowSetReader
-interface) to read a rowset in XML format. It calls an
-XmlWriter object (an extension of the
-RowSetWriter interface)
-to write a rowset in XML format. The reader and writer required by
-WebRowSet objects are provided by the
-SyncFactory in the form of SyncProvider
-implementations. In order to ensure well formed XML usage, a standard generic XML
-Schema is defined and published at
-
-http://java.sun.com/xml/ns/jdbc/webrowset.xsd.
-
-FilteredRowSet - A
-FilteredRowSet object provides filtering functionality in a programmatic
-and extensible way. There are many instances when a RowSet object
-has a need to provide filtering in its contents without sacrificing the disconnected
-environment, thus saving the expense of having to create a connection to the data source.
-Solutions to this need vary from providing heavyweight full scale
-SQL query abilities, to portable components, to more lightweight
-approaches. A FilteredRowSet object consumes
-an implementation of the Predicate
-interface, which may define a filter at run time. In turn, a
-FilteredRowSet object is tasked with enforcing the set filter for both
-inbound and outbound read and write operations. That is, all filters can be
-considered as bi-directional. No standard filters are defined;
-however, sufficient mechanics are specified to permit any required filter to be
-implemented.
-
-JoinRowSet - The JoinRowSet
-interface describes a mechanism by which relationships can be established between
-two or more standard RowSet implementations. Any number of RowSet
- objects can be added to a JoinRowSet object provided the RowSetobjects
-can be related in a SQL JOIN like fashion. By definition, the SQL JOIN
-statement is used to combine the data contained in two (or more) relational
-database tables based upon a common attribute. By establishing and then enforcing
-column matches, a JoinRowSet object establishes relationships between
-RowSet instances without the need to touch the originating data source.
-RowSet Implementations
-must follow the assertions described in this specification. In accordance
-with the terms of the Java Community Process, a
-Test Compatibility Kit (TCK) can be licensed to ensure compatibility with the
-specification. The following paragraphs outline a number of starting points for
-implementers of the standard JDBC RowSet definitions. Implementers
-should also consult the Implementer's Guide in the javax.sql.rowset.spi package for guidelines
-on SyncProvider implementations.
-
-
- All RowSet implementations must provide a
-no-argument constructor.
-
BaseRowSet Class
-
-A compliant JDBC RowSet implementation must implement one or more
-standard interfaces specified in this package and may extend the
-BaseRowSet abstract class. For example, a
-CachedRowSet implementation must implement the CachedRowSet
-interface and extend the BaseRowSet abstract class. The
-BaseRowSet class provides the standard architecture on which all
-RowSet implementations should be built, regardless of whether the
-RowSet objects exist in a connected or disconnected environment.
-The BaseRowSet abstract class provides any RowSet implementation
-with its base functionality, including property manipulation and event notification
-that is fully compliant with JavaBeans
-component requirements. As an example, all implementations provided in the
-reference implementations (contained in the com.sun.rowset package) use
-the BaseRowSet class as a basis for their implementations.
-
-The following table illustrates the features that the BaseRowSet
-abstract class provides.
-
-- --
-Features in - -BaseRowSet- - - -Feature -Details -- -Properties -Provides standard JavaBeans property manipulation -mechanisms to allow applications to get and set -RowSetcommand and -property values. Refer to the documentation of thejavax.sql.RowSet-interface (available in the JDBC 3.0 specification) for more details on -the standardRowSetproperties.- -Event notification -Provides standard JavaBeans event notifications -to registered event listeners. Refer to the documentation of -javax.sql.RowSetEvent-interface (available in the JDBC 3.0 specification) for -more details on how to register and handle standard RowSet events generated -by compliant implementations.- -Setters for a RowSet object's command -Provides a complete set of setter methods - for setting RowSet command parameters. -- - -Streams -Provides fields for storing of stream instances - in addition to providing a set of constants for stream type designation. -
-The JdbcRowSet describes a RowSet object that must always
-be connected to the originating data source. Implementations of the JdbcRowSet
-should ensure that this connection is provided solely by a JDBC driver.
-Furthermore, RowSet objects that are implementations of the
-JdbcRowSet interface and are therefore operating in a connected environment
-do not use the SyncFactory to obtain a RowSetReader object
-or a RowSetWriter object. They can safely rely on the JDBC driver to
-supply their needs by virtue of the presence of an underlying updatable and scrollable
-ResultSet implementation.
-
-
-A disconnected RowSet object, such as a CachedRowSet object,
-should delegate
-connection management to a SyncProvider object provided by the
-SyncFactory. To ensure fully disconnected semantics, all
-disconnected RowSet objects must ensure
-that the original connection made to the data source to populate the RowSet
-object is closed to permit the garbage collector to recover and release resources. The
-SyncProvider object ensures that the critical JDBC properties are
-maintained in order to re-establish a connection to the data source when a
-synchronization is required. A disconnected RowSet object should
-therefore ensure that no
-extraneous references remain on the Connection object.
-
-
-The RowsetMetaDataImpl class is a utility class that provides an implementation of the
-RowSetMetaData interface, supplying standard setter
-method implementations for metadata for both connected and disconnected
-RowSet objects. All implementations are free to use this standard
-implementation but are not required to do so.
-
-
-The RowSetWarning class provides warnings that can be set
-on RowSet implementations.
-Similar to SQLWarning objects,
-RowSetWarning objects are silently chained to the object whose method
-caused the warning to be thrown. All RowSet implementations should
-ensure that this chaining occurs if a warning is generated and also ensure that the
-warnings are available via the getRowSetWarnings method defined in either
-the JdbcRowSet interface or the CachedRowSet interface.
-After a warning has been retrieved with one of the
-getRowSetWarnings methods, the RowSetWarning method
-getNextWarning can be called on it to retrieve any warnings that might
-be chained on it. If a warning is returned, getNextWarning can be called
-on it, and so on until there are no more warnings.
-
-
-The Joinable interface provides both connected and disconnected
-RowSet objects with the capability to be added to a
-JoinRowSet object in an SQL JOIN operation.
-A RowSet object that has implemented the Joinable
-interface can set a match column, retrieve a match column, or unset a match column.
-A JoinRowSet object can then use the RowSet object's
-match column as a basis for adding the RowSet object.
-
- A RowSetFactory implementation must
- be provided.
-
RowSet object to use an implementation, the vendor must register
+ * it with the SyncFactory singleton. (See the class comment for
+ * SyncProvider for a full explanation of the registration process and
+ * the naming convention to be used.)
+ *
+ *
+ * The following classes and interfaces make up the javax.sql.rowset.spi
+ * package:
+ *
SyncFactory
+ * SyncProvider
+ * SyncFactoryException
+ * SyncProviderException
+ * SyncResolver
+ * XmlReader
+ * XmlWriter
+ * TransactionalWriter
+ * javax.sql package, are also part of the SPI:
+ * RowSetReader
+ * RowSetWriter
+ *
+ * A SyncProvider implementation provides a disconnected RowSet
+ * object with the mechanisms for reading data into it and for writing data that has been
+ * modified in it
+ * back to the underlying data source. A reader, a RowSetReader or
+ * XMLReader object, reads data into a RowSet object when the
+ * CachedRowSet methods execute or populate
+ * are called. A writer, a RowSetWriter or XMLWriter
+ * object, writes changes back to the underlying data source when the
+ * CachedRowSet method acceptChanges is called.
+ *
+ * The process of writing changes in a RowSet object to its data source
+ * is known as synchronization. The SyncProvider implementation that a
+ * RowSet object is using determines the level of synchronization that the
+ * RowSet object's writer uses. The various levels of synchronization are
+ * referred to as grades.
+ *
+ * The lower grades of synchronization are
+ * known as optimistic concurrency levels because they optimistically
+ * assume that there will be no conflicts or very few conflicts. A conflict exists when
+ * the same data modified in the RowSet object has also been modified
+ * in the data source. Using the optimistic concurrency model means that if there
+ * is a conflict, modifications to either the data source or the RowSet
+ * object will be lost.
+ *
+ * Higher grades of synchronization are called pessimistic because they assume + * that others will be accessing the data source and making modifications. These + * grades set varying levels of locks to increase the chances that no conflicts + * occur. + *
+ * The lowest level of synchronization is simply writing any changes made to the
+ * RowSet object to its underlying data source. The writer does
+ * nothing to check for conflicts.
+ * If there is a conflict and the data
+ * source values are overwritten, the changes other parties have made by to the data
+ * source are lost.
+ *
+ * The RIXMLProvider implementation uses the lowest level
+ * of synchronization and just writes RowSet changes to the data source.
+ *
+ *
+ * For the next level up, the
+ * writer checks to see if there are any conflicts, and if there are,
+ * it does not write anything to the data source. The problem with this concurrency
+ * level is that if another party has modified the corresponding data in the data source
+ * since the RowSet object got its data,
+ * the changes made to the RowSet object are lost. The
+ * RIOptimisticProvider implementation uses this level of synchronization.
+ *
+ * At higher levels of synchronization, referred to as pessimistic concurrency,
+ * the writer take steps to avoid conflicts by setting locks. Setting locks
+ * can vary from setting a lock on a single row to setting a lock on a table
+ * or the entire data source. The level of synchronization is therefore a tradeoff
+ * between the ability of users to access the data source concurrently and the ability
+ * of the writer to keep the data in the RowSet object and its data source
+ * synchronized.
+ *
+ * It is a requirement that all disconnected RowSet objects
+ * (CachedRowSet, FilteredRowSet, JoinRowSet,
+ * and WebRowSet objects) obtain their SyncProvider objects
+ * from the SyncFactory mechanism.
+ *
+ * The reference implementation (RI) provides two synchronization providers. + *
RIOptimisticProvider SyncFactory instance will
+ * supply to a disconnected RowSet object when no provider
+ * implementation is specified.RowSet object and the
+ * data source. If there is a conflict, it does nothing, meaning that
+ * changes to the RowSet object are not persisted to the data
+ * source.
+ * RIXMLProvider WebRowSet object, which is a rowset that can be written
+ * in XML format or read from XML format. The
+ * RIXMLProvider implementation does no checking at all for
+ * conflicts and simply writes any updated data in the
+ * WebRowSet object to the underlying data source.
+ * WebRowSet objects use this provider when they are
+ * dealing with XML data.
+ * SyncProvider implementations
+ * are bundled with the reference implementation, which makes them always available to
+ * RowSet implementations.
+ * SyncProvider implementations make themselves available by being
+ * registered with the SyncFactory singleton. When a RowSet
+ * object requests a provider, by specifying it in the constructor or as an argument to the
+ * CachedRowSet method setSyncProvider,
+ * the SyncFactory singleton
+ * checks to see if the requested provider has been registered with it.
+ * If it has, the SyncFactory creates an instance of it and passes it to the
+ * requesting RowSet object.
+ * If the SyncProvider implementation that is specified has not been registered,
+ * the SyncFactory singleton causes a SyncFactoryException object
+ * to be thrown. If no provider is specified,
+ * the SyncFactory singleton will create an instance of the default
+ * provider implementation, RIOptimisticProvider,
+ * and pass it to the requesting RowSet object.
+ *
+ *
+ * If a WebRowSet object does not specify a provider in its constructor, the
+ * SyncFactory will give it an instance of RIOptimisticProvider.
+ * However, the constructor for WebRowSet is implemented to set the provider
+ * to the RIXMLProvider, which reads and writes a RowSet object
+ * in XML format.
+ *
+ * See the SyncProvider class + * specification for further details. + *
+ * Vendors may develop a SyncProvider implementation with any one of the possible
+ * levels of synchronization, thus giving RowSet objects a choice of
+ * synchronization mechanisms.
+ *
+ *
+ * The Service Provider Interface provides a pluggable mechanism by which
+ * SyncProvider implementations can be registered and then generated when
+ * required. The lazy reference mechanism employed by the SyncFactory limits
+ * unnecessary resource consumption by not creating an instance until it is
+ * required by a disconnected
+ * RowSet object. The SyncFactory class also provides
+ * a standard API to configure logging options and streams that may be provided
+ * by a particular SyncProvider implementation.
+ *
+ * 2.2 Registering with the SyncFactory
+ *
+ * A third party SyncProvider implementation must be registered with the
+ * SyncFactory in order for a disconnected RowSet object
+ * to obtain it and thereby use its javax.sql.RowSetReader and
+ * javax.sql.RowSetWriter
+ * implementations. The following registration mechanisms are available to all
+ * SyncProvider implementations:
+ *
SyncProvider objects.
+ *
+ * SyncFactory will attempt to load SyncProvider
+ * objects bound to the context and register them with the factory. This
+ * context must be supplied to the SyncFactory for the mechanism to
+ * function correctly.
+ *
+ * Details on how to specify the system properties or properties in a property file
+ * and how to configure the JNDI Context are explained in detail in the
+ * SyncFactory class description.
+ *
+ * 2.3 SyncFactory Provider Instance Generation Policies + *
+ * The SyncFactory generates a requested SyncProvider
+ * object if the provider has been correctly registered. The
+ * following policies are adhered to when either a disconnected RowSet object
+ * is instantiated with a specified SyncProvider implementation or is
+ * reconfigured at runtime with an alternative SyncProvider object.
+ *
SyncProvider object is specified and the SyncFactory
+ * contains no reference to the provider, a SyncFactoryException is
+ * thrown.
+ *
+ * SyncProvider object is specified and the SyncFactory
+ * contains a reference to the provider, the requested provider is supplied.
+ *
+ * SyncProvider object is specified, the reference
+ * implementation provider RIOptimisticProvider is supplied.
+ *
+ * These policies are explored in more detail in the
+ * SyncFactory class.
+ *
+ *
+ * A compliant SyncProvider implementation that is fully pluggable
+ * into the SyncFactory must extend and implement all
+ * abstract methods in the SyncProvider
+ * class. In addition, an implementation must determine the
+ * grade, locking and updatable view capabilities defined in the
+ * SyncProvider class definition. One or more of the
+ * SyncProvider description criteria must be supported. It
+ * is expected that vendor implementations will offer a range of grade, locking, and
+ * updatable view capabilities.
+ *
+ * Furthermore, the SyncProvider naming convention must be followed as
+ * detailed in the SyncProvider class
+ * description.
+ *
+ * 3.2 Grades + *
+ * JSR 114 defines a set of grades to describe the quality of synchronization
+ * a SyncProvider object can offer a disconnected RowSet
+ * object. These grades are listed from the lowest quality of service to the highest.
+ *
SyncProvider implementation returning this grade will simply
+ * attempt to write any data that has changed in the RowSet object to the
+ *underlying data source, overwriting whatever is there. No attempt is made to compare
+ * original values with current values to see if there is a conflict. The
+ * RIXMLProvider is implemented with this grade.
+ *
+ * SyncProvider implementation returning this grade
+ * will check for conflicts in rows that have changed between the last synchronization
+ * and the current synchronization under way. Any changes in the originating data source
+ * that have been modified will not be reflected in the disconnected RowSet
+ * object. If there are no conflicts, changes in the RowSet object will be
+ * written to the data source. If there are conflicts, no changes are written.
+ * The RIOptimisticProvider implementation uses this grade.
+ *
+ * SyncProvider implementation returning this grade
+ * will check all rows, including rows that have not changed in the disconnected
+ * RowSet object. In this way, any changes to rows in the underlying
+ * data source will be reflected in the disconnected RowSet object
+ * when the synchronization finishes successfully.
+ *
+ * SyncProvider implementations returning this grade will lock
+ * the row in the originating data source that corresponds to the row being changed
+ * in the RowSet object to reduce the possibility of other
+ * processes modifying the same data in the data source.
+ *
+ * SyncProvider implementation returning this grade will lock
+ * the entire view and/or table affected by the original query used to
+ * populate a RowSet object.
+ * + * 3.3 Locks + *
+ * JSR 114 defines a set of constants that specify whether any locks have been
+ * placed on a RowSet object's underlying data source and, if so,
+ * on which constructs the locks are placed. These locks will remain on the data
+ * source while the RowSet object is disconnected from the data source.
+ *
+ * These constants should be considered complementary to the
+ * grade constants. The default setting for the majority of grade settings requires
+ * that no data source locks remain when a RowSet object is disconnected
+ * from its data source.
+ * The grades GRADE_LOCK_WHEN_MODIFIED and
+ * GRADE_LOCK_WHEN_LOADED allow a disconnected RowSet object
+ * to have a fine-grained control over the degree of locking.
+ *
SyncProvider implementations
+ * unless otherwise directed by a RowSet object.
+ *
+ * RowSet object.
+ *
+ * RowSet object.
+ *
+ * RowSet
+ * object.
+ * + * 3.4 Updatable Views + *
+ * A RowSet object may be populated with data from an SQL VIEW.
+ * The following constants indicate whether a SyncProvider object can
+ * update data in the table or tables from which the VIEW was derived.
+ *
SyncProvider implementation supports synchronization
+ * to the table or tables from which the SQL VIEW used to populate
+ * a RowSet object is derived.
+ *
+ * SyncProvider implementation does not support
+ * synchronization to the table or tables from which the SQL VIEW
+ * used to populate a RowSet object is derived.
+ *
+ * 3.5 Usage of SyncProvider Grading and Locking
+ *
+ * In the example below, the reference CachedRowSetImpl implementation
+ * reconfigures its current SyncProvider object by calling the
+ * setSyncProvider method.
+ *
+ *
+ * CachedRowSetImpl crs = new CachedRowSetImpl();
+ * crs.setSyncProvider("com.foo.bar.HASyncProvider");
+ *
+ * An application can retrieve the SyncProvider object currently in use
+ * by a disconnected RowSet object. It can also retrieve the
+ * grade of synchronization with which the provider was implemented and the degree of
+ * locking currently in use. In addition, an application has the flexibility to set
+ * the degree of locking to be used, which can increase the possibilities for successful
+ * synchronization. These operation are shown in the following code fragment.
+ *
+ * SyncProvider sync = crs.getSyncProvider();
+ *
+ * switch (sync.getProviderGrade()) {
+ * case: SyncProvider.GRADE_CHECK_ALL_AT_COMMIT
+ * //A high grade of optimistic synchronization
+ * break;
+ * case: SyncProvider.GRADE_CHECK_MODIFIED_AT_COMMIT
+ * //A low grade of optimistic synchronization
+ * break;
+ * case: SyncProvider.GRADE_LOCK_WHEN_LOADED
+ * // A pessimistic synchronization grade
+ * break;
+ * case: SyncProvider.GRADE_LOCK_WHEN_MODIFIED
+ * // A pessimistic synchronization grade
+ * break;
+ * case: SyncProvider.GRADE_NONE
+ * // No synchronization with the originating data source provided
+ * break;
+ * }
+ *
+ * switch (sync.getDataSourcLock() {
+ * case: SyncProvider.DATASOURCE_DB_LOCK
+ * // A lock is placed on the entire datasource that is used by the
+ * // RowSet object
+ * break;
+ *
+ * case: SyncProvider.DATASOURCE_NO_LOCK
+ * // No locks remain on the originating data source.
+ * break;
+ *
+ * case: SyncProvider.DATASOURCE_ROW_LOCK
+ * // A lock is placed on the rows that are touched by the original
+ * // SQL statement used to populate
+ * // the RowSet object that is using the SyncProvider
+ * break;
+ *
+ * case: DATASOURCE_TABLE_LOCK
+ * // A lock is placed on all tables that are touched by the original
+ * // SQL statement used to populated
+ * // the RowSet object that is using the SyncProvider
+ * break;
+ *
+ *
+ * It is also possible using the static utility method in the
+ * SyncFactory class to determine the list of SyncProvider
+ * implementations currently registered with the SyncFactory.
+ *
+ * + * Enumeration e = SyncFactory.getRegisteredProviders(); + *+ * + * + *
SyncResolver provides a way for an application to
+ * decide manually what to do when a conflict occurs. When the CachedRowSet
+ * method acceptChanges finishes and has detected one or more conflicts,
+ * it throws a SyncProviderException object. An application can
+ * catch the exception and
+ * have it retrieve a SyncResolver object by calling the method
+ * SyncProviderException.getSyncResolver().
+ *
+ * A SyncResolver object, which is a special kind of
+ * CachedRowSet object or
+ * a JdbcRowSet object that has implemented the SyncResolver
+ * interface, examines the conflicts row by row. It is a duplicate of the
+ * RowSet object being synchronized except that it contains only the data
+ * from the data source this is causing a conflict. All of the other column values are
+ * set to null. To navigate from one conflict value to another, a
+ * SyncResolver object provides the methods nextConflict and
+ * previousConflict.
+ *
+ * The SyncResolver interface also
+ * provides methods for doing the following:
+ *
RowSet object if it needs
+ * to be changed
+ *
+ * When the CachedRowSet method acceptChanges is called, it
+ * delegates to the RowSet object's SyncProvider object.
+ * How the writer provided by that SyncProvider object is implemented
+ * determines what level (grade) of checking for conflicts will be done. After all
+ * checking for conflicts is completed and one or more conflicts has been found, the method
+ * acceptChanges throws a SyncProviderException object. The
+ * application can catch the exception and use it to obtain a SyncResolver object.
+ *
+ * The application can then use SyncResolver methods to get information
+ * about each conflict and decide what to do. If the application logic or the user
+ * decides that a value in the RowSet object should be the one to
+ * persist, the application or user can overwrite the data source value with it.
+ *
+ * The comment for the SyncResolver interface has more detail.
+ *
+ *
RowSet object to use an implementation, the vendor must register
-it with the SyncFactory singleton. (See the class comment for
-SyncProvider for a full explanation of the registration process and
-the naming convention to be used.)
-
-
-The following classes and interfaces make up the javax.sql.rowset.spi
-package:
-
SyncFactory
- SyncProvider
- SyncFactoryException
- SyncProviderException
- SyncResolver
- XmlReader
- XmlWriter
- TransactionalWriter
-javax.sql package, are also part of the SPI:
-RowSetReader
- RowSetWriter
-
-A SyncProvider implementation provides a disconnected RowSet
-object with the mechanisms for reading data into it and for writing data that has been
-modified in it
-back to the underlying data source. A reader, a RowSetReader or
-XMLReader object, reads data into a RowSet object when the
-CachedRowSet methods execute or populate
-are called. A writer, a RowSetWriter or XMLWriter
-object, writes changes back to the underlying data source when the
-CachedRowSet method acceptChanges is called.
-
-The process of writing changes in a RowSet object to its data source
-is known as synchronization. The SyncProvider implementation that a
-RowSet object is using determines the level of synchronization that the
-RowSet object's writer uses. The various levels of synchronization are
-referred to as grades.
-
-The lower grades of synchronization are
-known as optimistic concurrency levels because they optimistically
-assume that there will be no conflicts or very few conflicts. A conflict exists when
-the same data modified in the RowSet object has also been modified
-in the data source. Using the optimistic concurrency model means that if there
-is a conflict, modifications to either the data source or the RowSet
-object will be lost.
-
-Higher grades of synchronization are called pessimistic because they assume -that others will be accessing the data source and making modifications. These -grades set varying levels of locks to increase the chances that no conflicts -occur. -
-The lowest level of synchronization is simply writing any changes made to the
-RowSet object to its underlying data source. The writer does
-nothing to check for conflicts.
-If there is a conflict and the data
-source values are overwritten, the changes other parties have made by to the data
-source are lost.
-
-The RIXMLProvider implementation uses the lowest level
-of synchronization and just writes RowSet changes to the data source.
-
-
-For the next level up, the
-writer checks to see if there are any conflicts, and if there are,
-it does not write anything to the data source. The problem with this concurrency
-level is that if another party has modified the corresponding data in the data source
-since the RowSet object got its data,
-the changes made to the RowSet object are lost. The
-RIOptimisticProvider implementation uses this level of synchronization.
-
-At higher levels of synchronization, referred to as pessimistic concurrency,
-the writer take steps to avoid conflicts by setting locks. Setting locks
-can vary from setting a lock on a single row to setting a lock on a table
-or the entire data source. The level of synchronization is therefore a tradeoff
-between the ability of users to access the data source concurrently and the ability
-of the writer to keep the data in the RowSet object and its data source
-synchronized.
-
-It is a requirement that all disconnected RowSet objects
-(CachedRowSet, FilteredRowSet, JoinRowSet,
-and WebRowSet objects) obtain their SyncProvider objects
-from the SyncFactory mechanism.
-
-The reference implementation (RI) provides two synchronization providers. -
RIOptimisticProvider SyncFactory instance will
- supply to a disconnected RowSet object when no provider
- implementation is specified.RowSet object and the
- data source. If there is a conflict, it does nothing, meaning that
- changes to the RowSet object are not persisted to the data
- source.
- RIXMLProvider WebRowSet object, which is a rowset that can be written
- in XML format or read from XML format. The
- RIXMLProvider implementation does no checking at all for
- conflicts and simply writes any updated data in the
- WebRowSet object to the underlying data source.
- WebRowSet objects use this provider when they are
- dealing with XML data.
- SyncProvider implementations
-are bundled with the reference implementation, which makes them always available to
-RowSet implementations.
-SyncProvider implementations make themselves available by being
-registered with the SyncFactory singleton. When a RowSet
-object requests a provider, by specifying it in the constructor or as an argument to the
-CachedRowSet method setSyncProvider,
-the SyncFactory singleton
-checks to see if the requested provider has been registered with it.
-If it has, the SyncFactory creates an instance of it and passes it to the
-requesting RowSet object.
-If the SyncProvider implementation that is specified has not been registered,
-the SyncFactory singleton causes a SyncFactoryException object
-to be thrown. If no provider is specified,
-the SyncFactory singleton will create an instance of the default
-provider implementation, RIOptimisticProvider,
-and pass it to the requesting RowSet object.
-
-
-If a WebRowSet object does not specify a provider in its constructor, the
-SyncFactory will give it an instance of RIOptimisticProvider.
-However, the constructor for WebRowSet is implemented to set the provider
-to the RIXMLProvider, which reads and writes a RowSet object
-in XML format.
-
-See the SyncProvider class -specification for further details. -
-Vendors may develop a SyncProvider implementation with any one of the possible
-levels of synchronization, thus giving RowSet objects a choice of
-synchronization mechanisms.
-
-
-The Service Provider Interface provides a pluggable mechanism by which
-SyncProvider implementations can be registered and then generated when
-required. The lazy reference mechanism employed by the SyncFactory limits
-unnecessary resource consumption by not creating an instance until it is
-required by a disconnected
-RowSet object. The SyncFactory class also provides
-a standard API to configure logging options and streams that may be provided
-by a particular SyncProvider implementation.
-
-2.2 Registering with the SyncFactory
-
-A third party SyncProvider implementation must be registered with the
-SyncFactory in order for a disconnected RowSet object
-to obtain it and thereby use its javax.sql.RowSetReader and
-javax.sql.RowSetWriter
-implementations. The following registration mechanisms are available to all
-SyncProvider implementations:
-
SyncProvider objects.
-
-SyncFactory will attempt to load SyncProvider
-objects bound to the context and register them with the factory. This
-context must be supplied to the SyncFactory for the mechanism to
-function correctly.
-
-Details on how to specify the system properties or properties in a property file
-and how to configure the JNDI Context are explained in detail in the
-SyncFactory class description.
-
-2.3 SyncFactory Provider Instance Generation Policies -
-The SyncFactory generates a requested SyncProvider
-object if the provider has been correctly registered. The
-following policies are adhered to when either a disconnected RowSet object
-is instantiated with a specified SyncProvider implementation or is
-reconfigured at runtime with an alternative SyncProvider object.
-
SyncProvider object is specified and the SyncFactory
-contains no reference to the provider, a SyncFactoryException is
-thrown.
-
-SyncProvider object is specified and the SyncFactory
-contains a reference to the provider, the requested provider is supplied.
-
-SyncProvider object is specified, the reference
-implementation provider RIOptimisticProvider is supplied.
-
-These policies are explored in more detail in the
-SyncFactory class.
-
-
-A compliant SyncProvider implementation that is fully pluggable
-into the SyncFactory must extend and implement all
-abstract methods in the SyncProvider
-class. In addition, an implementation must determine the
-grade, locking and updatable view capabilities defined in the
-SyncProvider class definition. One or more of the
-SyncProvider description criteria must be supported. It
-is expected that vendor implementations will offer a range of grade, locking, and
-updatable view capabilities.
-
-Furthermore, the SyncProvider naming convention must be followed as
-detailed in the SyncProvider class
-description.
-
-3.2 Grades -
-JSR 114 defines a set of grades to describe the quality of synchronization
-a SyncProvider object can offer a disconnected RowSet
-object. These grades are listed from the lowest quality of service to the highest.
-
SyncProvider implementation returning this grade will simply
-attempt to write any data that has changed in the RowSet object to the
-underlying data source, overwriting whatever is there. No attempt is made to compare
-original values with current values to see if there is a conflict. The
-RIXMLProvider is implemented with this grade.
-
-SyncProvider implementation returning this grade
-will check for conflicts in rows that have changed between the last synchronization
-and the current synchronization under way. Any changes in the originating data source
-that have been modified will not be reflected in the disconnected RowSet
-object. If there are no conflicts, changes in the RowSet object will be
-written to the data source. If there are conflicts, no changes are written.
-The RIOptimisticProvider implementation uses this grade.
-
-SyncProvider implementation returning this grade
-will check all rows, including rows that have not changed in the disconnected
-RowSet object. In this way, any changes to rows in the underlying
-data source will be reflected in the disconnected RowSet object
-when the synchronization finishes successfully.
-
-SyncProvider implementations returning this grade will lock
-the row in the originating data source that corresponds to the row being changed
-in the RowSet object to reduce the possibility of other
-processes modifying the same data in the data source.
-
-SyncProvider implementation returning this grade will lock
-the entire view and/or table affected by the original query used to
-populate a RowSet object.
--3.3 Locks -
-JSR 114 defines a set of constants that specify whether any locks have been
-placed on a RowSet object's underlying data source and, if so,
-on which constructs the locks are placed. These locks will remain on the data
-source while the RowSet object is disconnected from the data source.
-
-These constants should be considered complementary to the
-grade constants. The default setting for the majority of grade settings requires
-that no data source locks remain when a RowSet object is disconnected
-from its data source.
-The grades GRADE_LOCK_WHEN_MODIFIED and
-GRADE_LOCK_WHEN_LOADED allow a disconnected RowSet object
-to have a fine-grained control over the degree of locking.
-
SyncProvider implementations
-unless otherwise directed by a RowSet object.
-
-RowSet object.
-
-RowSet object.
-
-RowSet
-object.
--3.4 Updatable Views -
-A RowSet object may be populated with data from an SQL VIEW.
-The following constants indicate whether a SyncProvider object can
-update data in the table or tables from which the VIEW was derived.
-
SyncProvider implementation supports synchronization
-to the table or tables from which the SQL VIEW used to populate
-a RowSet object is derived.
-
-SyncProvider implementation does not support
-synchronization to the table or tables from which the SQL VIEW
-used to populate a RowSet object is derived.
-
-3.5 Usage of SyncProvider Grading and Locking
-
-In the example below, the reference CachedRowSetImpl implementation
-reconfigures its current SyncProvider object by calling the
-setSyncProvider method.
-
-
- CachedRowSetImpl crs = new CachedRowSetImpl();
- crs.setSyncProvider("com.foo.bar.HASyncProvider");
-
- An application can retrieve the SyncProvider object currently in use
-by a disconnected RowSet object. It can also retrieve the
-grade of synchronization with which the provider was implemented and the degree of
-locking currently in use. In addition, an application has the flexibility to set
-the degree of locking to be used, which can increase the possibilities for successful
-synchronization. These operation are shown in the following code fragment.
-
- SyncProvider sync = crs.getSyncProvider();
-
- switch (sync.getProviderGrade()) {
- case: SyncProvider.GRADE_CHECK_ALL_AT_COMMIT
- //A high grade of optimistic synchronization
- break;
- case: SyncProvider.GRADE_CHECK_MODIFIED_AT_COMMIT
- //A low grade of optimistic synchronization
- break;
- case: SyncProvider.GRADE_LOCK_WHEN_LOADED
- // A pessimistic synchronization grade
- break;
- case: SyncProvider.GRADE_LOCK_WHEN_MODIFIED
- // A pessimistic synchronization grade
- break;
- case: SyncProvider.GRADE_NONE
- // No synchronization with the originating data source provided
- break;
- }
-
- switch (sync.getDataSourcLock() {
- case: SyncProvider.DATASOURCE_DB_LOCK
- // A lock is placed on the entire datasource that is used by the
- // RowSet object
- break;
-
- case: SyncProvider.DATASOURCE_NO_LOCK
- // No locks remain on the originating data source.
- break;
-
- case: SyncProvider.DATASOURCE_ROW_LOCK
- // A lock is placed on the rows that are touched by the original
- // SQL statement used to populate
- // the RowSet object that is using the SyncProvider
- break;
-
- case: DATASOURCE_TABLE_LOCK
- // A lock is placed on all tables that are touched by the original
- // SQL statement used to populated
- // the RowSet object that is using the SyncProvider
- break;
-
-
- It is also possible using the static utility method in the
-SyncFactory class to determine the list of SyncProvider
-implementations currently registered with the SyncFactory.
-
-- Enumeration e = SyncFactory.getRegisteredProviders(); -- - -
SyncResolver provides a way for an application to
-decide manually what to do when a conflict occurs. When the CachedRowSet
-method acceptChanges finishes and has detected one or more conflicts,
-it throws a SyncProviderException object. An application can
-catch the exception and
-have it retrieve a SyncResolver object by calling the method
-SyncProviderException.getSyncResolver().
-
-A SyncResolver object, which is a special kind of
-CachedRowSet object or
-a JdbcRowSet object that has implemented the SyncResolver
-interface, examines the conflicts row by row. It is a duplicate of the
-RowSet object being synchronized except that it contains only the data
-from the data source this is causing a conflict. All of the other column values are
-set to null. To navigate from one conflict value to another, a
-SyncResolver object provides the methods nextConflict and
-previousConflict.
-
-The SyncResolver interface also
-provides methods for doing the following:
-
RowSet object if it needs
- to be changed
-
-When the CachedRowSet method acceptChanges is called, it
-delegates to the RowSet object's SyncProvider object.
-How the writer provided by that SyncProvider object is implemented
-determines what level (grade) of checking for conflicts will be done. After all
-checking for conflicts is completed and one or more conflicts has been found, the method
-acceptChanges throws a SyncProviderException object. The
-application can catch the exception and use it to obtain a SyncResolver object.
-
-The application can then use SyncResolver methods to get information
-about each conflict and decide what to do. If the application logic or the user
-decides that a value in the RowSet object should be the one to
-persist, the application or user can overwrite the data source value with it.
-
-The comment for the SyncResolver interface has more detail.
-
-