예제 #1
0
        //internal EventStreamResponse(
        //    HttpResponseMessage httpResponse,
        //    ValueAddedEventHandler added = null,
        //    ValueChangedEventHandler changed = null,
        //    ValueRemovedEventHandler removed = null)
        //{
        //    _cancel = new CancellationTokenSource();

        //    _cache = new TemporaryCache();

        //    if (added != null)
        //    {
        //        _cache.Added += added;
        //    }
        //    if (changed != null)
        //    {
        //        _cache.Changed += changed;
        //    }
        //    if (removed != null)
        //    {
        //        _cache.Removed += removed;
        //    }

        //    _pollingTask = ReadLoop(httpResponse, _cancel.Token);
        //}

        internal EventStreamResponse(
            IRequestManager requestManager,
            string listenPath,
            ValueAddedEventHandler added = null,
            ValueChangedEventHandler changed = null,
            ValueRemovedEventHandler removed = null)
        {
            this._requestManager = requestManager;
            this._listenPath = listenPath;

            _cancel = new CancellationTokenSource();

            _cache = new TemporaryCache();

            if (added != null)
            {
                _cache.Added += added;
            }
            if (changed != null)
            {
                _cache.Changed += changed;
            }
            if (removed != null)
            {
                _cache.Removed += removed;
            }
        }
 private void OnNewUpdate(
     IRequestManager<ConfigurationUpdate, ConfigurationUpdateAnswer> sender, 
     RequestMessage<ConfigurationUpdate> request)
 {
     var newConfiguration = request.request.update;
     //Not the most efficient code, but premature optimisation is root of evil.
     lock (internalLock)
     {
         var existing = allConfigurations.FirstOrDefault(o =>
             o.Instance == newConfiguration.Instance &&
             o.Key == newConfiguration.Key
         );
         if (existing != null)
         {
             existing.Value = newConfiguration.Value;
         }
         else
         {
             allConfigurations.Add(newConfiguration);
         }
     }
     this.persister.Persist(allConfigurations);
     //Todo here broadcast the update?
     sender.Send(new AnwserMessage<ConfigurationUpdateAnswer>()
     {
         id = request.id,
         answer = new ConfigurationUpdateAnswer()
         {
             result = true
         }
     });
 }
 public ConfigurationRequestHandler(
     IRequestManager<ConfigurationSubscription, ConfigurationSubscriptionAnswer> subscriptionsRequestSource,
     IRequestManager<ConfigurationUpdate, ConfigurationUpdateAnswer> updateRequestManager, 
     IStatePersister persister)
 {
     this.persister = persister;
     this.allConfigurations = persister.Read();
     subscriptionsRequestSource.OnRequest += (sender, message) => OnNewSubscription(subscriptionsRequestSource,message);
     updateRequestManager.OnRequest += (sender, message) => OnNewUpdate(updateRequestManager,message);
 }
예제 #4
0
 public void MyTestInitialize()
 {
     if (_target == null)
     {
         var catalog = new DirectoryCatalog(@"..\..\..\Plugins");
         var container = new CompositionContainer(catalog);
         _target = container.GetExportedValue<IRequestManager>();
         string graph = "AB5, BC4, CD8, DC8, DE6, AD5, CE2, EB3, AE7";
         _target.LoadGraph(graph);
     }
 }
        public ApiFactory()
        {
            JsonConvert.DefaultSettings = () => new JsonSerializerSettings
            {
                NullValueHandling = NullValueHandling.Ignore,
                DateFormatString = "dd.MM.yyyy",
                ContractResolver = new LowercaseContractResolver()
            };

            _requestManager = new RequestManager();

            _creatorDomainProvider = new Func<IDomainProvider>(() => new DomainProvider(_requestManager));
            _creatorAutorizationProvider = new Func<IAutorizationProvider>(() => new AutorizationProvider(_requestManager));
        }
        private void OnNewSubscription(
            IRequestManager<ConfigurationSubscription, ConfigurationSubscriptionAnswer> sender, 
            RequestMessage<ConfigurationSubscription> request)
        {
            IEnumerable<Configuration> result;
            //Not the most efficient code, but premature optimisation is root of evil.
            lock (internalLock)
            {
                var instanceFilter = request.request.instance;
                var matchingConfigurations = instanceFilter == ConfigurationInstanceWildcard
                    ? allConfigurations
                    : allConfigurations.Where(o => o.Instance == instanceFilter);
                result = matchingConfigurations;
            }

            sender.Send(new AnwserMessage<ConfigurationSubscriptionAnswer>()
            {
                id = request.id,
                answer = new ConfigurationSubscriptionAnswer()
                {
                    result = result.ToList()
                }
            });
        }
