Avatar
Please consider registering
guest
sp_LogInOut Log Insp_Registration Register
Register | Lost password?
Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
sp_Feed Topic RSSsp_TopicIcon
NodeBuilder: NodeId creation strategy
August 29, 2023
15:47, EEST
Avatar
Francesco Zambon
Member
Members
Forum Posts: 83
Member Since:
December 20, 2021
sp_UserOfflineSmall Offline

Good morning,

I have a question regarding the creation of object nodes via the method:
com.prosysopc.ua.server.instantiation.NodeBuilder.build()

I noticed that the NodeId of the child nodes of the object are of type String.

Would it be possible to change the NodeId to Numeric?

Thank you.

Best regards,
Francesco

August 30, 2023
9:48, EEST
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 1045
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

Hi,

Yes, but care should be taken not to make NodeIds of existing nodes. The String-NodeIds are a bit safer in this regard as it can represent hierarchical paths thus there is less chance of conflicts (UUIDs would be best, but they are not very human-readable). SDK doesn’t handle conflicts well i.e. createInstance/NodeBuilder is not transactional. If it fails halfway in the process then half the nodes are already added and rolling this back manually can be .. a bit of a pain.

Anyway, probably easiest is to override com.prosysopc.ua.server.NodeManagerUaNode.createNodeId(UaNode parent, QualifiedName of_the_child_node) by subtyping NodeManagerUaNode. There are also other createNodeId versions, but this is the one NodeBuilder calls, but if you wish to only have numeric ids you could override all of them. Note that SDK also uses these internally when making e.g. subnodes below structure datatype’d nodes.

If you need more control e.g. that the numeric should be based on specific InstanceDeclaration of a type etc. it is more complicated, but technically doable by making an UaNodeBuilderConfiguration (given in NodeBuilder constructor) that returns InstantiationStrategy that ignore the NodeId part of InstantiationStrategy.createInstance(InstantiationParameters) (or basically meaning you make new InstantiationParameters with the nodeid you want to have).

Forum Timezone: Europe/Helsinki
Most Users Ever Online: 1919
Currently Online: msaala
Guest(s) 35
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Heikki Tahvanainen: 402
hbrackel: 144
rocket science: 90
pramanj: 86
Francesco Zambon: 83
Ibrahim: 78
Sabari: 62
kapsl: 57
gjevremovic: 49
Xavier: 43
Member Stats:
Guest Posters: 0
Members: 732
Moderators: 8
Admins: 1
Forum Stats:
Groups: 3
Forums: 15
Topics: 1545
Posts: 6515
Newest Members:
mood edibles, LouieWreve, daniellabdx, janessan21, sammiebeak359, gena7127517, thorstenbouldin, Brett.Rollason, steven014223542, Roberthat
Moderators: Jouni Aro: 1029, Pyry: 1, Petri: 1, Bjarne Boström: 1045, Jimmy Ni: 26, Matti Siponen: 353, Lusetti: 0, Elias: 0
Administrators: admin: 1