Example #1
0
 public ConfigRepository(IConfigLoader configLoader, string systemConfigKey, string appConfigKey)
 {
     this.configLoader    = configLoader;
     configurations       = configLoader.LoadOnInit();
     this.systemConfigKey = systemConfigKey;
     this.appConfigKey    = appConfigKey;
 }
Example #2
0
 public void Loaded(IConfigLoader configLoader, IChatClient chatClient, 
     IHttpClient httpClient, IFileSystem fileSystem, IRandomiser randomiser)
 {
     var config = LoadConfig(configLoader);
     var tumblrClient = new TumblrClient(httpClient, config.ApiKey);
     _tumblrListener = new TumblrListener(chatClient, tumblrClient, randomiser);
 }
Example #3
0
        public SqlBuilder_Test()
        {
            _configLoader = new LocalFileConfigLoader(SqlMapConfigFilePath, LoggerFactory);
            var smartSqlContext = new SmartSqlContext(LoggerFactory.CreateLogger <SmartSqlContext>(), _configLoader.Load());

            _sqlBuilder = new SqlBuilder(LoggerFactory.CreateLogger <SqlBuilder>(), smartSqlContext);
        }
Example #4
0
        public static AlarmLoaderAndGenerator CreateSystemUnderTest <T>(
            IResourceSource <T> source,
            IAlarmDimensionProvider <T> dimensionProvider,
            IResourceAttributesProvider <T> attributeProvider,
            Func <WatchmanConfiguration, WatchmanServiceConfiguration> mapper,
            IAlarmCreator creator,
            IConfigLoader loader
            ) where T : class
        {
            var fakeLogger = new Mock <IAlarmLogger>();

            var task = new ServiceAlarmTasks <T>(
                fakeLogger.Object,
                new ResourceNamePopulator <T>(fakeLogger.Object, source),
                new ServiceAlarmGenerator <T>(
                    creator,
                    new ServiceAlarmBuilder <T>(source, dimensionProvider, attributeProvider)),
                new OrphanResourcesReporter <T>(
                    new OrphanResourcesFinder <T>(source),
                    new OrphansLogger(fakeLogger.Object)),
                mapper
                );

            return(new AlarmLoaderAndGenerator(
                       fakeLogger.Object,
                       loader,
                       new Mock <IDynamoAlarmGenerator>().Object,
                       new Mock <IOrphanTablesReporter>().Object,
                       new Mock <ISqsAlarmGenerator>().Object,
                       new Mock <IOrphanQueuesReporter>().Object,
                       creator,
                       new[] { task }
                       ));
        }
Example #5
0
 public void Loaded(IConfigLoader configLoader, IChatClient chatClient, 
     IHttpClient httpClient, IFileSystem fileSystem, IRandomiser randomiser)
 {
     var config = LoadConfig(configLoader);
     var mapsClient = new MapsClient(httpClient, config.ApiKey);
     _mapListener = new MapListener(chatClient, mapsClient);
 }
        public SmartSqlContext_Test()
        {
            _configLoader = new LocalFileConfigLoader("SmartSqlMapConfig.xml", LoggerFactory);
            var config = _configLoader.Load();

            _smartSqlContext = new SmartSqlContext(LoggerFactory.CreateLogger <SmartSqlContext>(), _configLoader.Load());
        }
 public DirectoryChecker(IConfigLoader configLoader)
 {
     if (configLoader == null)
     {
         throw new ArgumentNullException(nameof(configLoader));
     }
     _config = configLoader.Load();
 }
 public ServiceLauncher(IService service, IConfigLoader configLoader)
 {
     _service = service ?? throw new ArgumentNullException(nameof(service));
     if (configLoader == null)
     {
         throw new ArgumentNullException(nameof(configLoader));
     }
     _config = configLoader.Load();
 }
Example #9
0
        public WatsonService(ILoggerManager logger, IConfigLoader configLoader)
        {
            _logger     = logger;
            _nluService = from apiKey in configLoader.WatsonApiKey
                          let authenticator = new IamAuthenticator(apiKey)
                                              select new NaturalLanguageUnderstandingService("2020-05-01", authenticator);

            _nluService.Access(nlus => configLoader.WatsonUrl.Access(nlus.SetServiceUrl));
        }
