예제 #1
0
        /// <summary>
        /// Creates core service instances and registers them in <see cref="ServiceRegistration"/>.
        /// </summary>
        public static void RegisterCoreServices()
        {
            ILogger logger = ServiceRegistration.Get <ILogger>();

            logger.Debug("ApplicationCore: Registering IImpersonationService");
            ServiceRegistration.Set <IImpersonationService>(new ImpersonationService());

            logger.Debug("ApplicationCore: Registering IRegistry service");
            ServiceRegistration.Set <IRegistry>(new Services.Registry.Registry());

            logger.Debug("ApplicationCore: Registering IThreadPool service");
            ServiceRegistration.Set <IThreadPool>(new ThreadPool());

            logger.Debug("ApplicationCore: Registering IMessageBroker service");
            ServiceRegistration.Set <IMessageBroker>(new MessageBroker());

            logger.Debug("ApplicationCore: Registering IPluginManager service");
            ServiceRegistration.Set <IPluginManager>(new Services.PluginManager.PluginManager());

            logger.Debug("ApplicationCore: Registering ILocalization service");
            ServiceRegistration.Set <ILocalization>(new StringManager());

            logger.Debug("ApplicationCore: Registering ITaskScheduler service");
            ServiceRegistration.Set <ITaskScheduler>(new Services.TaskScheduler.TaskScheduler());

            logger.Debug("ApplicationCore: Registering IMediaAccessor service");
            ServiceRegistration.Set <IMediaAccessor>(new MediaAccessor());

            // ToDo: Remove the old ImporterWorker and this setting once the NewGen ImporterWorker actually works
            var importerWorkerSettings = ServiceRegistration.Get <ISettingsManager>().Load <ImporterWorkerSettings>();

            if (importerWorkerSettings.UseNewImporterWorker)
            {
                logger.Debug("ApplicationCore: Registering IImporterWorker NewGen service");
                ServiceRegistration.Set <IImporterWorker>(new ImporterWorkerNewGen());
            }
            else
            {
                logger.Debug("ApplicationCore: Registering IImporterWorker service");
                ServiceRegistration.Set <IImporterWorker>(new ImporterWorker());
            }
            ServiceRegistration.Get <ISettingsManager>().Save(importerWorkerSettings);

            logger.Debug("ApplicationCore: Registering IResourceServer service");
            ServiceRegistration.Set <IResourceServer>(new ResourceServer());

            logger.Debug("ApplicationCore: Registering IResourceMountingService");
            ServiceRegistration.Set <IResourceMountingService>(new ResourceMountingService());

            logger.Debug("ApplicationCore: Registering IRemoteResourceInformationService");
            ServiceRegistration.Set <IRemoteResourceInformationService>(new RemoteResourceInformationService());

            logger.Debug("ApplicationCore: Registering IThumbnailGenerator service");
            ServiceRegistration.Set <IThumbnailGenerator>(new ThumbnailGenerator());

            AdditionalPluginItemBuilders.Register();
        }
예제 #2
0
        public static void RegisterUiServices()
        {
            ILogger logger = ServiceRegistration.Get <ILogger>();

            logger.Debug("UiExtension: Registering INotificationService service");
            ServiceRegistration.Set <INotificationService>(new NotificationService());

            logger.Debug("UiExtension: Registering ISystemResolver service");
            ServiceRegistration.Set <ISystemResolver>(new SystemResolver());

            logger.Debug("UiExtension: Registering IWorkflowManager service");
            ServiceRegistration.Set <IWorkflowManager>(new WorkflowManager());

            logger.Debug("UiExtension: Registering IPlayerManager service");
            ServiceRegistration.Set <IPlayerManager>(new PlayerManager());

            logger.Debug("UiExtension: Registering IPlayerContextManager service");
            ServiceRegistration.Set <IPlayerContextManager>(new PlayerContextManager());

            logger.Debug("UiExtension: Registering ILocalSharesManagement service");
            ServiceRegistration.Set <ILocalSharesManagement>(new LocalSharesManagement());

            logger.Debug("UiExtension: Registering IServerConnectionManager service");
            ServiceRegistration.Set <IServerConnectionManager>(new ServerConnectionManager());

            logger.Debug("UiExtension: Registering IUserManagement service");
            ServiceRegistration.Set <IUserManagement>(new UserManagement());

            logger.Debug("UiExtension: Registering IMediaItemAspectTypeRegistration service");
            ServiceRegistration.Set <IMediaItemAspectTypeRegistration>(new MediaItemAspectTypeRegistration());

            logger.Debug("UiExtension: Registering IRelationshipTypeRegistration service");
            ServiceRegistration.Set <IRelationshipTypeRegistration>(new RelationshipTypeRegistration());

            logger.Debug("UiExtension: Registering IFrontendServer service");
            ServiceRegistration.Set <IFrontendServer>(new Services.FrontendServer.FrontendServer());

            logger.Debug("UiExtension: Registering IRemovableMediaTracker service");
            ServiceRegistration.Set <IRemovableMediaTracker>(new Services.RemovableMedia.RemovableMediaTracker());

            AdditionalPluginItemBuilders.Register();
        }
