Esempio n. 1
0
        public ComponentRegistryService(
            StorageService storageService,
            SystemStatusService systemStatusService,
            MessageBusService messageBusService,
            AppService appService,
            ComponentInitializerService componentInitializerService,
            ILogger <ComponentRegistryService> logger)
        {
            _storageService              = storageService ?? throw new ArgumentNullException(nameof(storageService));
            _messageBusService           = messageBusService ?? throw new ArgumentNullException(nameof(messageBusService));
            _componentInitializerService = componentInitializerService ?? throw new ArgumentNullException(nameof(componentInitializerService));
            _logger = logger ?? throw new ArgumentNullException(nameof(logger));

            _messageBusWrapper = new ComponentRegistryMessageBusWrapper(messageBusService);

            if (systemStatusService == null)
            {
                throw new ArgumentNullException(nameof(systemStatusService));
            }
            systemStatusService.Set("component_registry.count", () => _components.Count);

            if (appService is null)
            {
                throw new ArgumentNullException(nameof(appService));
            }
            appService.RegisterStatusProvider("components", () =>
            {
                return(GetComponents().Select(c => ComponentsController.CreateComponentModel(c)));
            });
        }
        public NotificationsService(
            StorageService storageService,
            SystemStatusService systemStatusService,
            ResourcesService resourcesService,
            PythonEngineService pythonEngineService,
            MessageBusService messageBusService,
            SystemService systemService,
            ILoggerFactory loggerFactory)
        {
            _storageService    = storageService ?? throw new ArgumentNullException(nameof(storageService));
            _resourcesService  = resourcesService ?? throw new ArgumentNullException(nameof(resourcesService));
            _messageBusService = messageBusService ?? throw new ArgumentNullException(nameof(messageBusService));
            _systemService     = systemService ?? throw new ArgumentNullException(nameof(systemService));

            if (loggerFactory == null)
            {
                throw new ArgumentNullException(nameof(loggerFactory));
            }
            _logger = loggerFactory.CreateLogger <NotificationsService>();

            pythonEngineService.RegisterSingletonProxy(new NotificationsPythonProxy(this));

            if (systemStatusService == null)
            {
                throw new ArgumentNullException(nameof(systemStatusService));
            }
            systemStatusService.Set("notifications.count", () =>
            {
                lock (_notifications)
                {
                    return(_notifications.Count);
                }
            });
        }
Esempio n. 3
0
        public HistoryService(
            ComponentRegistryService componentRegistryService,
            StorageService storageService,
            MessageBusService messageBusService,
            SystemStatusService systemStatusService,
            SystemCancellationToken systemCancellationToken,
            DiagnosticsService diagnosticsService,
            ILogger <HistoryService> logger)
        {
            _componentRegistryService = componentRegistryService ?? throw new ArgumentNullException(nameof(componentRegistryService));
            _storageService           = storageService ?? throw new ArgumentNullException(nameof(storageService));
            _messageBusService        = messageBusService ?? throw new ArgumentNullException(nameof(messageBusService));
            _systemCancellationToken  = systemCancellationToken ?? throw new ArgumentNullException(nameof(systemCancellationToken));
            _logger = logger ?? throw new ArgumentNullException(nameof(logger));

            if (diagnosticsService == null)
            {
                throw new ArgumentNullException(nameof(diagnosticsService));
            }
            _updateRateCounter = diagnosticsService.CreateOperationsPerSecondCounter("history.update_rate");

            if (systemStatusService == null)
            {
                throw new ArgumentNullException(nameof(systemStatusService));
            }
            systemStatusService.Set("history.component_status.pending_updates_count", _pendingComponentStatusValues.Count);
            systemStatusService.Set("history.component_status.update_rate", () => _updateRateCounter.Count);
            systemStatusService.Set("history.component_status.update_duration", () => _componentStatusUpdateDuration);
        }
        public ComponentRegistryService(
            StorageService storageService,
            SystemStatusService systemStatusService,
            MessageBusService messageBusService,
            ComponentInitializerFactory componentInitializerFactory,
            PythonEngineService pythonEngineService,
            ILoggerFactory loggerFactory)
        {
            _storageService              = storageService ?? throw new ArgumentNullException(nameof(storageService));
            _messageBusService           = messageBusService ?? throw new ArgumentNullException(nameof(messageBusService));
            _componentInitializerFactory = componentInitializerFactory ?? throw new ArgumentNullException(nameof(componentInitializerFactory));

            _messageBusProxy = new ComponentRegistryMessageBusProxy(messageBusService);

            pythonEngineService.RegisterSingletonProxy(new ComponentRegistryPythonProxy(this));

            if (loggerFactory == null)
            {
                throw new ArgumentNullException(nameof(loggerFactory));
            }
            _logger = loggerFactory.CreateLogger <ComponentRegistryService>();

            if (systemStatusService == null)
            {
                throw new ArgumentNullException(nameof(systemStatusService));
            }
            systemStatusService.Set("component_registry.count", () => _components.Count);
        }
