Closed rich0rd closed 6 years ago
Hallo
IMHO, i’m not 100% sure but an attribute delegate doesn’t belong to an Instance Definition, it belongs to the ObjectNode which will be instantiated later. I didn’t find out which member are applied on the ObjectNode created on cascade from the nodeFactory, but an AttributeDelegate if set on the InstanceDefinition, will not work on the instance. You have to set it after the object creation, on the real instance.
I assume this is not a Bug (may be I am wrong) but to me could make sense, since if you create 3 instances of a NodeType with the Node Factory (and its components, aka InstanceDefinitions) , then I think you should set there attribute delegate. Hence it will not make sense to have in the same server 3 Attribute Delegate which potentially access the same data.
Make sense ? @kevinherron , i am in a wrong way? or it is simply that the attribute Delegate it is not a standard construct ?
Thanks Lorenzo
Yes, that's correct, you would not put a delegate onto the definition for your custom type. It belongs on an instance.
Further, AccessLevel is an Attribute that belongs to a VariableNode, not and ObjectNode, which is why you aren't able to configure it.
On Mon, Mar 19, 2018 at 5:15 AM, Dalaitama notifications@github.com wrote:
Hallo
IMHO, i’m not 100% sure but an attribute delegate doesn’t belong to an Instance Definition, it belongs to the ObjectNode which will be instantiated later. I didn’t find out which member are applied on the ObjectNode created on cascade from the nodeFactory, but an AttributeDelegate if set on the InstanceDefinition, will not work on the instance. You have to set it after the object creation, on the real instance.
I assume this is not a Bug (may be I am wrong) but to me could make sense, since if you create 3 instances of a NodeType with the Node Factory (and its components, aka InstanceDefinitions) , then I think you should set there attribute delegate. Hence it will not make sense to have in the same server 3 Attribute Delegate which potentially access the same data.
Make sense ? @kevinherron https://github.com/kevinherron , i am in a wrong way?
Thanks Lorenzo
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/eclipse/milo/issues/239#issuecomment-374191933, or mute the thread https://github.com/notifications/unsubscribe-auth/AAUxMbQEoFuq6shltYaWbG9f8TyKJkAQks5tf6FHgaJpZM4Sv4jl .
Many thanks for the quick response. Of course the AccessLevel belongs to the VaribleNode but even if I set the AccessLevel on "foo" and "bar", the node factory does not assign the property to the object node. See: https://github.com/eclipse/milo/blob/c77d06a4d7ccfe408c3e931e15700f53c42a8f8d/opc-ua-sdk/sdk-server/src/main/java/org/eclipse/milo/opcua/sdk/server/nodes/NodeFactory.java#L196
Sorry, I misunderstood your issue originally.
Ok, it's a little more complicated. VariableTypeNode
s don't have AccessLevel
and UserAccessLevel
attributes, which is why they aren't "inherited" or assigned when building an instance.
The "fix" for this is going to require some work I'm planning on the 0.3 branch, which is to allow some kind of interceptor/visitor to be installed on the factory that gets called/notified at various stages of construction of a complex node hierarchy. In this case, the way it might work is you'd get a call that provided you the parent node and the newly instantiated child node and you'd have an opportunity to do anything you wish with that information, such as set an AccessLevel
on the node, or instantiate some type of object(s) specific to your application that the node represents, etc...
Hy,
I was playing with the server example of milo, more precisely with the addCustomObjectTypeAndInstance” method. (https://github.com/eclipse/milo/blob/c77d06a4d7ccfe408c3e931e15700f53c42a8f8d/milo-examples/server-examples/src/main/java/org/eclipse/milo/examples/server/ExampleNamespace.java#L540)
In my example my object nodes should have user access level AccessLevel.CurrentRead, AccessLevel.HistoryRead and an attribute delegate for reading requests.
In the milo server example, the object node is created comfortable by the node factory. But neither the user access level nor the attribute delegate is set/copied in the created object node. I’m new to milo and could not access if the node factory should do this. But who can I access the created child nodes of my object node to set these attributes?
Many thanks,