protected virtual IConfigSectionNode DoTryFindConfig(string setName, string clusterPath, bool searchParent, bool transcendNoc, out string actualPath) { actualPath = null; Metabank.SectionRegionBase level = App.GetMetabase().CatalogReg[clusterPath]; if (!(level is Metabank.SectionZone || level is Metabank.SectionNOC)) { return(null); } IConfigSectionNode result = null; while (level != null) { result = level.LevelConfig .Children .Where(c => c.IsSameName(Metabank.CONFIG_HOST_SET_SECTION) && c.IsSameNameAttr(setName)) .FirstOrDefault(); if (result != null) { break; } if (!searchParent) { break; } var zone = level as Metabank.SectionZone; if (zone != null) { var zparent = zone.ParentZone; if (zparent != null) { level = zparent; continue; } level = zone.NOC; continue; } if (!transcendNoc) { break; } var noc = level as Metabank.SectionNOC; if (noc != null) { level = noc.ParentNOCZone; } } if (result != null) { actualPath = level.RegionPath; } return(result); }
internal object LoadLevelImpl(string path, bool hosts = false) { IEnumerable <Metabank.SectionRegionBase> children = null; Metabank.SectionRegionBase section = null; if (path.IsNotNullOrWhiteSpace() && path != "/" && path != "\\") { section = Metabase.CatalogReg[path]; if (section == null) { return(Wave.SysConsts.JSON_RESULT_ERROR); } if (section is Metabank.SectionRegion) { var region = (Metabank.SectionRegion)section; children = region.SubRegionNames.OrderBy(r => r).Select(r => (Metabank.SectionRegionBase)region.GetSubRegion(r)) .Concat(region.NOCNames.OrderBy(n => n).Select(n => (Metabank.SectionRegionBase)region.GetNOC(n))); } else if (section is Metabank.SectionNOC) { var noc = (Metabank.SectionNOC)section; children = noc.ZoneNames.OrderBy(z => z).Select(z => noc.GetZone(z)); } else if (section is Metabank.SectionZone) { var zone = (Metabank.SectionZone)section; children = zone.SubZoneNames.OrderBy(z => z).Select(z => (Metabank.SectionRegionBase)zone.GetSubZone(z)); if (hosts) { children = children.Concat(zone.HostNames.OrderBy(h => h).Select(h => (Metabank.SectionRegionBase)zone.GetHost(h))); } } else { return(Azos.Wave.SysConsts.JSON_RESULT_ERROR); } } else { children = Metabase.CatalogReg.Regions; } var shost = App.GetThisHostMetabaseSection(); return(new { OK = true, path = path, myPath = shost.RegionPath, myPathSegs = shost.SectionsOnPath.Select(s => s.Name).ToArray(), children = makeChildren(children) }); }