Return-Path: Delivered-To: apmail-db-derby-commits-archive@www.apache.org Received: (qmail 67738 invoked from network); 5 May 2005 17:00:14 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 5 May 2005 17:00:14 -0000 Received: (qmail 65654 invoked by uid 500); 5 May 2005 17:02:38 -0000 Delivered-To: apmail-db-derby-commits-archive@db.apache.org Received: (qmail 65606 invoked by uid 500); 5 May 2005 17:02: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" Delivered-To: mailing list derby-commits@db.apache.org Received: (qmail 65584 invoked by uid 500); 5 May 2005 17:02:36 -0000 Delivered-To: apmail-incubator-derby-cvs@incubator.apache.org Received: (qmail 65568 invoked by uid 99); 5 May 2005 17:02:36 -0000 X-ASF-Spam-Status: No, hits=0.2 required=10.0 tests=NO_REAL_NAME X-Spam-Check-By: apache.org Received: from minotaur.apache.org (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.28) with SMTP; Thu, 05 May 2005 10:02:35 -0700 Received: (qmail 67714 invoked by uid 65534); 5 May 2005 17:00:10 -0000 Message-ID: <20050505170010.67713.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: svn commit: r168355 - in /incubator/derby/code/trunk/java/client/org/apache/derby: client/ClientBaseDataSource.java jdbc/ClientConnectionPoolDataSource.java jdbc/ClientDataSource.java jdbc/ClientXADataSource.java Date: Thu, 05 May 2005 17:00:09 -0000 To: derby-cvs@incubator.apache.org From: jboynes@apache.org X-Mailer: svnmailer-1.0.0-dev X-Virus-Checked: Checked X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: jboynes Date: Thu May 5 10:00:08 2005 New Revision: 168355 URL: http://svn.apache.org/viewcvs?rev=3D168355&view=3Drev Log: move all generic implementation into ClientBaseDataSource Modified: incubator/derby/code/trunk/java/client/org/apache/derby/client/ClientBa= seDataSource.java incubator/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientConn= ectionPoolDataSource.java incubator/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientData= Source.java incubator/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientXADa= taSource.java Modified: incubator/derby/code/trunk/java/client/org/apache/derby/client/Cl= ientBaseDataSource.java URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/client/o= rg/apache/derby/client/ClientBaseDataSource.java?rev=3D168355&r1=3D168354&r= 2=3D168355&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/derby/code/trunk/java/client/org/apache/derby/client/ClientBa= seDataSource.java (original) +++ incubator/derby/code/trunk/java/client/org/apache/derby/client/ClientBa= seDataSource.java Thu May 5 10:00:08 2005 @@ -248,21 +248,6 @@ return parseBoolean(retrieveMessageTextString, propertyDefault_ret= rieveMessageText); } =20 - // ---------------------------- traceLevel ---------------------------= -------- - // - - public final static int TRACE_NONE =3D 0x0; - public final static int TRACE_ALL =3D 0xFFFFFFFF; - public final static int propertyDefault_traceLevel =3D TRACE_ALL; - public final static String propertyKey_traceLevel =3D "traceLevel"; - - protected int traceLevel =3D propertyDefault_traceLevel; - - public static int getTraceLevel(Properties properties) { - String traceLevelString =3D properties.getProperty(propertyKey_tra= ceLevel); - return parseInt(traceLevelString, propertyDefault_traceLevel); - } - // ---------------------------- traceFile ----------------------------= ------- // protected String traceFile =3D null; @@ -305,6 +290,12 @@ return properties.getProperty("password"); } =20 + protected String password =3D null; + + synchronized public void setPassword(String password) { + this.password =3D password; + } + //------------------------ interface methods -------------------------= -------- =20 public Reference getReference() throws NamingException { @@ -703,6 +694,217 @@ throw new SqlException(null, "JDBC attribute " + attribute + "has an invalid value " + value + " Valid values are " + choicesStr); + } + + /* + * Properties to be seen by Bean - access thru reflection. + */ + + // -- Stardard JDBC DataSource Properties + + public synchronized void setDatabaseName(String databaseName) { + this.databaseName =3D databaseName; + } + + public String getDatabaseName() { + return this.databaseName; + } + + + public synchronized void setDataSourceName(String dataSourceName) { + this.dataSourceName =3D dataSourceName; + } + + public String getDataSourceName() { + return this.dataSourceName; + } + + public synchronized void setDescription(String description) { + this.description =3D description; + } + + public String getDescription() { + return this.description; + } + + + public synchronized void setPortNumber(int portNumber) { + this.portNumber =3D portNumber; + } + + public int getPortNumber() { + return this.portNumber; + } + + public synchronized void setServerName(String serverName) { + this.serverName =3D serverName; + } + + public String getServerName() { + return this.serverName; + } + + + public synchronized void setUser(String user) { + this.user =3D user; + } + + public String getUser() { + return this.user; + } + + synchronized public void setRetrieveMessageText(boolean retrieveMessag= eText) { + this.retrieveMessageText =3D retrieveMessageText; + } + + public boolean getRetrieveMessageText() { + return this.retrieveMessageText; + } + + // ---------------------------- securityMechanism --------------------= --------------- + /** + * The source security mechanism to use when connecting to this data s= ource. + *

