|
|
|
@ -1,3 +1,4 @@
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Copyright 2011 The IEC61850bean Authors
|
|
|
|
|
*
|
|
|
|
@ -13,34 +14,20 @@
|
|
|
|
|
*/
|
|
|
|
|
package com.beanit.iec61850bean;
|
|
|
|
|
|
|
|
|
|
import static java.nio.charset.StandardCharsets.UTF_8;
|
|
|
|
|
|
|
|
|
|
import com.beanit.iec61850bean.internal.scl.AbstractDataAttribute;
|
|
|
|
|
import com.beanit.iec61850bean.internal.scl.Bda;
|
|
|
|
|
import com.beanit.iec61850bean.internal.scl.Da;
|
|
|
|
|
import com.beanit.iec61850bean.internal.scl.DaType;
|
|
|
|
|
import com.beanit.iec61850bean.internal.scl.Do;
|
|
|
|
|
import com.beanit.iec61850bean.internal.scl.DoType;
|
|
|
|
|
import com.beanit.iec61850bean.internal.scl.EnumType;
|
|
|
|
|
import com.beanit.iec61850bean.internal.scl.EnumVal;
|
|
|
|
|
import com.beanit.iec61850bean.internal.scl.LnSubDef;
|
|
|
|
|
import com.beanit.iec61850bean.internal.scl.LnType;
|
|
|
|
|
import com.beanit.iec61850bean.internal.scl.Sdo;
|
|
|
|
|
import com.beanit.iec61850bean.internal.scl.TypeDefinitions;
|
|
|
|
|
import java.io.FileInputStream;
|
|
|
|
|
import java.io.FileNotFoundException;
|
|
|
|
|
import java.io.InputStream;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.LinkedHashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import javax.xml.parsers.DocumentBuilderFactory;
|
|
|
|
|
import com.beanit.iec61850bean.internal.scl.*;
|
|
|
|
|
import org.w3c.dom.Document;
|
|
|
|
|
import org.w3c.dom.NamedNodeMap;
|
|
|
|
|
import org.w3c.dom.Node;
|
|
|
|
|
import org.w3c.dom.NodeList;
|
|
|
|
|
|
|
|
|
|
import javax.xml.parsers.DocumentBuilderFactory;
|
|
|
|
|
import java.io.FileInputStream;
|
|
|
|
|
import java.io.FileNotFoundException;
|
|
|
|
|
import java.io.InputStream;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
|
import static java.nio.charset.StandardCharsets.UTF_8;
|
|
|
|
|
|
|
|
|
|
public class SclParser {
|
|
|
|
|
|
|
|
|
|
private final Map<String, DataSet> dataSetsMap = new HashMap<>();
|
|
|
|
@ -48,10 +35,26 @@ public class SclParser {
|
|
|
|
|
private TypeDefinitions typeDefinitions;
|
|
|
|
|
private Document doc;
|
|
|
|
|
private String iedName;
|
|
|
|
|
private List<ServerModel> serverModels = new ArrayList<>();
|
|
|
|
|
private final List<ServerModel> serverModels = new ArrayList<>();
|
|
|
|
|
private boolean useResvTmsAttributes = false;
|
|
|
|
|
|
|
|
|
|
private SclParser() {}
|
|
|
|
|
private String iedConnectedAP;
|
|
|
|
|
ConnectionParam connectionParm;
|
|
|
|
|
private final Map<String, ConnectionParam> iedConnectionMap = new HashMap<>();
|
|
|
|
|
private String iedManufacturer;
|
|
|
|
|
Map<String, String> descMap;
|
|
|
|
|
|
|
|
|
|
private List<String> ldsInsts;
|
|
|
|
|
private List<String> ldsRefs;
|
|
|
|
|
private Set<String> lnSet;
|
|
|
|
|
private Map<String, Set<String>> lns;
|
|
|
|
|
private final HashSet<String> lnS = new HashSet<>();
|
|
|
|
|
private final Map<String, String> cdcDOMap = new HashMap<>();
|
|
|
|
|
private Map<String, String> daiDescMap;
|
|
|
|
|
private List<LogicalDevice> logicalDevices;
|
|
|
|
|
|
|
|
|
|
private SclParser() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static List<ServerModel> parse(InputStream is) throws SclParseException {
|
|
|
|
|
SclParser sclParser = new SclParser();
|
|
|
|
@ -88,6 +91,39 @@ public class SclParser {
|
|
|
|
|
|
|
|
|
|
readTypeDefinitions();
|
|
|
|
|
|
|
|
|
|
NodeList connectedAPs = doc.getElementsByTagName("ConnectedAP");
|
|
|
|
|
|
|
|
|
|
for (int zz = 0; zz < connectedAPs.getLength(); zz++) {
|
|
|
|
|
Node connectedAP = connectedAPs.item(zz);
|
|
|
|
|
Node attributeName = connectedAP.getAttributes().getNamedItem("iedName");
|
|
|
|
|
iedConnectedAP = attributeName.getNodeValue();
|
|
|
|
|
connectionParm = new ConnectionParam();
|
|
|
|
|
if ((iedConnectedAP == null) || (iedConnectedAP.length() == 0)) {
|
|
|
|
|
throw new SclParseException("ConnectedAP must has a name");
|
|
|
|
|
}
|
|
|
|
|
NodeList elementsConnectedAP = connectedAP.getChildNodes();
|
|
|
|
|
|
|
|
|
|
for (int yy = 0; yy < elementsConnectedAP.getLength(); yy++) {
|
|
|
|
|
Node elementConnectedAP = elementsConnectedAP.item(yy);
|
|
|
|
|
String nodeAddress = elementConnectedAP.getNodeName();
|
|
|
|
|
if (nodeAddress.equals("Address")) {
|
|
|
|
|
|
|
|
|
|
NodeList address = elementConnectedAP.getChildNodes();
|
|
|
|
|
for (int ii = 0; ii < address.getLength(); ii++) {
|
|
|
|
|
|
|
|
|
|
Node elementAddress = address.item(ii);
|
|
|
|
|
|
|
|
|
|
String nodeCheck = elementAddress.getNodeName();
|
|
|
|
|
if ("P".equals(nodeCheck)) {
|
|
|
|
|
setConnectionParm(elementAddress);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
connectionParm.setIedName(iedConnectedAP);
|
|
|
|
|
iedConnectionMap.put(iedConnectedAP, connectionParm);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
NodeList iedList = doc.getElementsByTagName("IED");
|
|
|
|
|
if (iedList.getLength() == 0) {
|
|
|
|
|
throw new SclParseException("No IED section found!");
|
|
|
|
@ -100,6 +136,9 @@ public class SclParser {
|
|
|
|
|
|
|
|
|
|
Node nameAttribute = iedNode.getAttributes().getNamedItem("name");
|
|
|
|
|
|
|
|
|
|
Node manufacturerAttr = iedNode.getAttributes().getNamedItem("manufacturer");
|
|
|
|
|
iedManufacturer = manufacturerAttr.getNodeValue();
|
|
|
|
|
|
|
|
|
|
iedName = nameAttribute.getNodeValue();
|
|
|
|
|
if ((iedName == null) || (iedName.length() == 0)) {
|
|
|
|
|
throw new SclParseException("IED must have a name!");
|
|
|
|
@ -131,6 +170,48 @@ public class SclParser {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setConnectionParm(Node P) {
|
|
|
|
|
String nodeValue;
|
|
|
|
|
|
|
|
|
|
P.getAttributes().getNamedItem("type");
|
|
|
|
|
String typeValue = P.getAttributes().getNamedItem("type").getNodeValue();
|
|
|
|
|
|
|
|
|
|
nodeValue = P.getTextContent();
|
|
|
|
|
|
|
|
|
|
switch (typeValue) {
|
|
|
|
|
case "IP":
|
|
|
|
|
connectionParm.setIP(nodeValue);
|
|
|
|
|
break;
|
|
|
|
|
case "IP-SUBNET":
|
|
|
|
|
connectionParm.setIP_SUBNET(nodeValue);
|
|
|
|
|
break;
|
|
|
|
|
case "OSI-AP-Title":
|
|
|
|
|
connectionParm.setOSI_AP_Title(nodeValue);
|
|
|
|
|
break;
|
|
|
|
|
case "OSI-AE-Qualifier":
|
|
|
|
|
connectionParm.setOSI_AE_Qualifier(nodeValue);
|
|
|
|
|
break;
|
|
|
|
|
case "OSI-PSEL":
|
|
|
|
|
connectionParm.setOSI_PSEL(nodeValue);
|
|
|
|
|
break;
|
|
|
|
|
case "OSI-SSEL":
|
|
|
|
|
connectionParm.setOSI_SSEL(nodeValue);
|
|
|
|
|
break;
|
|
|
|
|
case "OSI-TSEL":
|
|
|
|
|
connectionParm.setOSI_TSEL(nodeValue);
|
|
|
|
|
break;
|
|
|
|
|
case "IP-GATEWAY":
|
|
|
|
|
connectionParm.setIP_GATEWAY(nodeValue);
|
|
|
|
|
break;
|
|
|
|
|
case "S-Profile":
|
|
|
|
|
connectionParm.setS_Profile(nodeValue);
|
|
|
|
|
break;
|
|
|
|
|
case "MAC-Address":
|
|
|
|
|
connectionParm.setMAC_Address(nodeValue);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void readTypeDefinitions() throws SclParseException {
|
|
|
|
|
|
|
|
|
|
NodeList dttSections = doc.getElementsByTagName("DataTypeTemplates");
|
|
|
|
@ -148,14 +229,19 @@ public class SclParser {
|
|
|
|
|
|
|
|
|
|
String nodeName = element.getNodeName();
|
|
|
|
|
|
|
|
|
|
if (nodeName.equals("LNodeType")) {
|
|
|
|
|
switch (nodeName) {
|
|
|
|
|
case "LNodeType":
|
|
|
|
|
typeDefinitions.putLNodeType(new LnType(element));
|
|
|
|
|
} else if (nodeName.equals("DOType")) {
|
|
|
|
|
break;
|
|
|
|
|
case "DOType":
|
|
|
|
|
typeDefinitions.putDOType(new DoType(element));
|
|
|
|
|
} else if (nodeName.equals("DAType")) {
|
|
|
|
|
break;
|
|
|
|
|
case "DAType":
|
|
|
|
|
typeDefinitions.putDAType(new DaType(element));
|
|
|
|
|
} else if (nodeName.equals("EnumType")) {
|
|
|
|
|
break;
|
|
|
|
|
case "EnumType":
|
|
|
|
|
typeDefinitions.putEnumType(new EnumType(element));
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -170,6 +256,12 @@ public class SclParser {
|
|
|
|
|
|
|
|
|
|
if (element.getNodeName().equals("Server")) {
|
|
|
|
|
|
|
|
|
|
ldsInsts = new ArrayList<>();
|
|
|
|
|
ldsRefs = new ArrayList<>();
|
|
|
|
|
descMap = new HashMap<>();
|
|
|
|
|
daiDescMap = new HashMap<>();
|
|
|
|
|
logicalDevices = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
ServerModel server = createServerModel(element);
|
|
|
|
|
|
|
|
|
|
Node namedItem = iedServer.getAttributes().getNamedItem("name");
|
|
|
|
@ -195,7 +287,9 @@ public class SclParser {
|
|
|
|
|
Node element = elements.item(i);
|
|
|
|
|
|
|
|
|
|
if (element.getNodeName().equals("LDevice")) {
|
|
|
|
|
lns = new HashMap<>();
|
|
|
|
|
logicalDevices.add(createNewLDevice(element));
|
|
|
|
|
this.logicalDevices.add(createNewLDevice(element));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -212,6 +306,19 @@ public class SclParser {
|
|
|
|
|
|
|
|
|
|
dataSetDefs.clear();
|
|
|
|
|
|
|
|
|
|
serverModel.setConnectionParam(iedConnectionMap.get(iedName));
|
|
|
|
|
serverModel.setIedName(iedName);
|
|
|
|
|
serverModel.setIedManufacturer(iedManufacturer);
|
|
|
|
|
serverModel.setLns(lns);
|
|
|
|
|
serverModel.setLnS(lnS);
|
|
|
|
|
serverModel.setDos(cdcDOMap);
|
|
|
|
|
|
|
|
|
|
serverModel.setLdsInsts(ldsInsts);
|
|
|
|
|
serverModel.setLdsRefs(ldsRefs);
|
|
|
|
|
serverModel.setDescriptions(descMap);
|
|
|
|
|
serverModel.setdAIDescriptions(daiDescMap);
|
|
|
|
|
serverModel.setLogicalDevices(logicalDevices);
|
|
|
|
|
|
|
|
|
|
return serverModel;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -237,15 +344,20 @@ public class SclParser {
|
|
|
|
|
throw new SclParseException("Required attribute \"inst\" in logical device not found!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ldsInsts.add(inst);
|
|
|
|
|
|
|
|
|
|
NodeList elements = ldXmlNode.getChildNodes();
|
|
|
|
|
List<LogicalNode> logicalNodes = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
String ref;
|
|
|
|
|
if ((ldName != null) && (ldName.length() != 0)) {
|
|
|
|
|
ref = ldName;
|
|
|
|
|
ldsRefs.add(ref);
|
|
|
|
|
} else {
|
|
|
|
|
ref = iedName + inst;
|
|
|
|
|
ldsRefs.add(ref);
|
|
|
|
|
}
|
|
|
|
|
lnSet = new HashSet<>();
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < elements.getLength(); i++) {
|
|
|
|
|
Node element = elements.item(i);
|
|
|
|
@ -254,8 +366,10 @@ public class SclParser {
|
|
|
|
|
logicalNodes.add(createNewLogicalNode(element, ref));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
lns.put(ref, lnSet);
|
|
|
|
|
|
|
|
|
|
LogicalDevice lDevice = new LogicalDevice(new ObjectReference(ref), logicalNodes);
|
|
|
|
|
lDevice.setLdInst(inst);
|
|
|
|
|
|
|
|
|
|
return lDevice;
|
|
|
|
|
}
|
|
|
|
@ -276,17 +390,24 @@ public class SclParser {
|
|
|
|
|
Node node = attributes.item(i);
|
|
|
|
|
String nodeName = node.getNodeName();
|
|
|
|
|
|
|
|
|
|
if (nodeName.equals("inst")) {
|
|
|
|
|
switch (nodeName) {
|
|
|
|
|
case "inst":
|
|
|
|
|
inst = node.getNodeValue();
|
|
|
|
|
} else if (nodeName.equals("lnType")) {
|
|
|
|
|
break;
|
|
|
|
|
case "lnType":
|
|
|
|
|
lnType = node.getNodeValue();
|
|
|
|
|
} else if (nodeName.equals("lnClass")) {
|
|
|
|
|
break;
|
|
|
|
|
case "lnClass":
|
|
|
|
|
lnClass = node.getNodeValue();
|
|
|
|
|
} else if (nodeName.equals("prefix")) {
|
|
|
|
|
break;
|
|
|
|
|
case "prefix":
|
|
|
|
|
prefix = node.getNodeValue();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
lnSet.add(prefix + lnClass + inst);
|
|
|
|
|
|
|
|
|
|
if (inst == null) {
|
|
|
|
|
throw new SclParseException("Required attribute \"inst\" not found!");
|
|
|
|
|
}
|
|
|
|
@ -298,6 +419,7 @@ public class SclParser {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String ref = parentRef + '/' + prefix + lnClass + inst;
|
|
|
|
|
lnS.add(ref);
|
|
|
|
|
|
|
|
|
|
LnType lnTypeDef = typeDefinitions.getLNodeType(lnType);
|
|
|
|
|
|
|
|
|
@ -316,6 +438,12 @@ public class SclParser {
|
|
|
|
|
|
|
|
|
|
NamedNodeMap doiAttributes = childNode.getAttributes();
|
|
|
|
|
Node nameAttribute = doiAttributes.getNamedItem("name");
|
|
|
|
|
Node cdcAttribute = doiAttributes.getNamedItem("desc");
|
|
|
|
|
|
|
|
|
|
if (cdcAttribute != null) {
|
|
|
|
|
descMap.put(ref + "." + nameAttribute.getNodeValue(), cdcAttribute.getNodeValue());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (nameAttribute != null && nameAttribute.getNodeValue().equals(dobject.getName())) {
|
|
|
|
|
doiNodeFound = childNode;
|
|
|
|
|
}
|
|
|
|
@ -323,7 +451,7 @@ public class SclParser {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dataObjects.addAll(
|
|
|
|
|
createFcDataObjects(dobject.getName(), ref, dobject.getType(), doiNodeFound));
|
|
|
|
|
createFcDataObjects(dobject.getName(), ref, dobject.getType(), doiNodeFound, dobject.getType()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// look for ReportControl
|
|
|
|
@ -343,6 +471,12 @@ public class SclParser {
|
|
|
|
|
dataSetDefs.add(new LnSubDef(childNode, lNode));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
lNode.setPrefix(prefix);
|
|
|
|
|
lNode.setLnClass(lnClass);
|
|
|
|
|
lNode.setLnInst(inst);
|
|
|
|
|
lNode.setLnType(lnType);
|
|
|
|
|
|
|
|
|
|
return lNode;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -378,25 +512,33 @@ public class SclParser {
|
|
|
|
|
Node node = attributes.item(j);
|
|
|
|
|
String nodeName = node.getNodeName();
|
|
|
|
|
|
|
|
|
|
if (nodeName.equals("ldInst")) {
|
|
|
|
|
switch (nodeName) {
|
|
|
|
|
case "ldInst":
|
|
|
|
|
ldInst = node.getNodeValue();
|
|
|
|
|
} else if (nodeName.equals("lnInst")) {
|
|
|
|
|
break;
|
|
|
|
|
case "lnInst":
|
|
|
|
|
lnInst = node.getNodeValue();
|
|
|
|
|
} else if (nodeName.equals("lnClass")) {
|
|
|
|
|
break;
|
|
|
|
|
case "lnClass":
|
|
|
|
|
lnClass = node.getNodeValue();
|
|
|
|
|
} else if (nodeName.equals("prefix")) {
|
|
|
|
|
break;
|
|
|
|
|
case "prefix":
|
|
|
|
|
prefix = node.getNodeValue();
|
|
|
|
|
} else if (nodeName.equals("doName")) {
|
|
|
|
|
break;
|
|
|
|
|
case "doName":
|
|
|
|
|
doName = node.getNodeValue();
|
|
|
|
|
} else if (nodeName.equals("daName")) {
|
|
|
|
|
break;
|
|
|
|
|
case "daName":
|
|
|
|
|
if (!node.getNodeValue().isEmpty()) {
|
|
|
|
|
daName = "." + node.getNodeValue();
|
|
|
|
|
}
|
|
|
|
|
} else if (nodeName.equals("fc")) {
|
|
|
|
|
break;
|
|
|
|
|
case "fc":
|
|
|
|
|
fc = Fc.fromString(node.getNodeValue());
|
|
|
|
|
if (fc == null) {
|
|
|
|
|
throw new SclParseException("FCDA contains invalid FC: " + node.getNodeValue());
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -446,8 +588,7 @@ public class SclParser {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DataSet dataSet = new DataSet(lNode.getReference().toString() + '.' + name, dsMembers, false);
|
|
|
|
|
return dataSet;
|
|
|
|
|
return new DataSet(lNode.getReference().toString() + '.' + name, dsMembers, false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private List<Rcb> createReportControlBlocks(Node xmlNode, String parentRef)
|
|
|
|
@ -588,7 +729,7 @@ public class SclParser {
|
|
|
|
|
|
|
|
|
|
BdaVisibleString rptId =
|
|
|
|
|
new BdaVisibleString(
|
|
|
|
|
new ObjectReference(reportObjRef.toString() + ".RptID"), fc, "", 129, false, false);
|
|
|
|
|
new ObjectReference(reportObjRef + ".RptID"), fc, "", 129, false, false);
|
|
|
|
|
attribute = rcbNodeAttributes.getNamedItem("rptID");
|
|
|
|
|
if (attribute != null) {
|
|
|
|
|
rptId.setValue(attribute.getNodeValue().getBytes(UTF_8));
|
|
|
|
@ -600,17 +741,17 @@ public class SclParser {
|
|
|
|
|
|
|
|
|
|
children.add(
|
|
|
|
|
new BdaBoolean(
|
|
|
|
|
new ObjectReference(reportObjRef.toString() + ".RptEna"), fc, "", false, false));
|
|
|
|
|
new ObjectReference(reportObjRef + ".RptEna"), fc, "", false, false));
|
|
|
|
|
|
|
|
|
|
if (fc == Fc.RP) {
|
|
|
|
|
children.add(
|
|
|
|
|
new BdaBoolean(
|
|
|
|
|
new ObjectReference(reportObjRef.toString() + ".Resv"), fc, "", false, false));
|
|
|
|
|
new ObjectReference(reportObjRef + ".Resv"), fc, "", false, false));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BdaVisibleString datSet =
|
|
|
|
|
new BdaVisibleString(
|
|
|
|
|
new ObjectReference(reportObjRef.toString() + ".DatSet"), fc, "", 129, false, false);
|
|
|
|
|
new ObjectReference(reportObjRef + ".DatSet"), fc, "", 129, false, false);
|
|
|
|
|
|
|
|
|
|
attribute = xmlNode.getAttributes().getNamedItem("datSet");
|
|
|
|
|
if (attribute != null) {
|
|
|
|
@ -622,7 +763,7 @@ public class SclParser {
|
|
|
|
|
|
|
|
|
|
BdaInt32U confRef =
|
|
|
|
|
new BdaInt32U(
|
|
|
|
|
new ObjectReference(reportObjRef.toString() + ".ConfRev"), fc, "", false, false);
|
|
|
|
|
new ObjectReference(reportObjRef + ".ConfRev"), fc, "", false, false);
|
|
|
|
|
attribute = xmlNode.getAttributes().getNamedItem("confRev");
|
|
|
|
|
if (attribute == null) {
|
|
|
|
|
throw new SclParseException(
|
|
|
|
@ -635,7 +776,7 @@ public class SclParser {
|
|
|
|
|
|
|
|
|
|
BdaInt32U bufTm =
|
|
|
|
|
new BdaInt32U(
|
|
|
|
|
new ObjectReference(reportObjRef.toString() + ".BufTm"), fc, "", false, false);
|
|
|
|
|
new ObjectReference(reportObjRef + ".BufTm"), fc, "", false, false);
|
|
|
|
|
attribute = xmlNode.getAttributes().getNamedItem("bufTime");
|
|
|
|
|
if (attribute != null) {
|
|
|
|
|
bufTm.setValue(Long.parseLong(attribute.getNodeValue()));
|
|
|
|
@ -644,13 +785,13 @@ public class SclParser {
|
|
|
|
|
|
|
|
|
|
children.add(
|
|
|
|
|
new BdaInt8U(
|
|
|
|
|
new ObjectReference(reportObjRef.toString() + ".SqNum"), fc, "", false, false));
|
|
|
|
|
new ObjectReference(reportObjRef + ".SqNum"), fc, "", false, false));
|
|
|
|
|
|
|
|
|
|
children.add(trigOps);
|
|
|
|
|
|
|
|
|
|
BdaInt32U intgPd =
|
|
|
|
|
new BdaInt32U(
|
|
|
|
|
new ObjectReference(reportObjRef.toString() + ".IntgPd"), fc, "", false, false);
|
|
|
|
|
new ObjectReference(reportObjRef + ".IntgPd"), fc, "", false, false);
|
|
|
|
|
attribute = xmlNode.getAttributes().getNamedItem("intgPd");
|
|
|
|
|
if (attribute != null) {
|
|
|
|
|
intgPd.setValue(Long.parseLong(attribute.getNodeValue()));
|
|
|
|
@ -659,19 +800,19 @@ public class SclParser {
|
|
|
|
|
|
|
|
|
|
children.add(
|
|
|
|
|
new BdaBoolean(
|
|
|
|
|
new ObjectReference(reportObjRef.toString() + ".GI"), fc, "", false, false));
|
|
|
|
|
new ObjectReference(reportObjRef + ".GI"), fc, "", false, false));
|
|
|
|
|
|
|
|
|
|
Rcb rcb = null;
|
|
|
|
|
Rcb rcb;
|
|
|
|
|
|
|
|
|
|
if (fc == Fc.BR) {
|
|
|
|
|
|
|
|
|
|
children.add(
|
|
|
|
|
new BdaBoolean(
|
|
|
|
|
new ObjectReference(reportObjRef.toString() + ".PurgeBuf"), fc, "", false, false));
|
|
|
|
|
new ObjectReference(reportObjRef + ".PurgeBuf"), fc, "", false, false));
|
|
|
|
|
|
|
|
|
|
children.add(
|
|
|
|
|
new BdaOctetString(
|
|
|
|
|
new ObjectReference(reportObjRef.toString() + ".EntryID"),
|
|
|
|
|
new ObjectReference(reportObjRef + ".EntryID"),
|
|
|
|
|
fc,
|
|
|
|
|
"",
|
|
|
|
|
8,
|
|
|
|
@ -680,7 +821,7 @@ public class SclParser {
|
|
|
|
|
|
|
|
|
|
children.add(
|
|
|
|
|
new BdaEntryTime(
|
|
|
|
|
new ObjectReference(reportObjRef.toString() + ".TimeOfEntry"),
|
|
|
|
|
new ObjectReference(reportObjRef + ".TimeOfEntry"),
|
|
|
|
|
fc,
|
|
|
|
|
"",
|
|
|
|
|
false,
|
|
|
|
@ -689,19 +830,19 @@ public class SclParser {
|
|
|
|
|
if (useResvTmsAttributes) {
|
|
|
|
|
children.add(
|
|
|
|
|
new BdaInt16(
|
|
|
|
|
new ObjectReference(reportObjRef.toString() + ".ResvTms"), fc, "", false, false));
|
|
|
|
|
new ObjectReference(reportObjRef + ".ResvTms"), fc, "", false, false));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
children.add(
|
|
|
|
|
new BdaOctetString(
|
|
|
|
|
new ObjectReference(reportObjRef.toString() + ".Owner"), fc, "", 64, false, false));
|
|
|
|
|
new ObjectReference(reportObjRef + ".Owner"), fc, "", 64, false, false));
|
|
|
|
|
|
|
|
|
|
rcb = new Brcb(reportObjRef, children);
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
children.add(
|
|
|
|
|
new BdaOctetString(
|
|
|
|
|
new ObjectReference(reportObjRef.toString() + ".Owner"), fc, "", 64, false, false));
|
|
|
|
|
new ObjectReference(reportObjRef + ".Owner"), fc, "", 64, false, false));
|
|
|
|
|
|
|
|
|
|
rcb = new Urcb(reportObjRef, children);
|
|
|
|
|
}
|
|
|
|
@ -713,7 +854,7 @@ public class SclParser {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private List<FcDataObject> createFcDataObjects(
|
|
|
|
|
String name, String parentRef, String doTypeID, Node doiNode) throws SclParseException {
|
|
|
|
|
String name, String parentRef, String doTypeID, Node doiNode, String type) throws SclParseException {
|
|
|
|
|
|
|
|
|
|
DoType doType = typeDefinitions.getDOType(doTypeID);
|
|
|
|
|
|
|
|
|
@ -723,6 +864,10 @@ public class SclParser {
|
|
|
|
|
|
|
|
|
|
String ref = parentRef + '.' + name;
|
|
|
|
|
|
|
|
|
|
String cdc = doType.getCdc();
|
|
|
|
|
|
|
|
|
|
cdcDOMap.put(ref, cdc);
|
|
|
|
|
|
|
|
|
|
List<ModelNode> childNodes = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
for (Da dattr : doType.das) {
|
|
|
|
@ -730,10 +875,22 @@ public class SclParser {
|
|
|
|
|
// look for DAI node with the name of the DA
|
|
|
|
|
Node iNodeFound = findINode(doiNode, dattr.getName());
|
|
|
|
|
|
|
|
|
|
if (iNodeFound != null) {
|
|
|
|
|
NamedNodeMap daiAttributes = iNodeFound.getAttributes();
|
|
|
|
|
if (daiAttributes != null) {
|
|
|
|
|
Node nameAttribute = daiAttributes.getNamedItem("name");
|
|
|
|
|
Node cdcAttribute = daiAttributes.getNamedItem("desc");
|
|
|
|
|
|
|
|
|
|
if (cdcAttribute != null) {
|
|
|
|
|
daiDescMap.put(ref + "." + nameAttribute.getNodeValue(), cdcAttribute.getNodeValue());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (dattr.getCount() >= 1) {
|
|
|
|
|
childNodes.add(createArrayOfDataAttributes(ref + '.' + dattr.getName(), dattr, iNodeFound));
|
|
|
|
|
} else {
|
|
|
|
|
childNodes.add(
|
|
|
|
|
FcModelNode fcModelNode =
|
|
|
|
|
createDataAttribute(
|
|
|
|
|
ref + '.' + dattr.getName(),
|
|
|
|
|
dattr.getFc(),
|
|
|
|
@ -741,7 +898,12 @@ public class SclParser {
|
|
|
|
|
iNodeFound,
|
|
|
|
|
false,
|
|
|
|
|
false,
|
|
|
|
|
false));
|
|
|
|
|
false
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
fcModelNode.setbType(dattr.getbType());
|
|
|
|
|
fcModelNode.setDaType(dattr.getType());
|
|
|
|
|
childNodes.add(fcModelNode);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -755,7 +917,7 @@ public class SclParser {
|
|
|
|
|
|
|
|
|
|
Node iNodeFound = findINode(doiNode, sdo.getName());
|
|
|
|
|
|
|
|
|
|
childNodes.addAll(createFcDataObjects(sdo.getName(), ref, sdo.getType(), iNodeFound));
|
|
|
|
|
childNodes.addAll(createFcDataObjects(sdo.getName(), ref, sdo.getType(), iNodeFound, type));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Map<Fc, List<FcModelNode>> subFCDataMap = new LinkedHashMap<>();
|
|
|
|
@ -773,7 +935,10 @@ public class SclParser {
|
|
|
|
|
|
|
|
|
|
for (Fc fc : Fc.values()) {
|
|
|
|
|
if (subFCDataMap.get(fc).size() > 0) {
|
|
|
|
|
fcDataObjects.add(new FcDataObject(objectReference, fc, subFCDataMap.get(fc)));
|
|
|
|
|
FcDataObject fcDataObject = new FcDataObject(objectReference, fc, subFCDataMap.get(fc));
|
|
|
|
|
fcDataObject.setDoType(type);
|
|
|
|
|
fcDataObject.setCdc(cdc);
|
|
|
|
|
fcDataObjects.add(fcDataObject);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -821,7 +986,9 @@ public class SclParser {
|
|
|
|
|
return new Array(new ObjectReference(ref), fc, arrayItems);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** returns a ConstructedDataAttribute or BasicDataAttribute */
|
|
|
|
|
/**
|
|
|
|
|
* returns a ConstructedDataAttribute or BasicDataAttribute
|
|
|
|
|
*/
|
|
|
|
|
private FcModelNode createDataAttribute(
|
|
|
|
|
String ref,
|
|
|
|
|
Fc fc,
|
|
|
|
@ -853,8 +1020,11 @@ public class SclParser {
|
|
|
|
|
|
|
|
|
|
Node iNodeFound = findINode(iXmlNode, bda.getName());
|
|
|
|
|
|
|
|
|
|
subDataAttributes.add(
|
|
|
|
|
createDataAttribute(ref + '.' + bda.getName(), fc, bda, iNodeFound, dchg, dupd, qchg));
|
|
|
|
|
FcModelNode fcModelNode = createDataAttribute(ref + '.' + bda.getName(), fc, bda, iNodeFound, dchg, dupd, qchg);
|
|
|
|
|
fcModelNode.setDaType(bda.getType());
|
|
|
|
|
fcModelNode.setbType(bda.getbType());
|
|
|
|
|
|
|
|
|
|
subDataAttributes.add(fcModelNode);
|
|
|
|
|
}
|
|
|
|
|
return new ConstructedDataAttribute(new ObjectReference(ref), fc, subDataAttributes);
|
|
|
|
|
}
|
|
|
|
@ -1057,7 +1227,7 @@ public class SclParser {
|
|
|
|
|
BdaTimestamp bda = new BdaTimestamp(new ObjectReference(ref), fc, sAddr, dchg, dupd);
|
|
|
|
|
if (val != null) {
|
|
|
|
|
// TODO
|
|
|
|
|
throw new SclParseException("parsing configured value for TIMESTAMP is not supported yet.");
|
|
|
|
|
bda.setDate(new Date(System.currentTimeMillis()));
|
|
|
|
|
}
|
|
|
|
|
return bda;
|
|
|
|
|
} else if (bType.equals("Enum")) {
|
|
|
|
|