Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into small_fix
- Loading branch information
Showing
26 changed files
with
1,644 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
Copyright (c) 2016, RTE (http://www.rte-france.com) | ||
This Source Code Form is subject to the terms of the Mozilla Public | ||
License, v. 2.0. If a copy of the MPL was not distributed with this | ||
file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
--> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<parent> | ||
<groupId>eu.itesla_project</groupId> | ||
<artifactId>itesla-parent</artifactId> | ||
<version>0.1-SNAPSHOT</version> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>case-repository</artifactId> | ||
<name>Case repository</name> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-api</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>joda-time</groupId> | ||
<artifactId>joda-time</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>${project.groupId}</groupId> | ||
<artifactId>iidm-converter-api</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>${project.groupId}</groupId> | ||
<artifactId>computation</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
</project> |
44 changes: 44 additions & 0 deletions
44
case-repository/src/main/java/eu/itesla_project/cases/CaseRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/** | ||
* Copyright (c) 2016, All partners of the iTesla project (http://www.itesla-project.eu/consortium) | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
*/ | ||
package eu.itesla_project.cases; | ||
|
||
import eu.itesla_project.iidm.network.Country; | ||
import eu.itesla_project.iidm.network.Network; | ||
import org.joda.time.DateTime; | ||
import org.joda.time.Interval; | ||
|
||
import java.util.List; | ||
import java.util.Set; | ||
|
||
/** | ||
* | ||
* @author Geoffroy Jamgotchian <geoffroy.jamgotchian at rte-france.com> | ||
*/ | ||
public interface CaseRepository { | ||
|
||
/** | ||
* Load a case from the repository. | ||
* | ||
* @param date date of the case | ||
* @param type type of the case, snapshot (SN) or forecast (FO) | ||
* @param country case perimeter, merge if null | ||
* @return a case | ||
*/ | ||
List<Network> load(DateTime date, CaseType type, Country country); | ||
|
||
/** | ||
* Check if the all the data of a case is available | ||
* | ||
* @param date date of the case | ||
* @param type type of the case, snapshot (SN) or forecast (FO) | ||
* @param country case perimeter, merge if null | ||
* @return true if all the data of a case is available, false otherwise | ||
*/ | ||
boolean isDataAvailable(DateTime date, CaseType type, Country country); | ||
|
||
Set<DateTime> dataAvailable(CaseType type, Set<Country> countries, Interval interval); | ||
} |
18 changes: 18 additions & 0 deletions
18
case-repository/src/main/java/eu/itesla_project/cases/CaseRepositoryFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/** | ||
* Copyright (c) 2016, All partners of the iTesla project (http://www.itesla-project.eu/consortium) | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
*/ | ||
package eu.itesla_project.cases; | ||
|
||
import eu.itesla_project.computation.ComputationManager; | ||
|
||
/** | ||
* @author Geoffroy Jamgotchian <geoffroy.jamgotchian at rte-france.com> | ||
*/ | ||
public interface CaseRepositoryFactory { | ||
|
||
CaseRepository create(ComputationManager computationManager); | ||
|
||
} |
16 changes: 16 additions & 0 deletions
16
case-repository/src/main/java/eu/itesla_project/cases/CaseType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/** | ||
* Copyright (c) 2016, All partners of the iTesla project (http://www.itesla-project.eu/consortium) | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
*/ | ||
package eu.itesla_project.cases; | ||
|
||
/** | ||
* | ||
* @author Geoffroy Jamgotchian <geoffroy.jamgotchian at rte-france.com> | ||
*/ | ||
public enum CaseType { | ||
SN, | ||
FO | ||
} |
19 changes: 19 additions & 0 deletions
19
case-repository/src/test/java/eu/itesla_project/cases/CoverageTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/** | ||
* Copyright (c) 2016, RTE (http://www.rte-france.com) | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
*/ | ||
package eu.itesla_project.cases; | ||
|
||
import org.junit.Test; | ||
|
||
/** | ||
* @author Mathieu Bague <mathieu.bague at rte-france.com> | ||
*/ | ||
public class CoverageTest { | ||
|
||
@Test | ||
public void testNothing() { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
Copyright (c) 2016, RTE (http://www.rte-france.com) | ||
This Source Code Form is subject to the terms of the Mozilla Public | ||
License, v. 2.0. If a copy of the MPL was not distributed with this | ||
file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
--> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>eu.itesla_project</groupId> | ||
<artifactId>itesla-parent</artifactId> | ||
<version>0.1-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>entsoe-case-repository</artifactId> | ||
<name>ENTSO-E case repository</name> | ||
|
||
<dependencies> | ||
<!-- Compilation dependencies --> | ||
<dependency> | ||
<groupId>com.google.guava</groupId> | ||
<artifactId>guava</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-api</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>joda-time</groupId> | ||
<artifactId>joda-time</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>eu.itesla_project</groupId> | ||
<artifactId>case-repository</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>eu.itesla_project</groupId> | ||
<artifactId>commons</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>eu.itesla_project</groupId> | ||
<artifactId>iidm-converter-api</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>${project.groupId}</groupId> | ||
<artifactId>entsoe-util</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
|
||
<!-- Test dependencies --> | ||
<dependency> | ||
<groupId>com.google.jimfs</groupId> | ||
<artifactId>jimfs</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.mockito</groupId> | ||
<artifactId>mockito-all</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-simple</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
</dependencies> | ||
|
||
</project> |
53 changes: 53 additions & 0 deletions
53
...e-repository/src/main/java/eu/itesla_project/entsoe/cases/EntsoeAndXmlCaseRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/** | ||
* Copyright (c) 2016, RTE (http://www.rte-france.com) | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
*/ | ||
package eu.itesla_project.entsoe.cases; | ||
|
||
import eu.itesla_project.cases.CaseRepository; | ||
import eu.itesla_project.computation.ComputationManager; | ||
import eu.itesla_project.commons.datasource.GenericReadOnlyDataSource; | ||
import eu.itesla_project.commons.datasource.ReadOnlyDataSourceFactory; | ||
import eu.itesla_project.iidm.import_.Importers; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import java.util.Arrays; | ||
import java.util.List; | ||
|
||
/** | ||
* Common ENTSOE and IIDM case repository layout: | ||
* <pre> | ||
* CIM/SN/2013/01/15/20130115_0620_SN2_FR0.zip | ||
* /FO/... | ||
* UCT/SN/... | ||
* /FO/... | ||
* IIDM/SN/2013/01/15/20130115_0720_SN2_FR0.xml | ||
* /FO/... | ||
* </pre> | ||
* | ||
* @author Quinary <itesla@quinary.com> | ||
*/ | ||
public class EntsoeAndXmlCaseRepository extends EntsoeCaseRepository { | ||
|
||
private static final Logger LOGGER = LoggerFactory.getLogger(EntsoeAndXmlCaseRepository.class); | ||
|
||
public EntsoeAndXmlCaseRepository(EntsoeCaseRepositoryConfig config, ComputationManager computationManager) { | ||
super(config, | ||
Arrays.asList(new EntsoeFormat(Importers.getImporter("CIM1", computationManager), "CIM"), | ||
new EntsoeFormat(Importers.getImporter("UCTE", computationManager), "UCT"), // official ENTSOE formats) | ||
new EntsoeFormat(Importers.getImporter("XIIDM", computationManager), "IIDM")), // XIIDM format | ||
(directory, baseName) -> new GenericReadOnlyDataSource(directory, baseName)); | ||
} | ||
|
||
public EntsoeAndXmlCaseRepository(EntsoeCaseRepositoryConfig config, List<EntsoeFormat> formats, ReadOnlyDataSourceFactory dataSourceFactory) { | ||
super(config, formats, dataSourceFactory); | ||
} | ||
|
||
public static CaseRepository create(ComputationManager computationManager) { | ||
return new EntsoeAndXmlCaseRepository(EntsoeAndXmlCaseRepositoryConfig.load(), computationManager); | ||
} | ||
|
||
} |
38 changes: 38 additions & 0 deletions
38
...sitory/src/main/java/eu/itesla_project/entsoe/cases/EntsoeAndXmlCaseRepositoryConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/** | ||
* Copyright (c) 2016, RTE (http://www.rte-france.com) | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
*/ | ||
package eu.itesla_project.entsoe.cases; | ||
|
||
import com.google.common.collect.Multimap; | ||
import eu.itesla_project.commons.config.PlatformConfig; | ||
import eu.itesla_project.iidm.import_.Importers; | ||
import eu.itesla_project.entsoe.util.EntsoeGeographicalCode; | ||
|
||
import java.nio.file.Path; | ||
import java.util.Collection; | ||
|
||
/** | ||
* | ||
* @author Quinary <itesla@quinary.com> | ||
*/ | ||
public class EntsoeAndXmlCaseRepositoryConfig extends EntsoeCaseRepositoryConfig { | ||
|
||
public EntsoeAndXmlCaseRepositoryConfig(Path rootDir, Multimap<EntsoeGeographicalCode, String> forbiddenFormatsByGeographicalCode) { | ||
super(rootDir, forbiddenFormatsByGeographicalCode); | ||
} | ||
|
||
public static EntsoeCaseRepositoryConfig load() { | ||
return load(PlatformConfig.defaultConfig()); | ||
} | ||
|
||
static EntsoeCaseRepositoryConfig load(PlatformConfig platformConfig) { | ||
return load(platformConfig, Importers.getFormats()); | ||
} | ||
|
||
static EntsoeCaseRepositoryConfig load(PlatformConfig platformConfig, Collection<String> supportedFormats) { | ||
return EntsoeCaseRepositoryConfig.load("entsoeandxmlcaserepo", platformConfig, supportedFormats); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
...itory/src/main/java/eu/itesla_project/entsoe/cases/EntsoeAndXmlCaseRepositoryFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/** | ||
* Copyright (c) 2016, RTE (http://www.rte-france.com) | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
*/ | ||
|
||
package eu.itesla_project.entsoe.cases; | ||
|
||
import eu.itesla_project.cases.CaseRepository; | ||
import eu.itesla_project.cases.CaseRepositoryFactory; | ||
import eu.itesla_project.computation.ComputationManager; | ||
|
||
/** | ||
* | ||
* @author Quinary <itesla@quinary.com> | ||
*/ | ||
public class EntsoeAndXmlCaseRepositoryFactory implements CaseRepositoryFactory { | ||
@Override | ||
public CaseRepository create(ComputationManager computationManager) { | ||
return EntsoeAndXmlCaseRepository.create(computationManager); | ||
} | ||
} |
Oops, something went wrong.