Package org.apache.nifi.dbcp
Class AbstractDBCPConnectionPool
java.lang.Object
org.apache.nifi.components.AbstractConfigurableComponent
org.apache.nifi.controller.AbstractControllerService
org.apache.nifi.dbcp.AbstractDBCPConnectionPool
- All Implemented Interfaces:
ConfigurableComponent
,ControllerService
,VerifiableControllerService
,DBCPService
public abstract class AbstractDBCPConnectionPool
extends AbstractControllerService
implements DBCPService, VerifiableControllerService
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.apache.commons.dbcp2.BasicDataSource
protected KerberosUser
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
configureDataSource
(ConfigurationContext context, org.apache.commons.dbcp2.BasicDataSource basicDataSource, DataSourceConfiguration configuration) private Connection
getConnection
(org.apache.commons.dbcp2.BasicDataSource dataSource, KerberosUser kerberosUser) protected abstract DataSourceConfiguration
protected abstract Driver
protected List
<PropertyDescriptor> getDynamicProperties
(ConfigurationContext context) protected KerberosUser
getKerberosUser
(ConfigurationContext context) protected KerberosUser
private void
loginKerberos
(KerberosUser kerberosUser) void
onConfigured
(ConfigurationContext context) Configures connection pool by creating an instance of theBasicDataSource
based on configuration provided withConfigurationContext
.void
shutdown()
Shutdown pool, close all open connections.private void
shutdown
(org.apache.commons.dbcp2.BasicDataSource dataSource, KerberosUser kerberosUser) verify
(ConfigurationContext context, ComponentLog verificationLogger, Map<String, String> variables) Methods inherited from class org.apache.nifi.controller.AbstractControllerService
abstractClearConfigContext, abstractStoreConfigContext, disabled, enabled, getConfigurationContext, getControllerServiceLookup, getIdentifier, getLogger, getNodeTypeProvider, getProperty, getStateManager, init, initialize, isEnabled
Methods inherited from class org.apache.nifi.components.AbstractConfigurableComponent
customValidate, equals, getPropertyDescriptor, getPropertyDescriptors, getSupportedDynamicPropertyDescriptor, getSupportedPropertyDescriptors, hashCode, onPropertyModified, toString, validate
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.apache.nifi.components.ConfigurableComponent
getIdentifier, getPropertyDescriptor, getPropertyDescriptors, onPropertyModified, validate
Methods inherited from interface org.apache.nifi.controller.ControllerService
initialize, isStateful, migrateProperties
Methods inherited from interface org.apache.nifi.dbcp.DBCPService
getConnection, getFlowFileFilter, getFlowFileFilter
-
Field Details
-
dataSource
protected volatile org.apache.commons.dbcp2.BasicDataSource dataSource -
kerberosUser
-
-
Constructor Details
-
AbstractDBCPConnectionPool
public AbstractDBCPConnectionPool()
-
-
Method Details
-
verify
public List<ConfigVerificationResult> verify(ConfigurationContext context, ComponentLog verificationLogger, Map<String, String> variables) - Specified by:
verify
in interfaceVerifiableControllerService
-
onConfigured
Configures connection pool by creating an instance of theBasicDataSource
based on configuration provided withConfigurationContext
.This operation makes no guarantees that the actual connection could be made since the underlying system may still go off-line during normal operation of the connection pool.
- Parameters:
context
- the configuration context- Throws:
InitializationException
- if unable to create a database connection
-
loginKerberos
- Throws:
InitializationException
-
getDriver
-
getDataSourceConfiguration
-
configureDataSource
protected void configureDataSource(ConfigurationContext context, org.apache.commons.dbcp2.BasicDataSource basicDataSource, DataSourceConfiguration configuration) -
getConnectionProperties
-
getDynamicProperties
-
getKerberosUser
-
getKerberosUserByCredentials
-
getConnection
- Specified by:
getConnection
in interfaceDBCPService
- Throws:
ProcessException
-
getConnection
private Connection getConnection(org.apache.commons.dbcp2.BasicDataSource dataSource, KerberosUser kerberosUser) -
shutdown
Shutdown pool, close all open connections. If a principal is authenticated with a KDC, that principal is logged out.- Throws:
SQLException
- if there is an error while closing open connections
-
shutdown
private void shutdown(org.apache.commons.dbcp2.BasicDataSource dataSource, KerberosUser kerberosUser) throws SQLException - Throws:
SQLException
-