private IdGenerator EnsureIdGenerator(ApplicationMetadataXml app) { IdGenerator idGenerator = this.FIdGenerators.FindByApp(app); if (idGenerator != null) { return(idGenerator); } ApplicationDbConfig connectionParams = new ApplicationDbConfig((XmlNode)app.ConnectionParams); for (int index = 0; index < this.FIdGenerators.Count; ++index) { IdGenerator fidGenerator = this.FIdGenerators[index]; if (fidGenerator.IsSameConnectionParams(connectionParams)) { idGenerator = fidGenerator; break; } } if (idGenerator == null) { idGenerator = IdGenerator.Create(this, connectionParams); this.FIdGenerators.Add((object)idGenerator); } idGenerator.ServedApps.Add((object)app); return(idGenerator); }
private void XmlRequest_QueryAppList(XmlNode request, XmlNode response) { for (int index = 0; index < this.FApps.Count; ++index) { ApplicationMetadataXml fapp = this.FApps[index]; XmlNode node = (XmlNode)XmlUtils.AppendElement(response, "App"); XmlUtils.SetAttr(node, "ID", fapp.Id); XmlUtils.SetAttr(node, "Name", fapp.Name); } }
public IdGenerator FindByApp(ApplicationMetadataXml app) { for (int index = 0; index < this.Count; ++index) { IdGenerator idGenerator = this[index]; if (idGenerator.ServedApps.Contains((object)app)) { return(idGenerator); } } return((IdGenerator)null); }
private void XmlRequest_ReloadApp(XmlNode request, XmlNode response) { ApplicationMetadataXml app = this.NeedRequestApp(request); IdGenerator byApp = this.FIdGenerators.FindByApp(app); if (byApp != null) { byApp.ServedApps.Remove((object)app); if (byApp.ServedApps.Count == 0) { this.FIdGenerators.Remove((object)byApp); byApp.Shutdown(); } } app.Reload(); }
private void XmlRequest_QueryAppMetadata(XmlNode request, XmlNode response) { ApplicationMetadataXml applicationMetadataXml = this.NeedRequestApp(request); if (XmlUtils.GetBoolAttr(request, "Reduced")) { this.FRequestDispatcher.ReplaceResponse(applicationMetadataXml.ReducedMetadata); } else if (XmlUtils.GetBoolAttr(request, "Incomplete")) { this.FRequestDispatcher.ReplaceResponse(applicationMetadataXml.GetIncompleteMetadata(out Dictionary <string, XmlElement> _, out List <XmlElement> _)); } else { this.FRequestDispatcher.ReplaceResponse(applicationMetadataXml.Metadata); } }