public virtual bool ContainsSection(Net.Vpc.Upa.Section item) { Net.Vpc.Upa.Entity entity = item.GetEntity(); Net.Vpc.Upa.Package module = entity.GetParent(); string s = (module == null ? "/" : module.GetPath() + "/") + entity.GetName() + "/" + item.GetPath(); return(sections.ContainsKey(s)); }
public virtual void UnregisterSection(Net.Vpc.Upa.Section item) { Net.Vpc.Upa.Entity entity = item.GetEntity(); Net.Vpc.Upa.Package module = entity.GetParent(); string s = (module == null ? "/" : module.GetPath() + "/") + entity.GetName() + "/" + item.GetPath(); sections.Remove(s); }
public virtual Net.Vpc.Upa.Section GetSection(string path, Net.Vpc.Upa.MissingStrategy missingStrategy) /* throws Net.Vpc.Upa.Exceptions.UPAException */ { if (path == null) { throw new System.NullReferenceException(); } string[] canonicalPathArray = Net.Vpc.Upa.Impl.Util.UPAUtils.GetCanonicalPathArray(path); if (canonicalPathArray.Length == 0) { throw new System.ArgumentException("invalid module path " + path); } Net.Vpc.Upa.Section module = null; foreach (string n in canonicalPathArray) { Net.Vpc.Upa.Section next = null; if (module == null) { foreach (Net.Vpc.Upa.EntityPart schemaItem in parts) { if (schemaItem is Net.Vpc.Upa.Section) { if (schemaItem.GetName().Equals(n)) { next = (Net.Vpc.Upa.Section)schemaItem; break; } } } if (next == null) { switch (missingStrategy) { case Net.Vpc.Upa.MissingStrategy.ERROR: { throw new Net.Vpc.Upa.Exceptions.NoSuchSectionException(path); } case Net.Vpc.Upa.MissingStrategy.CREATE: { next = AddSection(n, null); break; } case Net.Vpc.Upa.MissingStrategy.NULL: { return(null); } default: { throw new System.Exception(); } } } } else { try { next = module.GetSection(n); } catch (Net.Vpc.Upa.Exceptions.NoSuchSectionException e) { switch (missingStrategy) { case Net.Vpc.Upa.MissingStrategy.ERROR: { throw new Net.Vpc.Upa.Exceptions.NoSuchSectionException(path); } case Net.Vpc.Upa.MissingStrategy.CREATE: { next = AddSection(n, module.GetPath()); break; } case Net.Vpc.Upa.MissingStrategy.NULL: { return(null); } default: { throw new System.Exception(); } } } } module = next; } return(module); }