private static bool LookupConnectionFactoryInfo()

in src/nms-api/NMSConnectionFactory.cs [256:319]


        private static bool LookupConnectionFactoryInfo(string[] paths, string scheme, out string assemblyFileName,
            out string factoryClassName)
        {
            bool foundFactory = false;
            string schemeLower = scheme.ToLower();
            ProviderFactoryInfo pfi;

            // Look for a custom configuration to handle this scheme.
            string configFileName = String.Format("nmsprovider-{0}.config", schemeLower);

            assemblyFileName = String.Empty;
            factoryClassName = String.Empty;

            Tracer.DebugFormat("Attempting to locate provider configuration: {0}", configFileName);
            foreach (string path in paths)
            {
                string fullpath = Path.Combine(path, configFileName);
                Tracer.DebugFormat("Looking for: {0}", fullpath);

                try
                {
                    if (File.Exists(fullpath))
                    {
                        Tracer.DebugFormat("\tConfiguration file found in {0}", fullpath);
                        XmlDocument configDoc = new XmlDocument();

                        configDoc.Load(fullpath);
                        XmlElement providerNode = (XmlElement) configDoc.SelectSingleNode("/configuration/provider");

                        if (null != providerNode)
                        {
                            assemblyFileName = providerNode.GetAttribute("assembly");
                            factoryClassName = providerNode.GetAttribute("classFactory");
                            if (!String.IsNullOrEmpty(assemblyFileName) && !String.IsNullOrEmpty(factoryClassName))
                            {
                                foundFactory = true;
                                Tracer.DebugFormat("Selected custom provider for {0}: {1}, {2}", schemeLower,
                                    assemblyFileName, factoryClassName);
                                break;
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    Tracer.DebugFormat("Exception while scanning {0}: {1}", fullpath, ex.Message);
                }
            }

            if (!foundFactory)
            {
                // Check for standard provider implementations.
                if (schemaProviderFactoryMap.TryGetValue(schemeLower, out pfi))
                {
                    assemblyFileName = pfi.assemblyFileName;
                    factoryClassName = pfi.factoryClassName;
                    foundFactory = true;
                    Tracer.DebugFormat("Selected standard provider for {0}: {1}, {2}", schemeLower, assemblyFileName,
                        factoryClassName);
                }
            }

            return foundFactory;
        }