October 27, 2004

SwingSet 0.9.0-beta Released

Brian E. Pangburn writes "New Roads, LA - October 26, 2004 - We have just released version 0.9.0-beta of SwingSet, an open source Java toolkit that allows the standard Java Swing components to be made database aware. This is a major release with an entirely new datasource abstraction layer. Our goal for the 0.9.X series is to focus on bug squashing and possibly some minor feature enhancements. We hope to have a 1.0 production release by the end of 2004. See http://swingset.sourceforge.net for a detailed list of features and additional information. A Java Web Start version of the SwingSet demo application is available from http://swingset.sourceforge.net/SwingSet.jnlp

For version 0.9.0 all of the SwingSet components are now based on a new SSRowSet interface rather than Sun's existing RowSet interface. The SSRowSet differs from RowSet in two important ways:
    1. SSRowSet extends serializable which greatly facilitates serialization/deserialization in the rest of the SwingSet components
    2. SSRowSet only contains methods necessary to support the data types in used by SSTextDocument which will make writing SSRowSet implementations for non-updatable RowSets and other non-database datasources (e.g. a HashMap) much easier

A SSJdbcRowSetImpl implementation of SSRowSet is provided to replace the JdbcRowSetImpl used in most existing SwingSet applications. It is basically a serialized wrapper of JdbcRowSetImpl. It can be used in conjunction with the new SSConnection, a serialized wrapper of the Connection interface, which handles serialization/deserialization of database connection info (path, username, password, etc.). Finally, an SSRowSetAdapter is provided with empty method implementations of everything in SSRowSet. This adapter can be easily extended with non-empty method implementations for non-database datasources.

To accommodate non-updatable RowSets, SSJdbcRowSetImpl can be extended with custom updateXYZ() methods to handle database updates via INSERT/UPDATE queries. SSJdbcRowSetImpl can also serve as a template for writing SSRowSet wrappers for other RowSets (e.g. CachedRowSet, WebRowSet, etc.).

Unfortunately, the introduction of the SSRowSet requires modification of existing SwingSet applications, but with the SSJdbcRowSetImpl and SSConnection, these changes should be minimal. In order to provide maximum migration time, the 0.8.3-beta version of SwingSet was released on 10-22-2004 with all of the latest bugfixes and enhancements. Other than the new datasource abstraction layer, 0.8.3 and 0.9.0 are identical. Below is an example of changes required
to transition to 0.9.0 and later versions of SwingSet:

        *********************************
        OLD - Connection/RowSet
        *********************************
        import java.sql.*;
        import com.sun.rowset.JdbcRowSetImpl;

        Connection conn = null;
        JdbcRowSetImpl rowset = null;

        Class.forName("org.postgresql.Driver");
        conn = DriverManager.getConnection("jdbc:postgresql://pgs erver.greatmindsworking.com/suppliers_and_parts"," swingset","test");
        rowset = new JdbcRowSetImpl(conn);

        *********************************
        NEW - SSConnection/SSRowSet
        *********************************
        import java.sql.*;// still needed
        import com.nqadmin.swingSet.datasources.SSJdbcRowSetImpl;
        import com.nqadmin.swingSet.datasources.SSConnection;

        SSConnection ssConnection = null;
        SSJdbcRowSetImpl rowset = null;

        ssConnection = new SSConnection("jdbc:postgresql://pgserver.greatmind sworking.com/suppliers_and_parts","swingset", "test");
        ssConnection.setDriverName("org.postgresql.Driver" );
        ssConnection.createConnection();
        rowset = new SSJdbcRowSetImpl(ssConnection);"

Click Here!