Пример #1
0
        /// <summary>
        /// Register an instantiated INodeProvider with the node manager. The node manager will query the nodeprovider
        /// for a list of its node descriptions, and add these nodes to a master list of nodes which can be used
        /// by the scheduler. QUESTION: Do we allow duplicate Node Providers?
        /// </summary>
        /// <param name="providerToRegister"></param>
        /// <returns></returns>
        internal bool RegisterNodeProvider(INodeProvider nodeProviderToRegister)
        {
            ErrorUtilities.VerifyThrowArgumentNull(nodeProviderToRegister, "nodeProviderToRegister");

            INodeDescription[] nodeDescriptions = nodeProviderToRegister.QueryNodeDescriptions();

            int[] nodeIds = new int[nodeDescriptions.Length];
            for (int i = 0; i < nodeIds.Length; i++)
            {
                nodeIds[i] = parentEngine.GetNextNodeId();
            }
            nodeProviderToRegister.AssignNodeIdentifiers(nodeIds);

            // Go through all of the nodes as described by nodeDescriptions and add them to out list of nodes
            for (int i = 0; i < nodeDescriptions.Length; i++)
            {
                ProvidersNodeInformation nodeToAddFromProvider =
                    new ProvidersNodeInformation(i, nodeIds[i], nodeDescriptions[i], nodeProviderToRegister);
                nodeList.Add(nodeToAddFromProvider);
            }

            nodeProviders.Add(nodeProviderToRegister);

            return(true);
        }
Пример #2
0
        /// <summary>
        /// Register an instantiated INodeProvider with the node manager. The node manager will query the nodeprovider
        /// for a list of its node descriptions, and add these nodes to a master list of nodes which can be used
        /// by the scheduler. QUESTION: Do we allow duplicate Node Providers?
        /// </summary>
        /// <param name="providerToRegister"></param>
        /// <returns></returns>
        internal bool RegisterNodeProvider(INodeProvider nodeProviderToRegister)
        {
            ErrorUtilities.VerifyThrowArgumentNull(nodeProviderToRegister,"nodeProviderToRegister");

            INodeDescription[] nodeDescriptions = nodeProviderToRegister.QueryNodeDescriptions();

            int[] nodeIds = new int[nodeDescriptions.Length];
            for (int i = 0; i < nodeIds.Length; i++)
            {
                nodeIds[i] = parentEngine.GetNextNodeId();
            }
            nodeProviderToRegister.AssignNodeIdentifiers(nodeIds);

            // Go through all of the nodes as described by nodeDescriptions and add them to out list of nodes
            for(int i=0; i < nodeDescriptions.Length;i++)
            {
                ProvidersNodeInformation nodeToAddFromProvider = 
                    new ProvidersNodeInformation(i, nodeIds[i], nodeDescriptions[i], nodeProviderToRegister);
                nodeList.Add(nodeToAddFromProvider);
            }

            nodeProviders.Add(nodeProviderToRegister);

            return true;
        }
Пример #3
0
 /// <summary>
 /// Provide an array of INodeDescriptionsof the node provided by the node provider for the node. The index of the description
 /// is the node index to which the description matches
 /// </summary>
 /// <returns></returns>
 internal INodeDescription[] GetNodeDescriptions()
 {
     // The number of node descriptions is the number of nodes from all of the node providers, plus one for the default "0" node
     INodeDescription[] nodeDescription = new INodeDescription[nodeList.Count + 1];
     nodeDescription[0] = null;
     for (int nodeListIndex = 0; nodeListIndex < nodeList.Count; nodeListIndex++)
     {
         ProvidersNodeInformation nodeInfo = nodeList[nodeListIndex];
         // +1 because the node description already has the 0 element set to null
         nodeDescription[nodeListIndex + 1] = nodeInfo.Description;
     }
     return(nodeDescription);
 }