Package edu.ie3.datamodel.io.connectors
Class CsvFileConnector
java.lang.Object
edu.ie3.datamodel.io.connectors.CsvFileConnector
- All Implemented Interfaces:
DataConnector
Provides the connector (here: buffered writer) for specific files to be used by a
CsvFileSink
- Since:
- 19.03.20
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Deprecated, for removal: This API element is subject to removal in a future version.since 3.0. -
Constructor Summary
ConstructorDescriptionCsvFileConnector
(String baseDirectoryName, FileNamingStrategy fileNamingStrategy) -
Method Summary
Modifier and TypeMethodDescription<C extends UniqueEntity>
voidcloseEntityWriter
(Class<C> clz) Close an entity writer for the given classvoid
closeTimeSeriesWriter
(UUID uuid) Closes a time series writer for the time series with givenUUID
getCsvIndividualTimeSeriesMetaInformation
(ColumnScheme... columnSchemes) Receive the information for specific time series.getIndividualTimeSeriesMetaInformation
(UUID timeSeriesUuid) Deprecated, for removal: This API element is subject to removal in a future version.since 3.0.getOrInitWriter
(Class<? extends UniqueEntity> clz, String[] headerElements, String csvSep) <T extends TimeSeries<E,
V>, E extends TimeSeriesEntry<V>, V extends Value>
BufferedCsvWritergetOrInitWriter
(T timeSeries, String[] headerElements, String csvSep) Initialises a reader to get grip on the file that contains mapping information between coordinate id and actual coordinateinitReader
(Class<? extends UniqueEntity> clz) Initializes a file reader for the given class that should be read in.initReader
(String filePath) Initializes a file reader for the given file name.void
shutdown()
-
Constructor Details
-
CsvFileConnector
-
-
Method Details
-
getOrInitWriter
public BufferedCsvWriter getOrInitWriter(Class<? extends UniqueEntity> clz, String[] headerElements, String csvSep) throws ConnectorException - Throws:
ConnectorException
-
getOrInitWriter
public <T extends TimeSeries<E,V>, BufferedCsvWriter getOrInitWriterE extends TimeSeriesEntry<V>, V extends Value> (T timeSeries, String[] headerElements, String csvSep) throws ConnectorException - Throws:
ConnectorException
-
closeTimeSeriesWriter
Closes a time series writer for the time series with givenUUID
- Parameters:
uuid
- identifier of time series, whose writer is meant to be closed- Throws:
IOException
- If closing of writer fails.
-
closeEntityWriter
Close an entity writer for the given class- Type Parameters:
C
- Type of class- Parameters:
clz
- Class, that the writer is able to persist- Throws:
IOException
- If closing of writer fails.
-
initReader
Initializes a file reader for the given class that should be read in. The expected file name is determined based onFileNamingStrategy
of the thisCsvFileConnector
instance- Parameters:
clz
- the class of the entity that should be read- Returns:
- the reader that contains information about the file to be read in
- Throws:
FileNotFoundException
- If the matching file cannot be found
-
initReader
Initializes a file reader for the given file name. UseinitReader(Class)
for files that actually correspond to concrete entities.- Parameters:
filePath
- sub directory tree starting from base folder, including file name- Returns:
- the reader that contains information about the file to be read in
- Throws:
FileNotFoundException
- if no file with the provided file name can be found
-
getIndividualTimeSeriesMetaInformation
@Deprecated(since="3.0", forRemoval=true) public Optional<IndividualTimeSeriesMetaInformation> getIndividualTimeSeriesMetaInformation(UUID timeSeriesUuid) Deprecated, for removal: This API element is subject to removal in a future version.since 3.0. UsegetCsvIndividualTimeSeriesMetaInformation(ColumnScheme...)
insteadGet time series meta information for a given uuid.This method lazily evaluates the mapping from all time series files to their meta information.
- Parameters:
timeSeriesUuid
- The time series in question- Returns:
- An option on the queried information
-
getCsvIndividualTimeSeriesMetaInformation
public Map<UUID,CsvIndividualTimeSeriesMetaInformation> getCsvIndividualTimeSeriesMetaInformation(ColumnScheme... columnSchemes) Receive the information for specific time series. They are given back filtered by the column scheme in order to allow for accounting the different content types.- Parameters:
columnSchemes
- the column schemes to initialize readers for. If no scheme is given, all possible readers will be initialized.- Returns:
- A mapping from column scheme to the individual time series meta information
-
initIdCoordinateReader
Initialises a reader to get grip on the file that contains mapping information between coordinate id and actual coordinate- Returns:
- A
BufferedReader
- Throws:
FileNotFoundException
- If the file is not present
-
shutdown
public void shutdown()- Specified by:
shutdown
in interfaceDataConnector
-