Skip to content

Commit bcf7f4f

Browse files
committed
Make time bin format variable
1 parent 2028c37 commit bcf7f4f

File tree

2 files changed

+14
-33
lines changed

2 files changed

+14
-33
lines changed

src/main/java/org/radarbase/output/path/MonthlyObservationKeyPathFactory.kt

Lines changed: 0 additions & 31 deletions
This file was deleted.

src/main/java/org/radarbase/output/path/RecordPathFactory.kt

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,20 @@ abstract class RecordPathFactory : Plugin {
3434
lateinit var root: Path
3535
lateinit var extension: String
3636

37-
protected open val timeBinFormat: DateTimeFormatter
38-
get() = HOURLY_TIME_BIN_FORMAT
37+
protected open var timeBinFormat: DateTimeFormatter = HOURLY_TIME_BIN_FORMAT
38+
39+
override fun init(properties: Map<String, String>) {
40+
super.init(properties)
41+
properties["timeBinFormat"]?.let {
42+
try {
43+
timeBinFormat = DateTimeFormatter
44+
.ofPattern(it)
45+
.withZone(UTC)
46+
} catch (ex: IllegalArgumentException) {
47+
logger.error("Cannot use time bin format {}, using {} instad", it, timeBinFormat, ex)
48+
}
49+
}
50+
}
3951

4052
/**
4153
* Get the organization of given record in given topic.

0 commit comments

Comments
 (0)