Opc.Ua.Com.Client.ComHdaClientNodeManager.GetManagerHandle C# (CSharp) Method

GetManagerHandle() protected method

Returns a unique handle for the node.
protected GetManagerHandle ( ServerSystemContext context, Opc.Ua.NodeId nodeId, NodeState>.IDictionary cache ) : NodeHandle
context Opc.Ua.Server.ServerSystemContext
nodeId Opc.Ua.NodeId
cache NodeState>.IDictionary
return Opc.Ua.Server.NodeHandle
        protected override NodeHandle GetManagerHandle(ServerSystemContext context, NodeId nodeId, IDictionary<NodeId, NodeState> cache)
        {
            lock (Lock)
            {
                // quickly exclude nodes that are not in the namespace.
                if (!IsNodeIdInNamespace(nodeId))
                {
                    return null;
                }

                // check cache.
                if (cache != null)
                {
                    NodeState node = null;

                    if (cache.TryGetValue(nodeId, out node))
                    {
                        return new NodeHandle(nodeId, node);
                    }
                }

                NodeHandle handle = null;

                try
                {
                    // check for predefined nodes.
                    if (PredefinedNodes != null)
                    {
                        NodeState node = null;

                        if (PredefinedNodes.TryGetValue(nodeId, out node))
                        {
                            return handle = new NodeHandle(nodeId, node);
                        }
                    }

                    // parse the identifier.
                    HdaParsedNodeId parsedNodeId = HdaParsedNodeId.Parse(nodeId);

                    if (parsedNodeId != null)
                    {
                        handle = new NodeHandle();

                        handle.NodeId = nodeId;
                        handle.Validated = false;
                        handle.Node = null;
                        handle.ParsedNodeId = parsedNodeId;

                        return handle;
                    }
                }
                finally
                {
                    if (handle != null && handle.Node != null && cache != null)
                    {
                        cache.Add(nodeId, handle.Node);
                    }
                }

                return null;
            }
        }