Class AbstractDatabaseFetchProcessor

java.lang.Object
org.apache.nifi.components.AbstractConfigurableComponent
org.apache.nifi.processor.AbstractSessionFactoryProcessor
org.apache.nifi.processors.standard.AbstractDatabaseFetchProcessor
All Implemented Interfaces:
org.apache.nifi.components.ConfigurableComponent, org.apache.nifi.processor.Processor
Direct Known Subclasses:
AbstractQueryDatabaseTable, GenerateTableFetch

public abstract class AbstractDatabaseFetchProcessor extends org.apache.nifi.processor.AbstractSessionFactoryProcessor
A base class for common code shared by processors that fetch RDBMS data.
  • Field Details

    • INITIAL_MAX_VALUE_PROP_START

      public static final String INITIAL_MAX_VALUE_PROP_START
      See Also:
    • FRAGMENT_ID

      public static final String FRAGMENT_ID
    • FRAGMENT_INDEX

      public static final String FRAGMENT_INDEX
    • FRAGMENT_COUNT

      public static final String FRAGMENT_COUNT
    • REL_SUCCESS

      public static final org.apache.nifi.processor.Relationship REL_SUCCESS
    • relationships

      protected Set<org.apache.nifi.processor.Relationship> relationships
    • DBCP_SERVICE

      public static final org.apache.nifi.components.PropertyDescriptor DBCP_SERVICE
    • TABLE_NAME

      public static final org.apache.nifi.components.PropertyDescriptor TABLE_NAME
    • COLUMN_NAMES

      public static final org.apache.nifi.components.PropertyDescriptor COLUMN_NAMES
    • MAX_VALUE_COLUMN_NAMES

      public static final org.apache.nifi.components.PropertyDescriptor MAX_VALUE_COLUMN_NAMES
    • QUERY_TIMEOUT

      public static final org.apache.nifi.components.PropertyDescriptor QUERY_TIMEOUT
    • WHERE_CLAUSE

      public static final org.apache.nifi.components.PropertyDescriptor WHERE_CLAUSE
    • SQL_QUERY

      public static final org.apache.nifi.components.PropertyDescriptor SQL_QUERY
    • propDescriptors

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

      protected static final String NAMESPACE_DELIMITER
      See Also:
    • DB_TYPE

      public static final org.apache.nifi.components.PropertyDescriptor DB_TYPE
    • DATABASE_DIALECT_SERVICE

      static final org.apache.nifi.components.PropertyDescriptor DATABASE_DIALECT_SERVICE
    • columnTypeMap

      protected final Map<String,Integer> columnTypeMap
    • isDynamicTableName

      protected volatile boolean isDynamicTableName
    • isDynamicMaxValues

      protected volatile boolean isDynamicMaxValues
    • setupComplete

      protected final AtomicBoolean setupComplete
    • TIME_TYPE_FORMAT

      private static final DateTimeFormatter TIME_TYPE_FORMAT
    • ZERO_RESULT_WHERE_CLAUSE

      private static final String ZERO_RESULT_WHERE_CLAUSE
      See Also:
    • maxValueProperties

      protected Map<String,String> maxValueProperties
  • Constructor Details

    • AbstractDatabaseFetchProcessor

      public AbstractDatabaseFetchProcessor()
  • Method Details

    • customValidate

      protected Collection<org.apache.nifi.components.ValidationResult> customValidate(org.apache.nifi.components.ValidationContext validationContext)
      Overrides:
      customValidate in class org.apache.nifi.components.AbstractConfigurableComponent
    • setup

      public void setup(org.apache.nifi.processor.ProcessContext context)
    • setup

      public void setup(org.apache.nifi.processor.ProcessContext context, boolean shouldCleanCache, org.apache.nifi.flowfile.FlowFile flowFile)
    • getDatabaseDialectService

      protected DatabaseDialectService getDatabaseDialectService(org.apache.nifi.context.PropertyContext context)
    • getMaxValueStatementRequest

      private QueryStatementRequest getMaxValueStatementRequest(String tableName, String maxValueColumnNames, String derivedTableQuery)
    • getMaxValueFromRow

      protected static String getMaxValueFromRow(ResultSet resultSet, int columnIndex, Integer type, String maxValueString) throws ParseException, IOException, SQLException
      Throws:
      ParseException
      IOException
      SQLException
    • getLiteralByType

      protected static String getLiteralByType(int type, String value, String databaseType)
      Returns a SQL literal for the given value based on its type. For example, values of character type need to be enclosed in single quotes, whereas values of numeric type should not be.
      Parameters:
      type - The JDBC type for the desired literal
      value - The value to be converted to a SQL literal
      Returns:
      A String representing the given value as a literal of the given type
    • getStateKey

      protected static String getStateKey(String prefix, String columnName)
      Construct a key string for a corresponding state value.
      Parameters:
      prefix - A prefix may contain database and table name, or just table name, this can be null
      columnName - A column name
      Returns:
      a state key string
    • getDefaultMaxValueProperties

      protected Map<String,String> getDefaultMaxValueProperties(org.apache.nifi.processor.ProcessContext context, org.apache.nifi.flowfile.FlowFile flowFile)