Example #10
0
 public ModuleManager(IConfigLoader configLoader, IFileSystem fileSystem, 
     IChatClient chatClient, IHttpClient httpClient, IRandomiser randomiser)
 {
     _configLoader = configLoader;
     _fileSystem = fileSystem;
     _chatClient = chatClient;
     _httpClient = httpClient;
     _randomiser = randomiser;
 }
Example #11
0
 public SqlBuilder(ILogger <SqlBuilder> logger
                   , SmartSqlContext smartSqlContext
                   , IConfigLoader configLoader)
 {
     _logger                  = logger;
     _configLoader            = configLoader;
     _smartSqlContext         = smartSqlContext;
     _configLoader.OnChanged += _configLoader_OnChanged;
 }
Example #12
0
 public MyDebugLogger(IConfigLoader loader)
 {
     _syncObject = new object();
     if (loader == null)
     {
         throw new ArgumentNullException(nameof(loader));
     }
     _config = loader.Load();
 }
Example #13
0
 public EmailSender(ILogger logger,
                    IConfigLoader configLoader,
                    IEmailClient emailClient,
                    IValidator validator)
 {
     this.logger       = logger;
     this.configLoader = configLoader;
     this.emailClient  = emailClient;
     this.validator    = validator;
 }
Example #14
0
 public ConfigMgr(IConfigLoader loader, params Type[] preloads)
 {
     m_assets = loader;
     cfgDic   = new Dictionary <Type, object>();
     for (int i = 0; i < preloads.Length; i++)
     {
         Type t = preloads[i];
         LoadCfg(t);
     }
 }
Example #15
0
 public ConfigService(IConfigLoader configLoader,
                      IProjectEnvironmentConfigConverter projectEnvironmentConfigConverter,
                      IUnitOfWork unitOfWork,
                      ISharedAppSettingConverter sharedAppSettingsConverter)
 {
     _UnitOfWork = unitOfWork;
     _SharedAppSettingsConverter        = sharedAppSettingsConverter;
     _ProjectEnvironmentConfigConverter = projectEnvironmentConfigConverter;
     _ConfigLoader = configLoader;
 }
Example #16
0
 public SnakesAndLadders(ILevel level, IDice dice,
                         IConfigLoader configLoader, IOptions <SnakesAndLaddersConfig> config)
 {
     _level        = level;
     _dice         = dice;
     _configLoader = configLoader;
     _config       = config;
     _level.Initialize(_configLoader.Load(_config.Value.ConfigFileName));
     players = new ConcurrentDictionary <string, Player>();
 }
Example #17
0
 public SmartSqlMapper(String sqlMapConfigFilePath, IConfigLoader configLoader)
 {
     ConfigLoader = configLoader;
     ConfigLoader.Load(sqlMapConfigFilePath, this);
     DbProviderFactory = SqlMapConfig.Database.DbProvider.DbProviderFactory;
     SessionStore      = new DbConnectionSessionStore(this.GetHashCode().ToString());
     SqlBuilder        = new SqlBuilder(this);
     DataSourceManager = new DataSourceManager(this);
     CacheManager      = new CacheManager(this);
     _sqlRuner         = new SqlRuner(SqlBuilder, this);
 }
 public ReportGenerator(
     IConfigLoader configLoader,
     TableNamePopulator tableNamePopulator,
     IResourceSource <TableDescription> tableSource,
     IAmazonCloudWatch cloudwatch)
 {
     _configLoader       = configLoader;
     _tableNamePopulator = tableNamePopulator;
     _tableSource        = tableSource;
     _cloudwatch         = cloudwatch;
 }
Example #19
0
 public BaraMapper(String baraMapConfigFilePath, IConfigLoader configLoader)
 {
     ConfigLoader = configLoader;
     ConfigLoader.Load(baraMapConfigFilePath, this);
     DbProviderFactory = BaraMapConfig.DataBase.DbProvider.DbProviderFactory;
     SessionStore      = new DbConnectionSessionStore(this.GetHashCode().ToString());
     SqlBuilder        = new SqlBuilder(this);
     DataSourceManager = new DataSourceManager(this);
     CacheManager      = new CacheManager(this);
     SqlExecutor       = new SqlExecutor(SqlBuilder, this);
 }