+ * Security mechanism options are:

  • USER_ONLY_SECURITY
  • C= LEAR_TEXT_PASSWORD_SECURITY
  • + * ENCRYPTED_PASSWORD_SECURITY
  • ENCRYPTED_USER_AND_PASSWORD_SECURI= TY - both password and user are encrypted + *
The default security mechanism is USER_ONLY SECURITY + *

+ * If the application specifies a security mechanism then it will be t= he only one attempted. If the specified + * security mechanism is not supported by the conversation then an exc= eption will be thrown and there will be no + * additional retries. + *

+ * This property is currently only available for the DNC driver. + *

+ * Both user and password need to be set for all security mechanism ex= cept USER_ONLY_SECURITY + */ + // We use the NET layer constants to avoid a mapping for the NET drive= r=2E + public final static short USER_ONLY_SECURITY =3D (short) NetConfigurat= ion.SECMEC_USRIDONL; + public final static short CLEAR_TEXT_PASSWORD_SECURITY =3D (short) Net= Configuration.SECMEC_USRIDPWD; + public final static short ENCRYPTED_PASSWORD_SECURITY =3D (short) NetC= onfiguration.SECMEC_USRENCPWD; + public final static short ENCRYPTED_USER_AND_PASSWORD_SECURITY =3D (sh= ort) NetConfiguration.SECMEC_EUSRIDPWD; + + synchronized public void setSecurityMechanism(short securityMechanism)= { + this.securityMechanism =3D securityMechanism; + } + + public short getSecurityMechanism() { + return getUpgradedSecurityMechanism(securityMechanism, password); + } + + protected String connectionAttributes =3D ""; + + /** + * Set this property to pass in more Derby specific connection URL att= ributes. + * + * @param prop set to the list of Cloudscape connection attributes sep= arated by semi-colons. E.g., to specify an + * encryption bootPassword of "x8hhk2adf", and set upgrade= to true, do the following:

