From 8cc4d675f0722758fc40d68e2ab42754d8219d90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?DALL=27AGNOLA=20C=C3=A9dric?= Date: Tue, 29 May 2018 16:14:01 +0200 Subject: [PATCH 1/4] Update SclParser.java Add method to retrieve all IEDs --- .../src/com/libiec61850/scl/SclParser.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tools/model_generator/src/com/libiec61850/scl/SclParser.java b/tools/model_generator/src/com/libiec61850/scl/SclParser.java index 4ed22e51..4faa143b 100644 --- a/tools/model_generator/src/com/libiec61850/scl/SclParser.java +++ b/tools/model_generator/src/com/libiec61850/scl/SclParser.java @@ -30,6 +30,7 @@ import java.io.InputStream; import java.util.LinkedList; import java.util.List; import java.util.Stack; +import java.util.stream.Stream; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; @@ -118,6 +119,15 @@ public class SclParser { public Communication getCommunication() { return communication; } + + public Stream getIeds() { + return ieds.stream(); + } + + public int getIedsCount() { + return ieds.size(); + } + public static Document parseXmlWithLineNumberInformation(InputStream xmlInputStream) throws IOException, SAXException { final Document xmlDocument; @@ -314,4 +324,4 @@ public class SclParser { return null; } -} \ No newline at end of file +} From d49064f7ffd44c423b08bc7d25cd1cf5049b45fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?DALL=27AGNOLA=20C=C3=A9dric?= Date: Tue, 29 May 2018 16:17:31 +0200 Subject: [PATCH 2/4] Update IED.java Tolerate IED without access point --- tools/model_generator/src/com/libiec61850/scl/model/IED.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/tools/model_generator/src/com/libiec61850/scl/model/IED.java b/tools/model_generator/src/com/libiec61850/scl/model/IED.java index fb381aeb..45936a04 100644 --- a/tools/model_generator/src/com/libiec61850/scl/model/IED.java +++ b/tools/model_generator/src/com/libiec61850/scl/model/IED.java @@ -41,9 +41,6 @@ public class IED { List accessPointNodes = ParserUtils.getChildNodesWithTag(iedNode, "AccessPoint"); - if (accessPointNodes.size() == 0) - throw new SclParserException(iedNode, "no AccessPoint defined in IED " + name); - this.accessPoints = new LinkedList(); for (Node accessPointNode : accessPointNodes) { From 3564d3a03c0d0fe9cab94881cf83481b6bda0198 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?DALL=27AGNOLA=20C=C3=A9dric?= Date: Tue, 29 May 2018 16:46:56 +0200 Subject: [PATCH 3/4] Update AccessPoint.java Tolerate access point without server node --- .../src/com/libiec61850/scl/model/AccessPoint.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tools/model_generator/src/com/libiec61850/scl/model/AccessPoint.java b/tools/model_generator/src/com/libiec61850/scl/model/AccessPoint.java index 91fec813..3abef9bb 100644 --- a/tools/model_generator/src/com/libiec61850/scl/model/AccessPoint.java +++ b/tools/model_generator/src/com/libiec61850/scl/model/AccessPoint.java @@ -42,10 +42,8 @@ public class AccessPoint { Node serverNode = ParserUtils.getChildNodeWithTag(apNode, "Server"); - if (serverNode == null) - throw new SclParserException(apNode, "AccessPoint has no server defined!"); - - this.server = new Server(serverNode, typeDeclarations); + if (serverNode != null) + this.server = new Server(serverNode, typeDeclarations); } From e8c3d1100384a42951038de28341f8a0e044e340 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?DALL=27AGNOLA=20C=C3=A9dric?= Date: Tue, 29 May 2018 17:19:11 +0200 Subject: [PATCH 4/4] Update AccessPoint.java --- .../src/com/libiec61850/scl/model/AccessPoint.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tools/model_generator/src/com/libiec61850/scl/model/AccessPoint.java b/tools/model_generator/src/com/libiec61850/scl/model/AccessPoint.java index 3abef9bb..69d07cd1 100644 --- a/tools/model_generator/src/com/libiec61850/scl/model/AccessPoint.java +++ b/tools/model_generator/src/com/libiec61850/scl/model/AccessPoint.java @@ -42,10 +42,11 @@ public class AccessPoint { Node serverNode = ParserUtils.getChildNodeWithTag(apNode, "Server"); - if (serverNode != null) - this.server = new Server(serverNode, typeDeclarations); - - } + if (serverNode == null) { + server = null; + } else { + server = new Server(serverNode, typeDeclarations); + } public String getName() { return name;