java.lang.Objectorg.objectweb.telosys.dal.sql.ConnectionManager
Unique (static) access point to get databases connections
This class manages 1 to N databases connection providers
Constructor Summary | |
ConnectionManager()
|
Method Summary | |
static java.sql.Connection |
getConnection()
Returns a connection for the default database |
static java.sql.Connection |
getConnection(int iBaseId)
Returns a connection for the given database id |
protected static ConnectionProvider |
getConnectionProvider()
Returns the default database connection provider |
protected static ConnectionProvider |
getConnectionProvider(int iBaseId)
Return the connection provider for the given database id |
static Database |
getDatabase(int id)
Returns the database description for the given database id |
static java.util.List |
getDatabases()
Returns the list of all the databases managed by the current application |
static int |
getDefaultDatabase()
Returns the default database id |
static int |
getNumberOfDatabases()
Returns the number of databases entries supported by the connection manager including void entries |
static int |
getPoolSize(int id)
Returns the pool size for the given database id or 0 if the database exists but doesn't use a Telosys pool ( ConnectionFactory or DataSource ) or -1 if there's no database for the given id |
static java.lang.Class |
getProviderClass(int id)
Returns the ConnectionProvider's class for the given database id. |
static int |
getProviderType(int id)
Returns the type of ConnectionProvider one of the ConnectionProvider types : FACTORY, POOL, DATASOURCE or NO_PROVIDER if there's no database for the given id |
static DatabaseSession |
getSession()
|
static DatabaseSession |
getSession(int iDatabaseId)
|
static boolean |
init(java.io.InputStream is)
|
static boolean |
init(java.lang.String sFileName)
Connection manager initialization Load the 'dbcongif' XML file and create a connection provider for each database definition |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ConnectionManager()
Method Detail |
public static boolean init(java.lang.String sFileName)
sFileName
- :
dbconfig file name
public static boolean init(java.io.InputStream is)
public static DatabaseSession getSession() throws TelosysException
TelosysException
public static DatabaseSession getSession(int iDatabaseId) throws TelosysException
TelosysException
public static int getDefaultDatabase()
public static int getNumberOfDatabases()
public static java.sql.Connection getConnection() throws TelosysException
TelosysException
public static java.sql.Connection getConnection(int iBaseId) throws TelosysException
iBaseId
-
TelosysException
protected static ConnectionProvider getConnectionProvider()
protected static ConnectionProvider getConnectionProvider(int iBaseId)
iBaseId
-
public static java.util.List getDatabases()
public static Database getDatabase(int id)
id
- the database id ( 0 to N )
public static int getPoolSize(int id)
id
- the database id ( 0 to N )
public static java.lang.Class getProviderClass(int id)
id
- the database id ( 0 to N )
public static int getProviderType(int id)