com.sun.rowset.providers
Class RIXMLProvider

java.lang.Object
  extended byjavax.sql.rowset.spi.SyncProvider
      extended bycom.sun.rowset.providers.RIXMLProvider

public final class RIXMLProvider
extends SyncProvider

A reference implementation of a JDBC RowSet synchronization provider with the ability to read and write rowsets in well formed XML using the standard WebRowSet schema.

1.0 Background

This synchronization provider is registered with the SyncFactory by default as the com.sun.rowset.providers.RIXMLProvider.

A WebRowSet object uses an RIXMLProvider implementation to read an XML data source or to write itself in XML format using the WebRowSet XML schema definition available at

     http://java.sun.com/xml/ns/jdbc/webrowset.xsd
 
The RIXMLProvider implementation has a synchronization level of GRADE_NONE, which means that it does no checking at all for conflicts. It simply writes a WebRowSet object to a file.

2.0 Usage

A WebRowSet implementation is created with an RIXMLProvider by default.
     WebRowSet wrs = new FooWebRowSetImpl();
 
The SyncFactory always provides an instance of RIOptimisticProvider when no provider is specified, but the implementation of the default constructor for WebRowSet sets the provider to be the RIXMLProvider implementation. Therefore, the following line of code is executed behind the scenes as part of the implementation of the default constructor.
     wrs.setSyncProvider("com.sun.rowset.providers.RIXMLProvider"); 
 
See the standard RowSet reference implementations in the com.sun.rowset package for more details.

Author:
Jonathan Bruce
See Also:
SyncProvider, SyncProviderException, SyncFactory, SyncFactoryException

Field Summary
 
Fields inherited from class javax.sql.rowset.spi.SyncProvider
DATASOURCE_DB_LOCK, DATASOURCE_NO_LOCK, DATASOURCE_ROW_LOCK, DATASOURCE_TABLE_LOCK, GRADE_CHECK_ALL_AT_COMMIT, GRADE_CHECK_MODIFIED_AT_COMMIT, GRADE_LOCK_WHEN_LOADED, GRADE_LOCK_WHEN_MODIFIED, GRADE_NONE, NONUPDATABLE_VIEW_SYNC, UPDATABLE_VIEW_SYNC
 
Constructor Summary
RIXMLProvider()
          This provider is available to all JDBC RowSet implementations as the default persistence provider.
 
Method Summary
 int getDataSourceLock()
          Returns the default DATASOURCE_LOCK behavior of this reader
 int getProviderGrade()
          Returns the SyncProvider grade of syncrhonization that RowSet object instances can expect when using this implementation.
 java.lang.String getProviderID()
          Returns "javax.sql.rowset.providers.RIXMLProvider", which is the fully qualified class name of this provider implementation.
 javax.sql.RowSetReader getRowSetReader()
          Returns a null object as RowSetWriter objects are not returned by this SyncProvider
 javax.sql.RowSetWriter getRowSetWriter()
          Returns a null object as RowSetWriters are not returned by this SyncProvider
 java.lang.String getVendor()
          Returns the vendor name of the Reference Implemntation Optimistic Syncchronication Provider
 java.lang.String getVersion()
          Returns the release version ID of the Reference Implementation Optimistic Synchronization Provider.
 XmlReader getXmlReader()
          Retrieves the reader that this WebRowSet object will call when its readXml method is called.
 XmlWriter getXmlWriter()
          Retrieves the writer that this WebRowSet object will call when its writeXml method is called.
 void setDataSourceLock(int lock)
          Throws an unsupported operation exception as this method does function with non-locking XML data sources.
 void setXmlReader(XmlReader reader)
          Sets this WebRowSet object's reader to the given XmlReader object.
 void setXmlWriter(XmlWriter writer)
          Sets this WebRowSet object's writer to the given XmlWriter object.
 int supportsUpdatableView()
          Returns the default UPDATABLE_VIEW behavior of this reader
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RIXMLProvider

public RIXMLProvider()
This provider is available to all JDBC RowSet implementations as the default persistence provider.

Method Detail

getProviderID

public java.lang.String getProviderID()
Returns "javax.sql.rowset.providers.RIXMLProvider", which is the fully qualified class name of this provider implementation.

Specified by:
getProviderID in class SyncProvider
Returns:
a String object with the fully specified class name of this RIOptimisticProvider implementation

setXmlReader

public void setXmlReader(XmlReader reader)
                  throws java.sql.SQLException
