-
Notifications
You must be signed in to change notification settings - Fork 40
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
Import/export network from/to folder #3092
base: main
Are you sure you want to change the base?
Conversation
2dbe40a
to
2c21ab3
Compare
90d5275
to
c99bf83
Compare
c99bf83
to
38d18e8
Compare
Signed-off-by: HARPER Jon <jon.harper87@gmail.com>
38d18e8
to
91efeeb
Compare
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
Signed-off-by: Nicolas Rol <nicolas.rol@rte-france.com>
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
Signed-off-by: Florian Dupuy <florian.dupuy@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>
Quality Gate passedIssues Measures |
filter filenames to only keep those starting with the base name. This behaviour basename-filtering only occurs if | ||
`allFiles` is set to `false` in the datasource. | ||
Setting `allFiles` to `true` is for example very useful for the CGMES use case, in which a network is defined by | ||
several files (TP, EQ, SV, SSH, GL, ...), often without a common prefix (base name). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
several files (TP, EQ, SV, SSH, GL, ...), often without a common prefix (base name). | |
several files (TP, EQ, SV, SSH, GL, ...), often without a common prefix (base name). This makes the DirectoryDataSource behave just like an ArchiveDataSource. |
DataSourceBuilder dataSourceBuilder = new DataSourceBuilder().withObserver(observer); | ||
if (Files.isDirectory(fileOrDirectory)) { | ||
dataSourceBuilder.withDirectory(fileOrDirectory) | ||
.withBaseName(fileOrDirectory.getFileName().toString()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.withBaseName(fileOrDirectory.getFileName().toString()) | |
// we use the full directoryname here instead of a parsed representation using FileInformation | |
// this is required for now to allow directories with dots but without the dataextension (like "microgrid.v1.complete/") | |
// otherwise Fileinformation interprets the part after the dot as the dataextension. This has the drawback that | |
// directories with a dataextension (e.g. "network.xiidm/") will be rejected/mishandled because we will use | |
// a file named "network.xiidm.xiidm" inside it | |
// NOTE: this does not occur if the directory has a dot and also has the dataextension: "microgrid.v1.complete.xml/" works | |
// NOTE2: Maybe this can be fixed in the future by looking more at what is inside the directory and we can remove this | |
.withBaseName(fileOrDirectory.getFileName().toString()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should go in the javadoc more than in a simple comment
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?
feature
What is the current behavior?
Impossible to import a CGMES network described by several files in the same folder (one needs to zip the files)
What is the new behavior (if this is a feature change)?
It is now possible to import/export a CGMES network by giving the corresponding folder using
Network::read
orNetwork::write
methodsDoes this PR introduce a breaking change or deprecate an API?
Other information:
alternative to #3086