public void HandlerDelete(IIncomingHeaders incomingHeaders, IOutgoingHeaders outgoingHeaders) { Log.InfoFormat("Handling Delete request"); var handler = GetHandler(incomingHeaders); handler.HandlerDelete(GetSelectors(incomingHeaders)); Log.InfoFormat("Delete request handled successfully"); }
public void HandlerDelete(IIncomingHeaders incomingHeaders, IOutgoingHeaders outgoingHeaders) { Log.InfoFormat("Handling Delete request"); var handler = GetHandler(incomingHeaders); handler.HandlerDelete(GetSelectors(incomingHeaders)); Log.InfoFormat("Delete request handled successfully"); }
public EndpointReference HandleCreate(IIncomingHeaders incomingHeaders, IOutgoingHeaders outgoingHeaders, ExtractBodyDelegate extractBodyCallback) { Log.InfoFormat("Handling Create request"); var handler = GetHandler(incomingHeaders); var result = handler.HandleCreate(extractBodyCallback); Log.InfoFormat("Create request handled successfully"); return result; }
public EndpointReference HandleCreate(IIncomingHeaders incomingHeaders, IOutgoingHeaders outgoingHeaders, ExtractBodyDelegate extractBodyCallback) { Log.InfoFormat("Handling Create request"); var handler = GetHandler(incomingHeaders); var result = handler.HandleCreate(extractBodyCallback); Log.InfoFormat("Create request handled successfully"); return(result); }
private static IEnumerable <Selector> GetSelectors(IIncomingHeaders incomingHeaders) { var selectorSetHeader = incomingHeaders.GetHeader <SelectorSetHeader>(); if (selectorSetHeader != null) { Log.Info("Requesting selectors " + string.Join(", ", selectorSetHeader.Selectors.Select(x => x.ToString()))); return(selectorSetHeader.Selectors); } return(Enumerable.Empty <Selector>()); }
public object HandleGet(IIncomingHeaders incomingHeaders, IOutgoingHeaders outgoingHeaders) { Log.InfoFormat("Handling Get request"); var fragmentExpression = GetFragmentExpression(incomingHeaders, outgoingHeaders); var selectors = GetSelectors(incomingHeaders); var handler = GetHandler(incomingHeaders); var result = handler.HandleGet(fragmentExpression, selectors); Log.InfoFormat("Get request handled successfully"); return result; }
public object HandlePut(IIncomingHeaders incomingHeaders, IOutgoingHeaders outgoingHeaders, ExtractBodyDelegate extractBodyCallback) { Log.InfoFormat("Handling Put request"); var fragmentExpression = GetFragmentExpression(incomingHeaders, outgoingHeaders); var selectors = GetSelectors(incomingHeaders); var handler = GetHandler(incomingHeaders); var result = handler.HandlePut(fragmentExpression, selectors, extractBodyCallback); Log.InfoFormat("Put request handled successfully"); return result; }
public object HandlePut(IIncomingHeaders incomingHeaders, IOutgoingHeaders outgoingHeaders, ExtractBodyDelegate extractBodyCallback) { Log.InfoFormat("Handling Put request"); var fragmentExpression = GetFragmentExpression(incomingHeaders, outgoingHeaders); var selectors = GetSelectors(incomingHeaders); var handler = GetHandler(incomingHeaders); var result = handler.HandlePut(fragmentExpression, selectors, extractBodyCallback); Log.InfoFormat("Put request handled successfully"); return(result); }
public object HandleGet(IIncomingHeaders incomingHeaders, IOutgoingHeaders outgoingHeaders) { Log.InfoFormat("Handling Get request"); var fragmentExpression = GetFragmentExpression(incomingHeaders, outgoingHeaders); var selectors = GetSelectors(incomingHeaders); var handler = GetHandler(incomingHeaders); var result = handler.HandleGet(fragmentExpression, selectors); Log.InfoFormat("Get request handled successfully"); return(result); }
private static string GetFragmentExpression(IIncomingHeaders incomingHeaders, IOutgoingHeaders outgoingHeaders) { var fragmentTransferHeader = incomingHeaders.GetHeader<FragmentTransferHeader>(); string fragmentExpression = null; if (fragmentTransferHeader != null) { Log.InfoFormat("Requesting fragment '{0}'", fragmentTransferHeader.Expression); outgoingHeaders.AddHeader(fragmentTransferHeader, true); fragmentExpression = fragmentTransferHeader.Expression; } else { Log.Debug("Not a fragment request."); } return fragmentExpression; }
private static string GetFragmentExpression(IIncomingHeaders incomingHeaders, IOutgoingHeaders outgoingHeaders) { var fragmentTransferHeader = incomingHeaders.GetHeader <FragmentTransferHeader>(); string fragmentExpression = null; if (fragmentTransferHeader != null) { Log.InfoFormat("Requesting fragment '{0}'", fragmentTransferHeader.Expression); outgoingHeaders.AddHeader(fragmentTransferHeader, true); fragmentExpression = fragmentTransferHeader.Expression; } else { Log.Debug("Not a fragment request."); } return(fragmentExpression); }
private IManagementRequestHandler GetHandler(IIncomingHeaders incomingHeaders) { var resourceUriHeader = incomingHeaders.GetHeader<ResourceUriHeader>(); if (resourceUriHeader == null) { Log.ErrorFormat("Required ResourceURI header not found."); throw new DestinationUnreachableFaultException(); } var resourceUri = resourceUriHeader.ResourceUri; IManagementRequestHandler handler; if (_handlers.TryGetValue(resourceUri, out handler)) { Log.InfoFormat("Using {0} to handle resource '{1}'", handler, resourceUri); return handler; } Log.ErrorFormat("Handler for resource '{0}' not found.", resourceUri); throw new DestinationUnreachableFaultException(); }
private IManagementRequestHandler GetHandler(IIncomingHeaders incomingHeaders) { var resourceUriHeader = incomingHeaders.GetHeader <ResourceUriHeader>(); if (resourceUriHeader == null) { Log.ErrorFormat("Required ResourceURI header not found."); throw new DestinationUnreachableFaultException(); } var resourceUri = resourceUriHeader.ResourceUri; IManagementRequestHandler handler; if (_handlers.TryGetValue(resourceUri, out handler)) { Log.InfoFormat("Using {0} to handle resource '{1}'", handler, resourceUri); return(handler); } Log.ErrorFormat("Handler for resource '{0}' not found.", resourceUri); throw new DestinationUnreachableFaultException(); }
public Subscription(Expires expires, IEventingRequestHandler requestHandler, object filterInstance, EndpointReference subscriptionManagerReference, IIncomingHeaders incomingHeaders) { _handlerSubscription = requestHandler.Subscribe(this, filterInstance, subscriptionManagerReference, incomingHeaders); Renew(expires); }
public object HandleGet(IIncomingHeaders incomingHeaders, IOutgoingHeaders outgoingHeaders) { return _data; }
public object HandlePut(IIncomingHeaders incomingHeaders, IOutgoingHeaders outgoingHeaders, ExtractBodyDelegate extractBodyCallback) { _data = (SampleData)extractBodyCallback(typeof (SampleData)); return _data; }
public EndpointReference HandleCreate(IIncomingHeaders incomingHeaders, IOutgoingHeaders outgoingHeaders, ExtractBodyDelegate extractBodyCallback) { _data = (SampleData)extractBodyCallback(typeof(SampleData)); return new EndpointReference("http://example.com"); }
private static IEnumerable<Selector> GetSelectors(IIncomingHeaders incomingHeaders) { var selectorSetHeader = incomingHeaders.GetHeader<SelectorSetHeader>(); if (selectorSetHeader != null) { Log.Info("Requesting selectors "+string.Join(", ", selectorSetHeader.Selectors.Select(x => x.ToString()))); return selectorSetHeader.Selectors; } return Enumerable.Empty<Selector>(); }
public void HandlerDelete(IIncomingHeaders incomingHeaders, IOutgoingHeaders outgoingHeaders) { _data = null; }
public EndpointReference HandleCreate(IIncomingHeaders incomingHeaders, IOutgoingHeaders outgoingHeaders, ExtractBodyDelegate extractBodyCallback) { _data = (SampleData)extractBodyCallback(typeof(SampleData)); return(new EndpointReference("http://example.com")); }
public object HandlePut(IIncomingHeaders incomingHeaders, IOutgoingHeaders outgoingHeaders, ExtractBodyDelegate extractBodyCallback) { _data = (SampleData)extractBodyCallback(typeof(SampleData)); return(_data); }
public object HandleGet(IIncomingHeaders incomingHeaders, IOutgoingHeaders outgoingHeaders) { return(_data); }
public IDisposable Subscribe(IEventSink eventSink, object filterInstance, EndpointReference subscriptionManagerReference, IIncomingHeaders headers) { var selectorSetHeader = headers.GetHeader <SelectorSetHeader>(); var target = selectorSetHeader.Selectors.ExtractObjectName(); var listenerId = GenerateNextListenerId(); subscriptionManagerReference.AddProperty(new NotificationListenerListHeader(listenerId.ToString()), false); var subscriptionInfo = new SubscriptionInfo(eventSink, listenerId); lock (_subscriptions) { _subscriptions.Add(subscriptionInfo); } _server.AddNotificationListener(target, subscriptionInfo.OnNotification, subscriptionInfo.FilterNotification, listenerId); return(new SubscriptionRemover( () => { lock (_subscriptions) { var toRemove = _subscriptions.Single(x => x.EventSink == eventSink); _server.RemoveNotificationListener(target, toRemove.OnNotification, toRemove.FilterNotification, toRemove.ListenerId); _subscriptions.Remove(toRemove); } })); }
public void HandlerDelete(IIncomingHeaders incomingHeaders, IOutgoingHeaders outgoingHeaders) { _data = null; }
public Subscription(Expires expires, IEventingRequestHandler requestHandler, object filterInstance, EndpointReference subscriptionManagerReference, IIncomingHeaders incomingHeaders) { _handlerSubscription = requestHandler.Subscribe(this, filterInstance, subscriptionManagerReference, incomingHeaders); Renew(expires); }
public IDisposable Subscribe(IEventSink eventSink, object filterInstance, EndpointReference subscriptionManagerReference, IIncomingHeaders headers) { Console.WriteLine("Got subscription with filter {0}", filterInstance); _subscribers.Add(eventSink); return(new SubscriptionLifetime(() => _subscribers.Remove(eventSink))); }