Return-Path: X-Original-To: apmail-db-derby-commits-archive@www.apache.org Delivered-To: apmail-db-derby-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7F36A11EA9 for ; Mon, 16 Jun 2014 23:09:37 +0000 (UTC) Received: (qmail 36719 invoked by uid 500); 16 Jun 2014 23:09:37 -0000 Delivered-To: apmail-db-derby-commits-archive@db.apache.org Received: (qmail 36686 invoked by uid 500); 16 Jun 2014 23:09:37 -0000 Mailing-List: contact derby-commits-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: "Derby Development" List-Id: Delivered-To: mailing list derby-commits@db.apache.org Received: (qmail 36677 invoked by uid 99); 16 Jun 2014 23:09:37 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 16 Jun 2014 23:09:37 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 16 Jun 2014 23:09:32 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 74CB82388980; Mon, 16 Jun 2014 23:09:05 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1603022 - in /db/derby/code/trunk/java: engine/org/apache/derby/jdbc/ testing/org/apache/derbyTesting/functionTests/testData/serializedDataSources/ testing/org/apache/derbyTesting/junit/ Date: Mon, 16 Jun 2014 23:09:04 -0000 To: derby-commits@db.apache.org From: dag@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20140616230905.74CB82388980@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: dag Date: Mon Jun 16 23:09:03 2014 New Revision: 1603022 URL: http://svn.apache.org/r1603022 Log: DERBY-6552 The public api includes methods inherited from superclasses which aren't in the public api and so have no javadoc comments Follow-up patch derby-6552-restructure-even-more. This restructures the embedded hierarchy to avoid duplication also. It eliminates EmbeddedBaseDataSource. Removed a slew of warnings in the IDE also by some code washing, and regenerated the 10.11 serialized data sources for the SerializedDataSourceTest. I removed some Javadoc from non-public members in the API classes, and replaced them with end-of-line comments instead (to avoid user confusion). Removed: db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbeddedBaseDataSource.java Modified: db/derby/code/trunk/java/engine/org/apache/derby/jdbc/BasicEmbeddedConnectionPoolDataSource40.java db/derby/code/trunk/java/engine/org/apache/derby/jdbc/BasicEmbeddedDataSource40.java db/derby/code/trunk/java/engine/org/apache/derby/jdbc/BasicEmbeddedXADataSource40.java db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbedPooledConnection.java db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbedXAConnection.java db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbeddedConnectionPoolDataSource.java db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbeddedConnectionPoolDataSource40.java db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbeddedDataSource.java db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbeddedDataSource40.java db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbeddedXADataSource.java db/derby/code/trunk/java/engine/org/apache/derby/jdbc/InternalDriver.java db/derby/code/trunk/java/engine/org/apache/derby/jdbc/ReferenceableDataSource.java db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/testData/serializedDataSources/BasicEmbeddedConnectionPoolDataSource40-10_11_1_0.ser db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/testData/serializedDataSources/BasicEmbeddedDataSource40-10_11_1_0.ser db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/testData/serializedDataSources/BasicEmbeddedXADataSource40-10_11_1_0.ser db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/testData/serializedDataSources/EmbeddedConnectionPoolDataSource-10_11_1_0.ser db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/testData/serializedDataSources/EmbeddedConnectionPoolDataSource40-10_11_1_0.ser db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/testData/serializedDataSources/EmbeddedDataSource-10_11_1_0.ser db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/testData/serializedDataSources/EmbeddedDataSource40-10_11_1_0.ser db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/testData/serializedDataSources/EmbeddedXADataSource-10_11_1_0.ser db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/testData/serializedDataSources/EmbeddedXADataSource40-10_11_1_0.ser db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/JDBCClient.java Modified: db/derby/code/trunk/java/engine/org/apache/derby/jdbc/BasicEmbeddedConnectionPoolDataSource40.java URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/jdbc/BasicEmbeddedConnectionPoolDataSource40.java?rev=1603022&r1=1603021&r2=1603022&view=diff ============================================================================== --- db/derby/code/trunk/java/engine/org/apache/derby/jdbc/BasicEmbeddedConnectionPoolDataSource40.java (original) +++ db/derby/code/trunk/java/engine/org/apache/derby/jdbc/BasicEmbeddedConnectionPoolDataSource40.java Mon Jun 16 23:09:03 2014 @@ -24,7 +24,7 @@ import java.sql.SQLException; import javax.sql.PooledConnection; /** - * This datasource is suitable for an application using embedded Derby, + * This data source is suitable for an application using embedded Derby, * running on Java 8 Compact Profile 2 or higher. *

