Esempio n. 1
0
 public InternalAPIController(IServiceProvider services)
 {
     this._sourceWatcherService = (ISourceWatcherService)services.GetService(typeof(ISourceWatcherService));
     this._invokerCache         = (IInvokerCacheService)services.GetService(typeof(IInvokerCacheService));
     this._searchService        = (ISearchService)services.GetService(typeof(ISearchService));
     _internalApiHelper         = new InternalAPIHelper();
 }
Esempio n. 2
0
 public SourceWatcherBase(IHostingEnvironment env, IConfiguration configuration, IInvokerCacheService invokerCache, string eventSource)
 {
     _env          = env;
     _config       = configuration;
     _invokerCache = invokerCache;
     _eventSource  = eventSource;
 }
Esempio n. 3
0
 public DiagnosticControllerBase(IStampService stampService, ICompilerHostClient compilerHostClient, ISourceWatcherService sourceWatcherService, IInvokerCacheService invokerCache, IDataSourcesConfigurationService dataSourcesConfigService)
 {
     this._compilerHostClient       = compilerHostClient;
     this._sourceWatcherService     = sourceWatcherService;
     this._invokerCache             = invokerCache;
     this._dataSourcesConfigService = dataSourcesConfigService;
     this._stampService             = stampService;
 }
Esempio n. 4
0
        public GitHubWatcher(IHostingEnvironment env, IConfiguration configuration, IInvokerCacheService invokerCache, IGithubClient githubClient)
            : base(env, configuration, invokerCache, "GithubWatcher")
        {
            _githubClient = githubClient;

            _lastModifiedMarkerName = "_lastModified.marker";
            _deleteMarkerName       = "_delete.marker";
            _cacheIdFileName        = "cacheId.txt";
            LoadConfigurations();
            Start();
        }
Esempio n. 5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GitHubWatcher" /> class.
        /// </summary>
        /// <param name="env">Hosting environment.</param>
        /// <param name="configuration">The configuration.</param>
        /// <param name="invokerCache">Invoker cache.</param>
        /// <param name="gistCache">Gist cache.</param>
        /// <param name="githubClient">Github client.</param>
        public GitHubWatcher(IHostingEnvironment env, IConfiguration configuration, IInvokerCacheService invokerCache, IGistCacheService gistCache, IGithubClient githubClient)
            : base(env, configuration, invokerCache, gistCache, "GithubWatcher")
        {
            _githubClient = githubClient;

            LoadConfigurations();

            #region Initialize Github Worker

            // TODO: Register the github worker with destination path.
            var gistWorker     = new GithubGistWorker(gistCache);
            var detectorWorker = new GithubDetectorWorker(invokerCache);

            GithubWorkers = new Dictionary <string, IGithubWorker>
            {
                { gistWorker.Name, gistWorker },
                { detectorWorker.Name, detectorWorker }
            };

            #endregion Initialize Github Worker

            Start();
        }
Esempio n. 6
0
 public SiteControllerBase(IStampService stampService, ISiteService siteService, ICompilerHostClient compilerHostClient, ISourceWatcherService sourceWatcherService, IInvokerCacheService invokerCache, IDataSourcesConfigurationService dataSourcesConfigService)
     : base(stampService, compilerHostClient, sourceWatcherService, invokerCache, dataSourcesConfigService)
 {
     this._siteService = siteService;
 }
 public HostingEnvironmentController(IStampService stampService, ICompilerHostClient compilerHostClient, ISourceWatcherService sourceWatcherService, IInvokerCacheService invokerCache, IDataSourcesConfigurationService dataSourcesConfigService)
     : base(stampService, compilerHostClient, sourceWatcherService, invokerCache, dataSourcesConfigService)
 {
 }
        public SourceWatcherService(IHostingEnvironment env, IConfiguration configuration, IInvokerCacheService invokerCacheService, IGistCacheService gistCacheService, ISearchService searchService)
        {
            SourceWatcherType watcherType;

            if (env.IsProduction())
            {
                string watcherTypeRegistryValue = Registry.GetValue(RegistryConstants.SourceWatcherRegistryPath, RegistryConstants.WatcherTypeKey, 0).ToString();
                if (!Enum.TryParse <SourceWatcherType>(watcherTypeRegistryValue, out watcherType))
                {
                    throw new NotSupportedException($"Source Watcher Type : {watcherTypeRegistryValue} not supported.");
                }
            }
            else
            {
                watcherType = Enum.Parse <SourceWatcherType>(configuration[$"SourceWatcher:{RegistryConstants.WatcherTypeKey}"]);
            }

            switch (watcherType)
            {
            case SourceWatcherType.LocalFileSystem:
                _watcher = new LocalFileSystemWatcher(env, configuration, invokerCacheService, gistCacheService);
                break;

            case SourceWatcherType.Github:
                IGithubClient githubClient = new GithubClient(env, configuration);
                _watcher = new GitHubWatcher(env, configuration, invokerCacheService, gistCacheService, githubClient, searchService);
                break;

            default:
                throw new NotSupportedException("Source Watcher Type not supported");
            }
        }
 public LocalFileSystemWatcher(IHostingEnvironment env, IConfiguration configuration, IInvokerCacheService invokerCache)
     : base(env, configuration, invokerCache, "LocalFileSystemWatcher")
 {
     LoadConfigurations();
     Start();
 }
 public AppServiceCertificateController(IStampService stampService, ICompilerHostClient compilerHostClient, ISourceWatcherService sourceWatcherService, IInvokerCacheService invokerCache, IDataSourcesConfigurationService dataSourcesConfigService)
     : base(stampService, compilerHostClient, sourceWatcherService, invokerCache, dataSourcesConfigService)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="GithubDetectorWorker"/> class.
 /// </summary>
 /// <param name="invokerCache">Invoker cache.</param>
 public GithubDetectorWorker(IInvokerCacheService invokerCache)
 {
     InvokerCache = invokerCache;
 }
 public LocalFileSystemWatcher(IHostingEnvironment env, IConfiguration configuration, IInvokerCacheService invokerCache, IGistCacheService gistCache)
     : base(env, configuration, invokerCache, gistCache, "LocalFileSystemWatcher")
 {
     LoadConfigurations();
     Start();
     _invokerDictionary = new Dictionary <EntityType, ICache <string, EntityInvoker> >
     {
         { EntityType.Detector, invokerCache },
         { EntityType.Signal, invokerCache },
         { EntityType.Gist, gistCache }
     };
 }