com.github.jcustenborder.kafka.connect.utils.config.ConfigUtils Java Examples

The following examples show how to use com.github.jcustenborder.kafka.connect.utils.config.ConfigUtils. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RedisConnectorConfig.java    From kafka-connect-redis with Apache License 2.0 6 votes vote down vote up
public RedisConnectorConfig(ConfigDef config, Map<?, ?> originals) {
  super(config, originals);
  this.hosts = ConfigUtils.hostAndPorts(this, HOSTS_CONFIG, 6379);
  this.sslEnabled = getBoolean(SSL_CONFIG);
  this.password = getPassword(PASSWORD_CONFIG).value();
  this.database = getInt(DATABASE_CONFIG);
  this.clientMode = ConfigUtils.getEnum(ClientMode.class, this, CLIENT_MODE_CONFIG);
  this.autoReconnectEnabled = getBoolean(AUTO_RECONNECT_ENABLED_CONFIG);
  this.requestQueueSize = getInt(REQUEST_QUEUE_SIZE_CONFIG);
  this.keepAliveEnabled = getBoolean(SOCKET_KEEP_ALIVE_CONFIG);
  this.tcpNoDelay = getBoolean(SOCKET_TCP_NO_DELAY_CONFIG);
  this.connectTimeout = getInt(SOCKET_CONNECT_TIMEOUT_CONFIG);
  this.sslProvider = ConfigUtils.getEnum(RedisSslProvider.class, this, SSL_PROVIDER_CONFIG);
  final String keystorePath = getString(SSL_KEYSTORE_PATH_CONFIG);
  final String trustStorePath = getString(SSL_TRUSTSTORE_PATH_CONFIG);
  this.keystorePath = Strings.isNullOrEmpty(keystorePath) ? null : new File(keystorePath);
  this.truststorePath = Strings.isNullOrEmpty(trustStorePath) ? null : new File(trustStorePath);
  final String keystorePassword = getPassword(SSL_KEYSTORE_PASSWORD_CONFIG).value();
  final String trustPassword = getPassword(SSL_TRUSTSTORE_PASSWORD_CONFIG).value();
  this.keystorePassword = Strings.isNullOrEmpty(keystorePassword) ? null : keystorePassword;
  this.truststorePassword = Strings.isNullOrEmpty(trustPassword) ? null : trustPassword;
  this.maxAttempts = getInt(CONNECTION_ATTEMPTS_CONF);
  this.retryDelay = getInt(CONNECTION_RETRY_DELAY_MS_CONF);
}
 
Example #2
Source File: SpoolDirCsvSourceConnectorConfig.java    From kafka-connect-spooldir with Apache License 2.0 6 votes vote down vote up
public SpoolDirCsvSourceConnectorConfig(final boolean isTask, Map<String, ?> settings) {
  super(isTask, true, config(), settings);
  this.skipLines = this.getInt(SpoolDirCsvSourceConnectorConfig.CSV_SKIP_LINES_CONF);
  this.separatorChar = this.getChar(SpoolDirCsvSourceConnectorConfig.CSV_SEPARATOR_CHAR_CONF);
  this.quoteChar = this.getChar(SpoolDirCsvSourceConnectorConfig.CSV_QUOTE_CHAR_CONF);
  this.escapeChar = this.getChar(SpoolDirCsvSourceConnectorConfig.CSV_ESCAPE_CHAR_CONF);
  this.ignoreLeadingWhitespace = this.getBoolean(SpoolDirCsvSourceConnectorConfig.CSV_IGNORE_LEADING_WHITESPACE_CONF);
  this.ignoreQuotations = this.getBoolean(SpoolDirCsvSourceConnectorConfig.CSV_IGNORE_QUOTATIONS_CONF);
  this.strictQuotes = this.getBoolean(SpoolDirCsvSourceConnectorConfig.CSV_STRICT_QUOTES_CONF);
  this.keepCarriageReturn = this.getBoolean(SpoolDirCsvSourceConnectorConfig.CSV_KEEP_CARRIAGE_RETURN_CONF);
  this.verifyReader = this.getBoolean(SpoolDirCsvSourceConnectorConfig.CSV_VERIFY_READER_CONF);
  this.nullFieldIndicator = ConfigUtils.getEnum(CSVReaderNullFieldIndicator.class, this, SpoolDirCsvSourceConnectorConfig.CSV_NULL_FIELD_INDICATOR_CONF);
  this.firstRowAsHeader = this.getBoolean(SpoolDirCsvSourceConnectorConfig.CSV_FIRST_ROW_AS_HEADER_CONF);

  String charsetName = this.getString(SpoolDirCsvSourceConnectorConfig.CSV_CHARSET_CONF);
  this.charset = Charset.forName(charsetName);

  this.caseSensitiveFieldNames = this.getBoolean(SpoolDirCsvSourceConnectorConfig.CSV_CASE_SENSITIVE_FIELD_NAMES_CONF);
  this.useRFC4180Parser = this.getBoolean(CSV_USE_RFC_4180_PARSER_CONF);
}
 
Example #3
Source File: FromXmlConfig.java    From kafka-connect-transform-xml with Apache License 2.0 5 votes vote down vote up
public FromXmlConfig(Map<?, ?> originals) {
  super(config(), originals);
  this.schemaUrls = ConfigUtils.urls(this, SCHEMA_PATH_CONFIG);
  this.xjcPackage = getString(PACKAGE_CONFIG);
  this.optionsStrictCheck = getBoolean(XJC_OPTIONS_STRICT_CHECK_CONFIG);
  this.optionsAutomaticNameConflictResolution = getBoolean(XJC_OPTIONS_AUTOMATIC_NAME_CONFLICT_RESOLUTION_ENABLED_CONFIG);
}
 
Example #4
Source File: TwitterSourceConnectorConfig.java    From kafka-connect-twitter with Apache License 2.0 5 votes vote down vote up
public TwitterSourceConnectorConfig(Map<String, String> parsedConfig) {
  super(conf(), parsedConfig);
  this.topic = this.getString(KAFKA_STATUS_TOPIC_CONF);
  this.twitterDebug = this.getBoolean(TWITTER_DEBUG_CONF);
  this.processDeletes = this.getBoolean(PROCESS_DELETES_CONF);
  this.filterKeywords = ConfigUtils.getSet(this, FILTER_KEYWORDS_CONF);
  this.filterUserIds = ConfigUtils.getSet(this, FILTER_USER_IDS_CONF)
      .stream()
      .map(Long::parseLong)
      .collect(Collectors.toSet());
  this.queueBatchSize = getInt(QUEUE_BATCH_SIZE_CONF);
  this.queueEmptyMs = getInt(QUEUE_EMPTY_MS_CONF);
}
 
Example #5
Source File: AbstractSourceConnectorConfig.java    From kafka-connect-spooldir with Apache License 2.0 5 votes vote down vote up
public AbstractSourceConnectorConfig(ConfigDef definition, Map<?, ?> originals, boolean bufferedInputStream) {
  super(definition, originals);
  this.bufferedInputStream = bufferedInputStream;
  this.inputPath = ConfigUtils.getAbsoluteFile(this, INPUT_PATH_CONFIG);
  this.cleanupPolicy = ConfigUtils.getEnum(CleanupPolicy.class, this, CLEANUP_POLICY_CONF);

  if (finishedPathRequired()) {
    this.finishedPath = ConfigUtils.getAbsoluteFile(this, FINISHED_PATH_CONFIG);
  } else {
    this.finishedPath = null;
  }

  this.errorPath = ConfigUtils.getAbsoluteFile(this, ERROR_PATH_CONFIG);
  this.haltOnError = this.getBoolean(HALT_ON_ERROR_CONF);
  this.minimumFileAgeMS = this.getLong(FILE_MINIMUM_AGE_MS_CONF);
  this.batchSize = this.getInt(BATCH_SIZE_CONF);
  this.topic = this.getString(TOPIC_CONF);
  this.emptyPollWaitMs = this.getLong(EMPTY_POLL_WAIT_MS_CONF);
  this.processingFileExtension = this.getString(PROCESSING_FILE_EXTENSION_CONF);
  this.timestampMode = ConfigUtils.getEnum(TimestampMode.class, this, TIMESTAMP_MODE_CONF);
  final String inputPatternText = this.getString(INPUT_FILE_PATTERN_CONF);
  final Pattern inputPattern = Pattern.compile(inputPatternText);
  this.inputFilenameFilter = new PatternFilenameFilter(inputPattern);
  this.fileSortAttributes = ConfigUtils.getEnums(FileAttribute.class, this, FILE_SORT_ATTRIBUTES_CONF);
  this.taskIndex = getInt(TASK_INDEX_CONF);
  this.taskCount = getInt(TASK_COUNT_CONF);
  this.taskPartitioner = ConfigUtils.getEnum(TaskPartitioner.class, this, TASK_PARTITIONER_CONF);

  if (bufferedInputStream) {
    this.fileBufferSizeBytes = getInt(FILE_BUFFER_SIZE_CONF);
  } else {
    this.fileBufferSizeBytes = 0;
  }
  this.metadataLocation = ConfigUtils.getEnum(MetadataLocation.class, this, METADATA_LOCATION_CONF);
  this.metadataField = this.getString(METADATA_FIELD_CONF);
}
 
Example #6
Source File: ChangeCaseConfig.java    From kafka-connect-transform-common with Apache License 2.0 4 votes vote down vote up
public ChangeCaseConfig(Map<?, ?> originals) {
  super(config(), originals);
  this.from = ConfigUtils.getEnum(CaseFormat.class, this, FROM_CONFIG);
  this.to = ConfigUtils.getEnum(CaseFormat.class, this, TO_CONFIG);
}
 
Example #7
Source File: ToJSONConfig.java    From kafka-connect-transform-common with Apache License 2.0 4 votes vote down vote up
public ToJSONConfig(Map<String, ?> settings) {
  super(config(), settings);
  this.outputSchema = ConfigUtils.getEnum(Schema.Type.class, this, OUTPUT_SCHEMA_CONFIG);
  this.schemasEnable = getBoolean(SCHEMAS_ENABLE_CONFIG);
}
 
Example #8
Source File: ChangeTopicCaseConfig.java    From kafka-connect-transform-common with Apache License 2.0 4 votes vote down vote up
public ChangeTopicCaseConfig(Map<?, ?> originals) {
  super(config(), originals);
  this.from = ConfigUtils.getEnum(CaseFormat.class, this, FROM_CONFIG);
  this.to = ConfigUtils.getEnum(CaseFormat.class, this, TO_CONFIG);
}
 
Example #9
Source File: PatternFilterConfig.java    From kafka-connect-transform-common with Apache License 2.0 4 votes vote down vote up
public PatternFilterConfig(Map<String, ?> settings) {
  super(config(), settings);
  this.pattern = ConfigUtils.pattern(this, PATTERN_CONFIG);
  List<String> fields = getList(FIELD_CONFIG);
  this.fields = new HashSet<>(fields);
}
 
Example #10
Source File: TimestampNowFieldConfig.java    From kafka-connect-transform-common with Apache License 2.0 4 votes vote down vote up
public TimestampNowFieldConfig(Map<?, ?> originals) {
  super(config(), originals);
  this.fields = ConfigUtils.getSet(this, FIELDS_CONF);
}