Comments (8)
Hello Kevin, I have successfully import the NodeSet, and I have define some utils method, I wish it might be helpful for you.
@Slf4j
public class NodeUtils {
public static void parseNodeSet(UaNodeSet nodeSet, UaNodeContext context, UaNodeManager nodeManager){
Map<NodeId, NodeAttributes> nodes = nodeSet.getNodes();
ListMultimap<NodeId, Reference> allReferences = nodeSet.getAllReferences();
Map<NodeClass, List<NodeAttributes>> collect = nodes.values().stream()
.collect(groupingBy(NodeAttributes::getNodeClass));
for (NodeClass nodeClass : collect.keySet()) {
if (nodeClass.equals(NodeClass.ObjectType)) {
collect.get(NodeClass.ObjectType).stream()
.map(node -> ((ObjectTypeNodeAttributes) node))
.map(node -> node.getUaObjectTypeNode(context))
.forEach(nodeManager::addNode);
log.info("ObjectType success");
} else if (nodeClass.equals(NodeClass.VariableType)) {
collect.get(NodeClass.VariableType).stream()
.map(node -> ((VariableTypeNodeAttributes) node))
.map(node -> node.getUaVariableTypeNode(context))
.forEach(nodeManager::addNode);
log.info("VariableType success");
} else if (nodeClass.equals(NodeClass.Object)) {
collect.get(NodeClass.Object).stream()
.map(node -> ((ObjectNodeAttributes) node))
.map(node -> node.getObjectNode(context))
.forEach(nodeManager::addNode);
log.info("Object success");
} else if (nodeClass.equals(NodeClass.Variable)) {
collect.get(NodeClass.Variable).stream()
.map(node -> ((VariableNodeAttributes) node))
.map(node -> node.getUaVariableNode(context))
.forEach(nodeManager::addNode);
log.info("Variable success");
} else if (nodeClass.equals(NodeClass.Method)) {
collect.get(NodeClass.Method).stream()
.map(node -> ((MethodNodeAttributes) node))
.map(node -> node.getUaMethodNode(context))
.forEach(nodeManager::addNode);
log.info("Method success");
} else if (nodeClass.equals(NodeClass.DataType)) {
collect.get(NodeClass.DataType).stream()
.map(node -> ((DataTypeNodeAttributes) node))
.map(node -> node.getDataTypeNode(context))
.forEach(nodeManager::addNode);
log.info("DataType success");
} else if (nodeClass.equals(NodeClass.View)) {
collect.get(NodeClass.View).stream()
.map(node -> ((ViewNodeAttributes) node))
.map(node -> node.getUaViewNode(context))
.forEach(nodeManager::addNode);
log.info("View success");
} else if (nodeClass.equals(NodeClass.ReferenceType)) {
collect.get(NodeClass.ReferenceType).stream()
.map(node -> ((ReferenceTypeNodeAttributes) node))
.map(node -> node.getReferenceTypeNode(context))
.forEach(nodeManager::addNode);
log.info("ReferenceType success");
}
}
allReferences.values()
.forEach(nodeManager::addReference);
}
}
and for each type of node, I have added some functions like this:
public class ObjectNodeAttributes extends NodeAttributes {
/* Ignored parts */
public UaObjectNode getObjectNode(UaNodeContext context){
return new UaObjectNode(
context,
getNodeId(),
getBrowseName(),
getDisplayName(),
getDescription(),
getWriteMask(),
getUserWriteMask(),
getEventNotifier()
);
}
}
from opc-ua-nodeset-parser.
This library is used by the code generator but the generator itself not currently open source yet.
I may be able to generate these Nodes for you, though, and if you’re willing to use the dev/0.4
branch of Milo they might be usable.
from opc-ua-nodeset-parser.
Those classes are generated at build time. If you run mvn clean build
from the root of your check out they will get generated.
from opc-ua-nodeset-parser.
This library is used by the code generator but the generator itself not currently open source yet.
I may be able to generate these Nodes for you, though, and if you’re willing to use the
dev/0.4
branch of Milo they might be usable.
3Q for your reply. And I found the import in milo is
import org.opcfoundation.**opcua**.binaryschema.TypeDictionary;
However the sdk of opcfoundation is named
'
import org.opcfoundation.ua
'
And has no class named TypeDeictionary and so does the others,
from opc-ua-nodeset-parser.
i will take some time to make it out, 3Q for your help~
from opc-ua-nodeset-parser.
And I found the ua-server-sdk 0.4.0-SNAPSHOT hasn't been published yet. I'm pretty looking forward to its coming out~^_^
from opc-ua-nodeset-parser.
@0DennisLee0 I posted some example code of how I'm using this library to build an AddressSpace from a UANodeSet in another issue: #7 (comment)
from opc-ua-nodeset-parser.
Thank you for your kindly reply~
from opc-ua-nodeset-parser.
Related Issues (9)
- Compatibility with eclipse milo HOT 4
- Upgrade to 1.04 HOT 1
- Implementation Guidance of using this project with ExampleServer
- org.eclipse.milo:sdk-server:jar:0.4.0-SNAPSHOT is missing HOT 2
- gNode.getReferences() NPE HOT 1
- org.xml.sax.SAXParseException Premature end of file HOT 2
- About the relationship between custom attributes and UANodeSet Schema objects HOT 2
- Considering NodeSet2.xml when parsing NodeSet.xml HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from opc-ua-nodeset-parser.