@@ -95,11 +95,7 @@ class SourceConfiguration(originals: Map<*, *>) :
9595 return when (strategy) {
9696 SourceType .QUERY ->
9797 mapOf (
98- " database" to this .database,
99- " type" to " query" ,
100- " query" to query,
101- " partition" to 1 ,
102- )
98+ " database" to this .database, " type" to " query" , " query" to query, " partition" to 1 )
10399 SourceType .CDC -> mapOf (" database" to this .database, " type" to " cdc" , " partition" to 1 )
104100 }
105101 }
@@ -219,8 +215,7 @@ class SourceConfiguration(originals: Map<*, *>) :
219215 " delete" -> EntityOperation .DELETE
220216 else -> {
221217 throw ConfigException (
222- " Cannot parse $value as an operation. Allowed operations are create, delete or update." ,
223- )
218+ " Cannot parse $value as an operation. Allowed operations are create, delete or update." )
224219 }
225220 }
226221 val pattern = patterns.get(index)
@@ -334,14 +329,7 @@ class SourceConfiguration(originals: Map<*, *>) :
334329 is NodeSelector -> NodeSelector (it.change, it.changesTo, it.labels, it.key, it.metadata)
335330 is RelationshipSelector ->
336331 RelationshipSelector (
337- it.change,
338- it.changesTo,
339- it.type,
340- it.start,
341- it.end,
342- it.key,
343- it.metadata,
344- )
332+ it.change, it.changesTo, it.type, it.start, it.end, it.key, it.metadata)
345333 is EntitySelector -> EntitySelector (it.change, it.changesTo, it.metadata)
346334 else -> throw IllegalStateException (" unexpected pattern type ${it.javaClass.name} " )
347335 }
@@ -407,8 +395,7 @@ class SourceConfiguration(originals: Map<*, *>) :
407395 Regex (" ^neo4j\\ .cdc\\ .topic\\ .([a-zA-Z0-9._-]+)(\\ .patterns)\\ .([0-9]+)(\\ .changesTo)$" )
408396 private val CDC_PATTERN_ARRAY_METADATA_REGEX =
409397 Regex (
410- " ^neo4j\\ .cdc\\ .topic\\ .([a-zA-Z0-9._-]+)(\\ .patterns)\\ .([0-9]+)(\\ .metadata)\\ .([a-zA-Z0-9._-]+)$" ,
411- )
398+ " ^neo4j\\ .cdc\\ .topic\\ .([a-zA-Z0-9._-]+)(\\ .patterns)\\ .([0-9]+)(\\ .metadata)\\ .([a-zA-Z0-9._-]+)$" )
412399
413400 private val DEFAULT_POLL_INTERVAL = 10 .seconds
414401 private const val DEFAULT_BATCH_SIZE = 1000
@@ -424,8 +411,7 @@ class SourceConfiguration(originals: Map<*, *>) :
424411 DeprecatedNeo4jSourceConfiguration .STREAMING_FROM ->
425412 migrated[START_FROM ] =
426413 when (DeprecatedNeo4jSourceConfiguration .StreamingFrom .valueOf(
427- it.value.toString(),
428- )) {
414+ it.value.toString())) {
429415 DeprecatedNeo4jSourceConfiguration .StreamingFrom .ALL -> StartFrom .EARLIEST .name
430416 DeprecatedNeo4jSourceConfiguration .StreamingFrom .NOW -> StartFrom .NOW .name
431417 DeprecatedNeo4jSourceConfiguration .StreamingFrom .LAST_COMMITTED ->
@@ -484,8 +470,7 @@ class SourceConfiguration(originals: Map<*, *>) :
484470 originals.entries.filter { CDC_KEY_STRATEGY_REGEX .matches(it.key) }
485471 if (cdcTopics.isEmpty()) {
486472 strategy.addErrorMessage(
487- " At least one topic needs to be configured with pattern(s) describing the entities to query changes for. Please refer to documentation for more information." ,
488- )
473+ " At least one topic needs to be configured with pattern(s) describing the entities to query changes for. Please refer to documentation for more information." )
489474 } else {
490475 cdcTopics.forEach {
491476 // parse & validate CDC patterns
@@ -518,108 +503,93 @@ class SourceConfiguration(originals: Map<*, *>) :
518503 defaultValue = SourceType .QUERY .name
519504 validator = Validators .enum(SourceType ::class .java)
520505 recommender = Recommenders .enum(SourceType ::class .java)
521- },
522- )
506+ })
523507 .define(
524508 ConfigKeyBuilder .of(START_FROM , ConfigDef .Type .STRING ) {
525509 importance = ConfigDef .Importance .HIGH
526510 defaultValue = StartFrom .NOW .toString()
527511 validator = Validators .enum(StartFrom ::class .java)
528512 recommender = Recommenders .enum(StartFrom ::class .java)
529- },
530- )
513+ })
531514 .define(
532515 ConfigKeyBuilder .of(START_FROM_VALUE , ConfigDef .Type .STRING ) {
533516 importance = ConfigDef .Importance .HIGH
534517 defaultValue = " "
535518 recommender =
536519 Recommenders .visibleIf(
537- START_FROM ,
538- Predicate .isEqual(StartFrom .USER_PROVIDED .name),
539- )
540- },
541- )
520+ START_FROM , Predicate .isEqual(StartFrom .USER_PROVIDED .name))
521+ })
542522 .define(
543523 ConfigKeyBuilder .of(IGNORE_STORED_OFFSET , ConfigDef .Type .BOOLEAN ) {
544524 importance = ConfigDef .Importance .HIGH
545525 defaultValue = false
546- },
547- )
526+ })
548527 .define(
549528 ConfigKeyBuilder .of(TOPIC , ConfigDef .Type .STRING ) {
550529 importance = ConfigDef .Importance .HIGH
551530 defaultValue = " "
552531 recommender =
553532 Recommenders .visibleIf(STRATEGY , Predicate .isEqual(SourceType .QUERY .name))
554- },
555- )
533+ })
556534 .define(
557535 ConfigKeyBuilder .of(QUERY , ConfigDef .Type .STRING ) {
558536 importance = ConfigDef .Importance .HIGH
559537 defaultValue = " "
560538 recommender =
561539 Recommenders .visibleIf(STRATEGY , Predicate .isEqual(SourceType .QUERY .name))
562- },
563- )
540+ })
564541 .define(
565542 ConfigKeyBuilder .of(QUERY_STREAMING_PROPERTY , ConfigDef .Type .STRING ) {
566543 importance = ConfigDef .Importance .HIGH
567544 recommender =
568545 Recommenders .visibleIf(STRATEGY , Predicate .isEqual(SourceType .QUERY .name))
569546 defaultValue = " "
570- },
571- )
547+ })
572548 .define(
573549 ConfigKeyBuilder .of(QUERY_POLL_INTERVAL , ConfigDef .Type .STRING ) {
574550 importance = ConfigDef .Importance .HIGH
575551 recommender =
576552 Recommenders .visibleIf(STRATEGY , Predicate .isEqual(SourceType .QUERY .name))
577553 validator = Validators .pattern(SIMPLE_DURATION_PATTERN )
578554 defaultValue = DEFAULT_POLL_INTERVAL .toSimpleString()
579- },
580- )
555+ })
581556 .define(
582557 ConfigKeyBuilder .of(BATCH_SIZE , ConfigDef .Type .INT ) {
583558 importance = ConfigDef .Importance .HIGH
584559 recommender =
585560 Recommenders .visibleIf(STRATEGY , Predicate .isEqual(SourceType .QUERY .name))
586561 validator = Range .atLeast(1 )
587562 defaultValue = DEFAULT_BATCH_SIZE
588- },
589- )
563+ })
590564 .define(
591565 ConfigKeyBuilder .of(QUERY_TIMEOUT , ConfigDef .Type .STRING ) {
592566 importance = ConfigDef .Importance .HIGH
593567 recommender =
594568 Recommenders .visibleIf(STRATEGY , Predicate .isEqual(SourceType .QUERY .name))
595569 validator = Validators .pattern(SIMPLE_DURATION_PATTERN )
596570 defaultValue = DEFAULT_QUERY_TIMEOUT .toSimpleString()
597- },
598- )
571+ })
599572 .define(
600573 ConfigKeyBuilder .of(CDC_POLL_INTERVAL , ConfigDef .Type .STRING ) {
601574 importance = ConfigDef .Importance .HIGH
602575 recommender =
603576 Recommenders .visibleIf(STRATEGY , Predicate .isEqual(SourceType .CDC .name))
604577 validator = Validators .pattern(SIMPLE_DURATION_PATTERN )
605578 defaultValue = DEFAULT_CDC_POLL_INTERVAL .toSimpleString()
606- },
607- )
579+ })
608580 .define(
609581 ConfigKeyBuilder .of(CDC_POLL_DURATION , ConfigDef .Type .STRING ) {
610582 importance = ConfigDef .Importance .HIGH
611583 recommender =
612584 Recommenders .visibleIf(STRATEGY , Predicate .isEqual(SourceType .CDC .name))
613585 validator = Validators .pattern(SIMPLE_DURATION_PATTERN )
614586 defaultValue = DEFAULT_CDC_POLL_DURATION .toSimpleString()
615- },
616- )
587+ })
617588 .define(
618589 ConfigKeyBuilder .of(ENFORCE_SCHEMA , ConfigDef .Type .BOOLEAN ) {
619590 importance = ConfigDef .Importance .HIGH
620591 defaultValue = false
621592 validator = ConfigDef .NonNullValidator ()
622- },
623- )
593+ })
624594 }
625595}
0 commit comments