Esempio n. 5
0
        public NotificationsService(
            StorageService storageService,
            SystemStatusService systemStatusService,
            ResourceService resourcesService,
            MessageBusService messageBusService,
            SystemCancellationToken systemCancellationToken,
            ILogger <NotificationsService> logger)
        {
            _storageService          = storageService ?? throw new ArgumentNullException(nameof(storageService));
            _resourcesService        = resourcesService ?? throw new ArgumentNullException(nameof(resourcesService));
            _messageBusService       = messageBusService ?? throw new ArgumentNullException(nameof(messageBusService));
            _systemCancellationToken = systemCancellationToken ?? throw new ArgumentNullException(nameof(systemCancellationToken));
            _logger = logger ?? throw new ArgumentNullException(nameof(logger));

            if (systemStatusService == null)
            {
                throw new ArgumentNullException(nameof(systemStatusService));
            }
            systemStatusService.Set("notifications.count", () =>
            {
                lock (_notifications)
                {
                    return(_notifications.Count);
                }
            });
        }
 public GlobalVariablesService(
     StorageService storageService,
     MessageBusService messageBusService,
     ILogger <GlobalVariablesService> logger)
 {
     _storageService    = storageService ?? throw new ArgumentNullException(nameof(storageService));
     _messageBusService = messageBusService ?? throw new ArgumentNullException(nameof(messageBusService));
     _logger            = logger ?? throw new ArgumentNullException(nameof(logger));
 }
        protected internal MessageBusService GetMessageBusService()
        {
            MessageBusService service = new MessageBusService();

            service.GetType()
            .GetProperty("MessageBus", BindingFlags.Instance | BindingFlags.Public)
            .SetValue(service, new TestMessageBusService());
            return(service);
        }
        public GpioRegistryService(PythonEngineService pythonEngineService, MessageBusService messageBusService, ILoggerFactory loggerFactory)
        {
            if (pythonEngineService == null)
            {
                throw new ArgumentNullException(nameof(pythonEngineService));
            }
            _messageBusService = messageBusService ?? throw new ArgumentNullException(nameof(messageBusService));

            _logger = loggerFactory?.CreateLogger <GpioRegistryService>() ?? throw new ArgumentNullException(nameof(loggerFactory));

            pythonEngineService.RegisterSingletonProxy(new GpioPythonProxy(this, loggerFactory));
        }
 public AutomationRegistryService(
     PackageManagerService packageManagerService,
     PythonScriptHostFactoryService pythonScriptHostFactoryService,
     StorageService storageService,
     MessageBusService messageBusService,
     ILogger <AutomationRegistryService> logger)
 {
     _packageManagerService          = packageManagerService ?? throw new ArgumentNullException(nameof(packageManagerService));
     _pythonScriptHostFactoryService = pythonScriptHostFactoryService ?? throw new ArgumentNullException(nameof(pythonScriptHostFactoryService));
     _storageService    = storageService ?? throw new ArgumentNullException(nameof(storageService));
     _messageBusService = messageBusService ?? throw new ArgumentNullException(nameof(messageBusService));
     _logger            = logger ?? throw new ArgumentNullException(nameof(logger));
 }
Esempio n. 10
0
        public GlobalVariablesService(
            StorageService storageService,
            MessageBusService messageBusService,
            ILoggerFactory loggerFactory)
        {
            _storageService    = storageService ?? throw new ArgumentNullException(nameof(storageService));
            _messageBusService = messageBusService ?? throw new ArgumentNullException(nameof(messageBusService));

            if (loggerFactory == null)
            {
                throw new ArgumentNullException(nameof(loggerFactory));
            }
            _logger = loggerFactory.CreateLogger <GlobalVariablesService>();
        }
Esempio n. 11
0
        public SystemService(
            SystemStatusService systemStatusService,
            SystemLaunchArguments systemLaunchArguments,
            SystemCancellationToken systemCancellationToken,
            NotificationsService notificationsService,
            MessageBusService messageBusService,
            ILogger <SystemService> logger)
        {
            _systemStatusService   = systemStatusService ?? throw new ArgumentNullException(nameof(systemStatusService));
            _systemLaunchArguments = systemLaunchArguments ?? throw new ArgumentNullException(nameof(systemLaunchArguments));
            _notificationsService  = notificationsService ?? throw new ArgumentNullException(nameof(notificationsService));
            _messageBusService     = messageBusService ?? throw new ArgumentNullException(nameof(messageBusService));
            _logger = logger ?? throw new ArgumentNullException(nameof(logger));

            _creationTimestamp = DateTime.Now;
        }
