public ConfigurationView(ISystemConfiguration configuration, DevicesView view)
        {
            this.configuration = configuration;
            this.DevicesView = view;

            DefaultConfigure();
        }
        public QueuingSystem(ISystemConfiguration configuration, ISystemClock clock, IEngine engine, ISystemStatistics statistics)
        {
            Statistics = statistics;
            Configuration = configuration;

            Configuration.Devices.RequestHandledEvent += OnRequestHandled;
            engine.NewRequestEvent += OnNewRequest;
            clock.TickEvent += OnTickEvent;
        }
Example #3
0
        /// <summary>Initializes a new instance of the <see cref="WebCrawlerActor"/> class.</summary>
        /// <param name="systemConfiguration">The system configuration.</param>
        /// <param name="client"></param>
        public WebCrawlerActor(ISystemConfiguration systemConfiguration, IActorRef root)
        {
            _systemConfiguration = systemConfiguration;
            _root   = root;
            _client = new HttpClient();
            _httpTimeoutInMiniseconds = systemConfiguration.HttpTimeoutInMiniseconds;

            SetupHttpClient();

            Receive <RootActorMessages.AddressBook>(
                b =>
            {
                _actorDictionary = b.ActorDictionary;
                _gotBook         = true;
                Stash.UnstashAll();
            });

            Receive <CrawlerMessages.GetData>(
                m =>
            {
                if (_gotBook)
                {
                    ProcessGetMessage(m);
                    _lastActivity = DateTime.Now;
                }
                else
                {
                    Stash.Stash();
                }
            });

            Receive <CrawlerMessages.WebApiErrorResponse>(a => { ProcessWebErrorMessage(a); });

            Receive <CrawlerMessages.PipedRequest>(o => { ProcessPipedRequest(o); });

            Receive <CrawlerMessages.Timer>(
                t =>
            {
                if (_gotBook)
                {
                    ProcessTimer();
                }
                else
                {
                    Stash.Stash();
                }
            });
        }
        /// <summary>Initializes a new instance of the <see cref="RootActor"/> class.</summary>
        /// <param name="systemConfiguration">The system Configuration.</param>
        public RootActor(ISystemConfiguration systemConfiguration)
        {
            _systemConfiguration = systemConfiguration;

            Receive <RootActorMessages.AddressBookRequest>(
                a =>
            {
                Sender.Tell(new RootActorMessages.AddressBook(_actorDictionary));
            });
            Receive <RootActorMessages.StartSystem>(
                me =>
            {
                _started            = DateTime.Now;
                _startSystemMessage = me;
                if (!systemConfiguration.WaitForClusterStartMessage)
                {
                    _log.Info("Starting system directly");
                    StartSystem();
                }
            });

            Receive <RootActorMessages.FatalError>(
                a =>
            {
                _log.Error($"shutting down system - fatal error received, description: {a.Description ?? "none provided..."}");
                StopSystem();
            });

            Receive <RootActorMessages.HaltSystem>(
                a =>
            {
                _log.Info("Halting system");
                var duration = (DateTime.Now - _started).TotalSeconds;
                _log.Info("**************************************");
                _log.Info($"Time consumed: {duration} seconds");
                _log.Info("**************************************");
                Context.System.Terminate();
                Thread.Sleep(3000);         // allow to flush log buffer
            });

            Receive <RootActorMessages.ProcessFinished>(a => { StopSystem(); });
            Receive <StartFromCli>(
                o =>
            {
                StartSystem();
            });
        }
