Overview | Package | Class | Tree | Deprecated | Index | Help
| Openfire 3.4.3 Javadoc
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jivesoftware.database
Class DefaultConnectionProvider

    java.lang.Object
      org.jivesoftware.database.DefaultConnectionProvider

All Implemented Interfaces:
  ConnectionProvider

    public class DefaultConnectionProvider

extends Object
implements ConnectionProvider

Default Jive connection provider, which uses an internal connection pool.

Author:
  Jive Software

Constructor Summary
`DefaultConnectionProvider()` Creates a new DefaultConnectionProvider.

Method Summary
`void` | `destroy()` Tells the connection provider to destroy itself.
`void` | `finalize()`
`Connection` | `getConnection()` Returns a database connection.
`double` | `getConnectionTimeout()` Returns the amount of time between connection recycles in days.
`String` | `getDriver()` Returns the JDBC driver classname used to make database connections.
`int` | `getMaxConnections()` Returns the maximum number of connections that the pool will use.
`int` | `getMinConnections()` Returns the minimum number of connections that the pool will use.
`String` | `getPassword()` Returns the password used to connect to the database.
`String` | `getServerURL()` Returns the JDBC connection URL used to make database connections.
`String` | `getUsername()` Returns the username used to connect to the database.
`boolean` | `isMysqlUseUnicode()`
`boolean` | `isPooled()` Returns true if this connection provider provides connections out of a connection pool.
`void` | `restart()` This method should be called whenever properties have been changed so that the changes will take effect.
`void` | `setConnectionTimeout(double connectionTimeout)` Sets the amount of time between connection recycles in days.
`void` | `setDriver(String driver)` Sets the JDBC driver classname used to make database connections.
`void` | `setMaxConnections(int maxConnections)` Sets the maximum number of connections that the pool will use.
`void` | `setMinConnections(int minConnections)` Sets the minimum number of connections that the pool will use.
`void` | `setPassword(String password)` Sets the password used to connect to the database.
`void` | `setServerURL(String serverURL)` Sets the JDBC connection URL used to make database connections.
`void` | `setUsername(String username)` Sets the username used to connect to the database.
`void` | `start()` Starts the connection provider.
`String` | `toString()`

Methods inherited from class java.lang.Object
`clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### DefaultConnectionProvider

    public DefaultConnectionProvider()

  Creates a new DefaultConnectionProvider.

Method Detail

### isPooled

    public boolean isPooled()

  Description copied from interface: `ConnectionProvider`
  Returns true if this connection provider provides connections out of a connection pool. Implementing and using connection providers that are pooled is strongly recommended, as they greatly increase the speed of Jive.

  Specified by:
    `isPooled` in interface `ConnectionProvider`
  Returns:
    true if the Connection objects returned by this provider are pooled.

### getConnection

    public Connection getConnection()
                             throws SQLException

  Description copied from interface: `ConnectionProvider`
  Returns a database connection. When a Jive component is done with a connection, it will call the close method of that connection. Therefore, connection pools with special release methods are not directly supported by the connection provider infrastructure. Instead, connections from those pools should be wrapped such that calling the close method on the wrapper class will release the connection from the pool.

  Specified by:
    `getConnection` in interface `ConnectionProvider`
  Returns:
    a Connection object.
  Throws:
    `SQLException`

### start

    public void start()

  Description copied from interface: `ConnectionProvider`
  Starts the connection provider. For some connection providers, this will be a no-op. However, connection provider users should always call this method to make sure the connection provider is started.

  Specified by:
    `start` in interface `ConnectionProvider`

### restart

    public void restart()

  Description copied from interface: `ConnectionProvider`
  This method should be called whenever properties have been changed so that the changes will take effect.

  Specified by:
    `restart` in interface `ConnectionProvider`

### destroy

    public void destroy()

  Description copied from interface: `ConnectionProvider`
  Tells the connection provider to destroy itself. For many connection providers, this will essentially result in a no-op. However, connection provider users should always call this method when changing from one connection provider to another to ensure that there are no dangling database connections.

  Specified by:
    `destroy` in interface `ConnectionProvider`

### finalize

    public void finalize()

  Overrides:
    `finalize` in class `Object`

### getDriver

    public String getDriver()

  Returns the JDBC driver classname used to make database connections. For example: com.mysql.jdbc.Driver

  Returns:
    the JDBC driver classname.

### setDriver

    public void setDriver(String driver)

  Sets the JDBC driver classname used to make database connections. For example: com.mysql.jdbc.Driver

  Parameters:
    `driver` - the fully qualified JDBC driver name.

### getServerURL

    public String getServerURL()

  Returns the JDBC connection URL used to make database connections.

  Returns:
    the JDBC connection URL.

### setServerURL

    public void setServerURL(String serverURL)

  Sets the JDBC connection URL used to make database connections.

  Parameters:
    `serverURL` - the JDBC connection URL.

### getUsername

    public String getUsername()

  Returns the username used to connect to the database. In some cases, a username is not needed so this method will return null.

  Returns:
    the username used to connect to the datbase.

### setUsername

    public void setUsername(String username)

  Sets the username used to connect to the database. In some cases, a username is not needed so null should be passed in.

  Parameters:
    `username` - the username used to connect to the database.

### getPassword

    public String getPassword()

  Returns the password used to connect to the database. In some cases, a password is not needed so this method will return null.

  Returns:
    the password used to connect to the database.

### setPassword

    public void setPassword(String password)

  Sets the password used to connect to the database. In some cases, a password is not needed so null should be passed in.

  Parameters:
    `password` - the password used to connect to the database.

### getMinConnections

    public int getMinConnections()

  Returns the minimum number of connections that the pool will use. This should probably be at least three.

  Returns:
    the minimum number of connections in the pool.

### setMinConnections

    public void setMinConnections(int minConnections)

  Sets the minimum number of connections that the pool will use. This should probably be at least three.

  Parameters:
    `minConnections` - the minimum number of connections in the pool.

### getMaxConnections

    public int getMaxConnections()

  Returns the maximum number of connections that the pool will use. The actual number of connections in the pool will vary between this value and the minimum based on the current load.

  Returns:
    the max possible number of connections in the pool.

### setMaxConnections

    public void setMaxConnections(int maxConnections)

  Sets the maximum number of connections that the pool will use. The actual number of connections in the pool will vary between this value and the minimum based on the current load.

  Parameters:
    `maxConnections` - the max possible number of connections in the pool.

### getConnectionTimeout

    public double getConnectionTimeout()

  Returns the amount of time between connection recycles in days. For example, a value of .5 would correspond to recycling the connections in the pool once every half day.

  Returns:
    the amount of time in days between connection recycles.

### setConnectionTimeout

    public void setConnectionTimeout(double connectionTimeout)

  Sets the amount of time between connection recycles in days. For example, a value of .5 would correspond to recycling the connections in the pool once every half day.

  Parameters:
    `connectionTimeout` - the amount of time in days between connection recycles.

### isMysqlUseUnicode

    public boolean isMysqlUseUnicode()

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

Overview | Package | Class | Tree | Deprecated | Index | Help
| Openfire 3.4.3 Javadoc
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003-2007 Jive Software.