7192302: Remove JDBCRowSetImpl dependency on java.beans
authorlancea
Thu, 06 Sep 2012 13:16:19 -0400
changeset 13785 56dc8b1e89ba
parent 13784 b362a531f1b6
child 13786 dfe9a95e1c30
7192302: Remove JDBCRowSetImpl dependency on java.beans Reviewed-by: alanb, mchung
jdk/src/share/classes/com/sun/rowset/JdbcRowSetImpl.java
--- a/jdk/src/share/classes/com/sun/rowset/JdbcRowSetImpl.java	Thu Sep 06 14:07:12 2012 +0200
+++ b/jdk/src/share/classes/com/sun/rowset/JdbcRowSetImpl.java	Thu Sep 06 13:16:19 2012 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,7 +31,6 @@
 import java.io.*;
 import java.math.*;
 import java.util.*;
-import java.beans.*;
 
 import javax.sql.rowset.*;
 
@@ -83,12 +82,6 @@
      */
     private ResultSetMetaData resMD;
 
-    /**
-     * The property that helps to fire the property changed event when certain
-     * properties are changed in the <code>JdbcRowSet</code> object. This property
-     * is being added to satisfy Rave requirements.
-     */
-    private PropertyChangeSupport propertyChangeSupport;
 
     /**
      * The Vector holding the Match Columns
@@ -145,7 +138,6 @@
             throw new RuntimeException(ioe);
         }
 
-        propertyChangeSupport = new PropertyChangeSupport(this);
 
         initParams();
 
@@ -268,7 +260,6 @@
             throw new RuntimeException(ioe);
         }
 
-        propertyChangeSupport = new PropertyChangeSupport(this);
 
         initParams();
         // set the defaults
@@ -343,7 +334,6 @@
             throw new RuntimeException(ioe);
         }
 
-        propertyChangeSupport = new PropertyChangeSupport(this);
 
         initParams();
 
@@ -360,10 +350,6 @@
         setMaxRows(0);
         setMaxFieldSize(0);
 
-        // to ensure connection to a db call connect now
-        // and associate a conn with "this" object
-        // in this case.
-        conn = connect();
         setParams();
 
         setReadOnly(true);
@@ -435,7 +421,6 @@
             throw new RuntimeException(ioe);
         }
 
-        propertyChangeSupport = new PropertyChangeSupport(this);
 
         initParams();
 
@@ -620,12 +605,7 @@
 
     }
 
-    // An alternate solution is required instead of having the
-    // connect method as protected.
-    // This is a work around to assist Rave Team
-    // :ah
-
-    protected Connection connect() throws SQLException {
+    private Connection connect() throws SQLException {
 
         // Get a JDBC connection.
 
@@ -4056,9 +4036,7 @@
       // Added as per Rave requirements
 
       if( conn.getHoldability() != HOLD_CURSORS_OVER_COMMIT) {
-         ResultSet oldVal = rs;
          rs = null;
-         // propertyChangeSupport.firePropertyChange("ResultSet",oldVal,rs);
       }
     }
 
@@ -4119,9 +4097,7 @@
         // Makes the result ste handle null after rollback
         // Added as per Rave requirements
 
-        ResultSet oldVal = rs;
         rs = null;
-        // propertyChangeSupport.firePropertyChange("ResultSet", oldVal,rs);
     }
 
 
@@ -4247,12 +4223,6 @@
        rs = resultSet;
     }
 
-
-    // Over riding the setCommand from BaseRowSet for
-    // firing the propertyChangeSupport Event for
-    // Rave requirements when this property's value
-    // changes.
-
     /**
      * Sets this <code>JdbcRowSet</code> object's <code>command</code> property to
      * the given <code>String</code> object and clears the parameters, if any,
@@ -4277,28 +4247,19 @@
      * @see #getCommand
      */
     public void setCommand(String command) throws SQLException {
-       String oldVal;
 
        if (getCommand() != null) {
           if(!getCommand().equals(command)) {
-             oldVal = getCommand();
              super.setCommand(command);
              ps = null;
              rs = null;
-             propertyChangeSupport.firePropertyChange("command", oldVal,command);
           }
        }
        else {
           super.setCommand(command);
-          propertyChangeSupport.firePropertyChange("command", null,command);
        }
     }
 
-    // Over riding the setDataSourceName from BaseRowSet for
-    // firing the propertyChangeSupport Event for
-    // Rave requirements when this property's values
-    // changes.
-
     /**
      * Sets the <code>dataSourceName</code> property for this <code>JdbcRowSet</code>
      * object to the given logical name and sets this <code>JdbcRowSet</code> object's
@@ -4329,28 +4290,20 @@
      * @see #getDataSourceName
      */
     public void setDataSourceName(String dsName) throws SQLException{
-       String oldVal;
 
        if(getDataSourceName() != null) {
           if(!getDataSourceName().equals(dsName)) {
-             oldVal = getDataSourceName();
              super.setDataSourceName(dsName);
              conn = null;
              ps = null;
              rs = null;
-             propertyChangeSupport.firePropertyChange("dataSourceName",oldVal,dsName);
           }
        }
        else {
           super.setDataSourceName(dsName);
-          propertyChangeSupport.firePropertyChange("dataSourceName",null,dsName);
        }
     }
 
