APIdia Launch Partner
Top Description Fields Constructors Methods
com.sun.rowset.providers

public final Class RIOptimisticProvider

extends SyncProvider
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable
Imports
com.sun.rowset.JdbcRowSetResourceBundle, javax.sql.*, java.io.*, javax.sql.rowset.spi.*, com.sun.rowset.internal.*

The reference implementation of a JDBC Rowset synchronization provider providing optimistic synchronization with a relational datastore using any JDBC technology-enabled driver.

1.0 Background

This synchronization provider is registered with the SyncFactory by default as the com.sun.rowset.providers.RIOptimisticProvider. As an extension of the SyncProvider abstract class, it provides the reader and writer classes required by disconnected rowsets as javax.sql.RowSetReader and javax.sql.RowSetWriter interface implementations. As a reference implementation, RIOptimisticProvider provides a fully functional implementation offering a medium grade classification of synchronization, namely GRADE_CHECK_MODIFIED_AT_COMMIT. A disconnected RowSet implementation using the RIOptimisticProvider can expect the writer to check only rows that have been modified in the RowSet against the values in the data source. If there is a conflict, that is, if a value in the data source has been changed by another party, the RIOptimisticProvider will not write any of the changes to the data source and will throw a SyncProviderException object.

2.0 Usage

Standard disconnected RowSet implementations may opt to use this SyncProvider implementation in one of two ways:
  1. By specifically calling the setSyncProvider method defined in the CachedRowSet interface
        CachedRowset crs = new FooCachedRowSetImpl();
        crs.setSyncProvider("com.sun.rowset.providers.RIOptimisticProvider");
    
  2. By specifying it in the constructor of the RowSet implementation
        CachedRowset crs = new FooCachedRowSetImpl(
                            "com.sun.rowset.providers.RIOptimisticProvider");
    
Note that because the RIOptimisticProvider implementation is the default provider, it will always be the provider when no provider ID is specified to the constructor.

See the standard RowSet reference implementations in the com.sun.rowset package for more details.

Author
Jonathan Bruce
See Also
javax.sql.rowset.spi.SyncProvider, javax.sql.rowset.spi.SyncProviderException, javax.sql.rowset.spi.SyncFactory, javax.sql.rowset.spi.SyncFactoryException

Field Summary

Modifier and TypeField and Description
private String
providerID

The unique provider identifier.

private CachedRowSetReader
private JdbcRowSetResourceBundle
resBundle

ResourceBundle

pack-priv static final long
private String
vendorName

The vendor name of this SyncProvider implementation

private String
versionNumber

The version number of this SyncProvider implementation

private CachedRowSetWriter
Inherited from javax.sql.rowset.spi.SyncProvider:
DATASOURCE_DB_LOCKDATASOURCE_NO_LOCKDATASOURCE_ROW_LOCKDATASOURCE_TABLE_LOCKGRADE_CHECK_ALL_AT_COMMITGRADE_CHECK_MODIFIED_AT_COMMITGRADE_LOCK_WHEN_LOADEDGRADE_LOCK_WHEN_MODIFIEDGRADE_NONENONUPDATABLE_VIEW_SYNCUPDATABLE_VIEW_SYNC

Constructor Summary

AccessConstructor and Description
public
RIOptimisticProvider()

Creates an RIOptimisticProvider object initialized with the fully qualified class name of this SyncProvider implementation and a default reader and writer.

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

SyncProvider.DATASOURCE_NO_LOCK. The reference implementation does not support data source locks.
getDataSourceLock
()

Implements abstract javax.sql.rowset.spi.SyncProvider.getDataSourceLock.

Returns the active data source lock severity in this reference implementation of the SyncProvider abstract class.

public int
getProviderGrade()

Implements abstract javax.sql.rowset.spi.SyncProvider.getProviderGrade.

Returns the SyncProvider grade of synchronization that RowSet objects can expect when using this implementation.

public String

Returns:

String Provider ID of this persistence provider
getProviderID
()

Implements abstract javax.sql.rowset.spi.SyncProvider.getProviderID.

Returns the 'javax.sql.rowset.providers.RIOptimisticProvider' provider identification string.

public RowSetReader

Returns:

the javax.sql.RowSetReader object for this RIOptimisticProvider object
getRowSetReader
()

Implements abstract javax.sql.rowset.spi.SyncProvider.getRowSetReader.

Returns the javax.sql.RowSetReader object for this RIOptimisticProvider object.

public RowSetWriter

Returns:

the javax.sql.RowSetWriter object for this RIOptimisticProvider object
getRowSetWriter
()

Implements abstract javax.sql.rowset.spi.SyncProvider.getRowSetWriter.

Returns the javax.sql.RowSetWriter object for this RIOptimisticProvider object.

public String

Returns:

the String detailing the vendor name of this SyncProvider
getVendor
()

Implements abstract javax.sql.rowset.spi.SyncProvider.getVendor.

Returns the vendor name of the Reference Implementation Optimistic Synchronization Provider

public String

Returns:

the String detailing the version number of this SyncProvider
getVersion
()

Implements abstract javax.sql.rowset.spi.SyncProvider.getVersion.

Returns the release version ID of the Reference Implementation Optimistic Synchronization Provider.

