Class ConnectionFactoryImpl
- java.lang.Object
-
- com.sun.jdo.spi.persistence.support.sqlstore.impl.ConnectionFactoryImpl
-
- All Implemented Interfaces:
ConnectionFactory
,Serializable
public class ConnectionFactoryImpl extends Object implements ConnectionFactory, Serializable
- Version:
- 0.1
- Author:
- Craig Russell
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ConnectionFactoryImpl()
Creates new defaultConnectionFactoryImpl
objectConnectionFactoryImpl(String URL, String userName, char[] password, String driverName)
Creates newConnectionFactoryImpl
object with user infoConnectionFactoryImpl(String URL, String userName, char[] password, String driverName, int minPool, int maxPool)
Creates newConnectionFactoryImpl
object with user and connection info
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
configured(boolean flag)
INTERNAL Marks Connectionfactory as fully configuredboolean
equals(Object obj)
Determines whether obj is a ConnectionFactoryImpl with the same configurationConnection
getConnection()
Returns java.sql.ConnectionString
getDriverName()
Returns JDBC driver nameint
getLoginTimeout()
Returns the number of seconds to wait for a new connection to be established to the data sourcePrintWriter
getLogWriter()
Returns the LogWriter to which messages should be sentint
getMaxPool()
Returns maximum number of connections in the connection poolint
getMinPool()
Returns minimum number of connections in the connection poolint
getMsInterval()
Returns the amount of time, in milliseconds, between the connection manager's attempts to get a pooled connection.int
getMsWait()
Returns the number of milliseconds to wait for an available connection from the connection pool before throwing an exceptionint
getTransactionIsolation()
Gets this ConnectionFactory's current transaction isolation level.String
getURL()
Returns connection URLString
getUserName()
Returns database user nameint
hashCode()
Computes the hash code of this ConnectionFactoryImpl.void
setDriverName(String driverName)
Sets JDBC driver namevoid
setLoginTimeout(int loginTimeout)
Sets the number of seconds to wait for a new connection to be established to the data sourcevoid
setLogWriter(PrintWriter logWriter)
Sets the LogWriter to which messages should be sentvoid
setMaxPool(int maxPool)
Sets maximum number of connections in the connection poolvoid
setMinPool(int minPool)
Sets minimum number of connections in the connection poolvoid
setMsInterval(int msInterval)
Sets the amount of time, in milliseconds, between the connection manager's attempts to get a pooled connection.void
setMsWait(int msWait)
Sets the number of milliseconds to wait for an available connection from the connection pool before throwing an exceptionvoid
setPassword(char[] password)
Sets database user passwordvoid
setTransactionIsolation(int level)
Sets transaction isolation level for all connections of this ConnectionFactory.void
setURL(String URL)
Sets JDBC connection URLvoid
setUserName(String userName)
Sets database user
-
-
-
Constructor Detail
-
ConnectionFactoryImpl
public ConnectionFactoryImpl()
Creates new defaultConnectionFactoryImpl
object
-
ConnectionFactoryImpl
public ConnectionFactoryImpl(String URL, String userName, char[] password, String driverName)
Creates newConnectionFactoryImpl
object with user info- Parameters:
URL
- connection URLuserName
- database userpassword
- database user passworddriverName
- driver name
-
ConnectionFactoryImpl
public ConnectionFactoryImpl(String URL, String userName, char[] password, String driverName, int minPool, int maxPool)
Creates newConnectionFactoryImpl
object with user and connection info- Parameters:
URL
- connection URLuserName
- database userpassword
- database user passworddriverName
- driver nameminPool
- minimum number of connectionsmaxPool
- maximum number of connections
-
-
Method Detail
-
setDriverName
public void setDriverName(String driverName)
Sets JDBC driver name- Specified by:
setDriverName
in interfaceConnectionFactory
- Parameters:
driverName
- JDBC driver name
-
getDriverName
public String getDriverName()
Returns JDBC driver name- Specified by:
getDriverName
in interfaceConnectionFactory
- Returns:
- driver name
-
setURL
public void setURL(String URL)
Sets JDBC connection URL- Specified by:
setURL
in interfaceConnectionFactory
- Parameters:
URL
- connection URL
-
getURL
public String getURL()
Returns connection URL- Specified by:
getURL
in interfaceConnectionFactory
- Returns:
- connection URL
-
setUserName
public void setUserName(String userName)
Sets database user- Specified by:
setUserName
in interfaceConnectionFactory
- Parameters:
userName
- database user
-
getUserName
public String getUserName()
Returns database user name- Specified by:
getUserName
in interfaceConnectionFactory
- Returns:
- current database user name
-
setPassword
public void setPassword(char[] password)
Sets database user password- Specified by:
setPassword
in interfaceConnectionFactory
- Parameters:
password
- database user password
-
setMinPool
public void setMinPool(int minPool)
Sets minimum number of connections in the connection pool- Specified by:
setMinPool
in interfaceConnectionFactory
- Parameters:
minPool
- minimum number of connections
-
getMinPool
public int getMinPool()
Returns minimum number of connections in the connection pool- Specified by:
getMinPool
in interfaceConnectionFactory
- Returns:
- connection minPool
-
setMaxPool
public void setMaxPool(int maxPool)
Sets maximum number of connections in the connection pool- Specified by:
setMaxPool
in interfaceConnectionFactory
- Parameters:
maxPool
- maximum number of connections
-
getMaxPool
public int getMaxPool()
Returns maximum number of connections in the connection pool- Specified by:
getMaxPool
in interfaceConnectionFactory
- Returns:
- connection maxPool
-
setMsInterval
public void setMsInterval(int msInterval)
Sets the amount of time, in milliseconds, between the connection manager's attempts to get a pooled connection.- Specified by:
setMsInterval
in interfaceConnectionFactory
- Parameters:
msInterval
- the interval between attempts to get a database connection, in milliseconds.
-
getMsInterval
public int getMsInterval()
Returns the amount of time, in milliseconds, between the connection manager's attempts to get a pooled connection.- Specified by:
getMsInterval
in interfaceConnectionFactory
- Returns:
- the length of the interval between tries in milliseconds
-
setMsWait
public void setMsWait(int msWait)
Sets the number of milliseconds to wait for an available connection from the connection pool before throwing an exception- Specified by:
setMsWait
in interfaceConnectionFactory
- Parameters:
msWait
- number in milliseconds
-
getMsWait
public int getMsWait()
Returns the number of milliseconds to wait for an available connection from the connection pool before throwing an exception- Specified by:
getMsWait
in interfaceConnectionFactory
- Returns:
- number in milliseconds
-
setLogWriter
public void setLogWriter(PrintWriter logWriter)
Sets the LogWriter to which messages should be sent- Specified by:
setLogWriter
in interfaceConnectionFactory
- Parameters:
logWriter
- logWriter
-
getLogWriter
public PrintWriter getLogWriter()
Returns the LogWriter to which messages should be sent- Specified by:
getLogWriter
in interfaceConnectionFactory
- Returns:
- logWriter
-
setLoginTimeout
public void setLoginTimeout(int loginTimeout)
Sets the number of seconds to wait for a new connection to be established to the data source- Specified by:
setLoginTimeout
in interfaceConnectionFactory
- Parameters:
loginTimeout
- wait time in seconds
-
getLoginTimeout
public int getLoginTimeout()
Returns the number of seconds to wait for a new connection to be established to the data source- Specified by:
getLoginTimeout
in interfaceConnectionFactory
- Returns:
- wait time in seconds
-
setTransactionIsolation
public void setTransactionIsolation(int level)
Sets transaction isolation level for all connections of this ConnectionFactory. All validation is done by java.sql.Connection itself, so e.g. while Oracle will not allow to set solation level to TRANSACTION_REPEATABLE_READ, this method does not have any explicit restrictions- Specified by:
setTransactionIsolation
in interfaceConnectionFactory
- Parameters:
level
- - one of the java.sql.Connection.TRANSACTION_* isolation values
-
getTransactionIsolation
public int getTransactionIsolation()
Gets this ConnectionFactory's current transaction isolation level.- Specified by:
getTransactionIsolation
in interfaceConnectionFactory
- Returns:
- the current transaction isolation mode value as java.sql.Connection.TRANSACTION_*
-
getConnection
public Connection getConnection()
Returns java.sql.Connection- Specified by:
getConnection
in interfaceConnectionFactory
- Returns:
- connection as java.sql.Connection
-
equals
public boolean equals(Object obj)
Determines whether obj is a ConnectionFactoryImpl with the same configuration
-
hashCode
public int hashCode()
Computes the hash code of this ConnectionFactoryImpl.
-
configured
public void configured(boolean flag)
INTERNAL Marks Connectionfactory as fully configured- Parameters:
flag
- boolean flag
-
-