Skip to content

Commit

Permalink
First version of merging view : part of Substations & Voltagelevels m…
Browse files Browse the repository at this point in the history
…anagement (#963)

Signed-off-by: Thomas ADAM <[email protected]>

Change parent module version to 3.1.0 into merging-view

Signed-off-by: Thomas ADAM <[email protected]>
  • Loading branch information
tadam50 authored and miovd committed Nov 5, 2019
1 parent a71bfc1 commit 5021c81
Show file tree
Hide file tree
Showing 17 changed files with 2,234 additions and 1 deletion.
8 changes: 7 additions & 1 deletion distribution-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -278,10 +278,16 @@

<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>powsybl-iidm-reducer</artifactId>
<artifactId>powsybl-iidm-mergingview</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>powsybl-iidm-reducer</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>powsybl-iidm-test</artifactId>
Expand Down
84 changes: 84 additions & 0 deletions iidm/iidm-mergingview/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2019, 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>
<artifactId>powsybl-iidm</artifactId>
<groupId>com.powsybl</groupId>
<version>3.1.0-SNAPSHOT</version>
</parent>

<artifactId>powsybl-iidm-mergingview</artifactId>
<name>IIDM Merging View</name>
<description>A network merging tool for IIDM model</description>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifestEntries>
<Automatic-Module-Name>com.powsybl.iidm.mergingview</Automatic-Module-Name>
</manifestEntries>
</archive>
</configuration>
</plugin>
</plugins>
</build>

<dependencies>
<!-- Compilation dependencies -->
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>powsybl-commons</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>powsybl-iidm-api</artifactId>
<version>${project.version}</version>
</dependency>

<!-- Test dependencies -->
<dependency>
<groupId>com.google.jimfs</groupId>
<artifactId>jimfs</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>powsybl-iidm-impl</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>powsybl-iidm-test</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
/**
* Copyright (c) 2019, 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 com.powsybl.iidm.mergingview;

import java.util.Collection;
import java.util.Objects;
import java.util.Set;

import com.powsybl.commons.extensions.Extension;
import com.powsybl.iidm.network.Identifiable;

/**
* @author Thomas Adam <tadam at silicom.fr>
*/
abstract class AbstractAdapter<I extends Identifiable<I>> implements Identifiable<I> {

private final I delegate;

private final MergingViewIndex index;

protected AbstractAdapter(final I delegate, final MergingViewIndex index) {
this.delegate = Objects.requireNonNull(delegate, "delegate is null");
this.index = Objects.requireNonNull(index, "merging view index is null");
}

@Override
public MergingView getNetwork() {
return index.getView();
}

// -------------------------------
// Simple delegated methods ------
// -------------------------------
public I getDelegate() {
return delegate;
}

public MergingViewIndex getIndex() {
return index;
}

@Override
public String getId() {
return delegate.getId();
}

@Override
public String getName() {
return delegate.getName();
}

@Override
public boolean hasProperty() {
return delegate.hasProperty();
}

@Override
public boolean hasProperty(final String key) {
return delegate.hasProperty(key);
}

@Override
public String getProperty(final String key) {
return delegate.getProperty(key);
}

@Override
public String getProperty(final String key, final String defaultValue) {
return delegate.getProperty(key, defaultValue);
}

@Override
public String setProperty(final String key, final String value) {
return delegate.setProperty(key, value);
}

@Override
public Set<String> getPropertyNames() {
return delegate.getPropertyNames();
}

@Override
public <E extends Extension<I>> void addExtension(final Class<? super E> type, final E extension) {
delegate.addExtension(type, extension);
}

@Override
public <E extends Extension<I>> E getExtension(final Class<? super E> type) {
return delegate.getExtension(type);
}

@Override
public <E extends Extension<I>> E getExtensionByName(final String name) {
return delegate.getExtensionByName(name);
}

@Override
public <E extends Extension<I>> boolean removeExtension(final Class<E> type) {
return delegate.removeExtension(type);
}

@Override
public <E extends Extension<I>> Collection<E> getExtensions() {
return delegate.getExtensions();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/**
* Copyright (c) 2019, 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 com.powsybl.iidm.mergingview;

import com.powsybl.iidm.network.Identifiable;
import com.powsybl.iidm.network.NetworkListener;

/**
* @author Thomas Adam <tadam at silicom.fr>
*/
public class MergingNetworkListener implements NetworkListener {
@Override
public void onCreation(final Identifiable identifiable) {
throw MergingView.NOT_IMPLEMENTED_EXCEPTION;
}

@Override
public void onRemoval(final Identifiable identifiable) {
throw MergingView.NOT_IMPLEMENTED_EXCEPTION;
}

@Override
public void onUpdate(final Identifiable identifiable, final String attribute, final Object oldValue, final Object newValue) {
throw MergingView.NOT_IMPLEMENTED_EXCEPTION;
}
}
Loading

0 comments on commit 5021c81

Please sign in to comment.