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

    Fields
    Modifier and Type
    Field
    Description
    (package private) static final org.apache.nifi.components.PropertyDescriptor
     
    private String
     
    (package private) static final org.apache.nifi.components.PropertyDescriptor
     
    private DBCPService
     
    private String
     
    protected List<org.apache.nifi.components.PropertyDescriptor>
     
    (package private) static final org.apache.nifi.components.PropertyDescriptor
     
    private static final Set<org.apache.nifi.schema.access.SchemaField>
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    private void
    checkTableExists(DatabaseMetaData databaseMetaData, String tableName)
     
    private org.apache.nifi.serialization.record.RecordField
     
    private org.apache.nifi.serialization.record.RecordSchema
    getRecordSchemaFromMetadata(DatabaseMetaData databaseMetaData, String tableName)
     
    Set<org.apache.nifi.schema.access.SchemaField>
     
    protected List<org.apache.nifi.components.PropertyDescriptor>
     
    void
    onEnabled(org.apache.nifi.controller.ConfigurationContext context)
     
    org.apache.nifi.serialization.record.RecordSchema
    retrieveSchema(org.apache.nifi.serialization.record.SchemaIdentifier schemaIdentifier)
     
    (package private) org.apache.nifi.serialization.record.RecordSchema
    retrieveSchemaByName(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, isEnabled

    Methods inherited from class org.apache.nifi.components.AbstractConfigurableComponent

    customValidate, equals, getPropertyDescriptor, getPropertyDescriptors, getSupportedDynamicPropertyDescriptor, 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
  • Field Details

    • schemaFields

      private static final Set<org.apache.nifi.schema.access.SchemaField> 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

      protected List<org.apache.nifi.components.PropertyDescriptor> propDescriptors
    • dbcpService

      private volatile DBCPService dbcpService
    • dbCatalogName

      private volatile String dbCatalogName
    • dbSchemaName

      private volatile String dbSchemaName
  • Constructor Details

    • DatabaseTableSchemaRegistry

      public DatabaseTableSchemaRegistry()
  • Method Details

    • getSupportedPropertyDescriptors

      protected List<org.apache.nifi.components.PropertyDescriptor> getSupportedPropertyDescriptors()
      Overrides:
      getSupportedPropertyDescriptors in class org.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:
      retrieveSchema in interface SchemaRegistry
      Throws:
      IOException
      org.apache.nifi.schema.access.SchemaNotFoundException
    • getSuppliedSchemaFields

      public Set<org.apache.nifi.schema.access.SchemaField> getSuppliedSchemaFields()
      Specified by:
      getSuppliedSchemaFields in interface SchemaRegistry
    • retrieveSchemaByName

      org.apache.nifi.serialization.record.RecordSchema retrieveSchemaByName(org.apache.nifi.serialization.record.SchemaIdentifier schemaIdentifier) throws IOException, org.apache.nifi.schema.access.SchemaNotFoundException
      Throws:
      IOException
      org.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:
      SQLException
      org.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.SchemaNotFoundException
      SQLException