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.BasicDataSourceprotected KerberosUser -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidconfigureDataSource(ConfigurationContext context, org.apache.commons.dbcp2.BasicDataSource basicDataSource, DataSourceConfiguration configuration) private ConnectiongetConnection(org.apache.commons.dbcp2.BasicDataSource dataSource, KerberosUser kerberosUser) protected abstract DataSourceConfigurationprotected abstract Driverprotected List<PropertyDescriptor> getDynamicProperties(ConfigurationContext context) protected KerberosUsergetKerberosUser(ConfigurationContext context) protected KerberosUserprivate voidloginKerberos(KerberosUser kerberosUser) voidonConfigured(ConfigurationContext context) Configures connection pool by creating an instance of theBasicDataSourcebased on configuration provided withConfigurationContext.voidshutdown()Shutdown pool, close all open connections.private voidshutdown(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, isEnabledMethods inherited from class org.apache.nifi.components.AbstractConfigurableComponent
customValidate, equals, getPropertyDescriptor, getPropertyDescriptors, getSupportedDynamicPropertyDescriptor, getSupportedPropertyDescriptors, hashCode, onPropertyModified, toString, validateMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.nifi.components.ConfigurableComponent
getIdentifier, getPropertyDescriptor, getPropertyDescriptors, onPropertyModified, validateMethods inherited from interface org.apache.nifi.controller.ControllerService
initialize, isStateful, migratePropertiesMethods 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:
verifyin interfaceVerifiableControllerService
-
onConfigured
Configures connection pool by creating an instance of theBasicDataSourcebased 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:
getConnectionin 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
-