Example #20
0
 public static Configuration GetManager(IConfigLoader loader)
 {
     lock (typeof(ConfigurationManager))
     {
         Configuration result = new Configuration();
         result.Name         = loader.Name;
         result.ConfigLoader = loader;
         result.LoadConfig(loader.Load());
         return(result);
     }
 }
Example #21
0
 public FileProcessor(IConfigLoader loader, IFileReader fileReader, ILogger logger)
 {
     if (loader == null)
     {
         throw new ArgumentNullException(nameof(loader));
     }
     _config     = loader.Load();
     _delay      = _config.DelayForAnotherAttempt;
     _attempts   = _config.AttempsToAccessFilesystem;
     _fileReader = fileReader ?? throw new ArgumentNullException(nameof(fileReader));
     _logger     = logger ?? throw new ArgumentNullException(nameof(logger));
 }
Example #22
0
 public BaraMapper(ILoggerFactory loggerFactory, String baraMapConfigFilePath, IConfigLoader configLoader)
 {
     _loggerFactory = loggerFactory;
     _logger        = _loggerFactory.CreateLogger <BaraMapper>();
     ConfigLoader   = configLoader;
     ConfigLoader.Load(baraMapConfigFilePath, this);
     DbProviderFactory = BaraMapConfig.DataBase.DbProvider.DbProviderFactory;
     SessionStore      = new DbConnectionSessionStore(loggerFactory, this.GetHashCode().ToString());
     SqlBuilder        = new SqlBuilder(loggerFactory, this);
     DataSourceManager = new DataSourceManager(loggerFactory, this);
     CacheManager      = new CacheManager(loggerFactory, this);
     SqlExecutor       = new SqlExecutor(loggerFactory, SqlBuilder, this);
 }
 public ElasticSearchService(IConfigLoader config, ILoggerManager logger, IClassifier classifier)
 {
     _logger     = logger;
     _classifier = classifier;
     _client     = from url in config.EsUrl
                   from user in config.EsUser
                   from password in config.EsPassword
                   from defaultIndex in config.EsDefaultIndex
                   let uri                       = new Uri(url)
                                        let pool = new SingleNodeConnectionPool(uri)
                                                   select new ElasticClient(new ConnectionSettings(pool)
                                                                            .BasicAuthentication(user, password)
                                                                            .DefaultIndex(defaultIndex));
 }
        public void Reload(string name)
        {
            if (mManagers.ContainsKey(name))
            {
                mManagers.Remove(name);
            }
            IConfigLoader loader = null;

            if (!mConfigLoaders.TryGetValue(name, out loader))
            {
                throw new Configuration4NetError("{0} config loader not found", name);
            }
            mManagers[name] = CreateManager(loader);
        }
Example #25
0
 public ISmartSqlMapper GetSqlMapper(String smartSqlMapConfigPath, IConfigLoader configLoader)
 {
     if (!_mapperContainer.ContainsKey(smartSqlMapConfigPath))
     {
         lock (this)
         {
             if (!_mapperContainer.ContainsKey(smartSqlMapConfigPath))
             {
                 ISmartSqlMapper _mapper = new SmartSqlMapper(smartSqlMapConfigPath, configLoader);
                 _mapperContainer.Add(smartSqlMapConfigPath, _mapper);
             }
         }
     }
     return(_mapperContainer[smartSqlMapConfigPath]);
 }
Example #26
0
        private static Config LoadConfig(IConfigLoader configLoader)
        {
            var config = configLoader.Load<Config>("Maps/Config.json") ?? new Config();

            if (string.IsNullOrWhiteSpace(config.ApiKey))
            {
                Log.Warn("No 'apikey' defined in Config.json");
            }
            else
            {
                Log.Info("Found 'apikey' in Config.json");
            }

            return config;
        }
Example #27
0
        public static AlarmLoaderAndGenerator CreateSystemUnderTest <T, TAlarmConfig>(
            IResourceSource <T> source,
            IAlarmDimensionProvider <T> dimensionProvider,
            IResourceAttributesProvider <T, TAlarmConfig> attributeProvider,
            Func <WatchmanConfiguration, WatchmanServiceConfiguration <TAlarmConfig> > mapper,
            IAlarmCreator creator,
            IConfigLoader loader
            )
            where T : class
            where TAlarmConfig : class, IServiceAlarmConfig <TAlarmConfig>, new()
        {
            var builder = new Builder(loader, creator);

            builder.AddService(source, dimensionProvider, attributeProvider, mapper);
            return(builder.Build());
        }