+     *             ds.setConnectionAttributes("bootPassword=3Dx8hhk2adf;up=
grade=3Dtrue"); 
See Derby documentation for + * complete list. + */ + public final void setConnectionAttributes(String prop) { + connectionAttributes =3D prop; + } + + /** + * @return Derby specific connection URL attributes + */ + public final String getConnectionAttributes() { + return connectionAttributes; + } + + + // ---------------------------- traceLevel ---------------------------= -------- + // + + public final static int TRACE_NONE =3D 0x0; + public final static int TRACE_CONNECTION_CALLS =3D 0x1; + public final static int TRACE_STATEMENT_CALLS =3D 0x2; + public final static int TRACE_RESULT_SET_CALLS =3D 0x4; + public final static int TRACE_DRIVER_CONFIGURATION =3D 0x10; + public final static int TRACE_CONNECTS =3D 0x20; + public final static int TRACE_PROTOCOL_FLOWS =3D 0x40; + public final static int TRACE_RESULT_SET_META_DATA =3D 0x80; + public final static int TRACE_PARAMETER_META_DATA =3D 0x100; + public final static int TRACE_DIAGNOSTICS =3D 0x200; + public final static int TRACE_XA_CALLS =3D 0x800; + public final static int TRACE_ALL =3D 0xFFFFFFFF; + + public final static int propertyDefault_traceLevel =3D TRACE_ALL; + public final static String propertyKey_traceLevel =3D "traceLevel"; + + protected int traceLevel =3D propertyDefault_traceLevel; + + public static int getTraceLevel(Properties properties) { + String traceLevelString =3D properties.getProperty(propertyKey_tra= ceLevel); + return parseInt(traceLevelString, propertyDefault_traceLevel); + } + + synchronized public void setTraceLevel(int traceLevel) { + this.traceLevel =3D traceLevel; + } + + public int getTraceLevel() { + return this.traceLevel; + } + + + public synchronized void setTraceFile(String traceFile) { + this.traceFile =3D traceFile; + } + + public String getTraceFile() { + return this.traceFile; + } + + + public synchronized void setTraceDirectory(String traceDirectory) { + this.traceDirectory =3D traceDirectory; + } + + public String getTraceDirectory() { + return this.traceDirectory; + } + + synchronized public void setTraceFileAppend(boolean traceFileAppend) { + this.traceFileAppend =3D traceFileAppend; + } + + public boolean getTraceFileAppend() { + return this.traceFileAppend; + } + + + + + // --- private helper methods + + + /** + * The dataSource keeps individual fields for the values that are rele= vant to the client. These need to be updated + * when set connection attributes is called. + */ + protected void updateDataSourceValues(Properties prop) { + if (prop.containsKey(propertyKey_user)) { + setUser(getUser(prop)); + } + if (prop.containsKey(propertyKey_securityMechanism)) { + setSecurityMechanism(getSecurityMechanism(prop)); + } + if (prop.containsKey(propertyKey_traceFile)) { + setTraceFile(getTraceFile(prop)); + } + if (prop.containsKey(propertyKey_traceDirectory)) { + setTraceDirectory(getTraceDirectory(prop)); + } + if (prop.containsKey(propertyKey_traceFileAppend)) { + setTraceFileAppend(getTraceFileAppend(prop)); + } + if (prop.containsKey(propertyKey_securityMechanism)) { + setSecurityMechanism(getSecurityMechanism(prop)); + } + if (prop.containsKey(propertyKey_retrieveMessageText)) { + setRetrieveMessageText(getRetrieveMessageText(prop)); + } } =20 =20 Modified: incubator/derby/code/trunk/java/client/org/apache/derby/jdbc/Clie= ntConnectionPoolDataSource.java URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/client/o= rg/apache/derby/jdbc/ClientConnectionPoolDataSource.java?rev=3D168355&r1=3D= 168354&r2=3D168355&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientConn= ectionPoolDataSource.java (original) +++ incubator/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientConn= ectionPoolDataSource.java Thu May 5 10:00:08 2005 @@ -35,14 +35,6 @@ private static final long serialVersionUID =3D -539234282156481377L; public static final String className__ =3D "org.apache.derby.jdbc.Clie= ntConnectionPoolDataSource"; =20 - private String password =3D null; - - synchronized public void setPassword(String password) { - this.password =3D password; - } - - public final static String propertyKey_password =3D "password"; - public ClientConnectionPoolDataSource() { super(); } Modified: incubator/derby/code/trunk/java/client/org/apache/derby/jdbc/Clie= ntDataSource.java URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/client/o= rg/apache/derby/jdbc/ClientDataSource.java?rev=3D168355&r1=3D168354&r2=3D16= 8355&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientData= Source.java (original) +++ incubator/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientData= Source.java Thu May 5 10:00:08 2005 @@ -22,12 +22,10 @@ =20 import java.sql.Connection; import java.sql.SQLException; -import java.util.Properties; import javax.sql.DataSource; =20 import org.apache.derby.client.ClientBaseDataSource; import org.apache.derby.client.am.LogWriter; -import org.apache.derby.client.net.NetConfiguration; import org.apache.derby.client.net.NetConnection; import org.apache.derby.client.net.NetLogWriter; =20 @@ -112,12 +110,6 @@ // You cannot change the name of the class or the package it belongs t= o, as that information is written to the stream during // serialization. =20 - private String password =3D null; - - synchronized public void setPassword(String password) { - this.password =3D password; - } - =20 /** * Creates a simple DERBY data source with default property values for= a non-pooling, non-distributed environment. @@ -163,204 +155,6 @@ LogWriter dncLogWriter =3D super.computeDncLogWriterForNewConnecti= on("_sds"); updateDataSourceValues(tokenizeAttributes(connectionAttributes, nu= ll)); return new NetConnection((NetLogWriter) dncLogWriter, user, passwo= rd, this, -1, false); - } - - /* - * Properties to be seen by Bean - access thru reflection. - */ - - // -- Stardard JDBC DataSource Properties - - public synchronized void setDatabaseName(String databaseName) { - this.databaseName =3D databaseName; - } - - public String getDatabaseName() { - return this.databaseName; - } - - - public synchronized void setDataSourceName(String dataSourceName) { - this.dataSourceName =3D dataSourceName; - } - - public String getDataSourceName() { - return this.dataSourceName; - } - - public synchronized void setDescription(String description) { - this.description =3D description; - } - - public String getDescription() { - return this.description; - } - - - public synchronized void setPortNumber(int portNumber) { - this.portNumber =3D portNumber; - } - - public int getPortNumber() { - return this.portNumber; - } - - public synchronized void setServerName(String serverName) { - this.serverName =3D serverName; - } - - public String getServerName() { - return this.serverName; - } - - - public synchronized void setUser(String user) { - this.user =3D user; - } - - public String getUser() { - return this.user; - } - - synchronized public void setRetrieveMessageText(boolean retrieveMessag= eText) { - this.retrieveMessageText =3D retrieveMessageText; - } - - public boolean getRetrieveMessageText() { - return this.retrieveMessageText; - } - - // ---------------------------- securityMechanism --------------------= --------------- - /** - * The source security mechanism to use when connecting to this data s= ource. - *

- * Security mechanism options are:

  • USER_ONLY_SECURITY
  • C= LEAR_TEXT_PASSWORD_SECURITY
  • - * ENCRYPTED_PASSWORD_SECURITY
  • ENCRYPTED_USER_AND_PASSWORD_SECURI= TY - both password and user are encrypted - *
The default security mechanism is USER_ONLY SECURITY - *

- * If the application specifies a security mechanism then it will be t= he only one attempted. If the specified - * security mechanism is not supported by the conversation then an exc= eption will be thrown and there will be no - * additional retries. - *

- * This property is currently only available for the DNC driver. - *

- * Both user and password need to be set for all security mechanism ex= cept USER_ONLY_SECURITY - */ - // We use the NET layer constants to avoid a mapping for the NET drive= r=2E - public final static short USER_ONLY_SECURITY =3D (short) NetConfigurat= ion.SECMEC_USRIDONL; - public final static short CLEAR_TEXT_PASSWORD_SECURITY =3D (short) Net= Configuration.SECMEC_USRIDPWD; - public final static short ENCRYPTED_PASSWORD_SECURITY =3D (short) NetC= onfiguration.SECMEC_USRENCPWD; - public final static short ENCRYPTED_USER_AND_PASSWORD_SECURITY =3D (sh= ort) NetConfiguration.SECMEC_EUSRIDPWD; - - synchronized public void setSecurityMechanism(short securityMechanism)= { - this.securityMechanism =3D securityMechanism; - } - - public short getSecurityMechanism() { - return getUpgradedSecurityMechanism(securityMechanism, password); - } - - protected String connectionAttributes =3D ""; - - /** - * Set this property to pass in more Derby specific connection URL att= ributes. - * - * @param prop set to the list of Cloudscape connection attributes sep= arated by semi-colons. E.g., to specify an - * encryption bootPassword of "x8hhk2adf", and set upgrade= to true, do the following:

-     *             ds.setConnectionAttributes("bootPassword=3Dx8hhk2adf;up=
grade=3Dtrue"); 
See Derby documentation for - * complete list. - */ - public final void setConnectionAttributes(String prop) { - connectionAttributes =3D prop; - } - - /** - * @return Derby specific connection URL attributes - */ - public final String getConnectionAttributes() { - return connectionAttributes; - } - - - public final static int TRACE_NONE =3D 0x0; - public final static int TRACE_CONNECTION_CALLS =3D 0x1; - public final static int TRACE_STATEMENT_CALLS =3D 0x2; - public final static int TRACE_RESULT_SET_CALLS =3D 0x4; - public final static int TRACE_DRIVER_CONFIGURATION =3D 0x10; - public final static int TRACE_CONNECTS =3D 0x20; - public final static int TRACE_PROTOCOL_FLOWS =3D 0x40; - public final static int TRACE_RESULT_SET_META_DATA =3D 0x80; - public final static int TRACE_PARAMETER_META_DATA =3D 0x100; - public final static int TRACE_DIAGNOSTICS =3D 0x200; - public final static int TRACE_XA_CALLS =3D 0x800; - public final static int TRACE_ALL =3D 0xFFFFFFFF; - - synchronized public void setTraceLevel(int traceLevel) { - this.traceLevel =3D traceLevel; - } - - public int getTraceLevel() { - return this.traceLevel; - } - - - public synchronized void setTraceFile(String traceFile) { - this.traceFile =3D traceFile; - } - - public String getTraceFile() { - return this.traceFile; - } - - - public synchronized void setTraceDirectory(String traceDirectory) { - this.traceDirectory =3D traceDirectory; - } - - public String getTraceDirectory() { - return this.traceDirectory; - } - - synchronized public void setTraceFileAppend(boolean traceFileAppend) { - this.traceFileAppend =3D traceFileAppend; - } - - public boolean getTraceFileAppend() { - return this.traceFileAppend; - } - - - - - // --- private helper methods - - - /** - * The dataSource keeps individual fields for the values that are rele= vant to the client. These need to be updated - * when set connection attributes is called. - */ - private void updateDataSourceValues(Properties prop) { - if (prop.containsKey(propertyKey_user)) { - setUser(getUser(prop)); - } - if (prop.containsKey(propertyKey_securityMechanism)) { - setSecurityMechanism(getSecurityMechanism(prop)); - } - if (prop.containsKey(propertyKey_traceFile)) { - setTraceFile(getTraceFile(prop)); - } - if (prop.containsKey(propertyKey_traceDirectory)) { - setTraceDirectory(getTraceDirectory(prop)); - } - if (prop.containsKey(propertyKey_traceFileAppend)) { - setTraceFileAppend(getTraceFileAppend(prop)); - } - if (prop.containsKey(propertyKey_securityMechanism)) { - setSecurityMechanism(getSecurityMechanism(prop)); - } - if (prop.containsKey(propertyKey_retrieveMessageText)) { - setRetrieveMessageText(getRetrieveMessageText(prop)); - } } =20 } Modified: incubator/derby/code/trunk/java/client/org/apache/derby/jdbc/Clie= ntXADataSource.java URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/client/o= rg/apache/derby/jdbc/ClientXADataSource.java?rev=3D168355&r1=3D168354&r2=3D= 168355&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientXADa= taSource.java (original) +++ incubator/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientXADa= taSource.java Thu May 5 10:00:08 2005 @@ -35,14 +35,6 @@ // verify it everytime that ClientXADataSource is modified private static final long serialVersionUID =3D 7057075094707674880L; =20 - private String password =3D null; - - synchronized public void setPassword(String password) { - this.password =3D password; - } - - public final static String propertyKey_password =3D "password"; - public ClientXADataSource() { this.setResultSetHoldability(CLOSE_CURSORS_AT_COMMIT); }