public class DataSourceManager extends AbstractServerObject<ServerContext> implements CloseableComponent
| Constructor and Description |
|---|
DataSourceManager(ServerContext serverCtx) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes and removes all DataSources in the pool
|
boolean |
close(java.lang.String dataSourceName)
Closes and removes the given DataSource by name
|
int |
connect()
Reads the srv_datasource.cfg file and fills the pool with according connected DataSource Objects.
|
DataSourceEntry |
findDataSourceEntry(java.lang.String dsName)
Finds the DataSourceEntry by name
|
java.sql.Connection |
getCurrentConnection()
Returns a connection of the currently selected connection pool.
|
DataSourceEntry |
getCurrentDataSource() |
DBConnectionPool |
getDataSource(java.lang.String dataSourceName)
Returns the corresponding DBConnectionPool or null if not found
|
DataSourceEntry[] |
getDataSourceEntries()
Returns the list of currently configured DataSourceEntries
|
DBConnectionPool[] |
getDataSources() |
java.util.List<ServerCredential> |
getDefinedCredentials() |
int |
getSize()
Returns the number of configured DataSources
|
boolean |
hasDefinedCredentials() |
ResourceLock |
lockExclusive(SessionId sessId) |
ResourceLock |
lockShared(SessionId sessId) |
void |
releaseLock(SessionId sessId,
ResourceLock lock) |
DataSourceEntry |
resetToDefaultDataSource(SessionId sessId)
Resets to the default DataSource which is the first one configured in the config file.
|
DataSourceEntry |
resetToPreviousDataSource(SessionId sessId)
Resets to the previously selected DataSource.
|
DataSourceEntry |
selectDataSource(SessionId sessId,
java.lang.String dataSourceName)
Selects the DataSource by name.
|
getServerConfig, getServerContext, getServerParams, getServerStartup, getStatisticManager, toStringgetApplicationContext, getLogChannel, isLogDebug, isLogVerbose, logDebug, logDump, logError, logError, logFatal, logInfo, logVerbose, logWarning, setLogChannelconfigureDumpHeadlineLength, configureDumpMaxElementsPrinted, copyDumpStringValues, copyToStringValues, createDumpHeader, toDumpString, toDumpString, toStringpublic DataSourceManager(ServerContext serverCtx) throws java.lang.Exception
java.lang.Exceptionpublic java.util.List<ServerCredential> getDefinedCredentials()
public boolean hasDefinedCredentials()
public DataSourceEntry findDataSourceEntry(java.lang.String dsName)
public ResourceLock lockShared(SessionId sessId) throws java.lang.Exception
java.lang.Exceptionpublic ResourceLock lockExclusive(SessionId sessId) throws java.lang.Exception
java.lang.Exceptionpublic void releaseLock(SessionId sessId, ResourceLock lock) throws NotLockOwnerException
NotLockOwnerExceptionpublic int connect()
throws java.lang.Exception
java.lang.Exceptionpublic int getSize()
public void close()
close in interface java.lang.AutoCloseablepublic boolean close(java.lang.String dataSourceName)
public DataSourceEntry[] getDataSourceEntries()
public DBConnectionPool[] getDataSources()
public DBConnectionPool getDataSource(java.lang.String dataSourceName) throws InvalidDataSourceException
InvalidDataSourceExceptionpublic DataSourceEntry selectDataSource(SessionId sessId, java.lang.String dataSourceName) throws InvalidDataSourceException, ResourceLockedException
InvalidDataSourceException - if the data source name does not existResourceLockedExceptionpublic DataSourceEntry getCurrentDataSource()
public java.sql.Connection getCurrentConnection()
public DataSourceEntry resetToDefaultDataSource(SessionId sessId) throws InvalidDataSourceException, ResourceLockedException
InvalidDataSourceExceptionResourceLockedExceptionpublic DataSourceEntry resetToPreviousDataSource(SessionId sessId) throws InvalidDataSourceException, ResourceLockedException
InvalidDataSourceExceptionResourceLockedExceptionCopyright © 2013 EsprIT-Systems. All Rights Reserved.