public INodeLocatorRegistry CreateChildRegistry(string nodeId) { var childRegistry = new NodeLocatorBuilder(); RegisterNodeFactory(nodeId, async (nodeUri, locator) => new LinkedAsyncNodeLocator(await childRegistry.BuildNodeLocator(nodeUri), _nodeLocatorCompletionSource.Task)); return childRegistry; }
private static async Task<INode> LoadRootNode(NodeUri rootUri, INodeRuntime runtime, NodeConfigurationData configuration) { Debug.Indent(); Debug.Print("Load Node Descriptors Loaders"); //var nodeFactoryLoaders = configuration["nodeFactoryLoaders"].GetValue<IEnumerable<string>>() // .Select(x => runtime.TypeLoader.LoadType(x)) // .Select(x => runtime.ObjectLoader.CreateInstance<INodeFactoryDescriptorLoader>(x)) // .ToArray(); var nodeFactoryLoaders = new[] {new NodeFactoryDescriptorByTypeAttributeLoader(runtime)}; Debug.Print("Create Node loader"); var nodeLoader = new NodeFactoryLoader(nodeFactoryLoaders); Debug.Print("Create root Node locator builder"); var nodeLocatorBuilder = new NodeLocatorBuilder(); Debug.Print("Load root Node factory"); var nodeFactory = nodeLoader.LoadNodeFactory(nodeLocatorBuilder, configuration); Debug.Assert(nodeFactory != null, "Unable to load root Node factory"); Debug.Print($"Build root Node locator @'{rootUri}'"); var locator = await nodeLocatorBuilder.BuildNodeLocator(rootUri); Debug.Assert(locator != null, "Unable to build root Node locator"); Debug.Print($"Create root Node instance @'{rootUri}'"); var node = await nodeFactory(rootUri, locator); Debug.Assert(node != null, "Unable to create root Node instance"); Debug.Unindent(); return node; }