-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Datasources #2959
Datasources #2959
Conversation
Signed-off-by: Nicolas Rol <nicolas.rol@rte-france.com>
Signed-off-by: Nicolas Rol <nicolas.rol@rte-france.com>
Signed-off-by: Nicolas Rol <nicolas.rol@rte-france.com>
Signed-off-by: Nicolas Rol <nicolas.rol@rte-france.com>
Signed-off-by: Nicolas Rol <nicolas.rol@rte-france.com>
Signed-off-by: Nicolas Rol <nicolas.rol@rte-france.com>
# Conflicts: # pom.xml
Signed-off-by: Nicolas Rol <nicolas.rol@rte-france.com>
Signed-off-by: Nicolas Rol <nicolas.rol@rte-france.com>
Signed-off-by: Nicolas Rol <nicolas.rol@rte-france.com>
Signed-off-by: Nicolas Rol <nicolas.rol@rte-france.com>
Signed-off-by: Nicolas Rol <nicolas.rol@rte-france.com>
Signed-off-by: Nicolas Rol <nicolas.rol@rte-france.com>
Signed-off-by: Nicolas Rol <nicolas.rol@rte-france.com>
Should solve #121 (except successive compressions) |
Might solve #989 with some more documentation (will be done once the modifications are verified and accepted) |
Signed-off-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@rte-france.com> Signed-off-by: Nicolas Rol <nicolas.rol@rte-france.com>
Signed-off-by: Nicolas Rol <nicolas.rol@rte-france.com>
Signed-off-by: Nicolas Rol <nicolas.rol@rte-france.com>
Signed-off-by: Nicolas Rol <nicolas.rol@rte-france.com>
# Conflicts: # pom.xml
Signed-off-by: Nicolas Rol <nicolas.rol@rte-france.com>
Signed-off-by: Nicolas Rol <nicolas.rol@rte-france.com>
…Datasource when possible Signed-off-by: Nicolas Rol <nicolas.rol@rte-france.com>
Signed-off-by: Nicolas Rol <nicolas.rol@rte-france.com>
Signed-off-by: Nicolas Rol <nicolas.rol@rte-france.com>
Signed-off-by: Nicolas Rol <nicolas.rol@rte-france.com>
# Conflicts: # cgmes/cgmes-conversion/src/test/java/com/powsybl/cgmes/conversion/test/export/SteadyStateHypothesisExportTest.java
Signed-off-by: Nicolas Rol <nicolas.rol@rte-france.com>
Signed-off-by: Nicolas Rol <nicolas.rol@rte-france.com>
commons/src/test/java/com/powsybl/commons/datasource/TarArchiveDataSourceTest.java
Outdated
Show resolved
Hide resolved
…ncyWithDataSource parameter + remove checkConsistencyWithDataSource parameter in newInputStream Signed-off-by: Nicolas Rol <nicolas.rol@rte-france.com>
…ArchiveDataSource Signed-off-by: Nicolas Rol <nicolas.rol@rte-france.com>
Signed-off-by: Nicolas Rol <nicolas.rol@rte-france.com>
Signed-off-by: Nicolas Rol <nicolas.rol@rte-france.com>
…ile contains CGMES data Signed-off-by: Nicolas Rol <nicolas.rol@rte-france.com>
Quality Gate passedIssues Measures |
With the last modifications, using the following command in a folder containing the files from this archive MicroGrid.zip should create a new json file with the network from |
When trying to output to a zip, before we had $ itools convert-network --input-file /tmp/foo.xiidm --output-file /tmp/bar.zip --output-format XIIDM
Generating file /tmp/bar.zip:bar.xiidm... # the zip file contains a file named "bar.xiidm" now we have $ itools convert-network --input-file /tmp/foo.xiidm --output-file /tmp/bar.zip --output-format XIIDM
Generating file /tmp/bar.zip:.xiidm... # the zip file contains a file named ".xiidm" |
Please check if the PR fulfills these requirements
Does this PR already have an issue describing the problem?
No
What kind of change does this PR introduce?
Bug fix + feature
What is the current behavior?
to be completed
What is the new behavior (if this is a feature change)?
Two types of
DataSources
now exists:DirectoryDataSource
(inherited byGzDataSource
,Bzip2DataSource
,ZstdDataSource
,XZDataSource
): considers files in a directoryAbstractArchiveDataSource
(ZipDataSource
,TarDataSource
): considers files in an archiveDirectory DataSources consider the following parameters:
Archive DataSources consider the following parameters:
zip
ortar
)zip
,gz
,xz
, etc.)The parameter
sourceFormat
corresponds to the extension of the files the users want to consider in their datasources. For example, ifsourceFormat == ".xiidm"
, only files ending with".xiidm"
will be considered. The value can be anything. If the parameter is empty, it won't be considered in the file listing.The method
listNames(String)
now works like this:DirectoryDataSource
, it lists the files located in the directory, starting with the base name, having the same source format and the same compression format as the datasource and respecting the regex given as parameterA
DataSourceBuilder
is now provided in addition to usualDataSourceUtil.createDataSource
methods.Note: when creating a datasource by giving a filename, for example via
DataSourceUtil.createDataSource(Path directory, String fileName, DataSourceObserver observer)
, the different parameters are extracted from the filename. If the source format is empty or not a usual one (list defined in the newFileInformation
class), a warning will be raised.Does this PR introduce a breaking change or deprecate an API?
If yes, please check if the following requirements are fulfilled
What changes might users need to make in their application due to this PR? (migration steps)
Two types of
DataSources
now exists:DirectoryDataSource
(inherited byGzDataSource
,Bzip2DataSource
,ZstdDataSource
,XZDataSource
): considers files in a directoryAbstractArchiveDataSource
(ZipDataSource
,TarDataSource
): considers files in an archiveDirectory DataSources consider the following parameters:
Archive DataSources consider the following parameters:
zip
ortar
)zip
,gz
,xz
, etc.)The parameter
sourceFormat
corresponds to the extension of the files the users want to consider in their datasources. For example, ifsourceFormat == ".xiidm"
, only files ending with".xiidm"
will be considered. The value can be anything. If the parameter is empty, it won't be considered in the file listing.Therefore, multiple classes have changed, please update your code if you used them directly:
Bzip2FileDataSource
Bzip2DataSource
FileDataSource
DirectoryDataSource
GzFileDataSource
GzDataSource
TarDataSource
XZFileDataSource
XZDataSource
ZipFileDataSource
ZipDataSource
ZstdFileDataSource
ZstdDataSource
Note: Their constructors are not the same so you will have to adapt your code to the new ones, depending on which DataSource you use.
ReadOnlyDataSource
,ResourceDataSource
andMultipleReadOnlyDataSource
now extendAbstractReadOnlyDataSource
.The methods
DataSourceUtil.createDataSource()
have been reworked to be more consistent with each other and to provide more variations depending on the parameters you might want to use. Be careful regarding the parameters you use:String
parameter, it will be considered as afileName
baseName
and asourceFormat
archiveName
, abaseName
and asourceFormat
For instance,
new FileDataSource(path, "fileName")
could be replaced by one of the followings:new DirectoryDataSource(path, "fileName", "")
;DataSourceUtil.createDataSource(path, "fileName", "")
.Other information: