Class AppConnectionService
- java.lang.Object
-
- fr.paris.lutece.portal.service.database.AppConnectionService
-
public final class AppConnectionService extends java.lang.ObjectThis class provides a Database Connection Service based on pooled connections.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringDEFAULT_POOL_NAMEstatic java.lang.StringNO_POOL_DEFINED
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidfreeConnection(java.sql.Connection conn)Releases a connection and replaces it in the poolstatic java.sql.ConnectiongetConnection()Returns a connection to database from the pool namestatic PluginConnectionServicegetDefaultConnectionService()Returns a default Plugin Connection Servicestatic voidgetPoolList(ReferenceList list)Gets the list of all pools defined in the db.properties filestatic PoolManagergetPoolManager()Gets a reference on the current Pool Managerstatic voidinit(java.lang.String strConfigPath, java.lang.String strConfigFilename, java.lang.String strPoolName)Initializes the connection pool and sets the pool manager instancestatic voidreleasePool()Releases all the connections on all the pools
-
-
-
Field Detail
-
NO_POOL_DEFINED
public static final java.lang.String NO_POOL_DEFINED
- See Also:
- Constant Field Values
-
DEFAULT_POOL_NAME
public static final java.lang.String DEFAULT_POOL_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
init
public static void init(java.lang.String strConfigPath, java.lang.String strConfigFilename, java.lang.String strPoolName) throws LuteceInitExceptionInitializes the connection pool and sets the pool manager instance- Parameters:
strConfigPath- The relative Config pathstrConfigFilename- The config file namestrPoolName- The pool name- Throws:
LuteceInitException- If an error occured
-
getConnection
public static java.sql.Connection getConnection()
Returns a connection to database from the pool name- Returns:
- a connection to database from the pool
-
freeConnection
public static void freeConnection(java.sql.Connection conn)
Releases a connection and replaces it in the pool- Parameters:
conn- The connection to realease
-
releasePool
public static void releasePool()
Releases all the connections on all the pools
-
getPoolManager
public static PoolManager getPoolManager()
Gets a reference on the current Pool Manager- Returns:
- The current Pool Manager
-
getPoolList
public static void getPoolList(ReferenceList list)
Gets the list of all pools defined in the db.properties file- Parameters:
list- The Reference List
-
getDefaultConnectionService
public static PluginConnectionService getDefaultConnectionService()
Returns a default Plugin Connection Service- Returns:
- The connection Service
-
-