예제 #3
0
        /// <summary>
        /// Creates core service instances and registers them in <see cref="ServiceRegistration"/>. The optional <paramref name="dataDirectory"/> argument can
        /// be used to startup the application using a custom directory for data storage.
        /// </summary>
        /// <param name="dataDirectory">Path to custom data directory</param>
        public static void RegisterCoreServices(string dataDirectory = null)
        {
            // Insert a dummy while loading the path manager to break circular dependency of logger and path manager. This should not
            // be considered as a hack - simply the logger needs a path managed by the path manager and I don't want to remove log
            // output from the path manager only to prevent the dependency. Maybe we have a better solution in the future.
            ServiceRegistration.Set <ILogger>(new NoLogger());

            Services.PathManager.PathManager pathManager = new Services.PathManager.PathManager();
            pathManager.InitializeDefaults();
            if (!string.IsNullOrEmpty(dataDirectory))
            {
                pathManager.SetPath("DATA", dataDirectory);
            }

            ServiceRegistration.Set <IPathManager>(pathManager);

            ILogger logger = new Log4NetLogger(pathManager.GetPath(@"<LOG>"));

            logger.Info("ApplicationCore: Launching in AppDomain {0}...", AppDomain.CurrentDomain.FriendlyName);

            logger.Debug("ApplicationCore: Registering ILogger service");
            ServiceRegistration.Set <ILogger>(logger);

            logger.Debug("ApplicationCore: Registering IRegistry service");
            ServiceRegistration.Set <IRegistry>(new Services.Registry.Registry());

            logger.Debug("ApplicationCore: Registering IThreadPool service");
            ServiceRegistration.Set <IThreadPool>(new ThreadPool());

            logger.Debug("ApplicationCore: Registering IMessageBroker service");
            ServiceRegistration.Set <IMessageBroker>(new MessageBroker());

            logger.Debug("ApplicationCore: Registering IPluginManager service");
            ServiceRegistration.Set <IPluginManager>(new Services.PluginManager.PluginManager());

            logger.Debug("ApplicationCore: Registering ISettingsManager service");
            ServiceRegistration.Set <ISettingsManager>(new SettingsManager());

            logger.Debug("ApplicationCore: Registering ILocalization service");
            ServiceRegistration.Set <ILocalization>(new StringManager());

            logger.Debug("ApplicationCore: Registering ITaskScheduler service");
            ServiceRegistration.Set <ITaskScheduler>(new Services.TaskScheduler.TaskScheduler());

            logger.Debug("ApplicationCore: Registering IMediaAccessor service");
            ServiceRegistration.Set <IMediaAccessor>(new MediaAccessor());

            logger.Debug("ApplicationCore: Registering IImporterWorker service");
            ServiceRegistration.Set <IImporterWorker>(new ImporterWorker());

            logger.Debug("ApplicationCore: Registering IResourceServer service");
            ServiceRegistration.Set <IResourceServer>(new ResourceServer());

            logger.Debug("ApplicationCore: Registering IResourceMountingService");
            ServiceRegistration.Set <IResourceMountingService>(new ResourceMountingService());

            logger.Debug("ApplicationCore: Registering IRemoteResourceInformationService");
            ServiceRegistration.Set <IRemoteResourceInformationService>(new RemoteResourceInformationService());

            logger.Debug("ApplicationCore: Registering IThumbnailGenerator service");
            ServiceRegistration.Set <IThumbnailGenerator>(new ThumbnailGenerator());

            AdditionalPluginItemBuilders.Register();
        }