Class DataSourceConnectionSource
java.lang.Object
org.apache.log4j.component.spi.ComponentBase
org.apache.log4j.receivers.db.ConnectionSourceSkeleton
org.apache.log4j.receivers.db.DataSourceConnectionSource
- All Implemented Interfaces:
Component, ConnectionSource, org.apache.log4j.spi.OptionHandler, org.apache.log4j.xml.UnrecognizedElementHandler
public class DataSourceConnectionSource
extends ConnectionSourceSkeleton
implements org.apache.log4j.xml.UnrecognizedElementHandler
The DataSourceConnectionSource is an implementation of
ConnectionSource
that obtains the Connection in the recommended JDBC manner based on
a DataSource.
-
Field Summary
FieldsFields inherited from class ComponentBase
repositoryFields inherited from interface ConnectionSource
HSQL_DIALECT, MSSQL_DIALECT, MYSQL_DIALECT, ORACLE_DIALECT, POSTGRES_DIALECT, UNKNOWN_DIALECT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidObtain aConnectionfor use.booleanparseUnrecognizedElement(Element element, Properties props) voidsetDataSource(DataSource dataSource) Methods inherited from class ConnectionSourceSkeleton
discoverConnnectionProperties, getOverriddenSupportsGetGeneratedKeys, getPassword, getSQLDialectCode, getUser, setOverriddenSupportsGetGeneratedKeys, setPassword, setUser, supportsBatchUpdates, supportsGetGeneratedKeysMethods inherited from class ComponentBase
getLogger, getLoggerRepository, getNonFloodingLogger, resetErrorCount, setLoggerRepositoryMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Component
setLoggerRepository
-
Field Details
-
dataSource
-
-
Constructor Details
-
DataSourceConnectionSource
public DataSourceConnectionSource()
-
-
Method Details
-
activateOptions
public void activateOptions()- Specified by:
activateOptionsin interfaceorg.apache.log4j.spi.OptionHandler
-
getConnection
Description copied from interface:ConnectionSourceObtain aConnectionfor use. The client is responsible for closing theConnectionwhen it is no longer required.- Specified by:
getConnectionin interfaceConnectionSource- Throws:
SQLException- if aConnectioncould not be obtained- See Also:
-
getDataSource
-
setDataSource
-
parseUnrecognizedElement
- Specified by:
parseUnrecognizedElementin interfaceorg.apache.log4j.xml.UnrecognizedElementHandler- Throws:
Exception
-