Class DatabaseTableSchemaRegistry
java.lang.Object
org.apache.nifi.components.AbstractConfigurableComponent
org.apache.nifi.controller.AbstractControllerService
org.apache.nifi.db.schemaregistry.DatabaseTableSchemaRegistry
- All Implemented Interfaces:
org.apache.nifi.components.ConfigurableComponent,org.apache.nifi.controller.ControllerService,SchemaRegistry
@Tags({"schema","registry","database","table"})
@CapabilityDescription("Provides a service for generating a record schema from a database table definition. The service is configured to use a table name and a database connection fetches the table metadata (i.e. table definition) such as column names, data types, nullability, etc.")
public class DatabaseTableSchemaRegistry
extends org.apache.nifi.controller.AbstractControllerService
implements SchemaRegistry
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final org.apache.nifi.components.PropertyDescriptorprivate String(package private) static final org.apache.nifi.components.PropertyDescriptorprivate DBCPServiceprivate Stringprotected List<org.apache.nifi.components.PropertyDescriptor> (package private) static final org.apache.nifi.components.PropertyDescriptorprivate static final Set<org.apache.nifi.schema.access.SchemaField> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidcheckTableExists(DatabaseMetaData databaseMetaData, String tableName) private org.apache.nifi.serialization.record.RecordFieldcreateRecordFieldFromColumn(ResultSet columnResultSet) private org.apache.nifi.serialization.record.RecordSchemagetRecordSchemaFromMetadata(DatabaseMetaData databaseMetaData, String tableName) Set<org.apache.nifi.schema.access.SchemaField> protected List<org.apache.nifi.components.PropertyDescriptor> voidonEnabled(org.apache.nifi.controller.ConfigurationContext context) org.apache.nifi.serialization.record.RecordSchemaretrieveSchema(org.apache.nifi.serialization.record.SchemaIdentifier schemaIdentifier) (package private) org.apache.nifi.serialization.record.RecordSchemaretrieveSchemaByName(org.apache.nifi.serialization.record.SchemaIdentifier schemaIdentifier) 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, 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, migrateProperties
-
Field Details
-
schemaFields
-
DBCP_SERVICE
static final org.apache.nifi.components.PropertyDescriptor DBCP_SERVICE -
CATALOG_NAME
static final org.apache.nifi.components.PropertyDescriptor CATALOG_NAME -
SCHEMA_NAME
static final org.apache.nifi.components.PropertyDescriptor SCHEMA_NAME -
propDescriptors
-
dbcpService
-
dbCatalogName
-
dbSchemaName
-
-
Constructor Details
-
DatabaseTableSchemaRegistry
public DatabaseTableSchemaRegistry()
-
-
Method Details
-
getSupportedPropertyDescriptors
- Overrides:
getSupportedPropertyDescriptorsin classorg.apache.nifi.components.AbstractConfigurableComponent
-
onEnabled
@OnEnabled public void onEnabled(org.apache.nifi.controller.ConfigurationContext context) -
retrieveSchema
public org.apache.nifi.serialization.record.RecordSchema retrieveSchema(org.apache.nifi.serialization.record.SchemaIdentifier schemaIdentifier) throws IOException, org.apache.nifi.schema.access.SchemaNotFoundException - Specified by:
retrieveSchemain interfaceSchemaRegistry- Throws:
IOExceptionorg.apache.nifi.schema.access.SchemaNotFoundException
-
getSuppliedSchemaFields
- Specified by:
getSuppliedSchemaFieldsin interfaceSchemaRegistry
-
retrieveSchemaByName
org.apache.nifi.serialization.record.RecordSchema retrieveSchemaByName(org.apache.nifi.serialization.record.SchemaIdentifier schemaIdentifier) throws IOException, org.apache.nifi.schema.access.SchemaNotFoundException - Throws:
IOExceptionorg.apache.nifi.schema.access.SchemaNotFoundException
-
getRecordSchemaFromMetadata
private org.apache.nifi.serialization.record.RecordSchema getRecordSchemaFromMetadata(DatabaseMetaData databaseMetaData, String tableName) throws SQLException, org.apache.nifi.schema.access.SchemaNotFoundException - Throws:
SQLExceptionorg.apache.nifi.schema.access.SchemaNotFoundException
-
createRecordFieldFromColumn
private org.apache.nifi.serialization.record.RecordField createRecordFieldFromColumn(ResultSet columnResultSet) throws SQLException - Throws:
SQLException
-
checkTableExists
private void checkTableExists(DatabaseMetaData databaseMetaData, String tableName) throws org.apache.nifi.schema.access.SchemaNotFoundException, SQLException - Throws:
org.apache.nifi.schema.access.SchemaNotFoundExceptionSQLException
-