Example #5
0
        }                                                                      // Предполагается, что работа с коллекцией будет производиться из потока пользователя

        public DeviceConfiguration(IWorker <Action> backWorker, IThreadNotifier uiNotifier)
        {
            _backWorker = backWorker;
            _uiNotifier = uiNotifier;
            _flasher    = new DeviceFlasher(_backWorker, _uiNotifier);

            _customConfig  = new CustomConfigurationBuilderDefault().BuildConfiguration();
            _systemConfig  = new SystemConfigurationBuilderDefault().BuildConfiguration();
            _commandConfig = new CommandConfigurationBuilderDefault().BuildConfiguration();

            RpdMeters = new ObservableCollection <IRpdMeter>();

            Comment = string.Empty;

            _cycledPsnCmdPartInfos = new List <ICyclePsnCmdPartInfo>();
            _psnChannelInfos       = new List <IPsnChannelInfo>();
            PsnMeters = new ObservableCollection <IPsnMeter>();
        }
Example #6
0
        public static void printPrams(RiverSystemScenario scenario, ISystemConfiguration pSet)
        {
            StringBuilder sb = new StringBuilder();

            foreach (Catchment c in scenario.Network.catchmentList)
            {
                foreach (StandardFunctionalUnit fu in c.FunctionalUnits)
                {
                    List <AccessorMemberInfo> accessorInfoList = MetaParameterSet.KnownParameters(fu.rainfallRunoffModel);
                    foreach (var accessorMemberInfo in accessorInfoList)
                    {
                        sb.AppendLine(c.Name + ":" + fu.definition.Name + ":" + accessorMemberInfo.Name + ":" + accessorMemberInfo.GetValue(fu.rainfallRunoffModel));
                    }
                    sb.AppendLine("-----");
                }
            }
            (pSet as MetaParameterSet).RealConfiguration = sb.ToString();
            Console.WriteLine(sb.ToString());
        }
        public void TestInitialize()
        {
            generator = new MockSystemGenerator();

            clock = new SystemClock();
            engine = new Engine(clock, generator);
            devices = new SystemDevices(clock);


            systemDiscipline = new Fifo {TotalSize = 10};

            configuration = new SystemConfiguration(generator, devices, systemDiscipline);

            statistics = new SystemStatistics();

            system = new QueuingSystem(configuration, clock, engine, statistics);

            InitializeDevices();
        }
        /// <summary>Initializes a new instance of the <see cref="DataDispatcherActor"/> class.</summary>
        /// <param name="systemConfiguration">The system configuration.</param>
        public DataDispatcherActor(ISystemConfiguration systemConfiguration)
        {
            SetupActor(systemConfiguration);
            _readLinesBatchSize = _systemConfiguration.ReadLinesBatchSize;

            Receive <FileMessages.StartProcessing>(
                e =>
            {
                _actorDictionary = e.ActorDict;
                _crawler         = _actorDictionary["WebCrawlerActor"];
                _flowControl     = _actorDictionary["FlowControlActor"];
                RequestNewLines();
            });

            Receive <FileMessages.GetNextChunk>(a => { RequestNewLines(); });

            Receive <FileMessages.CannotReadFile>(
                error => { _actorDictionary["root"].Tell(new RootActorMessages.FatalError("Cannot Read Input File")); });

            Receive <FileMessages.EndOfFile>(a => { _flowControl.Tell(new FlowControlMessages.EoF()); });
        }
Example #9
0
        /// <summary>Initializes a new instance of the <see cref="FlowControlActor"/> class.</summary>
        /// <param name="systemConfiguration">The system configuration.</param>
        public FlowControlActor(ISystemConfiguration systemConfiguration)
        {
            _systemConfiguration = systemConfiguration;
            _lastChunkSent       = DateTime.Now;

            Receive <FlowControlMessages.Timer>(t => { _log.Info("Wainting for: StartProcessing"); });

            Receive <FlowControlMessages.StartProcessing>(
                m =>
            {
                _actorDictionary = m.ActorDictionary;
                Become(Processing);
                _actorDictionary["DataDispatcherActor"].Tell(new FileMessages.StartProcessing(_actorDictionary));
            });

            Receive <FlowControlMessages.GetNewLinesForCrawler>(
                m =>
            {
                /* swallow that as we are not ready yet */
            });
        }
