Esempio n. 1
0
        public WurmServerHistory(
            [NotNull] string dataDirectoryFullPath,
            [NotNull] IWurmLogsHistory wurmLogsHistory,
            IWurmServerList wurmServerList,
            IWurmApiLogger logger,
            IWurmLogsMonitorInternal wurmLogsMonitor,
            IWurmLogFiles wurmLogFiles,
            IInternalEventAggregator internalEventAggregator,
            [NotNull] IWurmServerGroups wurmServerGroups,
            [NotNull] IWurmApiConfig wurmApiConfig)
        {
            if (dataDirectoryFullPath == null)
            {
                throw new ArgumentNullException(nameof(dataDirectoryFullPath));
            }
            if (wurmLogsHistory == null)
            {
                throw new ArgumentNullException(nameof(wurmLogsHistory));
            }
            if (wurmServerGroups == null)
            {
                throw new ArgumentNullException(nameof(wurmServerGroups));
            }
            if (wurmApiConfig == null)
            {
                throw new ArgumentNullException(nameof(wurmApiConfig));
            }
            this.wurmLogsHistory  = wurmLogsHistory;
            this.wurmServerGroups = wurmServerGroups;
            this.wurmApiConfig    = wurmApiConfig;

            IPersistenceStrategy persistenceStrategy = new FlatFilesPersistenceStrategy(dataDirectoryFullPath);

            var persistentLibrary =
                new PersistentCollectionsLibrary(persistenceStrategy,
                                                 new PersObjErrorHandlingStrategy(logger));
            var collection = persistentLibrary.GetCollection("serverhistory");

            var providerFactory = new ServerHistoryProviderFactory(
                collection,
                wurmLogsHistory,
                wurmServerList,
                logger,
                wurmLogsMonitor,
                wurmLogFiles,
                internalEventAggregator);


            jobExecutor = new JobExecutor(providerFactory, persistentLibrary);
            runner      = new QueuedJobsSyncRunner <object, ServerName>(jobExecutor, logger);
        }
Esempio n. 2
0
 public JobExecutor([NotNull] ServerHistoryProviderFactory serverHistoryProviderFactory,
                    [NotNull] PersistentCollectionsLibrary persistentLibrary)
 {
     if (serverHistoryProviderFactory == null)
     {
         throw new ArgumentNullException(nameof(serverHistoryProviderFactory));
     }
     if (persistentLibrary == null)
     {
         throw new ArgumentNullException(nameof(persistentLibrary));
     }
     this.serverHistoryProviderFactory = serverHistoryProviderFactory;
     this.persistentLibrary            = persistentLibrary;
 }
Esempio n. 3
0
        public WurmServerHistory(
            string dataDirectoryFullPath,
            IWurmLogsHistory wurmLogsHistory,
            IWurmServerList wurmServerList,
            ILogger logger,
            IWurmLogsMonitorInternal wurmLogsMonitor,
            IWurmLogFiles wurmLogFiles)
        {
            var persistentLibrary =
                new PersistentCollectionsLibrary(new FlatFilesPersistenceStrategy(dataDirectoryFullPath),
                    new PersObjErrorHandlingStrategy(logger));
            var collection = persistentLibrary.GetCollection("serverhistory");

            var providerFactory = new ServerHistoryProviderFactory(
                collection,
                wurmLogsHistory,
                wurmServerList,
                logger,
                wurmLogsMonitor,
                wurmLogFiles);

            runner = new QueuedJobsSyncRunner<object, ServerName>(new JobExecutor(providerFactory, persistentLibrary), logger);
        }