file drop support
- Add a folder where you can drop Zip files which will then be extracted on the fly and ingsted. - CsvReaderSettings now contain TagMatcher that are applied to the first line and can be used to extract additional tags. - Update to jdk 16 so that we can have records.
This commit is contained in:
@@ -1,12 +1,15 @@
|
||||
package org.lucares.pdbui;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.lucares.pdbui.domain.TagMatcher;
|
||||
import org.lucares.utils.Preconditions;
|
||||
|
||||
public final class CsvReaderSettings {
|
||||
@@ -166,6 +169,8 @@ public final class CsvReaderSettings {
|
||||
|
||||
private String comment = "#";
|
||||
|
||||
private List<TagMatcher> firstLineMatcher = new ArrayList<>();
|
||||
|
||||
public CsvReaderSettings() {
|
||||
this("@timestamp", "duration", ",", new ColumnDefinitions());
|
||||
}
|
||||
@@ -238,6 +243,10 @@ public final class CsvReaderSettings {
|
||||
additionalTags.put(field, value);
|
||||
}
|
||||
|
||||
public void putAdditionalTag(final Map<String, String> additionalTags) {
|
||||
additionalTags.putAll(additionalTags);
|
||||
}
|
||||
|
||||
public Map<String, String> getAdditionalTags() {
|
||||
return Map.copyOf(additionalTags);
|
||||
}
|
||||
@@ -254,4 +263,52 @@ public final class CsvReaderSettings {
|
||||
this.columnDefinitions = columnDefinitions;
|
||||
}
|
||||
|
||||
public List<TagMatcher> getFirstLineMatcher() {
|
||||
return firstLineMatcher;
|
||||
}
|
||||
|
||||
public void setFirstLineMatcher(final List<TagMatcher> firstLineMatcher) {
|
||||
this.firstLineMatcher = firstLineMatcher;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
final StringBuilder builder = new StringBuilder();
|
||||
if (separator != null) {
|
||||
builder.append("\nseparator=");
|
||||
builder.append(separator);
|
||||
builder.append(", ");
|
||||
}
|
||||
if (columnDefinitions != null) {
|
||||
builder.append("\ncolumnDefinitions=");
|
||||
builder.append(columnDefinitions);
|
||||
builder.append(", ");
|
||||
}
|
||||
if (additionalTags != null) {
|
||||
builder.append("\nadditionalTags=");
|
||||
builder.append(additionalTags);
|
||||
builder.append(", ");
|
||||
}
|
||||
if (timeColumn != null) {
|
||||
builder.append("\ntimeColumn=");
|
||||
builder.append(timeColumn);
|
||||
builder.append(", ");
|
||||
}
|
||||
if (valueColumn != null) {
|
||||
builder.append("\nvalueColumn=");
|
||||
builder.append(valueColumn);
|
||||
builder.append(", ");
|
||||
}
|
||||
if (firstLineMatcher != null) {
|
||||
builder.append("\nfirstLineMatcher=");
|
||||
builder.append(firstLineMatcher);
|
||||
builder.append(", ");
|
||||
}
|
||||
if (comment != null) {
|
||||
builder.append("\ncomment=");
|
||||
builder.append(comment);
|
||||
}
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user