Esempio n. 12
0
        public ComponentGroupRegistryService(
            StorageService storageService,
            SystemStatusService systemInformationService,
            MessageBusService messageBusService,
            ILogger <ComponentGroupRegistryService> logger)
        {
            _storageService    = storageService ?? throw new ArgumentNullException(nameof(storageService));
            _messageBusService = messageBusService ?? throw new ArgumentNullException(nameof(messageBusService));
            _logger            = logger ?? throw new ArgumentNullException(nameof(logger));

            if (systemInformationService == null)
            {
                throw new ArgumentNullException(nameof(systemInformationService));
            }
            systemInformationService.Set("component_group_registry.count", () => _componentGroups.Count);
        }
Esempio n. 13
0
        public MainWindow()
        {
            this.db                = App.ServiceProvider.GetService(typeof(DatabaseService)) as DatabaseService;
            this.serverService     = App.ServiceProvider.GetService(typeof(ServerService)) as ServerService;
            this.messageBusService = App.ServiceProvider.GetService(typeof(MessageBusService)) as MessageBusService;



            this.messageBusService.RegisterEvent("appchanged", (appid) =>
            {
                Dispatcher.Invoke(() =>
                {
                    ReloadData();
                });
            });


            this.messageBusService.RegisterEvent("serverstatuschanged", (status) =>
            {
                ServerStatus   = this.serverService.GetServerStatus();
                this.Title     = "jSOS Server Status:" + ServerStatus;
                statusToUpdate = true;
            });

            SelectChildPermission = new RelayCommand <List <object> >(args =>
            {
                OnSelectChildPermission(args);
            }, o => true);



            SavePermission = new RelayCommand((obj) =>
            {
                OnSavePermission(obj);
            }, o => true);

            SaveSettings = new RelayCommand <Settings>((obj) =>
            {
                OnSaveSettings(obj);
            }, o => true);

            ReloadData();



            InitializeComponent();
        }
        public AutomationRegistryService(
            RepositoryService repositoryService,
            PythonScriptHostFactoryService pythonScriptHostFactoryService,
            StorageService storageService,
            MessageBusService messageBusService,
            ILoggerFactory loggerFactory)
        {
            _repositoryService = repositoryService ?? throw new ArgumentNullException(nameof(repositoryService));
            _pythonScriptHostFactoryService = pythonScriptHostFactoryService ?? throw new ArgumentNullException(nameof(pythonScriptHostFactoryService));
            _storageService    = storageService ?? throw new ArgumentNullException(nameof(storageService));
            _messageBusService = messageBusService ?? throw new ArgumentNullException(nameof(messageBusService));

            if (loggerFactory == null)
            {
                throw new ArgumentNullException(nameof(loggerFactory));
            }
            _logger = loggerFactory.CreateLogger <AutomationRegistryService>();
        }
        public MacroRegistryService(
            StorageService storageService,
            MessageBusService messageBusService,
            SystemStatusService systemStatusService,
            ComponentRegistryService componentRegistryService,
            ILogger <MacroRegistryService> logger)
        {
            _storageService           = storageService ?? throw new ArgumentNullException(nameof(storageService));
            _messageBusService        = messageBusService ?? throw new ArgumentNullException(nameof(messageBusService));
            _componentRegistryService = componentRegistryService ?? throw new ArgumentNullException(nameof(componentRegistryService));
            _logger = logger ?? throw new ArgumentNullException(nameof(logger));

            if (systemStatusService == null)
            {
                throw new ArgumentNullException(nameof(systemStatusService));
            }
            systemStatusService.Set("macro_registry.count", () => _macros.Count);

            _messageBusWrapper = new MacroRegistryMessageBusWrapper(_messageBusService);
        }
