Beispiel #1
0
        public CfgSystem GetSystemConfiguration(ILog log)
        {
            ExportFileParser parser = new ExportFileParser();

            parser.ExportReader = ExportReader;
            parser.RowParsed   +=
                new ExportFileParser.RowParsedDelegate(parser_RowParsed);
            parser.InfoParsed +=
                new ExportFileParser.InfoParsedDelegate(parser_InfoParsed);
            parser.Log = log;

            cfgDb = new DatabaseContents();
            parser.parse();
            cfgDb.ResolveReferences();
            CfgSystem result =
                new CfgSystem(
                    new DefaultCfgObjectDecorator(
                        new ExportFileCfgSystem(cfgDb)));

            return(result);
        }
Beispiel #2
0
        public ExportFileCfgSystem(DatabaseContents db)
        {
            this.db = db;
            hosts   = new List <ICfgObject>();
            foreach (Row row in db.GetTable("cfg_host").GetRows())
            {
                hosts.Add(new ExportFileCfgObject(row));
            }

            servers = new List <ICfgObject>();
            foreach (Row row in db.GetTable("cfg_server").GetRows())
            {
                servers.Add(new ExportFileCfgObject(row));
            }

            applications = new List <ICfgObject>();
            foreach (Row row in db.GetTable("cfg_application").GetRows())
            {
                applications.Add(new ExportFileCfgObject(row));
            }

            services = new List <ICfgObject>();
            foreach (Row row in db.GetTable("cfg_service").GetRows())
            {
                services.Add(new ExportFileCfgObject(row));
            }

            switches = new List <ICfgObject>();
            foreach (Row row in db.GetTable("cfg_switch").GetRows())
            {
                switches.Add(new ExportFileCfgObject(row));
            }

            tenants = new List <ICfgObject>();
            foreach (Row row in db.GetTable("cfg_tenant").GetRows())
            {
                tenants.Add(new ExportFileCfgObject(row));
            }
        }