Sets this WebRowSet object's reader to the given XmlReader object.

Throws:
java.sql.SQLException - if a database access error occurs

setXmlWriter

public void setXmlWriter(XmlWriter writer)
                  throws java.sql.SQLException
Sets this WebRowSet object's writer to the given XmlWriter object.

Throws:
java.sql.SQLException - if a database access error occurs

getXmlReader

public XmlReader getXmlReader()
                       throws java.sql.SQLException
Retrieves the reader that this WebRowSet object will call when its readXml method is called.

Returns:
the XmlReader object for this SyncProvider
Throws:
java.sql.SQLException - if a database access error occurs

getXmlWriter

public XmlWriter getXmlWriter()
                       throws java.sql.SQLException
Retrieves the writer that this WebRowSet object will call when its writeXml method is called.

Returns:
the XmlWriter for this SyncProvider
Throws:
java.sql.SQLException - if a database access error occurs

getProviderGrade

public int getProviderGrade()
Returns the SyncProvider grade of syncrhonization that RowSet object instances can expect when using this implementation. As this implementation provides no synchonization facilities to the XML data source, the lowest grade is returned.

Specified by:
getProviderGrade in class SyncProvider
Returns:
the SyncProvider syncronization grade of this provider; must be one of the following constants:
          SyncProvider.GRADE_NONE,
          SyncProvider.GRADE_MODIFIED_AT_COMMIT,
          SyncProvider.GRADE_CHECK_ALL_AT_COMMIT,
          SyncProvider.GRADE_LOCK_WHEN_MODIFIED,
          SyncProvider.GRADE_LOCK_WHEN_LOADED
       

supportsUpdatableView

public int supportsUpdatableView()
Returns the default UPDATABLE_VIEW behavior of this reader

Specified by:
supportsUpdatableView in class SyncProvider
Returns:
an int saying whether this SyncProvider object supports updating an SQL VIEW; one of the following: SyncProvider.UPDATABLE_VIEW_SYNC, SyncProvider.NONUPDATABLE_VIEW_SYNC

getDataSourceLock

public int getDataSourceLock()
                      throws SyncProviderException
Returns the default DATASOURCE_LOCK behavior of this reader

Specified by:
getDataSourceLock in class SyncProvider
Returns:
a constant indicating the current level of data source lock active in this SyncProvider object; one of the following:
           SyncProvider.DATASOURCE_NO_LOCK,
           SyncProvider.DATASOURCE_ROW_LOCK,
           SyncProvider.DATASOURCE_TABLE_LOCK,
           SyncProvider.DATASOURCE_DB_LOCK     
 
Throws:
SyncProviderException
See Also:
SyncProvider.setDataSourceLock(int)

setDataSourceLock

public void setDataSourceLock(int lock)
                       throws SyncProviderException
Throws an unsupported operation exception as this method does function with non-locking XML data sources.

Specified by:
setDataSourceLock in class SyncProvider
Parameters:
lock - one of the following constants indicating the severity level of data source lock required:
           SyncProvider.DATASOURCE_NO_LOCK,
           SyncProvider.DATASOURCE_ROW_LOCK,
           SyncProvider.DATASOURCE_TABLE_LOCK,
           SyncProvider.DATASOURCE_DB_LOCK,          
 
Throws:
SyncProviderException - if an unsupported data source locking level is set.
See Also:
SyncProvider.getDataSourceLock()

getRowSetWriter

public javax.sql.RowSetWriter getRowSetWriter()
Returns a null object as RowSetWriters are not returned by this SyncProvider

Specified by:
getRowSetWriter in class SyncProvider
Returns:
a javax.sql.RowSetWriter object

getRowSetReader

public javax.sql.RowSetReader getRowSetReader()
Returns a null object as RowSetWriter objects are not returned by this SyncProvider

Specified by:
getRowSetReader in class SyncProvider
Returns:
a javax.sql.RowSetReader object

getVersion

public java.lang.String getVersion()
Returns the release version ID of the Reference Implementation Optimistic Synchronization Provider.

Specified by:
getVersion in class SyncProvider
Returns:
the String detailing the version number of this SyncProvider

getVendor

public java.lang.String getVendor()
Returns the vendor name of the Reference Implemntation Optimistic Syncchronication Provider

Specified by:
getVendor in class SyncProvider
Returns:
the String detailing the vendor name of this SyncProvider