示例#1
0
        public void Query(Query query,
                          IMessagingListener listener,
                          string destinationId,
                          AdkQueryOptions queryOptions)
        {
            if (query == null)
            {
                AdkUtils._throw
                    (new ArgumentException("Query object cannot be null"), Agent.GetLog());
            }

            // Validate that the query object type and SIF Context are valid for this Topic
            if (query.ObjectType != fObjType)
            {
                AdkUtils._throw(new ArgumentException("Query object type: {" + query.ObjectTag +
                                                      "} does not match Topic object type: " + fObjType + "}"), log);
            }

            if (!query.SifContext.Equals(fContext))
            {
                AdkUtils._throw(new ArgumentException("Query SIF_Context: {" + query.SifContext +
                                                      "} does not match Topic SIF_Context: " + fContext + "}"), log);
            }

            _checkZones();

            AdkMessagingException err = null;

            //  Send the SIF_Request to each zone
            foreach (ZoneImpl z in fZones)
            {
                try
                {
                    z.Query(query, listener, destinationId, queryOptions);
                }
                catch (Exception th)
                {
                    if (err == null)
                    {
                        err =
                            new AdkMessagingException
                                ("Error querying topic \"" + fObjType + "\"", z);
                    }

                    if (th is AdkException)
                    {
                        err.Add(th);
                    }
                    else
                    {
                        err.Add(new AdkMessagingException(th.ToString(), z));
                    }
                }
            }

            if (err != null)
            {
                AdkUtils._throw(err, Agent.GetLog());
            }
        }
示例#2
0
 string IZone.Query(Query query, IMessagingListener listener)
 {
     // TODO:  Add TestZone.OpenADK.Library.IZone.Query implementation
     return(null);
 }
示例#3
0
 public string Query(Query query, IMessagingListener listener, string destinationId,
                     AdkQueryOptions queryOptions)
 {
     // TODO:  Add TestZone.Query implementation
     return(null);
 }
示例#4
0
 public void AddMessagingListener(IMessagingListener listener)
 {
     // TODO:  Add TestZone.AddMessagingListener implementation
 }
示例#5
0
 public void Query(Query query,
                   IMessagingListener listener)
 {
     Query(query, listener, null, 0);
 }
示例#6
0
 public void Query(Query query,
                   IMessagingListener listener,
                   AdkQueryOptions queryOptions)
 {
     Query(query, listener, null, queryOptions);
 }
示例#7
0
 /// <summary>   Register a <i>MessagingListener</i> to listen to messages received by the
 /// message handlers of this class.
 ///
 /// NOTE: Agents may register a MessagingListener with the Agent or IZone
 /// classes. When a listener is registered with both classes, it will be
 /// called twice. Consequently, it is recommended that most implementations
 /// choose to register MessagingListeners with only one of these classes
 /// depending on whether the agent is interested in receiving global
 /// notifications or notifications on only a subset of zones.
 ///
 /// </summary>
 /// <param name="listener">a MessagingListener implementation
 /// </param>
 public virtual void AddMessagingListener(IMessagingListener listener)
 {
     fMessagingListeners.Add(listener);
 }
示例#8
0
 /// <summary>   Remove a <i>MessagingListener</i> previously registered with the
 /// <c>addMessagingListener</c> method.
 ///
 /// </summary>
 /// <param name="listener">a MessagingListener implementation
 /// </param>
 public virtual void RemoveMessagingListener(IMessagingListener listener)
 {
     fMessagingListeners.Remove(listener);
 }
示例#9
0
        public void Query(Query query,
                                  IMessagingListener listener,
                                  string destinationId,
                                  AdkQueryOptions queryOptions)
        {
            if (query == null)
            {
                AdkUtils._throw
                    (new ArgumentException("Query object cannot be null"), Agent.GetLog());
            }

            // Validate that the query object type and SIF Context are valid for this Topic
            if (query.ObjectType != fObjType)
            {
                AdkUtils._throw(new ArgumentException("Query object type: {" + query.ObjectTag +
                        "} does not match Topic object type: " + fObjType + "}"), log);
            }

            if (!query.SifContext.Equals(fContext))
            {
                AdkUtils._throw(new ArgumentException("Query SIF_Context: {" + query.SifContext +
                        "} does not match Topic SIF_Context: " + fContext + "}"), log);
            }

            _checkZones();

            AdkMessagingException err = null;

            //  Send the SIF_Request to each zone
            foreach (ZoneImpl z in fZones)
            {
                try
                {
                    z.Query(query, listener, destinationId, queryOptions);
                }
                catch (Exception th)
                {
                    if (err == null)
                    {
                        err =
                            new AdkMessagingException
                                ("Error querying topic \"" + fObjType + "\"", z);
                    }

                    if (th is AdkException)
                    {
                        err.Add(th);
                    }
                    else
                    {
                        err.Add(new AdkMessagingException(th.ToString(), z));
                    }
                }
            }

            if (err != null)
            {
                AdkUtils._throw(err, Agent.GetLog());
            }
        }
示例#10
0
 public void Query(Query query,
                           IMessagingListener listener,
                           AdkQueryOptions queryOptions)
 {
     Query(query, listener, null, queryOptions);
 }
示例#11
0
 public void Query(Query query,
                           IMessagingListener listener)
 {
     Query(query, listener, null, 0);
 }
示例#12
0
 /// <summary> 	Remove a <i>MessagingListener</i> previously registered with the
 /// <c>addMessagingListener</c> method.
 /// 
 /// </summary>
 /// <param name="listener">a MessagingListener implementation
 /// </param>
 public virtual void RemoveMessagingListener( IMessagingListener listener )
 {
     fMessagingListeners.Remove( listener );
 }
示例#13
0
 /// <summary> 	Register a <i>MessagingListener</i> to listen to messages received by the
 /// message handlers of this class.
 /// 
 /// NOTE: Agents may register a MessagingListener with the Agent or IZone
 /// classes. When a listener is registered with both classes, it will be 
 /// called twice. Consequently, it is recommended that most implementations 
 /// choose to register MessagingListeners with only one of these classes 
 /// depending on whether the agent is interested in receiving global
 /// notifications or notifications on only a subset of zones.
 /// 
 /// </summary>
 /// <param name="listener">a MessagingListener implementation
 /// </param>
 public virtual void AddMessagingListener( IMessagingListener listener )
 {
     fMessagingListeners.Add( listener );
 }