-    // Over riding the setUrl from BaseRowSet for
-    // firing the propertyChangeSupport Event for
-    // Rave requirements when this property's values
-    // changes.
 
     /**
      * Sets the Url property for this <code>JdbcRowSet</code> object
@@ -4394,29 +4347,20 @@
      */
 
     public void setUrl(String url) throws SQLException {
-       String oldVal;
 
        if(getUrl() != null) {
           if(!getUrl().equals(url)) {
-             oldVal = getUrl();
              super.setUrl(url);
              conn = null;
              ps = null;
              rs = null;
-             propertyChangeSupport.firePropertyChange("url", oldVal, url);
           }
        }
        else {
           super.setUrl(url);
-          propertyChangeSupport.firePropertyChange("url", null, url);
        }
     }
 
-    // Over riding the setUsername from BaseRowSet for
-    // firing the propertyChangeSupport Event for
-    // Rave requirements when this property's values
-    // changes.
-
      /**
      * Sets the username property for this <code>JdbcRowSet</code> object
      * to the given user name. Because it
@@ -4438,29 +4382,20 @@
      * @see #getUsername
      */
     public void setUsername(String uname) {
-       String oldVal;
 
        if( getUsername() != null) {
           if(!getUsername().equals(uname)) {
-             oldVal = getUsername();
              super.setUsername(uname);
              conn = null;
              ps = null;
              rs = null;
-             propertyChangeSupport.firePropertyChange("username",oldVal,uname);
           }
        }
        else{
           super.setUsername(uname);
-          propertyChangeSupport.firePropertyChange("username",null,uname);
        }
     }
 
-    // Over riding the setPassword from BaseRowSet for
-    // firing the propertyChangeSupport Event for
-    // Rave requirements when this property's values
-    // changes.
-
      /**
      * Sets the password property for this <code>JdbcRowSet</code> object
      * to the given <code>String</code> object. Because it
@@ -4481,21 +4416,17 @@
      *     that must be supplied to the database to create a connection
      */
     public void setPassword(String password) {
-       String oldVal;
 
        if ( getPassword() != null) {
           if(!getPassword().equals(password)) {
-             oldVal = getPassword();
              super.setPassword(password);
              conn = null;
              ps = null;
              rs = null;
-             propertyChangeSupport.firePropertyChange("password",oldVal,password);
           }
        }
        else{
           super.setPassword(password);
-          propertyChangeSupport.firePropertyChange("password",null,password);
        }
     }
 
@@ -4528,7 +4459,6 @@
 
        if(oldVal != type) {
            super.setType(type);
-           propertyChangeSupport.firePropertyChange("type",oldVal,type);
        }
 
     }
@@ -4561,78 +4491,6 @@
 
        if(oldVal != concur) {
            super.setConcurrency(concur);
-           propertyChangeSupport.firePropertyChange("concurrency",oldVal,concur);
-       }
-
-    }
-
-    /**
-     * Sets the transaction isolation property for this JDBC <code>RowSet</code> object to the given
-     * constant. The DBMS will use this transaction isolation level for
-     * transactions if it can.
-     * <p>
-     * For <code>RowSet</code> implementations such as
-     * the <code>CachedRowSet</code> that operate in a disconnected environment,
-     * the <code>SyncProvider</code> object being used
-     * offers complementary locking and data integrity options. The
-     * options described below are pertinent only to connected <code>RowSet</code>
-     * objects (<code>JdbcRowSet</code> objects).
-     *
-     * @param transIso one of the following constants, listed in ascending order:
-     *              <code>Connection.TRANSACTION_NONE</code>,
-     *              <code>Connection.TRANSACTION_READ_UNCOMMITTED</code>,
-     *              <code>Connection.TRANSACTION_READ_COMMITTED</code>,
-     *              <code>Connection.TRANSACTION_REPEATABLE_READ</code>, or
-     *              <code>Connection.TRANSACTION_SERIALIZABLE</code>
-     * @throws SQLException if the given parameter is not one of the Connection
-     *          constants
-     * @see javax.sql.rowset.spi.SyncFactory
-     * @see javax.sql.rowset.spi.SyncProvider
-     * @see #getTransactionIsolation
-     */
-    public void setTransactionIsolation(int transIso) throws SQLException {
-
-       int oldVal;
-
-       try {
-          oldVal = getTransactionIsolation();
-        }catch(NullPointerException ex) {
-           oldVal = 0;
-        }
-
-       if(oldVal != transIso) {
-           super.setTransactionIsolation(transIso);
-           propertyChangeSupport.firePropertyChange("transactionIsolation",oldVal,transIso);
-       }
-
-    }
-
-    /**
-     * Sets the maximum number of rows that this <code>RowSet</code> object may contain to
-     * the given number. If this limit is exceeded, the excess rows are
-     * silently dropped.
-     *
-     * @param mRows an <code>int</code> indicating the current maximum number
-     *     of rows; zero means that there is no limit
-     * @throws SQLException if an error occurs internally setting the
-     *     maximum limit on the number of rows that a JDBC <code>RowSet</code> object
-     *     can contain; or if <i>max</i> is less than <code>0</code>; or
-     *     if <i>max</i> is less than the <code>fetchSize</code> of the
-     *     <code>RowSet</code>
-     */
-    public void setMaxRows(int mRows) throws SQLException {
-
-       int oldVal;
-
-       try {
-          oldVal = getMaxRows();
-        }catch(NullPointerException ex) {
-           oldVal = 0;
-        }
-
-       if(oldVal != mRows) {
-           super.setMaxRows(mRows);
-           propertyChangeSupport.firePropertyChange("maxRows",oldVal,mRows);
        }
 
     }