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 defaultConnectionFactoryImplobjectConnectionFactoryImpl(String URL, String userName, char[] password, String driverName)Creates newConnectionFactoryImplobject with user infoConnectionFactoryImpl(String URL, String userName, char[] password, String driverName, int minPool, int maxPool)Creates newConnectionFactoryImplobject with user and connection info
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidconfigured(boolean flag)INTERNAL Marks Connectionfactory as fully configuredbooleanequals(Object obj)Determines whether obj is a ConnectionFactoryImpl with the same configurationConnectiongetConnection()Returns java.sql.ConnectionStringgetDriverName()Returns JDBC driver nameintgetLoginTimeout()Returns the number of seconds to wait for a new connection to be established to the data sourcePrintWritergetLogWriter()Returns the LogWriter to which messages should be sentintgetMaxPool()Returns maximum number of connections in the connection poolintgetMinPool()Returns minimum number of connections in the connection poolintgetMsInterval()Returns the amount of time, in milliseconds, between the connection manager's attempts to get a pooled connection.intgetMsWait()Returns the number of milliseconds to wait for an available connection from the connection pool before throwing an exceptionintgetTransactionIsolation()Gets this ConnectionFactory's current transaction isolation level.StringgetURL()Returns connection URLStringgetUserName()Returns database user nameinthashCode()Computes the hash code of this ConnectionFactoryImpl.voidsetDriverName(String driverName)Sets JDBC driver namevoidsetLoginTimeout(int loginTimeout)Sets the number of seconds to wait for a new connection to be established to the data sourcevoidsetLogWriter(PrintWriter logWriter)Sets the LogWriter to which messages should be sentvoidsetMaxPool(int maxPool)Sets maximum number of connections in the connection poolvoidsetMinPool(int minPool)Sets minimum number of connections in the connection poolvoidsetMsInterval(int msInterval)Sets the amount of time, in milliseconds, between the connection manager's attempts to get a pooled connection.voidsetMsWait(int msWait)Sets the number of milliseconds to wait for an available connection from the connection pool before throwing an exceptionvoidsetPassword(char[] password)Sets database user passwordvoidsetTransactionIsolation(int level)Sets transaction isolation level for all connections of this ConnectionFactory.voidsetURL(String URL)Sets JDBC connection URLvoidsetUserName(String userName)Sets database user
-
-
-
Constructor Detail
-
ConnectionFactoryImpl
public ConnectionFactoryImpl()
Creates new defaultConnectionFactoryImplobject
-
ConnectionFactoryImpl
public ConnectionFactoryImpl(String URL, String userName, char[] password, String driverName)
Creates newConnectionFactoryImplobject 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 newConnectionFactoryImplobject 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:
setDriverNamein interfaceConnectionFactory- Parameters:
driverName- JDBC driver name
-
getDriverName
public String getDriverName()
Returns JDBC driver name- Specified by:
getDriverNamein interfaceConnectionFactory- Returns:
- driver name
-
setURL
public void setURL(String URL)
Sets JDBC connection URL- Specified by:
setURLin interfaceConnectionFactory- Parameters:
URL- connection URL
-
getURL
public String getURL()
Returns connection URL- Specified by:
getURLin interfaceConnectionFactory- Returns:
- connection URL
-
setUserName
public void setUserName(String userName)
Sets database user- Specified by:
setUserNamein interfaceConnectionFactory- Parameters:
userName- database user
-
getUserName
public String getUserName()
Returns database user name- Specified by:
getUserNamein interfaceConnectionFactory- Returns:
- current database user name
-
setPassword
public void setPassword(char[] password)
Sets database user password- Specified by:
setPasswordin interfaceConnectionFactory- Parameters:
password- database user password
-
setMinPool
public void setMinPool(int minPool)
Sets minimum number of connections in the connection pool- Specified by:
setMinPoolin interfaceConnectionFactory- Parameters:
minPool- minimum number of connections
-
getMinPool
public int getMinPool()
Returns minimum number of connections in the connection pool- Specified by:
getMinPoolin interfaceConnectionFactory- Returns:
- connection minPool
-
setMaxPool
public void setMaxPool(int maxPool)
Sets maximum number of connections in the connection pool- Specified by:
setMaxPoolin interfaceConnectionFactory- Parameters:
maxPool- maximum number of connections
-
getMaxPool
public int getMaxPool()
Returns maximum number of connections in the connection pool- Specified by:
getMaxPoolin 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:
setMsIntervalin 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:
getMsIntervalin 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:
setMsWaitin 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:
getMsWaitin interfaceConnectionFactory- Returns:
- number in milliseconds
-
setLogWriter
public void setLogWriter(PrintWriter logWriter)
Sets the LogWriter to which messages should be sent- Specified by:
setLogWriterin interfaceConnectionFactory- Parameters:
logWriter- logWriter
-
getLogWriter
public PrintWriter getLogWriter()
Returns the LogWriter to which messages should be sent- Specified by:
getLogWriterin 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:
setLoginTimeoutin 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:
getLoginTimeoutin 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:
setTransactionIsolationin 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:
getTransactionIsolationin interfaceConnectionFactory- Returns:
- the current transaction isolation mode value as java.sql.Connection.TRANSACTION_*
-
getConnection
public Connection getConnection()
Returns java.sql.Connection- Specified by:
getConnectionin 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
-
-