Beispiel #1
0
        /// <summary>
        /// Creates a new <see cref="SampleDataGenerator"/> object.
        /// </summary>
        /// <param name="historian">The Aika historian.</param>
        /// <param name="taskRunner">The Aika task runner.</param>
        /// <param name="logger">The logger for the instance.</param>
        /// <exception cref="ArgumentNullException"><paramref name="historian"/> is <see langword="null"/>.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="taskRunner"/> is <see langword="null"/>.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="logger"/> is <see langword="null"/>.</exception>
        /// <exception cref="ArgumentException"><paramref name="historian"/> is not configured to use <see cref="Aika.Historians.InMemoryHistorian"/> as its underlying implementation.</exception>
        public SampleDataGenerator(AikaHistorian historian, ITaskRunner taskRunner, ILogger <SampleDataGenerator> logger)
        {
            _logger     = logger ?? throw new ArgumentNullException(nameof(logger));
            _historian  = historian ?? throw new ArgumentNullException(nameof(historian));
            _taskRunner = taskRunner ?? throw new ArgumentNullException(nameof(taskRunner));

            //if (_historian.Historian.GetType() != typeof(Aika.Historians.InMemoryHistorian)) {
            //    throw new ArgumentException($"{nameof(SampleDataGenerator)} can only be used with the historian {typeof(Aika.Historians.InMemoryHistorian).FullName} implementation.", nameof(historian));
            //}
        }
Beispiel #2
0
        internal static async Task <HistorianInfoDto> ToHistorianInfoDto(this AikaHistorian historian, CancellationToken cancellationToken)
        {
            if (historian == null)
            {
                return(null);
            }

            var supportedFunctions = await historian.GetAvailableDataQueryFunctions(cancellationToken).ConfigureAwait(false);

            return(new HistorianInfoDto()
            {
                TypeName = historian.Historian.GetType().FullName,
                Version = historian.Historian.GetType().Assembly?.GetName()?.Version.ToString(),
                Description = historian.Historian.Description,
                SupportedFunctions = supportedFunctions.Select(x => x.ToHistorianDataFunctionDto()).ToArray(),
                Properties = historian.Historian.Properties == null
                ? new Dictionary <string, object>()
                : new Dictionary <string, object>(historian.Historian.Properties)
            });
        }
 public InMemoryHistorianTestFixture()
 {
     DefaultHistorian = CreateHistorian();
 }
Beispiel #4
0
 /// <summary>
 /// Creates a new <see cref="SnapshotSubscription"/> object.
 /// </summary>
 /// <param name="historian">The <see cref="AikaHistorian"/> instance to use.</param>
 internal SnapshotSubscription(AikaHistorian historian)
 {
     _historian = historian ?? throw new ArgumentNullException(nameof(historian));
 }
Beispiel #5
0
 /// <summary>
 /// Creates a new <see cref="TagsController"/> object.
 /// </summary>
 /// <param name="historian">The Aika historian instance.</param>
 /// <exception cref="ArgumentNullException"><paramref name="historian"/> is <see langword="null"/>.</exception>
 public TagsController(AikaHistorian historian)
 {
     _historian = historian ?? throw new ArgumentNullException(nameof(historian));
 }
Beispiel #6
0
 /// <summary>
 /// Creates a new <see cref="AikaService"/> object.
 /// </summary>
 /// <param name="aika">The <see cref="AikaHistorian"/> to initialize.</param>
 /// <param name="options">The service options.</param>
 /// <param name="logger">The logger for the service.</param>
 /// <exception cref="ArgumentNullException"><paramref name="aika"/> is <see langword="null"/>.</exception>
 /// <exception cref="ArgumentNullException"><paramref name="options"/> is <see langword="null"/>.</exception>
 internal AikaService(AikaHistorian aika, AikaServiceOptions options, ILogger <AikaService> logger)
 {
     _aika    = aika ?? throw new ArgumentNullException(nameof(aika));
     _options = options ?? throw new ArgumentNullException(nameof(options));
     _logger  = logger;
 }
Beispiel #7
0
 /// <summary>
 /// Creates a new <see cref="DataFilterHub"/> object.
 /// </summary>
 /// <param name="historian">The Aika historian.</param>
 /// <exception cref="ArgumentNullException"><paramref name="historian"/> is <see langword="null"/>.</exception>
 public DataFilterHub(AikaHistorian historian)
 {
     _historian = historian ?? throw new ArgumentNullException(nameof(historian));
 }
Beispiel #8
0
 /// <summary>
 /// Creates a new <see cref="SnapshotHub"/> object.
 /// </summary>
 /// <param name="historian">The Aika historian to use.</param>
 public SnapshotHub(AikaHistorian historian)
 {
     _historian = historian ?? throw new ArgumentNullException(nameof(historian));
 }
Beispiel #9
0
 /// <summary>
 /// Creates a new <see cref="StateSetConfigurationController"/> object.
 /// </summary>
 /// <param name="historian">The Aika historian instance.</param>
 /// <exception cref="ArgumentNullException"><paramref name="historian"/> is <see langword="null"/>.</exception>
 public StateSetConfigurationController(AikaHistorian historian)
 {
     _historian = historian ?? throw new ArgumentNullException(nameof(historian));
 }