Example #10
0
        /// <summary>Initializes a new instance of the <see cref="FileReaderActor"/> class.</summary>
        /// <param name="fileReader">The file reader.</param>
        /// <param name="systemConfiguration">The system Configuration.</param>
        public FileReaderActor(IFileReader fileReader, ISystemConfiguration systemConfiguration)
        {
            _fileReader        = fileReader;
            _internalChunkSize = systemConfiguration.InternalChunkSize;
            Receive <RootActorMessages.AddressBook>(b => { _actorDictionary = b.ActorDictionary; });

            Receive <FileMessages.CheckInputFile>(
                fileMessage =>
            {
                _log.Info($"Processing input file validation for: {fileMessage.FileName}");
                _fileName       = fileMessage.FileName;
                var checkResult = CheckFile(fileMessage.FileName);
                var response    = new FileMessages.FileValidated(fileMessage.FileName, checkResult);
                Sender.Tell(response);

                if (checkResult)
                {
                    // change state only when file is ok
                    Become(ValidatingHeader);
                }
            });
        }
 public static SystemConfiguration Convert(ISystemConfiguration sysConfig)
 {
     var hc = sysConfig as IHyperCube<double>;
     if (hc == null)
         throw new NotSupportedException("Can only represent system configurations that are hypercubes, as yet");
     var varNames = hc.GetVariableNames();
     var result = new HyperCube();
     result.Name = hc.GetConfigurationDescription();
     // TODO
     //result.Tags.Tags.Add(new Tag() { Name = "", Value = "" });
     result.Variables = new List<VariableSpecification>();
     foreach (var varName in varNames)
     {
         result.Variables.Add(new VariableSpecification
         {
             Name = varName,
             Value = hc.GetValue(varName),
             Minimum = hc.GetMinValue(varName),
             Maximum = hc.GetMaxValue(varName)
         });
     }
     return result;
 }
        /// <summary>Initializes a new instance of the <see cref="ValidatorActor"/> class.</summary>
        /// <param name="systemConfiguration">The system configuration.</param>
        public ValidatorActor(ISystemConfiguration systemConfiguration)
        {
            _systemConfiguration = systemConfiguration;
            Receive <ValidatorMessages.Validate>(
                m =>
            {
                Become(WaitingForResponses);
                _actorDictionary = m.ActorDictionary;
                _root            = Sender;
                _log.Info("Check starts ");

                _log.Info("Output file ");

                _actorDictionary["FileWriterActor"].Tell(
                    new FileWriterMessages.CreateFile(m.OutputFilePath, _systemConfiguration.StopIfDestinationFileExists, _actorDictionary));

                _log.Info("Input file ");
                _actorDictionary["FileValidatorActor"].Tell(
                    new FileMessages.CheckInputFile(m.InputFilePath, _actorDictionary, _systemConfiguration.HeaderValidationRegex));

                _log.Info("Web ");
                _actorDictionary["WebCheckerActor"].Tell(new CrawlerMessages.CheckEndpoint());
            });
        }
 public RecursoGrpcService(IMapper mapper, ISystemConfiguration systemConfiguration)
     : base(mapper, systemConfiguration)
 {
     _client = new Recurso.RecursoClient(_channel);
 }
Example #14
0
 /// <summary>
 /// Sets the static instance of the configuration.
 /// </summary>
 /// <param name="Configuration">Configuration object</param>
 public override void SetStaticInstance(ISystemConfiguration Configuration)
 {
     instance = Configuration as Introduction;
 }
Example #15
0
 public AuthController(ISystemConfiguration systemConfiguration)
 {
     _systemConfiguration = systemConfiguration;
 }
 public static IPermissionsManager CreateInstance(ILogger logger, IDataComponent dataComponent, ISystemConfiguration systemConfig)
 {
     return(Instance = new PermissionsManager(logger, dataComponent, systemConfig));
 }
