jmcnally 02/01/13 20:29:54
Modified: proposals/jdbc2pool/org/apache/torque/jdbc2pool/adapter Tag:
JDBC2POOL_BRANCH PooledConnectionDataSource.java
Log:
documentation improvement.
removed unused code.
Revision Changes Path
No revision
No revision
1.1.2.2 +32 -109
jakarta-turbine-torque/proposals/jdbc2pool/org/apache/torque/jdbc2pool/adapter/PooledConnectionDataSource.java
Index: PooledConnectionDataSource.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-torque/proposals/jdbc2pool/org/apache/torque/jdbc2pool/adapter/PooledConnectionDataSource.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- PooledConnectionDataSource.java 30 Dec 2001 17:33:36 -0000 1.1.2.1
+++ PooledConnectionDataSource.java 14 Jan 2002 04:29:53 -0000 1.1.2.2
@@ -61,7 +61,6 @@
import java.util.Hashtable;
import java.io.PrintWriter;
import java.io.Serializable;
-//import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import javax.sql.PooledConnection;
@@ -80,24 +79,16 @@
* DriverManager implementation
*
* @author <a href="mailto:[EMAIL PROTECTED]">John D. McNally</a>
- * @version $Id: PooledConnectionDataSource.java,v 1.1.2.1 2001/12/30 17:33:36
jmcnally Exp $
+ * @version $Id: PooledConnectionDataSource.java,v 1.1.2.2 2002/01/14 04:29:53
jmcnally Exp $
*/
public class PooledConnectionDataSource
implements ConnectionPoolDataSource, Referenceable, Serializable,
ObjectFactory
{
- /** Database Name */
- private String databaseName;
/** Description */
private String description;
- /** Network Protocol */
- private String networkProtocol;
/** Password */
private String password;
- /** Port number */
- private int portNumber;
- /** Server Name */
- private String serverName;
/** Url name */
private String url;
/** User name */
@@ -120,26 +111,10 @@
// Properties
/**
- * Get the value of databaseName.
- * @return value of databaseName.
- */
- public String getDatabaseName()
- {
- return databaseName;
- }
-
- /**
- * Set the value of databaseName.
- * @param v Value to assign to databaseName.
- */
- public void setDatabaseName(String v)
- {
- this.databaseName = v;
- }
-
-
- /**
- * Get the value of description.
+ * Get the value of description. This property is here for use by
+ * the code which will deploy this datasource. It is not used
+ * internally.
+ *
* @return value of description.
*/
public String getDescription()
@@ -148,87 +123,37 @@
}
/**
- * Set the value of description.
+ * Set the value of description. This property is here for use by
+ * the code which will deploy this datasource. It is not used
+ * internally.
+ *
* @param v Value to assign to description.
*/
public void setDescription(String v)
{
this.description = v;
}
-
- /**
- * Get the value of networkProtocol.
- * @return value of networkProtocol.
- */
- public String getNetworkProtocol()
- {
- return networkProtocol;
- }
-
+
/**
- * Set the value of networkProtocol.
- * @param v Value to assign to networkProtocol.
+ * Get the value of password for the default user.
+ * @return value of password.
*/
- public void setNetworkProtocol(String v)
- {
- this.networkProtocol = v;
- }
- /**
- * Get the value of password.
- * @return value of password.
- */
public String getPassword()
{
return password;
}
/**
- * Set the value of password.
+ * Set the value of password for the default user.
* @param v Value to assign to password.
*/
public void setPassword(String v)
{
this.password = v;
}
-
- /**
- * Get the value of portNumber.
- * @return value of portNumber.
- */
- public int getPortNumber()
- {
- return portNumber;
- }
-
- /**
- * Set the value of portNumber.
- * @param v Value to assign to portNumber.
- */
- public void setPortNumber(int v)
- {
- this.portNumber = v;
- }
-
- /**
- * Get the value of serverName.
- * @return value of serverName.
- */
- public String getServerName()
- {
- return serverName;
- }
-
- /**
- * Set the value of serverName.
- * @param v Value to assign to serverName.
- */
- public void setServerName(String v)
- {
- this.serverName = v;
- }
/**
- * Get the value of url.
+ * Get the value of url used to locate the database for this datasource.
* @return value of url.
*/
public String getUrl()
@@ -237,7 +162,7 @@
}
/**
- * Set the value of url.
+ * Set the value of url used to locate the database for this datasource.
* @param v Value to assign to url.
*/
public void setUrl(String v)
@@ -246,7 +171,7 @@
}
/**
- * Get the value of user.
+ * Get the value of default user (login or username).
* @return value of user.
*/
public String getUser()
@@ -255,7 +180,7 @@
}
/**
- * Set the value of user.
+ * Set the value of default user (login or username).
* @param v Value to assign to user.
*/
public void setUser(String v)
@@ -264,7 +189,7 @@
}
/**
- * Get the value of driver.
+ * Get the driver classname.
* @return value of driver.
*/
public String getDriver()
@@ -273,7 +198,8 @@
}
/**
- * Set the value of driver.
+ * Set the driver classname. Setting the driver classname cause the
+ * driver to be registered with the DriverManager.
* @param v Value to assign to driver.
*/
public void setDriver(String v)
@@ -285,7 +211,8 @@
}
/**
- * Attempt to establish a database connection.
+ * Attempt to establish a database connection using the default
+ * user and password.
*/
public PooledConnection getPooledConnection()
throws SQLException
@@ -306,21 +233,21 @@
{
return new PooledConnectionImpl(
DriverManager.getConnection( getUrl(),
- username,
- password ) );
+ getUser(),
+ getPassword() ) );
}
catch( ClassCircularityError e )
{
return new PooledConnectionImpl(
DriverManager.getConnection( getUrl(),
- username,
- password ) );
+ getUser(),
+ getPassword() ) );
}
}
/**
* Gets the maximum time in seconds that this data source can wait
- * while attempting to connect to a database..
+ * while attempting to connect to a database. NOT USED.
*/
public int getLoginTimeout()
{
@@ -328,7 +255,7 @@
}
/**
- * Get the log writer for this data source.
+ * Get the log writer for this data source. NOT USED.
*/
public PrintWriter getLogWriter()
{
@@ -337,7 +264,7 @@
/**
* Sets the maximum time in seconds that this data source will wait
- * while attempting to connect to a database.
+ * while attempting to connect to a database. NOT USED.
*/
public void setLoginTimeout(int seconds)
{
@@ -345,7 +272,7 @@
}
/**
- * Set the log writer for this data source.
+ * Set the log writer for this data source. NOT USED.
*/
public void setLogWriter(java.io.PrintWriter out)
{
@@ -362,12 +289,8 @@
Reference ref = new Reference(getClass().getName(), factory, null);
- //ref.add(new StringRefAddr("databaseName", getDatabaseName()));
ref.add(new StringRefAddr("description", getDescription()));
- //ref.add(new StringRefAddr("networkProtocol", getNetworkProtocol()));
ref.add(new StringRefAddr("password", getPassword()));
- //ref.add(new StringRefAddr("portNumber", "" + getPort()));
- //ref.add(new StringRefAddr("serverName", getServerName()));
ref.add(new StringRefAddr("user", getUser()));
ref.add(new StringRefAddr("url", getUrl()));
@@ -386,7 +309,6 @@
if (ref.getClassName().equals(getClass().getName()))
{
- // setDatabaseName((String)Ref.get("databaseName").getContent());
setDescription((String)ref.get("description").getContent());
setUrl((String)ref.get("url").getContent());
setUser((String)ref.get("user").getContent());
@@ -394,7 +316,8 @@
return this;
}
else
- { // We can't create an instance of the reference
+ {
+ // We can't create an instance of the reference
return null;
}
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>