Avatar

Please consider registering
guest

sp_LogInOut Log In sp_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 RSS sp_TopicIcon
NodeBuilder: NodeId creation strategy
August 29, 2023
15:47, EEST
Avatar
Francesco Zambon
Member
Members
Forum Posts: 81
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: 983
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: 518

Currently Online:
16 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

hbrackel: 135

pramanj: 86

Francesco Zambon: 81

rocket science: 77

Ibrahim: 76

Sabari: 62

kapsl: 57

gjevremovic: 49

Xavier: 43

fred: 41

Member Stats:

Guest Posters: 0

Members: 684

Moderators: 16

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1467

Posts: 6261

Newest Members:

digitechroshni, LouieWreve, Kickbiche, karrimacvitie5, graciela2073, sagarchau, elviralangwell4, Donnavek, Eddiefauth, DonaldPooma

Moderators: Jouni Aro: 1010, Otso Palonen: 32, Tuomas Hiltunen: 5, Pyry: 1, Petri: 0, Bjarne Boström: 983, Heikki Tahvanainen: 402, Jukka Asikainen: 1, moldzh08: 0, Jimmy Ni: 26, Teppo Uimonen: 21, Markus Johansson: 42, Niklas Nurminen: 0, Matti Siponen: 321, Lusetti: 0, Ari-Pekka Soikkeli: 5

Administrators: admin: 1