Example #17
0
 public RecursoController(IRecursoAppService recursoAppService, ISystemConfiguration systemConfiguration)
 {
     _recursoAppService   = recursoAppService;
     _systemConfiguration = systemConfiguration;
 }
Example #18
0
 public JwtManager(ISystemConfiguration systemConfiguration)
 {
     _systemConfiguration = systemConfiguration;
 }
 /// <summary>
 /// Recupera o valor da configuração no caminho informado.
 /// </summary>
 /// <param name="configuration">Instancia da configuração do sistema.</param>
 /// <param name="path">Caminho com os dados da configuração.</param>
 /// <returns></returns>
 public static string Get(this ISystemConfiguration configuration, string path)
 {
     return(Configuration.Configuration.Instance.ReadPath(path));
 }
 public RecursoTarefaApiService(ISystemConfiguration systemConfiguration)
     : base(systemConfiguration)
 {
 }
Example #21
0
 public PrintMonitor(ISystemConfiguration systemConfiguration)
 {
     this.printerName = systemConfiguration.PrinterConfiguration.PrinterName;
 }
Example #22
0
 public WorkflowApiService(ISystemConfiguration systemConfiguration)
     : base(systemConfiguration)
 {
 }
 public TipoTarefaGrpcService(IMapper mapper, ISystemConfiguration systemConfiguration)
     : base(mapper, systemConfiguration)
 {
     _client = new TipoTarefa.TipoTarefaClient(_channel);
 }
 public ImpedimentoGrpcService(IMapper mapper, ISystemConfiguration systemConfiguration)
     : base(mapper, systemConfiguration)
 {
     _client = new Impedimento.ImpedimentoClient(_channel);
 }
 public FxService(ISystemConfiguration systemConfiguration, IFixerService fixerService)
 {
     _systemConfiguration = systemConfiguration;
     _fixerService        = fixerService;
 }
Example #26
0
 public ImpedimentoApiService(ISystemConfiguration systemConfiguration)
     : base(systemConfiguration)
 {
 }
 public static IComponentManager CreateInstance(ILogger logger, IIoCContainer container, ISystemConfiguration config)
 {
     return(Instance = new ComponentManager(logger, container, config));
 }
 /// <summary>
 /// Sets the static instance of the configuration.
 /// </summary>
 /// <param name="Configuration">Configuration object</param>
 public abstract void SetStaticInstance(ISystemConfiguration Configuration);
 public ApontamentoApiService(ISystemConfiguration systemConfiguration)
     : base(systemConfiguration)
 {
 }
Example #30
0
 public RecursoController(IRecursoAppService recursoAppService, IJwtManager jwtManager, ISystemConfiguration systemConfiguration)
 {
     _recursoAppService   = recursoAppService;
     _jwtManager          = jwtManager;
     _systemConfiguration = systemConfiguration;
 }
 private PermissionsManager(ILogger logger, IDataComponent dataComponent, ISystemConfiguration systemConfig)
 {
     _logger        = logger;
     _dataComponent = dataComponent;
     _systemConfig  = systemConfig;
 }
 public CarInsuranceController(ICarInsuranceModelBuilder carInsuranceModelBuilder, 
                                 ISystemConfiguration systemConfiguration)
 {
     _systemConfiguration = systemConfiguration;
     _carInsuranceModelBuilder = carInsuranceModelBuilder;
 }
 public WorkflowGrpcService(IMapper mapper, ISystemConfiguration systemConfiguration)
     : base(mapper, systemConfiguration)
 {
     _client = new Workflow.WorkflowClient(_channel);
 }
 /// <summary>
 /// Sets the static instance of the configuration.
 /// </summary>
 /// <param name="Configuration">Configuration object</param>
 public override void SetStaticInstance(ISystemConfiguration Configuration)
 {
     instance = Configuration as DomainConfiguration;
 }
Example #35
0
 public AuthorizerActionFilter(ISystemConfiguration systemConfiguration)
 {
     _systemConfiguration = systemConfiguration;
 }