HEADS-project / heads_ide

http://heads-project.eu
9 stars 2 forks source link

OnConnect kev script being pushed to all connecting nodes #90

Closed kehusa closed 8 years ago

kehusa commented 8 years ago

When connecting nodes to a master node with onConnect kevscript defined, all nodes gets the kevscript pushed out. In the situation with Safe@Home this strategy fails when other nodes than FieldNodes connect. We need some mechanism to differentiate between different types of connecting nodes.

E.g. based on connecting nodeName, something like where only nodename like FN1, FN2 etc will get the script pushed :

set sync.onConnect (nodeName.matches(FN*)) = '
add {nodeName}.FieldNode_0 : no.tellu.FieldNode/1.0.28
set {nodeName}.FieldNode_0.Properties_nodeName__var = ....

Or perhaps based on different onConnect configurations where the connecting node can ask for a specific one, something like :

set sync.onConnect (FieldNode) = '
add {nodeName}.FieldNode_0 : no.tellu.FieldNode/1.0.28
set {nodeName}.FieldNode_0.Properties_nodeName__var = ....

and in the connecting node kevscript:

// create a fieldnode JavaScript (node1)

add node0 : JavascriptNode
add %node% : JavascriptNode
//create a default group to manage the node(s)
add sync : WSGroup/5.3.1
set sync.onConnectConfig = "FieldNode"
.....

This situation is a showstopper for the dynamic addition of RCDs as it is now since the javanode (EmbeddedWrapper) seems to crash after receiving the wrong kevscript from the master node:

00:20 ERROR: Error while adding instance FieldNode_0
java.lang.NullPointerException
        at org.kevoree.library.java.wrapper.KInstanceWrapper.setTargetObj(KInstanceWrapper.java:69
        at org.kevoree.library.java.wrapper.WrapperFactory.wrap(WrapperFactory.java:40)
        at org.kevoree.library.java.command.AddInstance.run(AddInstance.java:97)
        at java.lang.Thread.run(Thread.java:744)
00:20 WARN: Error during execution of AddInstance FieldNode_0
00:20 WARN: JavaSENode is aborting last update...
kehusa commented 8 years ago

@maxleiko and @barais, have you any thought on this? It is urgent to get a solution if we are going to present the RCD dynamic model update in the review.

maxleiko commented 8 years ago

@kehusa Yes I'm working on it since this morning. Gonna get back to you this afternoon

kehusa commented 8 years ago

@aliverud @sdalgard @maxleiko The new WSGroup is tested and it is working :-): image