Exemplo n.º 1
0
        public AzureTentQueues(IGeneralConfiguration configuration, 
            IJsonHelpers jsonHelpers,
            ITaskHelpers taskHelpers,
            ILoggingService loggingService)
        {
            Ensure.Argument.IsNotNull(configuration, nameof(configuration));
            Ensure.Argument.IsNotNull(jsonHelpers, nameof(jsonHelpers));
            Ensure.Argument.IsNotNull(taskHelpers, nameof(taskHelpers));
            Ensure.Argument.IsNotNull(loggingService, nameof(loggingService));

            this.taskHelpers = taskHelpers;
            this.loggingService = loggingService;

            // Create the storage account from the connection string, and the corresponding client.
            var queuesStorageAccount = CloudStorageAccount.Parse(configuration.AzureQueuesConnectionString);
            var queuesClient = queuesStorageAccount.CreateCloudQueueClient();

            // Create the queues references.
            this.mentionsQueue = queuesClient.GetQueueReference("mentions");
            this.subscriptionsQueue = queuesClient.GetQueueReference("subscriptions");
            this.appNotificationQueue = queuesClient.GetQueueReference("appnotifications");
            this.metaSubscriptionQueue = queuesClient.GetQueueReference("metasubscriptions");
            this.retryQueue = queuesClient.GetQueueReference("retries");

            // Create the IQueue objects.
            this.Mentions = new AzureQueue<QueueMentionMessage>(this.mentionsQueue, jsonHelpers);
            this.Subscriptions = new AzureQueue<QueueSubscriptionMessage>(this.subscriptionsQueue, jsonHelpers);
            this.AppNotifications = new AzureQueue<QueueAppNotificationMessage>(this.appNotificationQueue, jsonHelpers);
            this.MetaSubscriptions = new AzureQueue<QueueMetaSubscriptionMessage>(this.metaSubscriptionQueue, jsonHelpers);
            this.Retries = new AzureQueue<QueueRetryMessage>(this.retryQueue, jsonHelpers);

            // Create the initializer for this component.
            this.initializer = new TaskRunner(this.InitializeOnceAsync);
        }
 public AssemblyLoader(IGeneralConfiguration configuration)
 {
     if (configuration == null)
     {
         throw new ArgumentNullException(nameof(configuration));    
     }
     
     _configuration = configuration;
 }
Exemplo n.º 3
0
        public Task Invoke(
            IQueryStringHelpers queryStringHelpers,
            ITentFeedRequestFactory feedRequestFactory,
            IGeneralConfiguration configuration,
            HttpContext context)
        {
            // Read the request parameters from the request.
            var query = queryStringHelpers.ParseQueryString(context.Request.QueryString.Value);
            context.Items[RequestItemEnum.FeedRequest] = feedRequestFactory.FromQueryParameters(query);
            context.Items[RequestItemEnum.CacheControl] = this.ReadCacheControl(configuration, context.Request);

            // Continue on to the next middleware.
            return this.next(context);
        }
Exemplo n.º 4
0
        private CacheControlValue ReadCacheControl(IGeneralConfiguration configuration, HttpRequest request)
        {
            // First, check we have the custom Cache-Control header.
            var cacheControlStr = request.Headers[configuration.CacheControlHeaderName].FirstOrDefault() ??
                                  request.Headers["Cache-Control"].FirstOrDefault();

            // Convert it to an enum value.
            switch (cacheControlStr)
            {
                case "proxy":
                    return CacheControlValue.Proxy;
                case "no-proxy":
                    return CacheControlValue.NoProxy;
                default:
                    return default(CacheControlValue);
            }
        }