예제 #7
0
 public ContactController(IRequestManager requestManager) : base(requestManager)
 {
 }
 public APIContributionController(IRequestManager requestManager) : base(requestManager)
 {
 }
예제 #9
0
 public TransactionsController(IRequestManager requestManager) : base(requestManager)
 {
 }
예제 #10
0
 public FinanceReportsController(IRequestManager requestManager) : base(requestManager)
 {
 }
예제 #11
0
 public ProductManager(IRequestManager requestManager)
 {
     _requestManager = requestManager;
 }
예제 #12
0
 public CheckinTimeController(IRequestManager requestManager) : base(requestManager)
 {
 }
 public GetProductDataIdentifiedCommandHandler(IMediator mediator, IRequestManager requestManager) : base(mediator, requestManager)
 {
 }
예제 #14
0
 public ChAiPeopleController(IRequestManager requestManager) : base(requestManager)
 {
 }
 public ExternalServicesController(IRequestManager requestManager) : base(requestManager)
 {
 }
예제 #16
0
 public CheckInController(IRequestManager requestManager) : base(requestManager)
 {
 }
예제 #17
0
 public QueryController(IRequestManager requestManager) : base(requestManager)
 {
 }
예제 #18
0
 public MeetingsController(IRequestManager requestManager) : base(requestManager)
 {
 }
예제 #19
0
 internal FirebaseClient(IRequestManager requestManager)
 {
     _requestManager = requestManager;
 }
예제 #20
0
 /// <summary>
 /// For testing purposes only (Mock)
 /// </summary>
 /// <param name="requestManager"></param>
 public FirebaseClient(IRequestManager requestManager, IFirebaseConfig config)
 {
     this.Serializer = config.Serializer;
     _requestManager = requestManager;
 }
예제 #21
0
 public ChAiGiftsController(IRequestManager requestManager) : base(requestManager)
 {
 }
예제 #22
0
 public DeleteMeetingController(IRequestManager requestManager) : base(requestManager)
 {
 }
 public ApiRequestHandler(IRequestManager requestManager)
 {
     RequestManager = requestManager;
 }
예제 #24
0
 public RegSettingController(IRequestManager requestManager) : base(requestManager)
 {
 }
예제 #25
0
 public AnonymizeGdprDataIdentifiedCommandHandler(IMediator mediator, IRequestManager requestManager) : base(mediator, requestManager)
 {
 }
예제 #26
0
 public AccountController(IRequestManager requestManager) : base(requestManager)
 {
 }
 public IdentifierCommandHandler(IMediator mediator, IRequestManager requestManager)
 {
     this._mediator       = mediator ?? throw new ArgumentNullException(nameof(mediator));
     this._requestManager = requestManager ?? throw new ArgumentNullException(nameof(requestManager));
 }
예제 #28
0
 public PictureDirectoryController(IRequestManager requestManager) : base(requestManager)
 {
 }