private void
public void
setDataSourceLock(int
An int indicating the level of locking to be set; must be one of the following constants:
      SyncProvider.DATASOURCE_NO_LOCK,
      SyncProvider.DATASOURCE_ROW_LOCK,
      SyncProvider.DATASOURCE_TABLE_LOCK,
      SyncProvider.DATASOURCE_DB_LOCk
datasource_lock
)

Implements abstract javax.sql.rowset.spi.SyncProvider.setDataSourceLock.

Modifies the data source lock severity according to the standard SyncProvider classifications.

public int

Returns:

SyncProvider.NONUPDATABLE_VIEW_SYNC. The the reference implementation does not support updating tables that are the source of a view.
supportsUpdatableView
()

Implements abstract javax.sql.rowset.spi.SyncProvider.supportsUpdatableView.

Returns the supported updatable view abilities of the reference implementation of the SyncProvider abstract class.

Field Detail

providerIDback to summary
private String providerID

The unique provider identifier.

readerback to summary
private CachedRowSetReader reader
resBundleback to summary
private JdbcRowSetResourceBundle resBundle

ResourceBundle

serialVersionUIDback to summary
pack-priv static final long serialVersionUID
vendorNameback to summary
private String vendorName

The vendor name of this SyncProvider implementation

versionNumberback to summary
private String versionNumber

The version number of this SyncProvider implementation

writerback to summary
private CachedRowSetWriter writer

Constructor Detail

RIOptimisticProviderback to summary
public RIOptimisticProvider()

Creates an RIOptimisticProvider object initialized with the fully qualified class name of this SyncProvider implementation and a default reader and writer.

This provider is available to all disconnected RowSet implementations as the default persistence provider.

Method Detail

getDataSourceLockback to summary
public int getDataSourceLock() throws SyncProviderException

Implements abstract javax.sql.rowset.spi.SyncProvider.getDataSourceLock.

Returns the active data source lock severity in this reference implementation of the SyncProvider abstract class.

Returns:int

SyncProvider.DATASOURCE_NO_LOCK. The reference implementation does not support data source locks.

Exceptions
SyncProviderException:

Doc from javax.sql.rowset.spi.SyncProvider.getDataSourceLock.

if an error occurs determining the data source locking level.

getProviderGradeback to summary
public int getProviderGrade()

Implements abstract javax.sql.rowset.spi.SyncProvider.getProviderGrade.

Returns the SyncProvider grade of synchronization that RowSet objects can expect when using this implementation. As an optimistic synchronization provider, the writer will only check rows that have been modified in the RowSet object.

getProviderIDback to summary
public String getProviderID()

Implements abstract javax.sql.rowset.spi.SyncProvider.getProviderID.

Returns the 'javax.sql.rowset.providers.RIOptimisticProvider' provider identification string.

Returns:String

String Provider ID of this persistence provider

getRowSetReaderback to summary
public RowSetReader getRowSetReader()

Implements abstract javax.sql.rowset.spi.SyncProvider.getRowSetReader.

Returns the javax.sql.RowSetReader object for this RIOptimisticProvider object. This is the reader that will populate a RowSet object using this RIOptimisticProvider.

Returns:RowSetReader

the javax.sql.RowSetReader object for this RIOptimisticProvider object

getRowSetWriterback to summary
public RowSetWriter getRowSetWriter()

Implements abstract javax.sql.rowset.spi.SyncProvider.getRowSetWriter.

Returns the javax.sql.RowSetWriter object for this RIOptimisticProvider object. This is the writer that will write changes made to the Rowset object back to the data source.

Returns:RowSetWriter

the javax.sql.RowSetWriter object for this RIOptimisticProvider object

getVendorback to summary
public String getVendor()

Implements abstract javax.sql.rowset.spi.SyncProvider.getVendor.

Returns the vendor name of the Reference Implementation Optimistic Synchronization Provider

Returns:String

the String detailing the vendor name of this SyncProvider

getVersionback to summary
public String getVersion()

Implements abstract javax.sql.rowset.spi.SyncProvider.getVersion.

Returns the release version ID of the Reference Implementation Optimistic Synchronization Provider.

Returns:String

the String detailing the version number of this SyncProvider

readObjectback to summary
private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException
setDataSourceLockback to summary
public void setDataSourceLock(int datasource_lock) throws SyncProviderException

Implements abstract javax.sql.rowset.spi.SyncProvider.setDataSourceLock.

Modifies the data source lock severity according to the standard SyncProvider classifications.

Parameters
datasource_lock:int

An int indicating the level of locking to be set; must be one of the following constants:

      SyncProvider.DATASOURCE_NO_LOCK,
      SyncProvider.DATASOURCE_ROW_LOCK,
      SyncProvider.DATASOURCE_TABLE_LOCK,
      SyncProvider.DATASOURCE_DB_LOCk
Exceptions
SyncProviderException:
if the parameter specified is not SyncProvider.DATASOURCE_NO_LOCK
supportsUpdatableViewback to summary
public int supportsUpdatableView()

Implements abstract javax.sql.rowset.spi.SyncProvider.supportsUpdatableView.

Returns the supported updatable view abilities of the reference implementation of the SyncProvider abstract class.

Returns:int

SyncProvider.NONUPDATABLE_VIEW_SYNC. The the reference implementation does not support updating tables that are the source of a view.