RowSet objects.
A SyncProvider implementation is a class that extends the
SyncProvider abstract class.
A SyncProvider implementation is
identified by a unique ID, which is its fully qualified class name.
This name must be registered with the
SyncFactory SPI, thus making the implementation available to
all RowSet implementations.
The factory mechanism in the reference implementation uses this name to instantiate
the implementation, which can then provide a RowSet object with its
reader (a javax.sql.RowSetReader object) and its writer (a
javax.sql.RowSetWriter object).
The Jdbc RowSet Implementations specification provides two
reference implementations of the SyncProvider abstract class:
RIOptimisticProvider and RIXMLProvider.
The RIOptimisticProvider can set any RowSet
implementation with a RowSetReader object and a
RowSetWriter object. However, only the RIXMLProvider
implementation can set an XmlReader object and an
XmlWriter object. A WebRowSet object uses the
XmlReader object to read data in XML format to populate itself with that
data. It uses the XmlWriter object to write itself to a stream or
java.io.Writer object in XML format.
SyncProvider
implementations, the following should be noted:
SyncProvider implementation
is its fully qualified class name.
SyncProvider implementation in a package named providers.
For instance, if a vendor named Fred, Inc. offered a
SyncProvider implementation, you could have the following:
Vendor name: Fred, Inc.
Domain name of vendor: com.fred
Package name: com.fred.providers
SyncProvider implementation class name: HighAvailabilityProvider
Fully qualified class name of SyncProvider implementation:
com.fred.providers.HighAvailabilityProvider
The following line of code uses the fully qualified name to register
this implementation with the SyncFactory static instance.
SyncFactory.registerProvider(
"com.fred.providers.HighAvailabilityProvider");
The default SyncProvider object provided with the reference
implementation uses the following name:
com.sun.rowset.providers.RIOptimisticProvider
Vendors should refer to the reference implementation synchronization
providers for additional guidance on how to implement a new
SyncProvider implementation.
RowSet Object Gets Its ProviderRowset object may get access to a
SyncProvider object in one of the following two ways:
CachedRowSet crs = new CachedRowSet(
"com.fred.providers.HighAvailabilitySyncProvider");
setSyncProvider method
CachedRowSet crs = new CachedRowSet();
crs.setSyncProvider("com.fred.providers.HighAvailabilitySyncProvider");
By default, the reference implementations of the RowSet synchronization
providers are always available to the Java platform.
If no other pluggable synchronization providers have been correctly
registered, the SyncFactory will automatically generate
an instance of the default SyncProvider reference implementation.
Thus, in the preceding code fragment, if no implementation named
com.fred.providers.HighAvailabilitySyncProvider has been
registered with the SyncFactory instance, crs will be
assigned the default provider in the reference implementation, which is
com.sun.rowset.providers.RIOptimisticProvider.
RowSet object
and a data source violates
the original query or the underlying data source constraints, this will
result in undefined behavior for all disconnected RowSet implementations
and their designated SyncProvider implementations.
Not defining the behavior when such violations occur offers greater flexibility
for a SyncProvider
implementation to determine its own best course of action.
A SyncProvider implementation
may choose to implement a specific handler to
handle a subset of query violations.
However if an original query violation or a more general data source constraint
violation is not handled by the SyncProvider implementation,
all SyncProvider
objects must throw a SyncProviderException.
RowSet object to be populated
from an SQL query that is formulated originally from an SQL VIEW.
While in many cases it is possible for an update to be performed to an
underlying view, such an update requires additional metadata, which may vary.
The SyncProvider class provides two constants to indicate whether
an implementation supports updating an SQL VIEW.
NONUPDATABLE_VIEW_SYNC - Indicates that a SyncProvider
implementation does not support synchronization with an SQL VIEW as the
underlying source of data for the RowSet object.
UPDATABLE_VIEW_SYNC - Indicates that a
SyncProvider implementation
supports synchronization with an SQL VIEW as the underlying source
of data.
The default is for a RowSet object not to be updatable if it was
populated with data from an SQL VIEW.
SyncProvider ConstantsSyncProvider class provides three sets of constants that
are used as return values or parameters for SyncProvider methods.
SyncProvider objects may be implemented to perform synchronization
between a RowSet object and its underlying data source with varying
degrees of care. The first group of constants indicate how synchronization
is handled. For example, GRADE_NONE indicates that a
SyncProvider object will not take any care to see what data is
valid and will simply write the RowSet data to the data source.
GRADE_MODIFIED_AT_COMMIT indicates that the provider will check
only modified data for validity. Other grades check all data for validity
or set locks when data is modified or loaded.
SyncProvider object
SyncProvider object can
perform updates to an SQL VIEW javax.sql.rowset.spi.SyncFactory , javax.sql.rowset.spi.SyncFactoryException
| Modifier and Type | Field and Description |
|---|---|
| public static final int | DATASOURCE_DB_LOCK
Indicates that a lock is placed on the entire data source that is the source of
data for the |
| public static final int | DATASOURCE_NO_LOCK
Indicates that no locks remain on the originating data source. |
| public static final int | DATASOURCE_ROW_LOCK
Indicates that a lock is placed on the rows that are touched by the original
SQL statement used to populate the |
| public static final int | DATASOURCE_TABLE_LOCK
Indicates that a lock is placed on all tables that are touched by the original
SQL statement used to populate the |
| public static final int | GRADE_CHECK_ALL_AT_COMMIT
Indicates a high level optimistic synchronization grade with respect to the originating data source. |
| public static final int | GRADE_CHECK_MODIFIED_AT_COMMIT
Indicates a low level optimistic synchronization grade with respect to the originating data source. |
| public static final int | GRADE_LOCK_WHEN_LOADED
Indicates the most pessimistic synchronization grade with respect to the originating data source. |
| public static final int | GRADE_LOCK_WHEN_MODIFIED
Indicates a pessimistic synchronization grade with respect to the originating data source. |
| public static final int | GRADE_NONE
Indicates that no synchronization with the originating data source is provided. |
| public static final int | NONUPDATABLE_VIEW_SYNC
Indicates that a |
| public static final int | UPDATABLE_VIEW_SYNC
Indicates that a |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public abstract int | Returns: a constant indicating the current level of data source lock active in thisSyncProvider object;
one of the following:
SyncProvider.DATASOURCE_NO_LOCK,
SyncProvider.DATASOURCE_ROW_LOCK,
SyncProvider.DATASOURCE_TABLE_LOCK,
SyncProvider.DATASOURCE_DB_LOCK
Returns the current data source lock severity level active in this
|
| public abstract int | Returns: an int that is one of the following constants: SyncProvider.GRADE_NONE, SyncProvider.GRADE_CHECK_MODIFIED_AT_COMMIT, SyncProvider.GRADE_CHECK_ALL_AT_COMMIT, SyncProvider.GRADE_LOCK_WHEN_MODIFIED, SyncProvider.GRADE_LOCK_WHEN_LOADEDReturns a constant indicating the
grade of synchronization a |
| public abstract String | Returns: aString object with the fully qualified class name of
this SyncProvider objectReturns the unique identifier for this |
| public abstract RowSetReader | Returns: ajavax.sql.RowSetReader objectReturns a |
| public abstract RowSetWriter | Returns: ajavax.sql.RowSetWriter objectReturns a |
| public abstract String | Returns: aString detailing the vendor name of this
SyncProvider implementationReturns the vendor name of this |
| public abstract String | Returns: aString detailing the release version of the
SyncProvider implementationReturns the release version of this |
| public abstract void | setDataSourceLock(int
one of the following constants indicating the severity
level of data source lock required:
datasource_lock)
SyncProvider.DATASOURCE_NO_LOCK,
SyncProvider.DATASOURCE_ROW_LOCK,
SyncProvider.DATASOURCE_TABLE_LOCK,
SyncProvider.DATASOURCE_DB_LOCK,
Sets a lock on the underlying data source at the level indicated by datasource_lock. |
| public abstract int | Returns: anint saying whether this SyncProvider
object supports updating an SQL VIEW; one of the
following:
SyncProvider.UPDATABLE_VIEW_SYNC,
SyncProvider.NONUPDATABLE_VIEW_SYNCReturns whether this |
| DATASOURCE_DB_LOCK | back to summary |
|---|---|
| public static final int DATASOURCE_DB_LOCK Indicates that a lock is placed on the entire data source that is the source of
data for the | |
| DATASOURCE_NO_LOCK | back to summary |
|---|---|
| public static final int DATASOURCE_NO_LOCK Indicates that no locks remain on the originating data source. This is the default
lock setting for all | |
| DATASOURCE_ROW_LOCK | back to summary |
|---|---|
| public static final int DATASOURCE_ROW_LOCK Indicates that a lock is placed on the rows that are touched by the original
SQL statement used to populate the | |
| DATASOURCE_TABLE_LOCK | back to summary |
|---|---|
| public static final int DATASOURCE_TABLE_LOCK Indicates that a lock is placed on all tables that are touched by the original
SQL statement used to populate the | |
| GRADE_CHECK_ALL_AT_COMMIT | back to summary |
|---|---|
| public static final int GRADE_CHECK_ALL_AT_COMMIT Indicates a high level optimistic synchronization grade with
respect to the originating data source.
A | |
| GRADE_CHECK_MODIFIED_AT_COMMIT | back to summary |
|---|---|
| public static final int GRADE_CHECK_MODIFIED_AT_COMMIT Indicates a low level optimistic synchronization grade with
respect to the originating data source.
A | |
| GRADE_LOCK_WHEN_LOADED | back to summary |
|---|---|
| public static final int GRADE_LOCK_WHEN_LOADED Indicates the most pessimistic synchronization grade with
respect to the originating
data source. A | |
| GRADE_LOCK_WHEN_MODIFIED | back to summary |
|---|---|
| public static final int GRADE_LOCK_WHEN_MODIFIED Indicates a pessimistic synchronization grade with
respect to the originating data source.
A | |
| GRADE_NONE | back to summary |
|---|---|
| public static final int GRADE_NONE Indicates that no synchronization with the originating data source is
provided. A | |
| NONUPDATABLE_VIEW_SYNC | back to summary |
|---|---|
| public static final int NONUPDATABLE_VIEW_SYNC Indicates that a | |
| UPDATABLE_VIEW_SYNC | back to summary |
|---|---|
| public static final int UPDATABLE_VIEW_SYNC Indicates that a | |
| SyncProvider | back to summary |
|---|---|
| public SyncProvider() Creates a default | |
| getDataSourceLock | back to summary |
|---|---|
| public abstract int getDataSourceLock() throws SyncProviderException Returns the current data source lock severity level active in this
| |
| getProviderGrade | back to summary |
|---|---|
| public abstract int getProviderGrade() Returns a constant indicating the
grade of synchronization a
| |
| getProviderID | back to summary |
|---|---|
| public abstract String getProviderID() Returns the unique identifier for this
| |
| getRowSetReader | back to summary |
|---|---|
| public abstract RowSetReader getRowSetReader() Returns a
| |
| getRowSetWriter | back to summary |
|---|---|
| public abstract RowSetWriter getRowSetWriter() Returns a
| |
| getVendor | back to summary |
|---|---|
| public abstract String getVendor() Returns the vendor name of this
| |
| getVersion | back to summary |
|---|---|
| public abstract String getVersion() Returns the release version of this
| |
| setDataSourceLock | back to summary |
|---|---|
| public abstract void setDataSourceLock(int datasource_lock) throws SyncProviderException Sets a lock on the underlying data source at the level indicated by
datasource_lock. This should cause the
| |
| supportsUpdatableView | back to summary |
|---|---|
| public abstract int supportsUpdatableView() Returns whether this
| |