Пример #1
0
        protected StoreAccessor(
            IOperationStore operationStore,
            IEntityStore entityStore,
            IEntityIdSerializer entityIdSerializer,
            IEnumerable <IOperationRequestFactory> operationRequestFactories,
            IEnumerable <IOperationResultDataFactory> operationResultDataFactories)
        {
            if (operationRequestFactories is null)
            {
                throw new ArgumentNullException(nameof(operationRequestFactories));
            }

            if (operationResultDataFactories is null)
            {
                throw new ArgumentNullException(nameof(operationResultDataFactories));
            }

            OperationStore = operationStore ??
                             throw new ArgumentNullException(nameof(operationStore));
            EntityStore = entityStore ??
                          throw new ArgumentNullException(nameof(entityStore));
            EntityIdSerializer = entityIdSerializer ??
                                 throw new ArgumentNullException(nameof(entityIdSerializer));
            _requestFactories    = operationRequestFactories.ToDictionary(t => t.ResultType);
            _resultDataFactories = operationResultDataFactories.ToDictionary(t => t.ResultType);
        }
Пример #2
0
 public HttpOperationExecutorObservable(
     IConnection <TData> connection,
     IOperationStore operationStore,
     Func <IOperationResultBuilder <TData, TResult> > resultBuilder,
     OperationRequest request,
     ExecutionStrategy strategy)
 {
     _connection     = connection;
     _operationStore = operationStore;
     _resultBuilder  = resultBuilder;
     _request        = request;
     _strategy       = strategy;
 }
Пример #3
0
 public OperationExecutor(
     IConnection <TData> connection,
     Func <IOperationResultBuilder <TData, TResult> > resultBuilder,
     IOperationStore operationStore,
     ExecutionStrategy strategy = ExecutionStrategy.NetworkOnly)
 {
     _connection = connection ??
                   throw new ArgumentNullException(nameof(connection));
     _resultBuilder = resultBuilder ??
                      throw new ArgumentNullException(nameof(resultBuilder));
     _operationStore = operationStore ??
                       throw new ArgumentNullException(nameof(operationStore));
     _strategy = strategy;
 }
Пример #4
0
        /// <summary>
        /// Stops the Thread.
        /// </summary>
        public void Stop()
        {
            if (!IsStarted)
            {
                return;
            }

            Logger.Instance.LogFormat(LogType.Info, this, "Stopping Service");

            // Dispose and kill all threads
            foreach (IAlarmSource alarmSource in _alarmSources)
            {
                try
                {
                    // Unregister from event and dispose source
                    alarmSource.NewAlarm -= AlarmSource_NewAlarm;
                    alarmSource.Dispose();

                    // Stop and remove the thread
                    Thread ast = _alarmSourcesThreads[alarmSource];
                    // Abort and ignore exception
                    ast.Abort();

                    _alarmSourcesThreads.Remove(alarmSource);
                }
                catch (Exception ex)
                {
                    Logger.Instance.LogFormat(LogType.Warning, this, "Error disposing alarm source '{0}'.", alarmSource.GetType().FullName);
                    Logger.Instance.LogException(this, ex);
                }
            }

            // TODO: Dispose jobs!
            _jobs.Clear();

            // Dispose operation store
            _operationStore = null;
            // Dispose route plan provider
            _routePlanProvider = null;

            Logger.Instance.LogFormat(LogType.Info, this, "Stopped Service");

            IsStarted = false;
        }
Пример #5
0
 public Operation(IOperationStore store, ISystem system, Request request) : base(store, request)
 {
     System = system;
 }
 public OperationWithLogsService(IOperationStore operationStore, ILoggerStore loggerStore, IIncidentStore incidentStore)
 {
     this.operationStore = operationStore;
     this.loggerStore    = loggerStore;
     this.incidentStore  = incidentStore;
 }
Пример #7
0
 public System2Operation(IOperationStore store, ISystem system, System1Result data, int order) : base(store, data, order)
 {
     System = system;
 }
Пример #8
0
 public PolicyAction(IOperationStore store, T data, int order)
 {
     Order = order;
     Store = store;
     Data  = data;
 }
Пример #9
0
 private void InitializeOperationStore()
 {
     _operationStore = ExportedTypeLibrary.Import <IOperationStore>(AlarmWorkflowConfiguration.Instance.OperationStoreAlias);
     Logger.Instance.LogFormat(LogType.Info, this, "Using operation store '{0}'.", _operationStore.GetType().FullName);
 }
Пример #10
0
        /// <summary>
        /// Stops the Thread.
        /// </summary>
        public void Stop()
        {
            if (!IsStarted)
            {
                return;
            }

            Logger.Instance.LogFormat(LogType.Info, this, "Stopping Service");

            // Dispose and kill all threads
            foreach (IAlarmSource alarmSource in _alarmSources)
            {
                try
                {
                    // Unregister from event and dispose source
                    alarmSource.NewAlarm -= AlarmSource_NewAlarm;
                    alarmSource.Dispose();

                    // Stop and remove the thread
                    Thread ast = _alarmSourcesThreads[alarmSource];
                    // Abort and ignore exception
                    ast.Abort();

                    _alarmSourcesThreads.Remove(alarmSource);
                }
                catch (Exception ex)
                {
                    Logger.Instance.LogFormat(LogType.Warning, this, "Error disposing alarm source '{0}'.", alarmSource.GetType().FullName);
                    Logger.Instance.LogException(this, ex);
                }
            }

            // TODO: Dispose jobs!
            _jobs.Clear();

            // Dispose operation store
            _operationStore = null;
            // Dispose route plan provider
            _routePlanProvider = null;

            Logger.Instance.LogFormat(LogType.Info, this, "Stopped Service");

            IsStarted = false;
        }
Пример #11
0
 public Validation(IOperationStore store, ISystem system, Request data, int order) : base(store, data, order)
 {
     System = system;
 }
Пример #12
0
 public OperationController(IOperationStore store)
 {
     _store = store;
 }
Пример #13
0
 public Policy(IOperationStore store, T request)
 {
     Store   = store;
     Request = request;
     Actions = new List <IAction>();
 }
Пример #14
0
 private void InitializeOperationStore()
 {
     _operationStore = ExportedTypeLibrary.Import<IOperationStore>(AlarmWorkflowConfiguration.Instance.OperationStoreAlias);
     Logger.Instance.LogFormat(LogType.Info, this, "Using operation store '{0}'.", _operationStore.GetType().FullName);
 }
Пример #15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AlarmWorkflowService"/> class.
 /// </summary>
 /// <param name="parent"></param>
 public AlarmWorkflowService(AlarmWorkflowEngine parent)
 {
     _operationStore = parent.GetOperationStore();
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="AlarmWorkflowServiceInternal"/> class.
 /// </summary>
 /// <param name="parent"></param>
 public AlarmWorkflowServiceInternal(AlarmWorkflowEngine parent)
 {
     _operationStore = parent.GetOperationStore();
 }
Пример #17
0
        private void InitializeSettings()
        {
            _operationStore = ExportedTypeLibrary.Import<IOperationStore>(AlarmWorkflowConfiguration.Instance.OperationStoreAlias);
            Logger.Instance.LogFormat(LogType.Info, this, "Using operation store '{0}'.", _operationStore.GetType().FullName);

            _routePlanProvider = ExportedTypeLibrary.Import<IRoutePlanProvider>(AlarmWorkflowConfiguration.Instance.RoutePlanProviderAlias);
            Logger.Instance.LogFormat(LogType.Info, this, "Using route plan provider '{0}'.", _routePlanProvider.GetType().FullName);
        }