public static object CreateValue(Net.Vpc.Upa.Property info) { string ptype = info.GetTypeName(); string format = info.GetFormat(); string @value = info.GetValue(); return(CreateValue(@value, ptype, format)); }
private Net.Vpc.Upa.Impl.Config.ConnectionElement ParseConnection(System.Xml.XmlElement e) { Net.Vpc.Upa.Impl.Config.ConnectionElement s = new Net.Vpc.Upa.Impl.Config.ConnectionElement(); System.Collections.Generic.IDictionary <string, string> attrs = Net.Vpc.Upa.Impl.Util.XMLUtils.GetAttributes(e, connectionElementFilter); s.connectionString = TrimToNull(Net.Vpc.Upa.Impl.FwkConvertUtils.GetMapValue <string, string>(attrs, "connectionstring")); s.userName = TrimToNull(Net.Vpc.Upa.Impl.FwkConvertUtils.GetMapValue <string, string>(attrs, "username")); s.password = TrimToNull(Net.Vpc.Upa.Impl.FwkConvertUtils.GetMapValue <string, string>(attrs, "password")); s.structure = TrimToNull(Net.Vpc.Upa.Impl.FwkConvertUtils.GetMapValue <string, string>(attrs, "structure")); if (attrs.ContainsKey("enabled")) { s.properties["enabled"] = TrimToNull(Net.Vpc.Upa.Impl.FwkConvertUtils.GetMapValue <string, string>(attrs, "enabled")); } System.Xml.XmlNodeList nl = (e).ChildNodes; if (nl != null && (nl).Count > 0) { for (int i = 0; i < (nl).Count; i++) { System.Xml.XmlNode item = nl.Item(i); if (item is System.Xml.XmlElement) { System.Xml.XmlElement el = (System.Xml.XmlElement)item; //add it to list string tagName = (el).Name; if (Net.Vpc.Upa.Impl.Util.XMLUtils.EqualsUniform(tagName, "connectionString")) { s.connectionString = TrimToNull(((el).FirstChild).Value); } else if (Net.Vpc.Upa.Impl.Util.XMLUtils.EqualsUniform(tagName, "userName")) { s.userName = TrimToNull(((el).FirstChild).Value); } else if (Net.Vpc.Upa.Impl.Util.XMLUtils.EqualsUniform(tagName, "password")) { s.password = TrimToNull(((el).FirstChild).Value); } else if (Net.Vpc.Upa.Impl.Util.XMLUtils.EqualsUniform(tagName, "structure")) { s.structure = TrimToNull(((el).FirstChild).Value); } else if (Net.Vpc.Upa.Impl.Util.XMLUtils.EqualsUniform(tagName, "enabled")) { s.properties[tagName] = TrimToNull(((el).FirstChild).Value); } else if (Net.Vpc.Upa.Impl.Util.XMLUtils.EqualsUniform(tagName, "property")) { Net.Vpc.Upa.Property p = ParseProperty(el); object t = Net.Vpc.Upa.Impl.Util.UPAUtils.CreateValue(p); s.properties[p.GetName()] = t == null ? null : System.Convert.ToString(t); } else { throw new System.ArgumentException("Unsupported tag " + tagName + " for Connection and RootConnection. " + "valid tags are connectionString, userName, password, " + "structure, enabled, property"); } } else { } } } // System.out.println(item); return(s); }