Esempio n. 16
0
        public GlobalVariablesService(
            StorageService storageService,
            PythonEngineService pythonEngineService,
            MessageBusService messageBusService,
            ILoggerFactory loggerFactory)
        {
            _storageService    = storageService ?? throw new ArgumentNullException(nameof(storageService));
            _messageBusService = messageBusService ?? throw new ArgumentNullException(nameof(messageBusService));

            if (loggerFactory == null)
            {
                throw new ArgumentNullException(nameof(loggerFactory));
            }
            _logger = loggerFactory.CreateLogger <GlobalVariablesService>();

            if (pythonEngineService == null)
            {
                throw new ArgumentNullException(nameof(pythonEngineService));
            }
            pythonEngineService.RegisterSingletonProxy(new GlobalVariablesPythonProxy(this));
        }
        public MacroRegistryService(
            StorageService storageService,
            MessageBusService messageBusService,
            SystemStatusService systemStatusService,
            ILoggerFactory loggerFactory)
        {
            _storageService      = storageService ?? throw new ArgumentNullException(nameof(storageService));
            _messageBusService   = messageBusService ?? throw new ArgumentNullException(nameof(messageBusService));
            _systemStatusService = systemStatusService ?? throw new ArgumentNullException(nameof(systemStatusService));

            if (loggerFactory == null)
            {
                throw new ArgumentNullException(nameof(loggerFactory));
            }
            _logger = loggerFactory.CreateLogger <MacroRegistryService>();

            if (systemStatusService == null)
            {
                throw new ArgumentNullException(nameof(systemStatusService));
            }
            systemStatusService.Set("macros.macros_count", () => 0);
        }
Esempio n. 18
0
        public ComponentGroupRegistryService(
            StorageService storageService,
            SystemStatusService systemInformationService,
            MessageBusService messageBusService,
            AppService appService,
            ILogger <ComponentGroupRegistryService> logger)
        {
            _storageService    = storageService ?? throw new ArgumentNullException(nameof(storageService));
            _messageBusService = messageBusService ?? throw new ArgumentNullException(nameof(messageBusService));
            _appService        = appService ?? throw new ArgumentNullException(nameof(appService));
            _logger            = logger ?? throw new ArgumentNullException(nameof(logger));

            if (systemInformationService == null)
            {
                throw new ArgumentNullException(nameof(systemInformationService));
            }
            systemInformationService.Set("component_group_registry.count", () => _componentGroups.Count);

            appService.RegisterStatusProvider("componentGroups", () =>
            {
                return(GetComponentGroups().Select(c => ComponentGroupsController.CreateComponentGroupModel(c)));
            });
        }
Esempio n. 19
0
 public ComponentRegistryMessageBusProxy(MessageBusService messageBusService)
 {
     _messageBusService = messageBusService ?? throw new ArgumentNullException(nameof(messageBusService));
 }
Esempio n. 20
0
 public BaseController(DatabaseService databaseService, MessageBusService messageBusService)
 {
     this.DatabaseService   = databaseService;
     this.MessageBusService = messageBusService;
 }
Esempio n. 21
0
 public FileSystemController(DatabaseService databaseService, MessageBusService messageBusService) : base(databaseService, messageBusService)
 {
 }
Esempio n. 22
0
 public MessageBusServicePythonProxy(MessageBusService messageBusService)
 {
     _messageBusService = messageBusService ?? throw new ArgumentNullException(nameof(messageBusService));
 }
Esempio n. 23
0
 public MacroRegistryMessageBusWrapper(MessageBusService messageBusService)
 {
     _messageBusService = messageBusService ?? throw new ArgumentNullException(nameof(messageBusService));
 }
 public GpioRegistryService(MessageBusService messageBusService, ILoggerFactory loggerFactory)
 {
     _messageBusService = messageBusService ?? throw new ArgumentNullException(nameof(messageBusService));
     _logger            = loggerFactory?.CreateLogger <GpioRegistryService>() ?? throw new ArgumentNullException(nameof(loggerFactory));
 }
Esempio n. 25
0
 public ServerService(MessageBusService messageBusService)
 {
     this.messageBusService = messageBusService;
 }
Esempio n. 26
0
 public MessageParser(MessageBusService messageBus)
 {
     MessageBus = messageBus?.MessageBus;
 }
Esempio n. 27
0
 public GpioRegistryService(MessageBusService messageBusService, ILogger <GpioRegistryService> logger)
 {
     _messageBusService = messageBusService ?? throw new ArgumentNullException(nameof(messageBusService));
     _logger            = logger ?? throw new ArgumentNullException(nameof(logger));
 }
Esempio n. 28
0
 public AppController(DatabaseService databaseService, MessageBusService messageBusService) : base(databaseService, messageBusService)
 {
 }
 public ImageMessageParser(MessageBusService messageBus, IImageTemplateRepository imageTemplateRepository)
     : base(messageBus)
 {
     ImageTemplateRepository = imageTemplateRepository;
 }
Esempio n. 30
0
 public MessageBusController(MessageBusService messageBusService)
 {
     _messageBusService = messageBusService ?? throw new ArgumentNullException(nameof(messageBusService));
 }