/// <summary>
 /// Initializes a new instance of <see cref="ApplicationResourceResolver"/>
 /// </summary>
 /// <param name="application">Current <see cref="IApplication">Application</see></param>
 /// <param name="types"><see cref="IApplicationResourceTypes">Resource types</see> available</param>
 /// <param name="resolvers">Instances of <see cref="ICanResolveApplicationResources"/> for specialized resolving</param>
 /// <param name="typeDiscoverer"><see cref="ITypeDiscoverer"/> for discovering types needed</param>
 public ApplicationResourceResolver(IApplication application, IApplicationResourceTypes types, IInstancesOf <ICanResolveApplicationResources> resolvers, ITypeDiscoverer typeDiscoverer)
 {
     _application     = application;
     _types           = types;
     _resolversByType = resolvers.ToDictionary(r => r.ApplicationResourceType.Identifier, r => r);
     _typeDiscoverer  = typeDiscoverer;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PullConnectors"/> class.
 /// </summary>
 /// <param name="pullConnectorsClient"><see cref="IClientFor{T}">client for</see> <see cref="PullConnectorsClient"/> for connecting to runtime.</param>
 /// <param name="connectors">Instances of <see cref="IAmAPullConnector"/>.</param>
 /// <param name="configuration"><see cref="PullConnectorsConfiguration"/> for configuring pull connectors.</param>
 public PullConnectors(
     IClientFor <PullConnectorsClient> pullConnectorsClient,
     IInstancesOf <IAmAPullConnector> connectors,
     PullConnectorsConfiguration configuration)
 {
     _connectors           = connectors.ToDictionary(_ => (ConnectorId)Guid.NewGuid(), _ => _);
     _pullConnectorsClient = pullConnectorsClient;
     _configuration        = configuration;
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PushConnectors"/> class.
 /// </summary>
 /// <param name="pushConnectorsClient"><see cref="IClientFor{T}">client for</see> <see cref="PushConnectorsClient"/> for connecting to runtime.</param>
 /// <param name="connectors">Instances of <see cref="IAmAPushConnector"/>.</param>
 /// <param name="logger"><see cref="ILogger"/> for logging.</param>
 public PushConnectors(
     IClientFor <PushConnectorsClient> pushConnectorsClient,
     IInstancesOf <IAmAPushConnector> connectors,
     ILogger logger)
 {
     _connectors           = connectors.ToDictionary(_ => (ConnectorId)Guid.NewGuid(), _ => _);
     _pushConnectorsClient = pushConnectorsClient;
     _logger = logger;
 }
Ejemplo n.º 4
0
        /// <inheritdoc/>
        public void Start()
        {
            _logger.Information("Start pull connectors");
            var connectors = _connectors.ToDictionary(_ => _.Name, _ => _);

            if (connectors.Count > 0)
            {
                var configurationObject = _configurationFactory();

                foreach ((Source source, PullConnectorConfiguration configuration) in configurationObject)
                {
                    _logger.Information($"Starting '{source}'");
                    var timer = new Timer(configuration.Interval);
                    timer.Elapsed += (s, e) =>
                    {
                        var data = connectors[source].GetAllData();
                        data.ForEach(dataPoint => _communicationClient.SendAsJson("output", dataPoint));
                    };
                    timer.AutoReset = true;
                    timer.Enabled   = true;
                }
            }
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Initializes a new instance <see cref="SentenceParser"/>
 /// </summary>
 /// <param name="formats">All available <see cref="ISentenceFormat">formats</see></param>
 public SentenceParser(IInstancesOf <ISentenceFormat> formats)
 {
     _formats = formats.ToDictionary(_ => $"{_.Identitifer}", _ => _);
 }