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, toString
getApplicationContext, getLogChannel, isLogDebug, isLogVerbose, logDebug, logDump, logError, logError, logFatal, logInfo, logVerbose, logWarning, setLogChannel
configureDumpHeadlineLength, configureDumpMaxElementsPrinted, copyDumpStringValues, copyToStringValues, createDumpHeader, toDumpString, toDumpString, toString
public DataSourceManager(ServerContext serverCtx) throws java.lang.Exception
java.lang.Exception
public 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.Exception
public ResourceLock lockExclusive(SessionId sessId) throws java.lang.Exception
java.lang.Exception
public void releaseLock(SessionId sessId, ResourceLock lock) throws NotLockOwnerException
NotLockOwnerException
public int connect() throws java.lang.Exception
java.lang.Exception
public int getSize()
public void close()
close
in interface java.lang.AutoCloseable
public boolean close(java.lang.String dataSourceName)
public DataSourceEntry[] getDataSourceEntries()
public DBConnectionPool[] getDataSources()
public DBConnectionPool getDataSource(java.lang.String dataSourceName) throws InvalidDataSourceException
InvalidDataSourceException
public DataSourceEntry selectDataSource(SessionId sessId, java.lang.String dataSourceName) throws InvalidDataSourceException, ResourceLockedException
InvalidDataSourceException
- if the data source name does not existResourceLockedException
public DataSourceEntry getCurrentDataSource()
public java.sql.Connection getCurrentConnection()
public DataSourceEntry resetToDefaultDataSource(SessionId sessId) throws InvalidDataSourceException, ResourceLockedException
InvalidDataSourceException
ResourceLockedException
public DataSourceEntry resetToPreviousDataSource(SessionId sessId) throws InvalidDataSourceException, ResourceLockedException
InvalidDataSourceException
ResourceLockedException
Copyright © 2013 EsprIT-Systems. All Rights Reserved.