org.opennms.netmgt.config
Class C3P0ConnectionFactory

java.lang.Object
  extended by org.opennms.netmgt.config.BaseConnectionFactory
      extended by org.opennms.netmgt.config.C3P0ConnectionFactory
All Implemented Interfaces:
Wrapper, CommonDataSource, DataSource, ClosableDataSource

public class C3P0ConnectionFactory
extends BaseConnectionFactory

C3P0ConnectionFactory class.


Constructor Summary
C3P0ConnectionFactory(InputStream stream, String dsName)
           
C3P0ConnectionFactory(String configFile, String dsName)
           
 
Method Summary
 void close()
          close
 Connection getConnection()
          getConnection
 Connection getConnection(String username, String password)
          
 DataSource getDataSource()
          getDataSource
 int getLoginTimeout()
          getLoginTimeout
 PrintWriter getLogWriter()
          getLogWriter
 String getUrl()
          getUrl
 String getUser()
          getUser
protected  void initializePool(JdbcDataSource dataSource)
           
 void setIdleTimeout(int idleTimeout)
          How long, in seconds, an idle connection is kept in the pool before it is removed.
 void setLoginTimeout(int seconds)
          How long, in seconds, to attempt to make a connection to the database.
 void setLogWriter(PrintWriter out)
          
 void setMaxPool(int maxPool)
          The maximum number of pooled connections to retain.
 void setMaxSize(int maxSize)
          The maximum number of connections that can be created.
 void setMinPool(int minPool)
          The minimum number of pooled connections to retain.
 void setUrl(String url)
          setUrl
 void setUser(String user)
          setUser
 
Methods inherited from class org.opennms.netmgt.config.BaseConnectionFactory
isWrapperFor, unwrap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

C3P0ConnectionFactory

public C3P0ConnectionFactory(InputStream stream,
                             String dsName)
                      throws org.exolab.castor.xml.MarshalException,
                             org.exolab.castor.xml.ValidationException,
                             PropertyVetoException,
                             SQLException
Throws:
org.exolab.castor.xml.MarshalException
org.exolab.castor.xml.ValidationException
PropertyVetoException
SQLException

C3P0ConnectionFactory

public C3P0ConnectionFactory(String configFile,
                             String dsName)
                      throws IOException,
                             org.exolab.castor.xml.MarshalException,
                             org.exolab.castor.xml.ValidationException,
                             PropertyVetoException,
                             SQLException
Throws:
IOException
org.exolab.castor.xml.MarshalException
org.exolab.castor.xml.ValidationException
PropertyVetoException
SQLException
Method Detail

initializePool

protected void initializePool(JdbcDataSource dataSource)
                       throws SQLException
Specified by:
initializePool in class BaseConnectionFactory
Throws:
SQLException

getConnection

public Connection getConnection()
                         throws SQLException
Description copied from class: BaseConnectionFactory

getConnection

Specified by:
getConnection in interface DataSource
Specified by:
getConnection in class BaseConnectionFactory
Returns:
a Connection object.
Throws:
SQLException - if any.

getUrl

public String getUrl()
Description copied from class: BaseConnectionFactory

getUrl

Specified by:
getUrl in class BaseConnectionFactory
Returns:
a String object.

setUrl

public void setUrl(String url)
Description copied from class: BaseConnectionFactory

setUrl

Specified by:
setUrl in class BaseConnectionFactory
Parameters:
url - a String object.

getUser

public String getUser()
Description copied from class: BaseConnectionFactory

getUser

Specified by:
getUser in class BaseConnectionFactory
Returns:
a String object.

setUser

public void setUser(String user)
Description copied from class: BaseConnectionFactory

setUser

Specified by:
setUser in class BaseConnectionFactory
Parameters:
user - a String object.

getDataSource

public DataSource getDataSource()
Description copied from class: BaseConnectionFactory

getDataSource

Specified by:
getDataSource in class BaseConnectionFactory
Returns:
a DataSource object.

getConnection

public Connection getConnection(String username,
                                String password)
                         throws SQLException
Description copied from class: BaseConnectionFactory

Specified by:
getConnection in interface DataSource
Specified by:
getConnection in class BaseConnectionFactory
Throws:
SQLException

getLogWriter

public PrintWriter getLogWriter()
                         throws SQLException
Description copied from class: BaseConnectionFactory

getLogWriter

Specified by:
getLogWriter in interface CommonDataSource
Specified by:
getLogWriter in class BaseConnectionFactory
Returns:
a PrintWriter object.
Throws:
SQLException - if any.

setLogWriter

public void setLogWriter(PrintWriter out)
                  throws SQLException
Description copied from class: BaseConnectionFactory

Specified by:
setLogWriter in interface CommonDataSource
Specified by:
setLogWriter in class BaseConnectionFactory
Throws:
SQLException

setLoginTimeout

public void setLoginTimeout(int seconds)
                     throws SQLException
Description copied from class: BaseConnectionFactory
How long, in seconds, to attempt to make a connection to the database.

Specified by:
setLoginTimeout in interface CommonDataSource
Specified by:
setLoginTimeout in interface ClosableDataSource
Specified by:
setLoginTimeout in class BaseConnectionFactory
Throws:
SQLException

getLoginTimeout

public int getLoginTimeout()
                    throws SQLException
Description copied from class: BaseConnectionFactory

getLoginTimeout

Specified by:
getLoginTimeout in interface CommonDataSource
Specified by:
getLoginTimeout in class BaseConnectionFactory
Returns:
a int.
Throws:
SQLException - if any.

close

public void close()
           throws SQLException
Description copied from class: BaseConnectionFactory

close

Specified by:
close in interface ClosableDataSource
Overrides:
close in class BaseConnectionFactory
Throws:
SQLException - if any.

setIdleTimeout

public void setIdleTimeout(int idleTimeout)
Description copied from interface: ClosableDataSource
How long, in seconds, an idle connection is kept in the pool before it is removed.


setMinPool

public void setMinPool(int minPool)
Description copied from interface: ClosableDataSource
The minimum number of pooled connections to retain.


setMaxPool

public void setMaxPool(int maxPool)
Description copied from interface: ClosableDataSource
The maximum number of pooled connections to retain.


setMaxSize

public void setMaxSize(int maxSize)
Description copied from interface: ClosableDataSource
The maximum number of connections that can be created.



Copyright © 2011. All Rights Reserved.