Пример #1
0
        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);
        }
Пример #2
0
 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);
     }
 }
Пример #3
0
 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);
 }
Пример #4
0
        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();
        }
Пример #5
0
        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);
            }
        }