Class FileNameFragment

java.lang.Object
io.aiven.kafka.connect.common.config.ConfigFragment
io.aiven.kafka.connect.common.config.FileNameFragment

public final class FileNameFragment extends ConfigFragment
Fragment to handle all file name extraction operations. Requires OutputFormatFragment and (@link CompressionFragment}
  • Field Details

  • Constructor Details

    • FileNameFragment

      public FileNameFragment(org.apache.kafka.common.config.AbstractConfig cfg)
      Create an instance of this fragment wrapping the specified config.
      Parameters:
      cfg - the configuration to read from.
  • Method Details

    • setter

      public static FileNameFragment.Setter setter(Map<String,String> data)
      Gets a setter for this properties in this fragment.
      Parameters:
      data - the data to update.
      Returns:
      the Setter.
    • validateDistributionType

      public void validateDistributionType(DistributionType distributionType)
      Validate the distribution type works with the file name template.
      Parameters:
      distributionType - the distribution type for the validator
    • validateRecordGrouper

      public void validateRecordGrouper()
      Validate that the record grouper works with the fileNameTemplate and the max records per file.
    • update

      public static org.apache.kafka.common.config.ConfigDef update(org.apache.kafka.common.config.ConfigDef configDef)
      Adds the FileName properties to the configuration definition.
      Parameters:
      configDef - the configuration definition to update.
      Returns:
      the updated configuration definition.
    • update

      public static org.apache.kafka.common.config.ConfigDef update(org.apache.kafka.common.config.ConfigDef configDef, CompressionType defaultCompressionType)
      Adds the FileName properties to the configuration definition.
      Parameters:
      configDef - the configuration definition to update.
      defaultCompressionType - The default compression type. May be null.
      Returns:
      the updated configuration definition.
    • validate

      public void validate()
      Description copied from class: ConfigFragment
      Validate that the data in the configuration matches any restrictions. Default implementation does nothing.
      Overrides:
      validate in class ConfigFragment
    • getFilename

      public String getFilename()
      Returns the text of the filename template. May throw ConfigException if the property FILE_NAME_TEMPLATE_CONFIG is not set.
      Returns:
      the text of the filename template.
    • getCompressionType

      public CompressionType getCompressionType()
      Retrieves the defined compression type.
      Returns:
      the defined compression type or CompressionType.NONE if there is no defined compression type.
    • getFilenameTemplate

      public Template getFilenameTemplate()
      Gets the filename template.
      Returns:
      the Filename template.
    • getFilenameTimezone

      public ZoneId getFilenameTimezone()
      Gets the filename timezone
      Returns:
      The timezone specified for filenames.
    • getFilenameTimestampSource

      public TimestampSource getFilenameTimestampSource()
      Gets the timestamp source for the file name.
      Returns:
      the timestamp source for the file name.
    • getMaxRecordsPerFile

      public int getMaxRecordsPerFile()
      Gets the maximum number of records allowed in a file.
      Returns:
      the maximum number of records allowed in a file.
    • getSourceName

      public String getSourceName()
    • getPrefixTemplate

      public String getPrefixTemplate()