* BasicEmbeddedConnectionPoolDataSource40 is similar to @@ -51,17 +51,12 @@ public class BasicEmbeddedConnectionPool * Implementation of ConnectionPoolDataSource interface methods */ - /** - * @see javax.sql.ConnectionPoolDataSource#getPooledConnection() - */ + @Override public final PooledConnection getPooledConnection() throws SQLException { return createPooledConnection (getUser(), getPassword(), false); } - /** - * @see javax.sql.ConnectionPoolDataSource#getPooledConnection( - * String, String) - */ + @Override public final PooledConnection getPooledConnection( String username, String password) throws SQLException { Modified: db/derby/code/trunk/java/engine/org/apache/derby/jdbc/BasicEmbeddedDataSource40.java URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/jdbc/BasicEmbeddedDataSource40.java?rev=1603022&r1=1603021&r2=1603022&view=diff ============================================================================== --- db/derby/code/trunk/java/engine/org/apache/derby/jdbc/BasicEmbeddedDataSource40.java (original) +++ db/derby/code/trunk/java/engine/org/apache/derby/jdbc/BasicEmbeddedDataSource40.java Mon Jun 16 23:09:03 2014 @@ -23,9 +23,21 @@ package org.apache.derby.jdbc; import java.io.PrintWriter; import java.sql.Connection; +import java.sql.Driver; +import java.sql.DriverManager; import java.sql.SQLException; import java.sql.SQLFeatureNotSupportedException; +import java.util.Properties; import java.util.logging.Logger; +import org.apache.derby.iapi.db.Database; +import org.apache.derby.iapi.error.ExceptionSeverity; +import org.apache.derby.iapi.jdbc.ResourceAdapter; +import org.apache.derby.iapi.reference.Attribute; +import org.apache.derby.iapi.reference.MessageId; +import org.apache.derby.iapi.reference.Property; +import org.apache.derby.iapi.reference.SQLState; +import org.apache.derby.iapi.services.i18n.MessageService; +import org.apache.derby.iapi.services.monitor.Monitor; import org.apache.derby.impl.jdbc.Util; /** @@ -33,154 +45,769 @@ import org.apache.derby.impl.jdbc.Util; * This data source is suitable for an application using embedded Derby, * running on Java 8 Compact Profile 2 or higher. *

- * BasicEmbeddedDataSource40 is similar to EmbeddedDataSource40, but does + * BasicEmbeddedDataSource40 is similar to EmbeddedDataSource, but does * not support JNDI naming, i.e. it does not implement * {@code javax.naming.Referenceable}. * - * @see EmbeddedDataSource40 + * @see EmbeddedDataSource */ -public class BasicEmbeddedDataSource40 extends EmbeddedBaseDataSource - implements javax.sql.DataSource { +public class BasicEmbeddedDataSource40 + implements javax.sql.DataSource, java.io.Serializable, + EmbeddedDataSourceInterface +{ private static final long serialVersionUID = -4945135214995641182L; - public BasicEmbeddedDataSource40() {} - - @Override - public void setLoginTimeout(int seconds) throws SQLException { - super.setLoginTimeout(seconds); - } - - @Override - public int getLoginTimeout() throws SQLException { - return super.getLoginTimeout(); - } - - @Override - public void setLogWriter(PrintWriter logWriter) - throws SQLException { - super.setLogWriter(logWriter); - } - - @Override - public PrintWriter getLogWriter() throws SQLException { - return super.getLogWriter(); - } - - @Override - public final void setPassword(String password) { - super.setPassword(password); - } - - @Override - public final String getPassword() { - return super.getPassword(); - } - + protected String description; + protected String dataSourceName; + protected String databaseName; + /** + * Derby specific connection attributes. + * @serial + */ + protected String connectionAttributes; + + /** + * Set to "create" if the database should be created. + * @serial + */ + protected String createDatabase; + + /** + * Set to "shutdown" if the database should be shutdown. + * @serial + */ + protected String shutdownDatabase; + + /** + * Set password to be a set of connection attributes. + */ + protected boolean attributesAsPassword; + + // shortDatabaseName has attributes of databaseName stripped off + private String shortDatabaseName; + + private String password; + private String user; + protected int loginTimeout; + + // instance variables that will not be serialized + transient private PrintWriter printer; + transient protected String jdbcurl; + + // Unlike a DataSource, LocalDriver is shared by all + // Derby databases in the same jvm. + transient protected InternalDriver driver; + + public BasicEmbeddedDataSource40() { + update(); + } + + /* + * Properties to be seen by Bean - access through reflection. + */ + + /** + * Set the database name. Setting this property is mandatory. If a + * database named wombat at g:/db needs to be accessed, database name + * should be set to "g:/db/wombat". The database will be booted if it + * is not already running in the system. + * + * @param databaseName the name of the database + */ + @Override + public synchronized void setDatabaseName(String databaseName) { + this.databaseName = databaseName; + + if( databaseName!= null && databaseName.contains(";")) { + String[] dbShort = databaseName.split(";"); + this.shortDatabaseName = dbShort[0]; + } else { + this.shortDatabaseName = databaseName; + } + + update(); + } + + /** + * @return the database name set by {@link #setDatabaseName}. + */ @Override - public void setDatabaseName(String databaseName) { - super.setDatabaseName(databaseName); + public String getDatabaseName() { + return databaseName; } - @Override - public String getDatabaseName() { - return super.getDatabaseName(); + // + // Return database name with ant attributes stripped off. + // + private String getShortDatabaseName() { + return shortDatabaseName; } + /** + * Set the data source name. The property is not mandatory. It is used + * for informational purposes only. + * + * @param dsn the name of the data source + */ @Override - public void setDataSourceName(String dataSourceName) { - super.setDataSourceName(dataSourceName); + public void setDataSourceName(String dsn) { + dataSourceName = dsn; } + /** + * @return data source name as set in {@link #setDataSourceName}. + */ @Override public String getDataSourceName() { - return super.getDataSourceName(); + return dataSourceName; } + /** + * Set the data source descripton. This property is not mandatory. + * It is used for informational purposes only. + * + * @param desc the description of the data source + */ @Override - public void setDescription(String description) { - super.setDescription(description); + public void setDescription(String desc) { + description = desc; } + /** + * @return the description as set in {@link #setDescription}. + */ @Override public String getDescription() { - return super.getDescription(); + return description; } + /** + * Set the {@code user} property for the data source. + *

+ * This is user name for any data source {@code getConnection()} call + * that takes no arguments. + * @param user The user + */ @Override public void setUser(String user) { - super.setUser(user); + this.user = user; } + /** + * @return the user name as set by {@link #setUser}. + */ @Override public String getUser() { - return super.getUser(); - } - - @Override - public final void setCreateDatabase(String create) { - super.setCreateDatabase(create); - } - - @Override - public final String getCreateDatabase() { - return super.getCreateDatabase(); + return user; } + /** + * Set the {@code password} property for the data source. + *

+ * This is user's password for any data source {@code getConnection()} call + * that takes no arguments. + * @param password The password in plain text + */ + @Override + public void setPassword(String password) { + this.password = password; + } + + /** + * @return the password as set in {@link #setPassword}. + */ + @Override + public String getPassword() { + return password; + } + + /* + * DataSource methods + */ + + /** + * Gets the maximum time in seconds that this data source can wait + * while attempting to connect to a database. A value of zero + * means that the timeout is the default system timeout + * if there is one; otherwise it means that there is no timeout. + * When a data source object is created, the login timeout is + * initially zero. See {@link #setLoginTimeout}. + * + * @return the data source login time limit + * @exception SQLException if a database access error occurs. + */ @Override - public final void setShutdownDatabase(String shutdown) { - super.setShutdownDatabase(shutdown); + public int getLoginTimeout() throws SQLException { + return loginTimeout; } + /** + * Sets the maximum time in seconds that this data source will wait + * while attempting to connect to a database. A value of zero + * specifies that the timeout is the default system timeout + * if there is one; otherwise it specifies that there is no timeout. + * When a data source object is created, the login timeout is + * initially zero. + *

+ * Derby currently ignores this property. + * + * @param seconds the data source login time limit + * @exception SQLException if a database access error occurs. + */ @Override - public final String getShutdownDatabase() { - return super.getShutdownDatabase(); + public void setLoginTimeout(int seconds) throws SQLException { + loginTimeout = seconds; } - @Override - public final void setConnectionAttributes(String prop) { - super.setConnectionAttributes(prop); - } + /** + * Get the log writer for this data source. + *

+ * The log writer is a character output stream to which all logging + * and tracing messages for this data source object instance will be + * printed. This includes messages printed by the methods of this + * object, messages printed by methods of other objects manufactured + * by this object, and so on. Messages printed to a data source + * specific log writer are not printed to the log writer associated + * with the {@code java.sql.Drivermanager} class. + * When a data source object is created the log writer is + * initially null, in other words, logging is disabled. + * + * @return the log writer for this data source, null if disabled + * @exception SQLException if a database-access error occurs. + */ @Override - public final String getConnectionAttributes() { - return super.getConnectionAttributes(); + public PrintWriter getLogWriter() throws SQLException { + return printer; } - + /** + * Set the log writer for this data source. + *

+ * The log writer is a character output stream to which all logging + * and tracing messages for this data source object instance will be + * printed. This includes messages printed by the methods of this + * object, messages printed by methods of other objects manufactured + * by this object, and so on. Messages printed to a data source + * specific log writer are not printed to the log writer associated + * with the {@code java.sql.Drivermanager} class. + * When a data source object is created the log writer is + * initially null, in other words, logging is disabled. + * + * @param out the new log writer; to disable, set to null + * @exception SQLException if a database-access error occurs. + */ + @Override + public void setLogWriter(PrintWriter out) throws SQLException { + printer = out; + } + + protected void update() { + StringBuilder sb = new StringBuilder(64); + + sb.append(Attribute.PROTOCOL); + + // Set the database name from the databaseName property + String dbName = getDatabaseName(); + + if (dbName != null) { + dbName = dbName.trim(); + } + + if (dbName == null || dbName.length() == 0) { + // need to put something in so that we do not allow the + // database name to be set from the request or from the + // connection attributes. + + // this space will selected as the database name (and + // trimmed to an empty string) See the getDatabaseName() + // code in InternalDriver. Since this is a non-null value, + // it will be selected over any databaseName connection + // attribute. + dbName = " "; + } + + sb.append(dbName); + String connAttrs = getConnectionAttributes(); + + if (connAttrs != null) { + connAttrs = connAttrs.trim(); + + if (connAttrs.length() != 0) { + sb.append(';'); + sb.append(connectionAttributes); + } + } + + jdbcurl = sb.toString(); + } + + /* + * Properties to be seen by Bean - access thru reflection. + */ + + /** + * Set this property to create a new database. If this property + * is not set, the database (identified by {@code databaseName}) + * is assumed to be already existing. + * + * @param create if set to the string {@code "create"}, this data + * source will try to create a new database of databaseName, or + * boot the database if one by that name already exists. + */ + @Override + public void setCreateDatabase(String create) { + if (create != null && + create.toLowerCase(java.util.Locale.ENGLISH).equals("create")) { + createDatabase = create; + } else { + createDatabase = null; + } + } + + /** + * @return The string {@code "create"} if create is set, or {@code + * null} if not + */ + @Override + public String getCreateDatabase() { + return createDatabase; + } + + @SuppressWarnings("ResultOfObjectAllocationIgnored") + InternalDriver findDriver() throws SQLException { + String url = jdbcurl; + + synchronized(this) { + // The driver has either never been booted, or it has been + // shutdown by a 'jdbc:derby:;shutdown=true' + if (driver == null || !driver.acceptsURL(url)) { + + new org.apache.derby.jdbc.EmbeddedDriver(); + + // If we know the driver, we loaded it. Otherwise only + // work if DriverManager has already loaded it. + // DriverManager will throw an exception if driver is not found + Driver registerDriver = DriverManager.getDriver(url); + + if (registerDriver instanceof AutoloadedDriver) { + driver = + (InternalDriver)AutoloadedDriver.getDriverModule(); + } else { + driver = (InternalDriver) registerDriver; + } + } + // else driver != null and driver can accept url + } + + return driver; + } + + /** + * Set this property to pass in more Derby specific connection URL + * attributes. + *
+ * Any attributes that can be set using a property of this DataSource + * implementation (e.g user, password) should not be set in connection + * attributes. Conflicting settings in connection attributes and + * properties of the DataSource will lead to unexpected behaviour. + * + * @param prop set to the list of Derby connection attributes + * separated by semi-colons. E.g., to specify an encryption + * bootPassword of "x8hhk2adf", and set upgrade to true, do the + * following: + * + *

+     *     ds.setConnectionAttributes("bootPassword=x8hhk2adf;upgrade=true");
+     * 
+ * + * See the Derby documentation for complete list. + */ + @Override + public void setConnectionAttributes(String prop) { + connectionAttributes = prop; + update(); + } + + + /** + * @return the Derby specific connection URL attributes, see + * {@link #setConnectionAttributes}. + */ + @Override + public String getConnectionAttributes() { + return connectionAttributes; + } + + /** + * Set this property if you wish to shutdown the database identified by + * {@code databaseName}. + * + * @param shutdown if set to the string {@code "shutdown"}, this + * data source will shutdown the database if it is running. + */ + @Override + public void setShutdownDatabase(String shutdown) { + if (shutdown != null && shutdown.equalsIgnoreCase("shutdown")) { + shutdownDatabase = shutdown; + } else { + shutdownDatabase = null; + } + } + + /** + * @return the string {@code "shutdown"} if shutdown is set, or + * null if not, cf. {@link #setShutdownDatabase}. + */ + @Override + public String getShutdownDatabase() { + return shutdownDatabase; + } + + /** + * Set {@code attributeAsPassword} property to enable passing connection + * request attributes in the password argument of + * {@link #getConnection(String,String)}. + + * If the property is set to {@code true} then the {@code password} + * argument of the {@link #getConnection(String, String)} + * method call is taken to be a list of connection attributes with the + * same format as the {@code connectionAttributes} property. + * + * @param attributesAsPassword Use {@code true} to encode password + * argument as a set of connection attributes in a connection request. + */ + @Override + public void setAttributesAsPassword(boolean attributesAsPassword) { + this.attributesAsPassword = attributesAsPassword; + update(); + } + + /** + * Return the value of the {@code attributesAsPassword} property, cf. + * {@link #setAttributesAsPassword}. + * @return the value + */ + @Override + public boolean getAttributesAsPassword() { + return attributesAsPassword; + } + + // Most of our customers would be using JNDI to get the data + // sources. Since we don't have a jndi in the test setup to test this, we + // are adding this method to fake it. This is getting used in XAJNDITest + // so we can compare the two data sources. + @Override + public boolean equals(Object p0) { + + if (p0 instanceof EmbeddedDataSource) { + EmbeddedDataSource ds = (EmbeddedDataSource)p0; + + boolean match = true; + + if (databaseName != null) { + if (!(databaseName.equals(ds.databaseName))) + match = false; + } else if (ds.databaseName != null) { + match = false; + } + + if (dataSourceName != null) { + if (!(dataSourceName.equals(ds.dataSourceName))) { + match = false; + } + } else if (ds.dataSourceName != null) { + match = false; + } + + if (description != null) { + if (!(description.equals(ds.description))) { + match = false; + } + } else if (ds.description != null) { + match = false; + } + + if (createDatabase != null) { + if (!(createDatabase.equals(ds.createDatabase))) { + match = false; + } + } else if (ds.createDatabase != null) { + match = false; + } + + if (shutdownDatabase != null) { + if (!(shutdownDatabase.equals(ds.shutdownDatabase))) { + match = false; + } + } else if (ds.shutdownDatabase != null) { + match = false; + } + + if (connectionAttributes != null) { + if (!(connectionAttributes.equals(ds.connectionAttributes))) { + match = false; + } + } else if (ds.connectionAttributes != null) { + match = false; + } + + if (loginTimeout != ds.loginTimeout) { + match = false; + } + + return match; + + } + + return false; + } + + @Override + public int hashCode() { + int hash = 5; + hash = 29 * hash + + (this.description != null ? + this.description.hashCode() : 0); + hash = 29 * hash + + (this.dataSourceName != null ? + this.dataSourceName.hashCode() : 0); + hash = 29 * hash + + (this.databaseName != null ? + this.databaseName.hashCode() : 0); + hash = 29 * hash + + (this.connectionAttributes != null ? + this.connectionAttributes.hashCode() : 0); + hash = 29 * hash + + (this.createDatabase != null ? + this.createDatabase.hashCode() : 0); + hash = 29 * hash + + (this.shutdownDatabase != null ? + this.shutdownDatabase.hashCode() : 0); + hash = 29 * hash + + this.loginTimeout; + return hash; + } + + + /* + * DataSource methods - keep these non-final so that others can + * extend Derby's classes if they choose to. + */ + + + /** + * Attempt to establish a database connection. + * + * @return a Connection to the database + * @exception SQLException if a database-access error occurs. + */ @Override public Connection getConnection() throws SQLException { - return super.getConnection(); + return this.getConnection(getUser(), getPassword(), false); } + /** + * Attempt to establish a database connection with the given username and + * password. If the {@code attributeAsPassword} property is set to true + * then the password argument is taken to be a list of connection + * attributes with the same format as the {@code connectionAttributes} + * property. + * + * @param username the database user on whose behalf the Connection is + * being made + * @param password the user's password + * @return a Connection to the database + * @exception SQLException if a database-access error occurs. + */ @Override - public Connection getConnection(String user, String password) + public Connection getConnection(String username, String password) throws SQLException { - return super.getConnection(user, password); + return this.getConnection(username, password, true); } - @Override - public final Logger getParentLogger() throws SQLFeatureNotSupportedException { - return super.getParentLogger(); - } + // requestPassword Use {@code true} if the password came from the + // getConnection() call. + final Connection getConnection(String username, + String password, + boolean requestPassword) + throws SQLException { - @Override - public boolean isWrapperFor(Class iface) throws SQLException { - return super.isWrapperFor(iface); - } + Properties info = new Properties(); + if (username != null) { + info.put(Attribute.USERNAME_ATTR, username); + } + + if (!requestPassword || !attributesAsPassword) { + if (password != null) { + info.put(Attribute.PASSWORD_ATTR, password); + } + } + + if (createDatabase != null) { + info.put(Attribute.CREATE_ATTR, "true"); + } + + if (shutdownDatabase != null) { + info.put(Attribute.SHUTDOWN_ATTR, "true"); + } + + String url = jdbcurl; + + if (attributesAsPassword && requestPassword && password != null) { + StringBuilder sb = + new StringBuilder(url.length() + password.length() + 1); + + sb.append(url); + sb.append(';'); + sb.append(password); // these are now request attributes on the URL + + url = sb.toString(); + } + + Connection conn = findDriver().connect( url, info, loginTimeout ); + + // JDBC driver's getConnection method returns null if + // the driver does not handle the request's URL. + if (conn == null) { + throw Util.generateCsSQLException(SQLState.PROPERTY_INVALID_VALUE, + Attribute.DBNAME_ATTR, + getDatabaseName()); + } + + return conn; + } + + // JDBC 4.0 java.sql.Wrapper interface methods + + /** + * Returns false unless {@code interFace} is implemented. + * + * @param interFace a class defining an interface + * @return {@code true} if this implements the interface or directly or + * indirectly wraps an object that does + * @throws SQLException if an error occurs while determining + * whether this is a wrapper for an object with the given interface + */ + @Override + public boolean isWrapperFor(Class interFace) throws SQLException { + return interFace.isInstance(this); + } + + /** + * Returns {@code this} if this class implements the specified interface. + * + * @param iface a class defining an interface + * @return an object that implements the interface + * @throws SQLException if no object is found that implements the + * interface + */ @Override public T unwrap(Class iface) throws SQLException { - return super.unwrap(iface); - } - - @Override - public final void setAttributesAsPassword(boolean attributesAsPassword) { - super.setAttributesAsPassword(attributesAsPassword); + // Derby does not implement non-standard methods on JDBC objects, + // hence return this if this class implements the interface, or + // throw an SQLException. + try { + return iface.cast(this); + } catch (ClassCastException cce) { + throw Util.generateCsSQLException(SQLState.UNABLE_TO_UNWRAP, + iface); + } + } + + protected static ResourceAdapter setupResourceAdapter( + EmbeddedXADataSourceInterface ds, + ResourceAdapter ra, + String user, + String password, + boolean requestPassword) throws SQLException { + + synchronized(ds) { + if (ra == null || !ra.isActive()) { + // If it is inactive, it is useless. + ra = null; + + // DERBY-4907 make sure the database name sent to find service + // does not include attributes. + String dbName = + ((BasicEmbeddedDataSource40)ds).getShortDatabaseName(); + + if (dbName != null) { + // see if database already booted, if it is, then + // don't make a connection. + Database database = null; + + // if monitor is never setup by any ModuleControl, + // getMonitor returns null and no Derby database + // has been booted. + if (Monitor.getMonitor() != null) { + database = (Database) + Monitor.findService(Property.DATABASE_MODULE, + dbName); + } + + if (database == null) { + // If database is not found, try connecting to it. + // This boots and/or creates the database. If + // database cannot be found, this throws SQLException. + if (requestPassword) { + ds.getConnection(user, password).close(); + } else { + ds.getConnection().close(); + } + + // now try to find it again + database = (Database) + Monitor.findService(Property.DATABASE_MODULE, + dbName); + } + + if (database != null) { + ra = (ResourceAdapter) database.getResourceAdapter(); + } + } + + if (ra == null) { + throw new SQLException( + MessageService.getTextMessage( + MessageId.CORE_DATABASE_NOT_AVAILABLE), + "08006", + ExceptionSeverity.DATABASE_SEVERITY); + } + + // If database is already up, we need to set up driver + // seperately. + InternalDriver driver = + ((BasicEmbeddedDataSource40)ds).findDriver(); + + if (driver == null) { + throw new SQLException( + MessageService.getTextMessage( + MessageId.CORE_DRIVER_NOT_AVAILABLE), + "08006", + ExceptionSeverity.DATABASE_SEVERITY); + } + } + } + + return ra; + } + + //////////////////////////////////////////////////////////////////// + // + // INTRODUCED BY JDBC 4.1 IN JAVA 7 + // + //////////////////////////////////////////////////////////////////// + + // Cannot add @Override here: the compiler balks since this is compiled + // with compiler level 1.6 which doesn't specify this method in the + // JDBC interface (4.0). Add as soon as we move to minimum 1.7. + public Logger getParentLogger() throws SQLFeatureNotSupportedException + { + throw (SQLFeatureNotSupportedException) Util.generateCsSQLException + ( SQLState.NOT_IMPLEMENTED, "getParentLogger" ); } - @Override - public final boolean getAttributesAsPassword() { - return super.getAttributesAsPassword(); - } } Modified: db/derby/code/trunk/java/engine/org/apache/derby/jdbc/BasicEmbeddedXADataSource40.java URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/jdbc/BasicEmbeddedXADataSource40.java?rev=1603022&r1=1603021&r2=1603022&view=diff ============================================================================== --- db/derby/code/trunk/java/engine/org/apache/derby/jdbc/BasicEmbeddedXADataSource40.java (original) +++ db/derby/code/trunk/java/engine/org/apache/derby/jdbc/BasicEmbeddedXADataSource40.java Mon Jun 16 23:09:03 2014 @@ -56,9 +56,7 @@ public class BasicEmbeddedXADataSource40 * Implementation of XADataSource interface methods */ - /** - * @see javax.sql.XADataSource#getXAConnection() - */ + @Override public final XAConnection getXAConnection() throws SQLException { if (ra == null || !ra.isActive()) { @@ -68,9 +66,7 @@ public class BasicEmbeddedXADataSource40 return createXAConnection (ra, getUser(), getPassword(), false); } - /** - * @see javax.sql.XADataSource#getXAConnection(String, String) - */ + @Override public final XAConnection getXAConnection(String user, String password) throws SQLException { @@ -82,21 +78,15 @@ public class BasicEmbeddedXADataSource40 } // implementation methods + @Override protected void update() { ra = null; super.update(); } - /** - * Instantiate and return an EmbedXAConnection from this instance - * of EmbeddedXADataSource. - * - * @param user - * @param password - * @return XAConnection - * @throws SQLException if a connection can't be created - */ + // Instantiate and return an EmbedXAConnection from this instance + // of EmbeddedXADataSource. private XAConnection createXAConnection( ResourceAdapter ra, String user, @@ -112,6 +102,7 @@ public class BasicEmbeddedXADataSource40 /** * @return The ResourceAdapter instance for the underlying database */ + @Override public ResourceAdapter getResourceAdapter() { return ra; } Modified: db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbedPooledConnection.java URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbedPooledConnection.java?rev=1603022&r1=1603021&r2=1603022&view=diff ============================================================================== --- db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbedPooledConnection.java (original) +++ db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbedPooledConnection.java Mon Jun 16 23:09:03 2014 @@ -100,7 +100,7 @@ class EmbedPooledConnection implements j BrokeredConnection currentConnectionHandle; // set up once by the data source - final EmbeddedBaseDataSource dataSource; + final BasicEmbeddedDataSource40 dataSource; private final String username; private final String password; /** @@ -118,7 +118,7 @@ class EmbedPooledConnection implements j return isActive; } - EmbedPooledConnection(EmbeddedBaseDataSource ds, String u, String p, + EmbedPooledConnection(BasicEmbeddedDataSource40 ds, String u, String p, boolean requestPassword) throws SQLException { dataSource = ds; Modified: db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbedXAConnection.java URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbedXAConnection.java?rev=1603022&r1=1603021&r2=1603022&view=diff ============================================================================== --- db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbedXAConnection.java (original) +++ db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbedXAConnection.java Mon Jun 16 23:09:03 2014 @@ -45,7 +45,7 @@ class EmbedXAConnection extends EmbedPoo private EmbedXAResource xaRes; - EmbedXAConnection(EmbeddedBaseDataSource ds, + EmbedXAConnection(BasicEmbeddedDataSource40 ds, ResourceAdapter ra, String u, String p, Modified: db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbeddedConnectionPoolDataSource.java URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbeddedConnectionPoolDataSource.java?rev=1603022&r1=1603021&r2=1603022&view=diff ============================================================================== --- db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbeddedConnectionPoolDataSource.java (original) +++ db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbeddedConnectionPoolDataSource.java Mon Jun 16 23:09:03 2014 @@ -22,11 +22,8 @@ package org.apache.derby.jdbc; import java.sql.SQLException; -import java.sql.SQLFeatureNotSupportedException; -import java.util.logging.Logger; import javax.sql.PooledConnection; -import org.apache.derby.impl.jdbc.Util; /**

@@ -84,6 +81,7 @@ public class EmbeddedConnectionPoolDataS @exception SQLException if a database-access error occurs. */ + @Override public final PooledConnection getPooledConnection() throws SQLException { return createPooledConnection (getUser(), getPassword(), false); } @@ -98,6 +96,7 @@ public class EmbeddedConnectionPoolDataS @exception SQLException if a database-access error occurs. */ + @Override public final PooledConnection getPooledConnection(String username, String password) throws SQLException @@ -105,10 +104,10 @@ public class EmbeddedConnectionPoolDataS return createPooledConnection (username, password, true); } - /** - * Create and return an EmbedPooledConnection from this instance - * of EmbeddedConnectionPoolDataSource. - */ + // + // Create and return an EmbedPooledConnection from this instance + // of EmbeddedConnectionPoolDataSource. + // private PooledConnection createPooledConnection (String user, String password, boolean requestPassword) throws SQLException { Modified: db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbeddedConnectionPoolDataSource40.java URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbeddedConnectionPoolDataSource40.java?rev=1603022&r1=1603021&r2=1603022&view=diff ============================================================================== --- db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbeddedConnectionPoolDataSource40.java (original) +++ db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbeddedConnectionPoolDataSource40.java Mon Jun 16 23:09:03 2014 @@ -23,7 +23,7 @@ package org.apache.derby.jdbc; /**

This is a vacuous, deprecated class. At one time, it had real behavior and helped us support - separate datasources for Java 5 and Java 6. + separate data sources for Java 5 and Java 6. Now that we no longer support Java 5, all functionality has migrated into the superclass, EmbeddedConnectionPoolDataSource. This class is preserved for backward compatibility reasons.

Modified: db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbeddedDataSource.java URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbeddedDataSource.java?rev=1603022&r1=1603021&r2=1603022&view=diff ============================================================================== --- db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbeddedDataSource.java (original) +++ db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbeddedDataSource.java Mon Jun 16 23:09:03 2014 @@ -21,14 +21,9 @@ package org.apache.derby.jdbc; -import java.io.PrintWriter; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.lang.reflect.Modifier; -import java.sql.Connection; -import java.sql.SQLException; -import java.sql.SQLFeatureNotSupportedException; -import java.util.logging.Logger; import javax.naming.NamingException; import javax.naming.Reference; import javax.naming.Referenceable; @@ -239,6 +234,7 @@ public class EmbeddedDataSource extends * @return the created reference object for this data source * @exception NamingException cannot find named object */ + @Override public final Reference getReference() throws NamingException { // These fields will be set by the JNDI server when it decides to @@ -253,25 +249,20 @@ public class EmbeddedDataSource extends return ref; } - /** - * Add Java Bean properties to the reference using - * StringRefAddr for each property. List of bean properties - * is defined from the public getXXX() methods on this object - * that take no arguments and return short, int, boolean or String. - * The StringRefAddr has a key of the Java bean property name, - * converted from the method name. E.g. traceDirectory for - * traceDirectory. - * - */ + // + // Add Java Bean properties to the reference using + // StringRefAddr for each property. List of bean properties + // is defined from the public getXXX() methods on this object + // that take no arguments and return short, int, boolean or String. + // The StringRefAddr has a key of the Java bean property name, + // converted from the method name. E.g. traceDirectory for + // traceDirectory. private static void addBeanProperties(Object ths, Reference ref) { // Look for all the getXXX methods in the class that take no arguments. Method[] methods = ths.getClass().getMethods(); - for (int i = 0; i < methods.length; i++) { - - Method m = methods[i]; - + for (Method m : methods) { // only look for simple getter methods. if (m.getParameterTypes().length != 0) continue; @@ -285,7 +276,7 @@ public class EmbeddedDataSource extends if ((methodName.length() < 5) || !methodName.startsWith("get")) continue; - Class returnType = m.getReturnType(); + Class returnType = m.getReturnType(); if (Integer.TYPE.equals(returnType) || Short.TYPE.equals(returnType) @@ -297,10 +288,10 @@ public class EmbeddedDataSource extends String propertyName = methodName.substring(3, 4).toLowerCase( java.util.Locale.ENGLISH).concat( - methodName.substring(4)); + methodName.substring(4)); try { - Object ov = m.invoke(ths, null); + Object ov = m.invoke(ths, (Object[])null); // Need to check if property value is null, otherwise // "null" string gets stored. if (ov != null) { @@ -315,144 +306,6 @@ public class EmbeddedDataSource extends } @Override - public void setLoginTimeout(int seconds) throws SQLException { - super.setLoginTimeout(seconds); - } - - @Override - public int getLoginTimeout() throws SQLException { - return super.getLoginTimeout(); - } - - @Override - public void setLogWriter(PrintWriter logWriter) - throws SQLException { - super.setLogWriter(logWriter); - } - - @Override - public PrintWriter getLogWriter() throws SQLException { - return super.getLogWriter(); - } - - @Override - public final void setPassword(String password) { - super.setPassword(password); - } - - @Override - public final String getPassword() { - return super.getPassword(); - } - - @Override - public void setDatabaseName(String databaseName) { - super.setDatabaseName(databaseName); - } - - @Override - public String getDatabaseName() { - return super.getDatabaseName(); - } - - @Override - public void setDataSourceName(String dataSourceName) { - super.setDataSourceName(dataSourceName); - } - - @Override - public String getDataSourceName() { - return super.getDataSourceName(); - } - - @Override - public void setDescription(String description) { - super.setDescription(description); - } - - @Override - public String getDescription() { - return super.getDescription(); - } - - @Override - public void setUser(String user) { - super.setUser(user); - } - - @Override - public String getUser() { - return super.getUser(); - } - - @Override - public final void setCreateDatabase(String create) { - super.setCreateDatabase(create); - } - - @Override - public final String getCreateDatabase() { - return super.getCreateDatabase(); - } - - @Override - public final void setShutdownDatabase(String shutdown) { - super.setShutdownDatabase(shutdown); - } - - @Override - public final String getShutdownDatabase() { - return super.getShutdownDatabase(); - } - - @Override - public final void setConnectionAttributes(String prop) { - super.setConnectionAttributes(prop); - } - - @Override - public final String getConnectionAttributes() { - return super.getConnectionAttributes(); - } - - - @Override - public Connection getConnection() throws SQLException { - return super.getConnection(); - } - - @Override - public Connection getConnection(String user, String password) - throws SQLException { - return super.getConnection(user, password); - } - - @Override - public final Logger getParentLogger() throws SQLFeatureNotSupportedException { - return super.getParentLogger(); - } - - @Override - public boolean isWrapperFor(Class iface) throws SQLException { - return super.isWrapperFor(iface); - } - - @Override - public T unwrap(Class iface) throws SQLException { - return super.unwrap(iface); - } - - @Override - public final void setAttributesAsPassword(boolean attributesAsPassword) { - super.setAttributesAsPassword(attributesAsPassword); - } - - @Override - public final boolean getAttributesAsPassword() { - return super.getAttributesAsPassword(); - } - - @Override public Object getObjectInstance(Object refObj, javax.naming.Name name, javax.naming.Context nameContext, Modified: db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbeddedDataSource40.java URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbeddedDataSource40.java?rev=1603022&r1=1603021&r2=1603022&view=diff ============================================================================== --- db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbeddedDataSource40.java (original) +++ db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbeddedDataSource40.java Mon Jun 16 23:09:03 2014 @@ -24,7 +24,7 @@ package org.apache.derby.jdbc; /**

This is a vacuous, deprecated class. At one time, it had real behavior and helped us support - separate datasources for Java 5 and Java 6. + separate data sources for Java 5 and Java 6. Now that we no longer support Java 5, all functionality has migrated into the superclass, EmbeddedDataSource. This class is preserved for backward compatibility reasons.

Modified: db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbeddedXADataSource.java URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbeddedXADataSource.java?rev=1603022&r1=1603021&r2=1603022&view=diff ============================================================================== --- db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbeddedXADataSource.java (original) +++ db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbeddedXADataSource.java Mon Jun 16 23:09:03 2014 @@ -23,18 +23,12 @@ package org.apache.derby.jdbc; import java.sql.SQLException; import javax.sql.XAConnection; -import org.apache.derby.iapi.db.Database; -import org.apache.derby.iapi.error.ExceptionSeverity; import org.apache.derby.iapi.jdbc.ResourceAdapter; -import org.apache.derby.iapi.reference.MessageId; -import org.apache.derby.iapi.reference.Property; -import org.apache.derby.iapi.services.i18n.MessageService; -import org.apache.derby.iapi.services.monitor.Monitor; /**

- This datasource is suitable for an application using embedded Derby, + This data source is suitable for an application using embedded Derby, running on full Java SE 6 or higher, corresponding to JDBC 4.0 and higher. EmbeddedXADataSource is an XADataSource implementation.

@@ -70,7 +64,8 @@ import org.apache.derby.iapi.services.mo

See EmbeddedDataSource for DataSource properties.

*/ -public class EmbeddedXADataSource extends EmbeddedDataSource implements EmbeddedXADataSourceInterface +public class EmbeddedXADataSource extends EmbeddedDataSource + implements EmbeddedXADataSourceInterface { private static final long serialVersionUID = -5715798975598379738L; @@ -98,6 +93,7 @@ public class EmbeddedXADataSource extend * @return a Connection to the database * @exception SQLException if a database-access error occurs. */ + @Override public final XAConnection getXAConnection() throws SQLException { if (ra == null || !ra.isActive()) @@ -115,6 +111,7 @@ public class EmbeddedXADataSource extend * @return a Connection to the database * @exception SQLException if a database-access error occurs. */ + @Override public final XAConnection getXAConnection(String user, String password) throws SQLException { @@ -128,20 +125,17 @@ public class EmbeddedXADataSource extend * private method */ - protected void update() { + @Override + protected void update() { ra = null; super.update(); } - /** - * Instantiate and return an EmbedXAConnection from this instance - * of EmbeddedXADataSource. - * - * @param user - * @param password - * @return XAConnection - */ + // + // Instantiate and return an EmbedXAConnection from this instance + // of EmbeddedXADataSource. + // private XAConnection createXAConnection (ResourceAdapter ra, String user, String password, boolean requestPassword) throws SQLException @@ -182,6 +176,7 @@ public class EmbeddedXADataSource extend * @return The ResourceAdapter instance for * the underlying database */ + @Override public ResourceAdapter getResourceAdapter() { return ra; Modified: db/derby/code/trunk/java/engine/org/apache/derby/jdbc/InternalDriver.java URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/jdbc/InternalDriver.java?rev=1603022&r1=1603021&r2=1603022&view=diff ============================================================================== --- db/derby/code/trunk/java/engine/org/apache/derby/jdbc/InternalDriver.java (original) +++ db/derby/code/trunk/java/engine/org/apache/derby/jdbc/InternalDriver.java Mon Jun 16 23:09:03 2014 @@ -795,17 +795,17 @@ public class InternalDriver implements M * EmbeddedDataSource. */ protected PooledConnection getNewPooledConnection( - EmbeddedBaseDataSource eds, String user, String password, + BasicEmbeddedDataSource40 eds, String user, String password, boolean requestPassword) throws SQLException { return new EmbedPooledConnection(eds, user, password, requestPassword); } /** * Create and return an EmbedXAConnection from the received instance of - * EmbeddedBaseDataSource. + * BasicEmbeddedDataSource40. */ protected XAConnection getNewXAConnection( - EmbeddedBaseDataSource eds, ResourceAdapter ra, + BasicEmbeddedDataSource40 eds, ResourceAdapter ra, String user, String password, boolean requestPassword) throws SQLException { return new EmbedXAConnection(eds, ra, user, password, requestPassword); Modified: db/derby/code/trunk/java/engine/org/apache/derby/jdbc/ReferenceableDataSource.java URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/jdbc/ReferenceableDataSource.java?rev=1603022&r1=1603021&r2=1603022&view=diff ============================================================================== --- db/derby/code/trunk/java/engine/org/apache/derby/jdbc/ReferenceableDataSource.java (original) +++ db/derby/code/trunk/java/engine/org/apache/derby/jdbc/ReferenceableDataSource.java Mon Jun 16 23:09:03 2014 @@ -20,7 +20,7 @@ */ package org.apache.derby.jdbc; -import java.lang.reflect.*; +import java.lang.reflect.Method; import java.util.Enumeration; import javax.naming.RefAddr; import javax.naming.Reference; @@ -47,14 +47,11 @@ import javax.naming.spi.ObjectFactory; * factory as part of their JDBC product. * * @see org.apache.derby.jdbc.EmbeddedDataSource - * @see org.apache.derby.jdbc.EmbeddedDataSource40 * @see org.apache.derby.jdbc.EmbeddedConnectionPoolDataSource - * @see org.apache.derby.jdbc.EmbeddedConnectionPoolDataSource40 * @see org.apache.derby.jdbc.EmbeddedXADataSource - * @see org.apache.derby.jdbc.EmbeddedXADataSource40 */ -public class ReferenceableDataSource extends EmbeddedBaseDataSource +public class ReferenceableDataSource extends BasicEmbeddedDataSource40 implements ObjectFactory { private static final long serialVersionUID = 1872877359127597176L; @@ -87,6 +84,7 @@ public class ReferenceableDataSource ext * object is made. * @throws Exception if recreating the object fails */ + @Override public Object getObjectInstance(Object refObj, javax.naming.Name name, javax.naming.Context nameContext, @@ -112,29 +110,27 @@ public class ReferenceableDataSource ext return ds; } - /** Reflect lookup for Java bean method taking a single String arg */ - private static final Class[] STRING_ARG = { "".getClass() }; - /** Reflect lookup for Java bean method taking a single int arg */ - private static final Class[] INT_ARG = { Integer.TYPE }; - /** Reflect lookup for Java bean method taking a single boolean arg */ - private static final Class[] BOOLEAN_ARG = { Boolean.TYPE }; - /** Reflect lookup for Java bean method taking a single short arg */ - private static final Class[] SHORT_ARG = { Short.TYPE }; - - /** - * Set the Java bean properties for an object from its Reference. The - * Reference contains a set of StringRefAddr values with the key being the - * bean name and the value a String representation of the bean's value. This - * code looks for setXXX() method where the set method corresponds to the - * standard bean naming scheme and has a single parameter of type String, - * int, boolean or short. - */ + // Reflect lookup for Java bean method taking a single String arg + private static final Class[] STRING_ARG = { "".getClass() }; + // Reflect lookup for Java bean method taking a single int arg + private static final Class[] INT_ARG = { Integer.TYPE }; + // Reflect lookup for Java bean method taking a single boolean arg + private static final Class[] BOOLEAN_ARG = { Boolean.TYPE }; + // Reflect lookup for Java bean method taking a single short arg + private static final Class[] SHORT_ARG = { Short.TYPE }; + + // Set the Java bean properties for an object from its Reference. The + // Reference contains a set of StringRefAddr values with the key being the + // bean name and the value a String representation of the bean's value. This + // code looks for setXXX() method where the set method corresponds to the + // standard bean naming scheme and has a single parameter of type String, + // int, boolean or short. private static void setBeanProperties(Object ds, Reference ref) throws Exception { - for (Enumeration e = ref.getAll(); e.hasMoreElements();) { + for (Enumeration e = ref.getAll(); e.hasMoreElements();) { - RefAddr attribute = (RefAddr) e.nextElement(); + RefAddr attribute = e.nextElement(); String propertyName = attribute.getType(); Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/testData/serializedDataSources/BasicEmbeddedConnectionPoolDataSource40-10_11_1_0.ser URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/testData/serializedDataSources/BasicEmbeddedConnectionPoolDataSource40-10_11_1_0.ser?rev=1603022&r1=1603021&r2=1603022&view=diff ============================================================================== Files db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/testData/serializedDataSources/BasicEmbeddedConnectionPoolDataSource40-10_11_1_0.ser (original) and db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/testData/serializedDataSources/BasicEmbeddedConnectionPoolDataSource40-10_11_1_0.ser Mon Jun 16 23:09:03 2014 differ Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/testData/serializedDataSources/BasicEmbeddedDataSource40-10_11_1_0.ser URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/testData/serializedDataSources/BasicEmbeddedDataSource40-10_11_1_0.ser?rev=1603022&r1=1603021&r2=1603022&view=diff ============================================================================== Files db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/testData/serializedDataSources/BasicEmbeddedDataSource40-10_11_1_0.ser (original) and db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/testData/serializedDataSources/BasicEmbeddedDataSource40-10_11_1_0.ser Mon Jun 16 23:09:03 2014 differ Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/testData/serializedDataSources/BasicEmbeddedXADataSource40-10_11_1_0.ser URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/testData/serializedDataSources/BasicEmbeddedXADataSource40-10_11_1_0.ser?rev=1603022&r1=1603021&r2=1603022&view=diff ============================================================================== Files db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/testData/serializedDataSources/BasicEmbeddedXADataSource40-10_11_1_0.ser (original) and db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/testData/serializedDataSources/BasicEmbeddedXADataSource40-10_11_1_0.ser Mon Jun 16 23:09:03 2014 differ Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/testData/serializedDataSources/EmbeddedConnectionPoolDataSource-10_11_1_0.ser URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/testData/serializedDataSources/EmbeddedConnectionPoolDataSource-10_11_1_0.ser?rev=1603022&r1=1603021&r2=1603022&view=diff ============================================================================== Files db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/testData/serializedDataSources/EmbeddedConnectionPoolDataSource-10_11_1_0.ser (original) and db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/testData/serializedDataSources/EmbeddedConnectionPoolDataSource-10_11_1_0.ser Mon Jun 16 23:09:03 2014 differ Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/testData/serializedDataSources/EmbeddedConnectionPoolDataSource40-10_11_1_0.ser URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/testData/serializedDataSources/EmbeddedConnectionPoolDataSource40-10_11_1_0.ser?rev=1603022&r1=1603021&r2=1603022&view=diff ============================================================================== Files db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/testData/serializedDataSources/EmbeddedConnectionPoolDataSource40-10_11_1_0.ser (original) and db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/testData/serializedDataSources/EmbeddedConnectionPoolDataSource40-10_11_1_0.ser Mon Jun 16 23:09:03 2014 differ Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/testData/serializedDataSources/EmbeddedDataSource-10_11_1_0.ser URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/testData/serializedDataSources/EmbeddedDataSource-10_11_1_0.ser?rev=1603022&r1=1603021&r2=1603022&view=diff ============================================================================== Files db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/testData/serializedDataSources/EmbeddedDataSource-10_11_1_0.ser (original) and db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/testData/serializedDataSources/EmbeddedDataSource-10_11_1_0.ser Mon Jun 16 23:09:03 2014 differ Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/testData/serializedDataSources/EmbeddedDataSource40-10_11_1_0.ser URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/testData/serializedDataSources/EmbeddedDataSource40-10_11_1_0.ser?rev=1603022&r1=1603021&r2=1603022&view=diff ============================================================================== Files db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/testData/serializedDataSources/EmbeddedDataSource40-10_11_1_0.ser (original) and db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/testData/serializedDataSources/EmbeddedDataSource40-10_11_1_0.ser Mon Jun 16 23:09:03 2014 differ Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/testData/serializedDataSources/EmbeddedXADataSource-10_11_1_0.ser URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/testData/serializedDataSources/EmbeddedXADataSource-10_11_1_0.ser?rev=1603022&r1=1603021&r2=1603022&view=diff ============================================================================== Files db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/testData/serializedDataSources/EmbeddedXADataSource-10_11_1_0.ser (original) and db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/testData/serializedDataSources/EmbeddedXADataSource-10_11_1_0.ser Mon Jun 16 23:09:03 2014 differ Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/testData/serializedDataSources/EmbeddedXADataSource40-10_11_1_0.ser URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/testData/serializedDataSources/EmbeddedXADataSource40-10_11_1_0.ser?rev=1603022&r1=1603021&r2=1603022&view=diff ============================================================================== Files db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/testData/serializedDataSources/EmbeddedXADataSource40-10_11_1_0.ser (original) and db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/testData/serializedDataSources/EmbeddedXADataSource40-10_11_1_0.ser Mon Jun 16 23:09:03 2014 differ Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/JDBCClient.java URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/JDBCClient.java?rev=1603022&r1=1603021&r2=1603022&view=diff ============================================================================== --- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/JDBCClient.java (original) +++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/JDBCClient.java Mon Jun 16 23:09:03 2014 @@ -47,15 +47,15 @@ public final class JDBCClient { "org.apache.derby.jdbc.EmbeddedDriver", JDBC.vmSupportsJNDI() ? - "org.apache.derby.jdbc.EmbeddedDataSource40": + "org.apache.derby.jdbc.EmbeddedDataSource": "org.apache.derby.jdbc.BasicEmbeddedDataSource40", JDBC.vmSupportsJNDI() ? - "org.apache.derby.jdbc.EmbeddedConnectionPoolDataSource40": + "org.apache.derby.jdbc.EmbeddedConnectionPoolDataSource": "org.apache.derby.jdbc.BasicEmbeddedConnectionPoolDataSource40", JDBC.vmSupportsJNDI() ? - "org.apache.derby.jdbc.EmbeddedXADataSource40": + "org.apache.derby.jdbc.EmbeddedXADataSource": "org.apache.derby.jdbc.BasicEmbeddedXADataSource40", "jdbc:derby:");