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
Deleting all nodes by namespaceindex
March 4, 2015
14:44, EET
Avatar
jve
Member
Members
Forum Posts: 5
Member Since:
February 4, 2015
sp_UserOfflineSmall Offline

I am working on an aggregating server, where I have multiple nodemanagers (NodeManagerUaNode) on the same server, each handling its own namespace. I have a situation where at certain times I need to delete all nodes with a certain namespaceindex from the server (i.e all nodes handled by a certain nodemanager). What would be the most direct way to do this?

I tried clearing the NodeMap for the specified nodemanager by calling this.getNodes().clear() (I admit I do not know the actual function of this map). This seemed to delete all the nodes I wanted to delete, or at least they disappeared from UaExpert. But after I have called this, I cannot seem use the nodemanager to add nodes anymore. I get no errors when adding nodes with the same manager, but none of them show up on any client.

March 4, 2015
15:44, EET
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 1026
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

Do you also remove and add the reference between the “root” of your nodes and the NodeManagerRoot?

March 5, 2015
8:33, EET
Avatar
jve
Member
Members
Forum Posts: 5
Member Since:
February 4, 2015
sp_UserOfflineSmall Offline

Can you clarify your question a bit? What do you mean by “the root of my nodes”? The nodes I wish to delete can be found at separate places in the address space, and as far as I know, I haven’t done anything with NodeManagerRoot (the initial address space is created automatically since I’m using the SampleConsoleServer from the SDK as a basis for my server). Do you mean that there is some reference between NodeManagerRoot and each created NodeManagerUaNode that gets deleted when I call getNodes().clear()? If so, how can I reinstate it?

March 5, 2015
14:34, EET
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 1026
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

I mean in general: if you remove nodes from the address space, I suppose, you are also removing all references to them. And also if you add references, you will then add new references, so that you can access them.

If you just clear the NodeMap, you will get rid of the node objects, but the references will stay – so when you add new nodes, the references will not change to point to the new nodes and you cannot then find them by browsing.

I must admit that I do not know for certain what happens if you do like you have done.

March 9, 2015
11:43, EET
Avatar
jve
Member
Members
Forum Posts: 5
Member Since:
February 4, 2015
sp_UserOfflineSmall Offline

Ok, that makes sense, thank you for you reply. So I guess there is no easy way to delete nodes by a certain namespaceindex and then be able to add them again? I ended up just straightforwardly browsing through the address space while checking the namespaceindex of every node and deleting the correct ones including their references. Seems to be fast enough, since this operation doesn’t need to be run that often.

March 11, 2015
11:45, EET
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 1026
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

Yes, that is a bit difficult. But if you can access the nodeMap, you can of course loop the nodes in the map and delete them separately, including the references – to and from the nodes.

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 1919

Currently Online:
17 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Heikki Tahvanainen: 402

hbrackel: 144

rocket science: 88

pramanj: 86

Francesco Zambon: 83

Ibrahim: 78

Sabari: 62

kapsl: 57

gjevremovic: 49

Xavier: 43

Member Stats:

Guest Posters: 0

Members: 731

Moderators: 7

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1529

Posts: 6471

Newest Members:

inilarythikibia, rickykennion, PromotionToold, HypromeImpupe, toneylapham544, rondawolinski7, Marypof5711, roycedelargie91, kourtneyquisenbe, ellis87832073466

Moderators: Jouni Aro: 1026, Pyry: 1, Petri: 0, Bjarne Boström: 1032, Jimmy Ni: 26, Matti Siponen: 349, Lusetti: 0

Administrators: admin: 1