Example #28
0
        public SmartSqlMapper(ILoggerFactory loggerFactory, String sqlMapConfigFilePath, IConfigLoader configLoader)
        {
            _loggerFactory    = loggerFactory;
            _logger           = loggerFactory.CreateLogger <SmartSqlMapper>();
            ConfigLoader      = configLoader;
            SqlMapConfig      = ConfigLoader.Load();
            DbProviderFactory = SqlMapConfig.Database.DbProvider.DbProviderFactory;
            SessionStore      = new DbConnectionSessionStore(loggerFactory, this.GetHashCode().ToString());
            SqlBuilder        = new SqlBuilder(loggerFactory, this);
            DataSourceManager = new DataSourceManager(loggerFactory, this);
            CacheManager      = new CacheManager(loggerFactory, this);
            _sqlRuner         = new SqlRuner(loggerFactory, SqlBuilder, this);

            ConfigLoader.OnChanged = SqlConfigOnChanged;
            SqlMapConfig.SetLogger(_loggerFactory.CreateLogger <SmartSqlMapConfig>());
        }
Example #29
0
 public SmartSqlMapper(
     ILoggerFactory loggerFactory,
     String sqlMapConfigFilePath = "SmartSqlMapConfig.xml"
     )
 {
     _loggerFactory = loggerFactory;
     _logger        = loggerFactory.CreateLogger <SmartSqlMapper>();
     ConfigLoader   = new LocalFileConfigLoader(loggerFactory);
     ConfigLoader.Load(sqlMapConfigFilePath, this);
     DbProviderFactory = SqlMapConfig.Database.DbProvider.DbProviderFactory;
     SessionStore      = new DbConnectionSessionStore(loggerFactory, this.GetHashCode().ToString());
     SqlBuilder        = new SqlBuilder(loggerFactory, this);
     DataSourceManager = new DataSourceManager(loggerFactory, this);
     CacheManager      = new CacheManager(loggerFactory, this);
     _sqlRuner         = new SqlRuner(loggerFactory, SqlBuilder, this);
 }
Example #30
0
 public SmartSqlMapper(
     String sqlMapConfigFilePath
     , IDbConnectionSessionStore sessionStore
     , IDataSourceManager dataSourceManager
     , ICacheManager cacheManager
     , ISqlBuilder sqlBuilder
     , IConfigLoader configLoader
     )
 {
     configLoader.Load(sqlMapConfigFilePath, this);
     DbProviderFactory = SqlMapConfig.Database.DbProvider.DbProviderFactory;
     SessionStore      = sessionStore;
     SqlBuilder        = sqlBuilder;
     DataSourceManager = dataSourceManager;
     CacheManager      = cacheManager;
     _sqlRuner         = new SqlRuner(SqlBuilder, this);
 }
 private void SetLoadProperty(IConfigLoader loader, PropertyCollections properties)
 {
     foreach (Property p in properties)
     {
         PropertyInfo pi = loader.GetType().GetProperty(p.Name, BindingFlags.Public | BindingFlags.Instance);
         if (pi != null && pi.CanWrite)
         {
             try
             {
                 object value = Convert.ChangeType(p.Value, pi.PropertyType);
                 pi.SetValue(loader, value, null);
             }
             catch
             {
             }
         }
     }
 }
Example #32
0
        public void Load(string path, IConfigLoader loader)
        {
            Coroutine.Instance.StartOnTask(() =>
            {
                for (int i = 0; i < ResPath.Count; i++)
                {
                    var p = System.IO.Path.Combine(ResPath[i], path);
                    if (loader._loadOK(p))
                    {
                        break;
                    }
                }
            });

            //var f = new File();
            //Debug.LogError($"file no found: {path}");
            //callback?.Invoke(null);
        }
Example #33
0
    private void Awake()
    {
        _configLoader = new ConfigLoader();
        _dataStorage  = new DataStorage.DataStorage(_configLoader);
        _dataStorage.Load(configPath);

        _cameraController.Init(_dataStorage.Data.cameraSettings);

        _game = new Game.GameModel(_dataStorage.Data);
        _game.Init(_dataStorage.Data.settings.playersCount);

        _gamePresenter = new GamePresenter(_game, _gameView);

        _presenters = new PlayerPresenter[_players.Length];
        for (var i = 0; i < _players.Length; i++)
        {
            _presenters[i] = new PlayerPresenter(_game, _game.GetPlayer(i), _players[i]);
        }
    }