예제 #29
0
        public static bool FindPage(string pageUrl, IRequestManager requestManager)
        {
            if (_pageLanguageIndex == null)
            {
                IndexSite();
            }

            var pageIndex = GetPageIndex(Language.CurrentLanguageId);

            if (pageIndex.Items.Count == 0)
            {
                return(false);
            }

            var segments = GetUrlSegments(pageUrl);
            var position = 0;
            var lastPage = new PageIndexItem();

            for (var i = 0; i < segments.Length; i++)
            {
                var segment     = segments[i];
                var segmentHash = segment.GetHashCode();

                while (true)
                {
                    var page = pageIndex.Items[position];
                    if ((page.UrlSegmentHash == segmentHash) && (page.UrlSegment == segment))
                    {
                        if (i == segments.Length - 1)
                        {
                            requestManager.HandlePage(page);
                            return(true);
                        }

                        lastPage = page;
                        position = page.FirstChild;

                        if (position == -1)
                        {
                            if (TryAsPageExtender(i + 1, segments, lastPage))
                            {
                                return(true);
                            }
                            if (requestManager.TryMvcSupport(i + 1, segments, lastPage))
                            {
                                return(true);
                            }
                            if (TryAsRedirect(pageUrl))
                            {
                                return(true);
                            }

                            return(false);
                        }

                        // Continue to next segment
                        break;
                    }

                    position = page.NextPage;

                    if (position == -1)
                    {
                        if (TryAsPageExtender(i, segments, lastPage))
                        {
                            return(true);
                        }
                        if (requestManager.TryMvcSupport(i, segments, lastPage))
                        {
                            return(true);
                        }
                        if (TryAsRedirect(pageUrl))
                        {
                            return(true);
                        }

                        return(false);
                    }
                }
            }



            return(false);
        }
 public CreateOrderIdentifiedCommandHandler(IMediator mediator, IRequestManager requestManager) : base(mediator, requestManager)
 {
 }
예제 #31
0
 public BundleHeaderTypesController(IRequestManager requestManager) : base(requestManager)
 {
 }
 public SetStockConfirmedOrderStatusIdenfifiedCommandHandler(IMediator mediator, IRequestManager requestManager) : base(mediator, requestManager)
 {
 }
예제 #33
0
 public IdentifiedCommandHandler(IMediator mediator,
                                 IRequestManager requestManager)
 {
     _mediator       = mediator;
     _requestManager = requestManager;
 }
예제 #34
0
 public LookupController(IRequestManager requestManager) : base(requestManager)
 {
 }
        public SearchTicketApiFactory()
        {
            _requestManager = new RequestManager();

            _creatorUserInfoProvider = new Func<IUserInfoProvider>(() => new UserInfoProvider(_requestManager));
            _creatorDataInfoProvider = new Func<IDataInfoProvider>(() => new DataInfoProvider(_requestManager));
            _creatorPopularRoutesProvider = new Func<IPopularRoutesProvider>(() => new PopularRoutesProvider(_requestManager));
            _creatorSearchTicketsProvider = new Func<ISearchTicketsProvider>(() => new SearchTicketsProvider(_requestManager));
            _creatorSimpleSearchTicketsProvider = new Func<ISimpleSearchTicketsProvider>(() => new SimpleSearchTicketsProvider(_requestManager));
        }
예제 #36
0
 public UserInfoProvider(IRequestManager requestManager)
     : base(requestManager)
 {
     _uriBuilder = new UriBuilder { Scheme = GeneralSettings.ShemaName, Port = -1 };
 }
예제 #37
0
 public FirebaseClient(IFirebaseConfig config)
 {
     this.Serializer  = config.Serializer;
     this.JsonPatcher = new JsonPatcher(this.Serializer);
     _requestManager  = new RequestManager(config);
 }
 public AutorizationProvider(IRequestManager requestManager) : base(requestManager)
 {
 }
 public BaseApiProvider(IRequestManager requestManager)
 {
     _requestManager = requestManager;
 }
 public SimpleSearchTicketsProvider(IRequestManager requestManager)
     : base(requestManager)
 {
 }
예제 #41
0
 public RemoveOrderItemFromOrderIdentifiedCommandHanlder(IMediator mediator, IRequestManager requestManager) : base(mediator, requestManager)
 {
 }
 public PopularRoutesProvider(IRequestManager requestManager)
     : base(requestManager)
 {
 }
 public DomainProvider(IRequestManager requestManager) 
     : base(requestManager)
 {
 }