Exemplo n.º 5
0
        public BewitLogic(IBewitRepository bewitRepository,
            IBewitFactory bewitFactory, 
            ICryptoHelpers cryptoHelpers, 
            IUriHelpers uriHelpers, 
            IGeneralConfiguration configuration)
        {
            Ensure.Argument.IsNotNull(bewitRepository, nameof(bewitRepository));
            Ensure.Argument.IsNotNull(bewitFactory, nameof(bewitFactory));
            Ensure.Argument.IsNotNull(cryptoHelpers, nameof(cryptoHelpers));
            Ensure.Argument.IsNotNull(uriHelpers, nameof(uriHelpers));
            Ensure.Argument.IsNotNull(configuration, nameof(configuration));

            this.bewitRepository = bewitRepository;
            this.bewitFactory = bewitFactory;
            this.cryptoHelpers = cryptoHelpers;
            this.uriHelpers = uriHelpers;
            this.configuration = configuration;
        }
Exemplo n.º 6
0
 public CurrencyApiService(
     ILogger <CurrencyApiService> logger,
     IMapper mapper,
     ICurrencyRateQueryService currencyRateQueryService,
     IApiHandlingStrategy apiHandlingStrategy,
     ICacheConfiguration cacheConfiguration,
     IGeneralConfiguration apiConfiguration,
     IMissingDataService missingDataService,
     ICurrencyRateCache currencyRateCache)
 {
     this.logger = logger;
     this.mapper = mapper;
     this.currencyRateQueryService = currencyRateQueryService;
     this.apiHandlingStrategy      = apiHandlingStrategy;
     this.cacheConfiguration       = cacheConfiguration;
     this.apiConfiguration         = apiConfiguration;
     this.missingDataService       = missingDataService;
     this.currencyRateCache        = currencyRateCache;
 }
Exemplo n.º 7
0
        public TentFeedRequestFactory(
            IUserLogic userLogic,
            ITentRequestDateFactory requestDateFactory,
            ITentRequestPostFactory requestPostFactory,
            IUriHelpers uriHelpers,
            IQueryStringHelpers queryStringHelpers,
            ITentPostTypeFactory postTypeFactory,
            IGeneralConfiguration configuration)
        {
            Ensure.Argument.IsNotNull(uriHelpers, nameof(uriHelpers));
            Ensure.Argument.IsNotNull(requestPostFactory, nameof(requestPostFactory));
            Ensure.Argument.IsNotNull(requestDateFactory, nameof(requestDateFactory));
            Ensure.Argument.IsNotNull(postTypeFactory, nameof(postTypeFactory));
            Ensure.Argument.IsNotNull(configuration, nameof(configuration));

            this.userLogic = userLogic;
            this.requestPostFactory = requestPostFactory;
            this.requestDateFactory = requestDateFactory;
            this.postTypeFactory = postTypeFactory;
            this.uriHelpers = uriHelpers;
            this.queryStringHelpers = queryStringHelpers;
            this.configuration = configuration;
        }
Exemplo n.º 8
0
        public AzureTentBlobs(IGeneralConfiguration configuration,
            ITaskHelpers taskHelpers,
            ILoggingService loggingService)
        {
            Ensure.Argument.IsNotNull(configuration, nameof(configuration));
            Ensure.Argument.IsNotNull(taskHelpers, nameof(taskHelpers));
            Ensure.Argument.IsNotNull(loggingService, nameof(loggingService));

            this.taskHelpers = taskHelpers;
            this.loggingService = loggingService;

            // Create the storage account from the connection stirng, and the corresponding client.
            var blobsStorageAccount = CloudStorageAccount.Parse(configuration.AzureBlobsConnectionString);
            var blobsClient = blobsStorageAccount.CreateCloudBlobClient();

            // Create the blob container references.
            this.attachmentsContainer = blobsClient.GetContainerReference("attachments");

            // Create IBlobContainer objects.
            this.Attachments = new AzureBlobContainer(this.attachmentsContainer);

            // Create the initializer for this component.
            this.initializer = new TaskRunner(this.InitializeOnceAsync);
        }
 public TestInstallerInfoProviderNsis(IGeneralConfiguration configuration)
 {
 }
Exemplo n.º 10
0
 public UriHelpers(IGeneralConfiguration configuration)
 {
     Ensure.Argument.IsNotNull(configuration, "configuration");
     this.configuration = configuration;
 }