rowset

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » 6.0 JDK Modules com.sun » rowset 
OpenJDK: rowset
License:The GNU General Public License (GPL)
URL:https://openjdk.dev.java.net
Description:
Package NameComment
com.sun.rowset com.sun.rowset Package Provides five standard implementations of the standard JDBC RowSet implementation interface definitions. These reference implementations are included with the J2SE version 1.5 platform and represent the benchmark standard RowSet implementations as verified by the Test Compatibility Kit (TCK) as mandated by the Java Community Process.

1.0 Available JDBC RowSet Reference Implementations

The following implementations are provided:
JdbcRowSetImpl - The javax.sql.rowset.JdbcRowSet interface reference implementation.

CachedRowSetImpl - The javax.sql.rowset.CachedRowSet interface reference implementation.

WebRowSetImpl - The javax.sql.rowset.WebRowSet interface reference implementation.

FilteredRowSetImpl - The javax.sql.rowset.FilteredRowSet interface reference implementation.

JoinRowSetImpl - The javax.sql.rowset.JoinRowSet interface reference implementation.
All details on their expected behavior, including their interactions with the SyncProvider SPI and helper classes are provided in the interface definitions in the javax.sql.rowset package specification.

2.0 Usage

The reference implementations represent robust implementations of the standard RowSet interfaces defined in the javax.sql.rowset package. All disconnected RowSet implementations, such as the CachedRowSetImpl and WebRowSetImpl, are flexible enough to use the SyncFactory SPIs to leverage non-reference implementation SyncProvider implementations to obtain differing synchronization semantics. Furthermore, developers and vendors alike are free to use these implementations and integrate them into their products just as they can with to other components of the Java platform.

3.0 Extending the JDBC RowSet Implementations

The JDBC RowSet reference implementations are provided as non-final classess so that any developer can extend them to provider additional features while maintaining the core required standard functionality and compatibility. It is anticipated that many vendors and developers will extend the standard feature set to their their particular needs. The website for JDBC Technology will provider a portal where implementations can be listed, similar to the way it provides a site for JDBC drivers.

com.sun.rowset.internal
com.sun.rowset.providers javax.sql.rowset.providers Package Repository for the RowSet reference implementations of the SyncProvider abstract class. These implementations provide a disconnected RowSet object with the ability to synchronize the data in the underlying data source with its data. These implementations are provided as the default SyncProvider implementations and are accessible via the SyncProvider SPI managed by the SyncFactory.

1.0 SyncProvider Reference Implementations

The main job of a SyncProvider implementation is to manage the reader and writer mechanisms. The SyncProvider SPI, as specified in the javax.sql.rowset.spi package, provides a pluggable mechanism by which javax.sql.RowSetReader and javax.sql.RowSetWriter implementations can be supplied to a disconnected RowSet object.

A reader, a javax.sql.RowSetReader object, does the work necessary to populate a RowSet object with data. A writer, a javax.sql.RowSetWriter object, does the work necessary for synchronizing a RowSet object's data with the data in the originating source of data. Put another way, a writer writes a RowSet object's data back to the data source.

Generally speaking, the course of events is this. The reader makes a connection to the data source and reads the data from a ResultSet object into its RowSet object. Then it closes the connection. While the RowSet object is disconnected, an application makes some modifications to the data and calls the method acceptChanges. At this point, the writer is called to write the changes back to the database table or view from which the original data came. This is called synchronization.

If the data in the originating data source has not changed, there is no problem with just writing the RowSet object's new data to the data source. If it has changed, however, there is a conflict that needs to be resolved. One way to solve the problem is not to let the data in the data source be changed in the first place, which can be done by setting locks on a row, a table, or the whole data source. Setting locks is a way to avoid conflicts, but it can be very expensive. Another approach, which is at the other end of the spectrum, is simply to assume that no conflicts will occur and thus do nothing to avoid conflicts. Different SyncProvider implementations may handle synchronization in any of these ways, varying from doing no checking for conflicts, to doing various levels of checking, to guaranteeing that there are no conflicts.

The SyncProvider class offers methods to help a RowSet object discover and manage how a provider handles synchronization. The method getProviderGrade returns the grade of synchronization a provider offers. An application can direct the provider to use a particular level of locking by calling the method setDataSourceLock and specifying the level of locking desired. If a RowSet object's data came from an SQL VIEW, an application may call the method supportsUpdatableView to find out whether the VIEW can be updated.

Synchronization is done completely behind the scenes, so it is third party vendors of synchronization provider implementations who have to take care of this complex task. Application programmers can decide which provider to use and the level of locking to be done, but they are free from having to worry about the implementation details.

The JDBC RowSet Implementations reference implementation provides two implementations of the SyncProvider class:

  • RIOptimisticProvider - provides the javax.sql.RowSetReader and javax.sql.RowSetWriter interface implementations and provides an optimistic concurrency model for synchronization. This model assumes that there will be few conflicts and therefore uses a relatively low grade of synchronization. If no other provider is available, this is the default provider that the SyncFactory will supply to a RowSet object.
  • RIXMLProvider - provides the XmlReader (an extension of the javax.sql.RowSetReader interface) and the XmlWriter (an extension of the javax.sql.RowSetWriter interface) to enable WebRowSet objects to write their state to a well formed XML document according to the WebRowSet XML schema definition.

2.0 Basics in RowSet Population & Synchronization

A rowset's first task is to populate itself with rows of column values. Generally, these rows will come from a relational database, so a rowset has properties that supply what is necessary for making a connection to a database and executing a query. A rowset that does not need to establish a connection and execute a command, such as one that gets its data from a tabular file instead of a relational database, does not need to have these properties set. The vast majority of RowSets, however, do need to set these properties. The general rule is that a RowSet is required to set only the properties that it uses.

The command property contains the query that determines what data a RowSet will contain. Rowsets have methods for setting a query's parameter(s), which means that a query can be executed multiple times with different parameters to produce different result sets. Or the query can be changed to something completely new to get a new result set.

Once a rowset contains the rows from a ResultSet object or some other data source, its column values can be updated, and its rows can be inserted or deleted. Any method that causes a change in the rowset's values or cursor position also notifies any object that has been registered as a listener with the rowset. So, for example, a table that displays the rowset's data in an applet can can be notified of changes and make updates as they occur.

The changes made to a rowset can be propagated back to the original data source to keep the rowset and its data source synchronized. Although this involves many operations behind the scenes, it is completely transparent to the application programmer and remains the concern of the RowSet provider developer. All an application has to do is invoke the method acceptChanges, and the data source backing the rowset will be updated to match the current values in the rowset.

A disconnected rowset, such as a CachedRowSet or WebRowSet object, establishes a connection to populate itself with data from a database and then closes the connection. The RowSet object will remain disconnected until it wants to propagate changes back to its database table, which is optional. To write its changes back to the database (synchronize with the database), the rowset establishes a connection, write the changes, and then once again disconnects itself.

3.0 Other Possible Implementations

There are many other possible implementations of the SyncProvider abstract class. One possibility is to employ a more robust synchronization model, which would give a RowSet object increased trust in the provider's ability to get any updates back to the original data source. Another possibility is a more formal synchronization mechanism such as SyncML (http://www.syncml.org/)


www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.