/// <summary> Listen for services of a given type. The type has to be a fully qualified /// type name such as <code>_http._tcp.local.</code>. /// </summary> /// <param name="type">full qualified service type, such as <code>_http._tcp.local.</code>. /// </param> /// <param name="listener">listener for service updates /// </param> public virtual void AddServiceListener(string type, IServiceListener listener) { string lotype = type.ToLower(); RemoveServiceListener(lotype, listener); IList list = null; lock (this) { list = (IList)serviceListeners[lotype]; if (list == null) { list = ArrayList.Synchronized(new ArrayList()); serviceListeners[lotype] = list; } list.Add(listener); } // report cached service types foreach (DictionaryEntry entry in cache) { for (DNSCache.CacheNode n = (DNSCache.CacheNode)entry.Value; n != null; n = n.Next) { DNSRecord rec = (DNSRecord)n.Value; if (rec.type == DNSConstants.TYPE_SRV) { if (rec.name.EndsWith(type)) { listener.ServiceAdded(this, new ServiceEvent(this, type, ToUnqualifiedName(type, rec.name), null)); } } } } new ServiceResolver(this, type).start(); }
static void n_ServiceAdded_Ljavax_jmdns_ServiceEvent_(IntPtr jnienv, IntPtr native__this, IntPtr native_p0) { IServiceListener __this = Java.Lang.Object.GetObject <IServiceListener> (native__this, JniHandleOwnership.DoNotTransfer); global::Javax.Jmdns.ServiceEvent p0 = Java.Lang.Object.GetObject <global::Javax.Jmdns.ServiceEvent> (native_p0, JniHandleOwnership.DoNotTransfer); __this.ServiceAdded(p0); }
/// <summary> /// Removes a listener /// </summary> /// <param name="listener">Listener.</param> public void RemoveListener(IServiceListener listener) { if (!this.listeners.Contains(listener)) { return; } this.listeners.Remove(listener); NotifyAll(); }
public static Infrastructure AddListener(this Infrastructure infrastructure, IServiceListener listener) { if (infrastructure.ServiceListener == null) { infrastructure.ServiceListener = new ServiceListener(); } (infrastructure.ServiceListener as ServiceListener).Add(listener); return(infrastructure); }
public static Infrastructure AddListener(this Infrastructure infrastructure, IServiceListener listener) { if (infrastructure.ServiceListener == null) { infrastructure.ServiceListener = new ServiceListener(); } (infrastructure.ServiceListener as ServiceListener).Add(listener); return infrastructure; }
public FhirService(Infrastructure infrastructure) { this.localhost = infrastructure.Localhost; this.store = infrastructure.Store; this.snapshotstore = infrastructure.SnapshotStore; this.generator = infrastructure.Generator; this.index = infrastructure.Index; this.listener = infrastructure.ServiceListener; transfer = new Transfer(generator, localhost); pager = new Pager(store, snapshotstore, localhost, transfer); }
public static Infrastructure ClearListeners(this Infrastructure infrastructure, IServiceListener listener) { if (infrastructure.ServiceListener == null) { infrastructure.ServiceListener = new ServiceListener(); } if (infrastructure.ServiceListener is ServiceListener) { (infrastructure.ServiceListener as ServiceListener).Clear(); } return infrastructure; }
////////////////////////////////////////////////////////////////////////// public void AddServiceListener(IServiceListener listener) { m_checker.Check(); IAllServiceListener al = listener as IAllServiceListener; if (al != null) m_systemBundle.getAllServiceListeners().Add(al); else m_systemBundle.getServiceListeners().Add(listener); lock (m_lock) { m_serviceListeners.Add(listener); } }
public FhirService(ILocalhost localhost, IFhirStore fhirStore, ISnapshotStore snapshotStore, IGenerator keyGenerator, IFhirIndex fhirIndex, IServiceListener serviceListener, IFhirResponseFactory responseFactory, IndexService indexService) { this.localhost = localhost; this.fhirStore = fhirStore; this.snapshotstore = snapshotStore; this.keyGenerator = keyGenerator; this.fhirIndex = fhirIndex; this.serviceListener = serviceListener; this.responseFactory = responseFactory; _indexService = indexService; transfer = new Transfer(this.keyGenerator, localhost); pager = new Pager(this.fhirStore, snapshotstore, localhost, transfer, ModelInfo.SearchParameters); //TODO: Use FhirModel instead of ModelInfo for the searchparameters. }
/// <summary> Remove listener for services of a given type.</summary> /// <param name="listener">listener for service updates /// </param> public virtual void RemoveServiceListener(string type, IServiceListener listener) { type = type.ToLower(); IList list = (IList)serviceListeners[type]; if (list != null) { lock (this) { list.Remove(listener); if (list.Count == 0) { serviceListeners.Remove(type); } } } }
/// <summary> /// Adds a listener for a given question. The listener will have /// its update_record method called when information is available to /// answer the question. /// </summary> /// <param name="listener">Listener.</param> /// <param name="question">Question.</param> public void AddListener(IServiceListener listener, DNSQuestion question) { long now = Utilities.CurrentTimeMilliseconds(); this.listeners.Add(listener); if (question != null) { foreach (DNSRecord record in this.Cache.EntriesWithName(question.Name)) { if (question.AnsweredBy(record) && !record.IsExpired(now)) { listener.UpdateRecord(this, now, record); } } } NotifyAll(); }
////////////////////////////////////////////////////////////////////////// public void RemoveServiceListener(IServiceListener listener) { m_checker.Check(); IAllServiceListener al = listener as IAllServiceListener; if (al != null) { m_systemBundle.getAllServiceListeners().Remove(al); } else { m_systemBundle.getServiceListeners().Remove(listener); } lock (m_lock) { m_serviceListeners.Remove(listener); } }
private void Inform(IServiceListener listener, Uri location, Entry entry) { listener.Inform(location, entry); }
public void Add(IServiceListener listener) { this.listeners.Add(listener); }
private void Inform(IServiceListener listener, Uri location, Interaction interaction) { listener.Inform(location, interaction); }
/// <summary> /// 移除一个服务监听器 /// </summary> /// <param name="listener">服务监听器实例</param> public void RemoveServiceListener(IServiceListener listener) { serviceListenerList.Remove(listener); ((IFrameworkListener)framework).RemoveServiceListener(listener); }
////////////////////////////////////////////////////////////////////////// public void AddServiceListener(IServiceListener listener, string filter) { m_checker.Check(); throw new NotImplementedException(); }
/// <summary> Remove listener for services of a given type.</summary> /// <param name="listener">listener for service updates /// </param> public virtual void RemoveServiceListener(string type, IServiceListener listener) { type = type.ToLower(); IList list = (IList) serviceListeners[type]; if (list != null) { lock (this) { list.Remove(listener); if (list.Count == 0) { serviceListeners.Remove(type); } } } }
/// <summary> Listen for services of a given type. The type has to be a fully qualified /// type name such as <code>_http._tcp.local.</code>. /// </summary> /// <param name="type">full qualified service type, such as <code>_http._tcp.local.</code>. /// </param> /// <param name="listener">listener for service updates /// </param> public virtual void AddServiceListener(string type, IServiceListener listener) { string lotype = type.ToLower(); RemoveServiceListener(lotype, listener); IList list = null; lock (this) { list = (IList) serviceListeners[lotype]; if (list == null) { list = ArrayList.Synchronized(new ArrayList()); serviceListeners[lotype] = list; } list.Add(listener); } // report cached service types foreach (DictionaryEntry entry in cache) { for (DNSCache.CacheNode n = (DNSCache.CacheNode)entry.Value; n != null; n = n.Next) { DNSRecord rec = (DNSRecord) n.Value; if (rec.type == DNSConstants.TYPE_SRV) { if (rec.name.EndsWith(type)) { listener.ServiceAdded(this, new ServiceEvent(this, type, ToUnqualifiedName(type, rec.name), null)); } } } } new ServiceResolver(this, type).start(); }
/// <summary> /// 添加一个服务监听器 /// </summary> /// <param name="listener">服务监听器实例</param> public void AddServiceListener(IServiceListener listener) { serviceListenerList.Add(listener); }
public ControlServer() { _service = DocsServer.GetSingleton(); }
public static Infrastructure ClearListeners(this Infrastructure infrastructure, IServiceListener listener) { if (infrastructure.ServiceListener == null) { infrastructure.ServiceListener = new ServiceListener(); } if (infrastructure.ServiceListener is ServiceListener) { (infrastructure.ServiceListener as ServiceListener).Clear(); } return(infrastructure); }
/// <summary> /// 添加一个服务监听器实例 /// </summary> /// <param name="listener">服务监听器实例</param> public void AddServiceListener(IServiceListener listener) { ((IFrameworkListener)framework).AddServiceListener(listener); serviceListenerList.Add(listener); }
/// <summary> /// 移除一个服务监听器 /// </summary> /// <param name="listener">服务监听器</param> public void RemoveServiceListener(IServiceListener listener) { serviceListenerList.Remove(listener); }