Search in sources :

Example 1 with InvalidAdapterParameterException

use of eu.fthevenet.binjr.data.exceptions.InvalidAdapterParameterException in project selenium_java by sergueik.

the class CsvFileAdapter method loadParams.

@Override
public void loadParams(Map<String, String> params) throws DataAdapterException {
    if (params == null) {
        throw new InvalidAdapterParameterException("Could not find parameter list for adapter " + getSourceName());
    }
    zoneId = validateParameter(params, "zoneId", s -> {
        if (s == null) {
            throw new InvalidAdapterParameterException("Parameter zoneId is missing in adpater " + getSourceName());
        }
        return ZoneId.of(s);
    });
    String path = validateParameterNullity(params, "csvPath");
    delimiter = validateParameter(params, "delimiter", s -> {
        if (s == null || s.isEmpty() || s.length() > 1) {
            throw new InvalidAdapterParameterException("Parameter 'delimiter' is missing for adapter " + this.getSourceName());
        }
        return s.charAt(0);
    });
    encoding = validateParameterNullity(params, "encoding");
    dateTimePattern = validateParameterNullity(params, "dateTimePattern");
    this.csvPath = Paths.get(path);
}
Also used : UnitPrefixes(eu.fthevenet.binjr.data.workspace.UnitPrefixes) DataAdapterException(eu.fthevenet.binjr.data.exceptions.DataAdapterException) Profiler(eu.fthevenet.util.logging.Profiler) InvalidAdapterParameterException(eu.fthevenet.binjr.data.exceptions.InvalidAdapterParameterException) TimeSeriesInfo(eu.fthevenet.binjr.data.workspace.TimeSeriesInfo) TreeItem(javafx.scene.control.TreeItem) ZonedDateTime(java.time.ZonedDateTime) HashMap(java.util.HashMap) TimeSeriesProcessor(eu.fthevenet.binjr.data.timeseries.TimeSeriesProcessor) XYChart(javafx.scene.chart.XYChart) Map(java.util.Map) ChartType(eu.fthevenet.binjr.data.workspace.ChartType) Path(java.nio.file.Path) CsvDecoder(eu.fthevenet.binjr.data.codec.CsvDecoder) FetchingDataFromAdapterException(eu.fthevenet.binjr.data.exceptions.FetchingDataFromAdapterException) Files(java.nio.file.Files) IOException(java.io.IOException) DataSample(eu.fthevenet.binjr.data.codec.DataSample) Instant(java.time.Instant) ZoneId(java.time.ZoneId) DataAdapter(eu.fthevenet.binjr.data.adapters.DataAdapter) List(java.util.List) ConcurrentSkipListMap(java.util.concurrent.ConcurrentSkipListMap) Logger(org.apache.logging.log4j.Logger) TimeSeriesBinding(eu.fthevenet.binjr.data.adapters.TimeSeriesBinding) Paths(java.nio.file.Paths) DateTimeFormatter(java.time.format.DateTimeFormatter) LogManager(org.apache.logging.log4j.LogManager) SortedMap(java.util.SortedMap) DoubleTimeSeriesProcessor(eu.fthevenet.binjr.data.timeseries.DoubleTimeSeriesProcessor) InputStream(java.io.InputStream) InvalidAdapterParameterException(eu.fthevenet.binjr.data.exceptions.InvalidAdapterParameterException)

Aggregations

DataAdapter (eu.fthevenet.binjr.data.adapters.DataAdapter)1 TimeSeriesBinding (eu.fthevenet.binjr.data.adapters.TimeSeriesBinding)1 CsvDecoder (eu.fthevenet.binjr.data.codec.CsvDecoder)1 DataSample (eu.fthevenet.binjr.data.codec.DataSample)1 DataAdapterException (eu.fthevenet.binjr.data.exceptions.DataAdapterException)1 FetchingDataFromAdapterException (eu.fthevenet.binjr.data.exceptions.FetchingDataFromAdapterException)1 InvalidAdapterParameterException (eu.fthevenet.binjr.data.exceptions.InvalidAdapterParameterException)1 DoubleTimeSeriesProcessor (eu.fthevenet.binjr.data.timeseries.DoubleTimeSeriesProcessor)1 TimeSeriesProcessor (eu.fthevenet.binjr.data.timeseries.TimeSeriesProcessor)1 ChartType (eu.fthevenet.binjr.data.workspace.ChartType)1 TimeSeriesInfo (eu.fthevenet.binjr.data.workspace.TimeSeriesInfo)1 UnitPrefixes (eu.fthevenet.binjr.data.workspace.UnitPrefixes)1 Profiler (eu.fthevenet.util.logging.Profiler)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 Files (java.nio.file.Files)1 Path (java.nio.file.Path)1 Paths (java.nio.file.Paths)1 Instant (java.time.Instant)1 ZoneId (java.time.ZoneId)1