提交 a3044f98 编写于 作者: L lancea

7192302: Remove JDBCRowSetImpl dependency on java.beans

Reviewed-by: alanb, mchung
上级 12f0c4ef
/* /*
* 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -31,7 +31,6 @@ import javax.naming.*; ...@@ -31,7 +31,6 @@ import javax.naming.*;
import java.io.*; import java.io.*;
import java.math.*; import java.math.*;
import java.util.*; import java.util.*;
import java.beans.*;
import javax.sql.rowset.*; import javax.sql.rowset.*;
...@@ -83,12 +82,6 @@ public class JdbcRowSetImpl extends BaseRowSet implements JdbcRowSet, Joinable { ...@@ -83,12 +82,6 @@ public class JdbcRowSetImpl extends BaseRowSet implements JdbcRowSet, Joinable {
*/ */
private ResultSetMetaData resMD; 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 * The Vector holding the Match Columns
...@@ -145,7 +138,6 @@ public class JdbcRowSetImpl extends BaseRowSet implements JdbcRowSet, Joinable { ...@@ -145,7 +138,6 @@ public class JdbcRowSetImpl extends BaseRowSet implements JdbcRowSet, Joinable {
throw new RuntimeException(ioe); throw new RuntimeException(ioe);
} }
propertyChangeSupport = new PropertyChangeSupport(this);
initParams(); initParams();
...@@ -268,7 +260,6 @@ public class JdbcRowSetImpl extends BaseRowSet implements JdbcRowSet, Joinable { ...@@ -268,7 +260,6 @@ public class JdbcRowSetImpl extends BaseRowSet implements JdbcRowSet, Joinable {
throw new RuntimeException(ioe); throw new RuntimeException(ioe);
} }
propertyChangeSupport = new PropertyChangeSupport(this);
initParams(); initParams();
// set the defaults // set the defaults
...@@ -343,7 +334,6 @@ public class JdbcRowSetImpl extends BaseRowSet implements JdbcRowSet, Joinable { ...@@ -343,7 +334,6 @@ public class JdbcRowSetImpl extends BaseRowSet implements JdbcRowSet, Joinable {
throw new RuntimeException(ioe); throw new RuntimeException(ioe);
} }
propertyChangeSupport = new PropertyChangeSupport(this);
initParams(); initParams();
...@@ -360,10 +350,6 @@ public class JdbcRowSetImpl extends BaseRowSet implements JdbcRowSet, Joinable { ...@@ -360,10 +350,6 @@ public class JdbcRowSetImpl extends BaseRowSet implements JdbcRowSet, Joinable {
setMaxRows(0); setMaxRows(0);
setMaxFieldSize(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(); setParams();
setReadOnly(true); setReadOnly(true);
...@@ -435,7 +421,6 @@ public class JdbcRowSetImpl extends BaseRowSet implements JdbcRowSet, Joinable { ...@@ -435,7 +421,6 @@ public class JdbcRowSetImpl extends BaseRowSet implements JdbcRowSet, Joinable {
throw new RuntimeException(ioe); throw new RuntimeException(ioe);
} }
propertyChangeSupport = new PropertyChangeSupport(this);
initParams(); initParams();
...@@ -620,12 +605,7 @@ public class JdbcRowSetImpl extends BaseRowSet implements JdbcRowSet, Joinable { ...@@ -620,12 +605,7 @@ public class JdbcRowSetImpl extends BaseRowSet implements JdbcRowSet, Joinable {
} }
// An alternate solution is required instead of having the private Connection connect() throws SQLException {
// connect method as protected.
// This is a work around to assist Rave Team
// :ah
protected Connection connect() throws SQLException {
// Get a JDBC connection. // Get a JDBC connection.
...@@ -4056,9 +4036,7 @@ public class JdbcRowSetImpl extends BaseRowSet implements JdbcRowSet, Joinable { ...@@ -4056,9 +4036,7 @@ public class JdbcRowSetImpl extends BaseRowSet implements JdbcRowSet, Joinable {
// Added as per Rave requirements // Added as per Rave requirements
if( conn.getHoldability() != HOLD_CURSORS_OVER_COMMIT) { if( conn.getHoldability() != HOLD_CURSORS_OVER_COMMIT) {
ResultSet oldVal = rs;
rs = null; rs = null;
// propertyChangeSupport.firePropertyChange("ResultSet",oldVal,rs);
} }
} }
...@@ -4119,9 +4097,7 @@ public class JdbcRowSetImpl extends BaseRowSet implements JdbcRowSet, Joinable { ...@@ -4119,9 +4097,7 @@ public class JdbcRowSetImpl extends BaseRowSet implements JdbcRowSet, Joinable {
// Makes the result ste handle null after rollback // Makes the result ste handle null after rollback
// Added as per Rave requirements // Added as per Rave requirements
ResultSet oldVal = rs;
rs = null; rs = null;
// propertyChangeSupport.firePropertyChange("ResultSet", oldVal,rs);
} }
...@@ -4247,12 +4223,6 @@ public class JdbcRowSetImpl extends BaseRowSet implements JdbcRowSet, Joinable { ...@@ -4247,12 +4223,6 @@ public class JdbcRowSetImpl extends BaseRowSet implements JdbcRowSet, Joinable {
rs = resultSet; 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 * Sets this <code>JdbcRowSet</code> object's <code>command</code> property to
* the given <code>String</code> object and clears the parameters, if any, * the given <code>String</code> object and clears the parameters, if any,
...@@ -4277,28 +4247,19 @@ public class JdbcRowSetImpl extends BaseRowSet implements JdbcRowSet, Joinable { ...@@ -4277,28 +4247,19 @@ public class JdbcRowSetImpl extends BaseRowSet implements JdbcRowSet, Joinable {
* @see #getCommand * @see #getCommand
*/ */
public void setCommand(String command) throws SQLException { public void setCommand(String command) throws SQLException {
String oldVal;
if (getCommand() != null) { if (getCommand() != null) {
if(!getCommand().equals(command)) { if(!getCommand().equals(command)) {
oldVal = getCommand();
super.setCommand(command); super.setCommand(command);
ps = null; ps = null;
rs = null; rs = null;
propertyChangeSupport.firePropertyChange("command", oldVal,command);
} }
} }
else { else {
super.setCommand(command); 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> * 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 * object to the given logical name and sets this <code>JdbcRowSet</code> object's
...@@ -4329,28 +4290,20 @@ public class JdbcRowSetImpl extends BaseRowSet implements JdbcRowSet, Joinable { ...@@ -4329,28 +4290,20 @@ public class JdbcRowSetImpl extends BaseRowSet implements JdbcRowSet, Joinable {
* @see #getDataSourceName * @see #getDataSourceName
*/ */
public void setDataSourceName(String dsName) throws SQLException{ public void setDataSourceName(String dsName) throws SQLException{
String oldVal;
if(getDataSourceName() != null) { if(getDataSourceName() != null) {
if(!getDataSourceName().equals(dsName)) { if(!getDataSourceName().equals(dsName)) {
oldVal = getDataSourceName();
super.setDataSourceName(dsName); super.setDataSourceName(dsName);
conn = null; conn = null;
ps = null; ps = null;
rs = null; rs = null;
propertyChangeSupport.firePropertyChange("dataSourceName",oldVal,dsName);
} }
} }
else { else {
super.setDataSourceName(dsName); 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 * Sets the Url property for this <code>JdbcRowSet</code> object
...@@ -4394,29 +4347,20 @@ public class JdbcRowSetImpl extends BaseRowSet implements JdbcRowSet, Joinable { ...@@ -4394,29 +4347,20 @@ public class JdbcRowSetImpl extends BaseRowSet implements JdbcRowSet, Joinable {
*/ */
public void setUrl(String url) throws SQLException { public void setUrl(String url) throws SQLException {
String oldVal;
if(getUrl() != null) { if(getUrl() != null) {
if(!getUrl().equals(url)) { if(!getUrl().equals(url)) {
oldVal = getUrl();
super.setUrl(url); super.setUrl(url);
conn = null; conn = null;
ps = null; ps = null;
rs = null; rs = null;
propertyChangeSupport.firePropertyChange("url", oldVal, url);
} }
} }
else { else {
super.setUrl(url); 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 * Sets the username property for this <code>JdbcRowSet</code> object
* to the given user name. Because it * to the given user name. Because it
...@@ -4438,29 +4382,20 @@ public class JdbcRowSetImpl extends BaseRowSet implements JdbcRowSet, Joinable { ...@@ -4438,29 +4382,20 @@ public class JdbcRowSetImpl extends BaseRowSet implements JdbcRowSet, Joinable {
* @see #getUsername * @see #getUsername
*/ */
public void setUsername(String uname) { public void setUsername(String uname) {
String oldVal;
if( getUsername() != null) { if( getUsername() != null) {
if(!getUsername().equals(uname)) { if(!getUsername().equals(uname)) {
oldVal = getUsername();
super.setUsername(uname); super.setUsername(uname);
conn = null; conn = null;
ps = null; ps = null;
rs = null; rs = null;
propertyChangeSupport.firePropertyChange("username",oldVal,uname);
} }
} }
else{ else{
super.setUsername(uname); 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 * Sets the password property for this <code>JdbcRowSet</code> object
* to the given <code>String</code> object. Because it * to the given <code>String</code> object. Because it
...@@ -4481,21 +4416,17 @@ public class JdbcRowSetImpl extends BaseRowSet implements JdbcRowSet, Joinable { ...@@ -4481,21 +4416,17 @@ public class JdbcRowSetImpl extends BaseRowSet implements JdbcRowSet, Joinable {
* that must be supplied to the database to create a connection * that must be supplied to the database to create a connection
*/ */
public void setPassword(String password) { public void setPassword(String password) {
String oldVal;
if ( getPassword() != null) { if ( getPassword() != null) {
if(!getPassword().equals(password)) { if(!getPassword().equals(password)) {
oldVal = getPassword();
super.setPassword(password); super.setPassword(password);
conn = null; conn = null;
ps = null; ps = null;
rs = null; rs = null;
propertyChangeSupport.firePropertyChange("password",oldVal,password);
} }
} }
else{ else{
super.setPassword(password); super.setPassword(password);
propertyChangeSupport.firePropertyChange("password",null,password);
} }
} }
...@@ -4528,7 +4459,6 @@ public class JdbcRowSetImpl extends BaseRowSet implements JdbcRowSet, Joinable { ...@@ -4528,7 +4459,6 @@ public class JdbcRowSetImpl extends BaseRowSet implements JdbcRowSet, Joinable {
if(oldVal != type) { if(oldVal != type) {
super.setType(type); super.setType(type);
propertyChangeSupport.firePropertyChange("type",oldVal,type);
} }
} }
...@@ -4561,78 +4491,6 @@ public class JdbcRowSetImpl extends BaseRowSet implements JdbcRowSet, Joinable { ...@@ -4561,78 +4491,6 @@ public class JdbcRowSetImpl extends BaseRowSet implements JdbcRowSet, Joinable {
if(oldVal != concur) { if(oldVal != concur) {
super.setConcurrency(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);
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册