public virtual Net.Vpc.Upa.Impl.Config.PersistenceUnitElement GetOrAddPersistenceUnitElement(string name)
 {
     Net.Vpc.Upa.Impl.Config.PersistenceUnitElement v = Net.Vpc.Upa.Impl.FwkConvertUtils.GetMapValue <string, Net.Vpc.Upa.Impl.Config.PersistenceUnitElement>(persistenceUnitElements, name);
     if (v == null)
     {
         v        = new Net.Vpc.Upa.Impl.Config.PersistenceUnitElement();
         v.name   = name;
         v.parent = this;
         persistenceUnitElements[name] = v;
     }
     return(v);
 }
Exemple #2
0
        private Net.Vpc.Upa.Impl.Config.PersistenceUnitElement ParsePersistenceUnit(System.Xml.XmlElement e, Net.Vpc.Upa.Impl.Config.PersistenceGroupElement persistenceGroupElement)
        {
            System.Collections.Generic.IDictionary <string, string> attrs = Net.Vpc.Upa.Impl.Util.XMLUtils.GetAttributes(e, persistenceUnitElementFilter);
            string name = Nullify(Net.Vpc.Upa.Impl.FwkConvertUtils.GetMapValue <string, string>(attrs, "name"));

            Net.Vpc.Upa.Impl.Config.PersistenceUnitElement s = persistenceGroupElement.GetOrAddPersistenceUnitElement(name);
            s.start    = ParseBoolean(Net.Vpc.Upa.Impl.FwkConvertUtils.GetMapValue <string, string>(attrs, "start"), s.start);
            s.autoScan = ParseBoolean(Net.Vpc.Upa.Impl.FwkConvertUtils.GetMapValue <string, string>(attrs, "autoScan"), s.autoScan);
            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, "connection"))
                        {
                            s.connectionElements.Add(ParseConnection(el));
                        }
                        else if (Net.Vpc.Upa.Impl.Util.XMLUtils.EqualsUniform(tagName, "rootConnection"))
                        {
                            s.rootConnectionElements.Add(ParseConnection(el));
                        }
                        else if (Net.Vpc.Upa.Impl.Util.XMLUtils.EqualsUniform(tagName, "property"))
                        {
                            s.properties.Add(ParseProperty(el));
                        }
                        else if (Net.Vpc.Upa.Impl.Util.XMLUtils.EqualsUniform(tagName, "scan"))
                        {
                            s.scanElements.Add(ParseScan(el));
                        }
                        else
                        {
                            throw new System.ArgumentException("Unsupported tag " + tagName + " for PersistenceUnit. " + "valid tags are connection, rootConnection, property, scan");
                        }
                    }
                    else
                    {
                    }
                }
            }
            //                    System.out.println(item);
            return(s);
        }