Example #34
0
 public AlarmLoaderAndGenerator(
     IAlarmLogger logger,
     IConfigLoader configLoader,
     DynamoAlarmGenerator dynamoGenerator,
     OrphanTablesReporter orphanTablesReporter,
     SqsAlarmGenerator sqsGenerator,
     OrphanQueuesReporter orphanQueuesReporter,
     IAlarmCreator creator,
     IEnumerable <IServiceAlarmTasks> otherServices)
 {
     _logger               = logger;
     _configLoader         = configLoader;
     _dynamoGenerator      = dynamoGenerator;
     _orphanTablesReporter = orphanTablesReporter;
     _sqsGenerator         = sqsGenerator;
     _orphanQueuesReporter = orphanQueuesReporter;
     _creator              = creator;
     _otherServices        = otherServices;
 }
Example #35
0
        public AppSettingsLoader(
			IAppDirectoriesBuilder directoryBuilder,
			IFileSystem fileSystem,
			IConfigLoader configLoader,
			IVariablesLoader variablesLoader,
			IHighlightsLoader highlightsLoader,
			IGameState gameState,
			IServiceLocator services,
			AppSettings settings)
        {
            _directoryBuilder = directoryBuilder;
            _fileSystem = fileSystem;
            _configLoader = configLoader;
            _variablesLoader = variablesLoader;
            _highlightsLoader = highlightsLoader;
            _gameState = gameState;
            _services = services;
            _settings = settings;
        }
Example #36
0
        private static Config LoadConfig(IConfigLoader configLoader, IFileSystem fileSystem)
        {
            var config = configLoader.Load<Config>("ChatLog/Config.json") ?? new Config();

            if (string.IsNullOrWhiteSpace(config.Path))
            {
                config.Path = "ChatLogs";
                Log.Info("No path specified, using 'ChatLogs'");
            }
            else
            {
                config.Path = config.Path;
            }

            try
            {
                if (fileSystem.DirectoryExists(config.Path))
                {
                    Log.Info("Path exists, skipping creation");
                }
                else
                {
                    Log.Info("Path does not exist, creating it..");
                    fileSystem.CreateDirectory(config.Path);
                }

                Log.Info($"Path is '{config.Path}'");
            }
            catch (Exception e)
            {
                Log.Error($"Error creating '{config.Path}': {e.Message}");
                Log.Error("Path not set");
            }

            return config;
        }
Example #37
0
 public HomeController(IViewModelService service, IConfigLoader<IWebConfig> loader)
     : base(loader)
 {
     _service = service;
 }
 internal ResourceHttpHandlerFactory(AssmanContext assmanContext, IConfigLoader configLoader)
 {
     _assmanContext = assmanContext;
     _configLoader = configLoader;
 }
Example #39
0
 public AccountController(IConfigLoader<IWebConfig> configLoader, IAuthenticationService authService)
     : base(configLoader)
 {
     _authService = authService;
 }
Example #40
0
 public ControllerBase(IConfigLoader<IWebConfig> configLoader)
 {
     configLoader.Initialize();
 }
Example #41
0
 public void Loaded(IConfigLoader configLoader, IChatClient chatClient, 
     IHttpClient httpClient, IFileSystem fileSystem, IRandomiser randomiser)
 {
     var config = LoadConfig(configLoader, fileSystem);
     _chatListener = new ChatListener(fileSystem, chatClient, config);
 }
Example #42
0
		public ConfigRepository(IConfigLoader configLoader, string systemConfigKey, string appConfigKey) {
			this.configLoader = configLoader;
			configurations = configLoader.LoadOnInit();
			this.systemConfigKey = systemConfigKey;
			this.appConfigKey = appConfigKey;
		}
Example #43
0
		public ConfigRepository(IConfigLoader configLoader) : this(configLoader, "System", null) {
			appConfigKey = GetAppConfigKey();
		}
Example #44
0
 protected internal ConfigDrivenResourceModeProvider(IConfigLoader configLoader)
 {
     _configLoader = configLoader;
 }