Apache.NMS.Test.NMSTestSupport.GetFactoryParams C# (CSharp) Method

GetFactoryParams() protected method

Get the parameters for the ConnectionFactory from the configuration file.
protected GetFactoryParams ( XmlElement uriNode ) : object[]
uriNode System.Xml.XmlElement Parent node of the factoryParams node.
return object[]
        protected object[] GetFactoryParams(XmlElement uriNode)
        {
            ArrayList factoryParams = new ArrayList();
            XmlElement factoryParamsNode = (XmlElement) uriNode.SelectSingleNode("factoryParams");

            if(null != factoryParamsNode)
            {
                XmlNodeList nodeList = factoryParamsNode.SelectNodes("param");

                if(null != nodeList)
                {
                    foreach(XmlElement paramNode in nodeList)
                    {
                        string paramType = paramNode.GetAttribute("type");
                        string paramValue = ReplaceEnvVar(paramNode.GetAttribute("value"));

                        switch(paramType)
                        {
                        case "string":
                            factoryParams.Add(paramValue);
                            break;

                        case "int":
                            factoryParams.Add(int.Parse(paramValue));
                            break;

                        // TODO: Add more parameter types
                        }
                    }
                }
            }

            if(factoryParams.Count > 0)
            {
                return factoryParams.ToArray();
            }

            return null;
        }