This is an automated email from the ASF dual-hosted git repository.

dfoulks pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/activemq-nms-ems.git

commit 6e3b1039c3cba89277e476fc05147c46a9f60d4e
Author: Jim Gomes <[email protected]>
AuthorDate: Wed Jan 13 23:24:44 2016 +0000

    Applied patch from Stephane Ramet to implement QueueBrowser.  Thanks 
Stephane!
    Fixes [AMQNET-517]. (See https://issues.apache.org/jira/browse/AMQNET-517)
---
 src/main/csharp/QueueBrowser.cs | 33 +++++++++++++++++++++++++++++----
 1 file changed, 29 insertions(+), 4 deletions(-)

diff --git a/src/main/csharp/QueueBrowser.cs b/src/main/csharp/QueueBrowser.cs
index 37d8172..3423f20 100644
--- a/src/main/csharp/QueueBrowser.cs
+++ b/src/main/csharp/QueueBrowser.cs
@@ -107,12 +107,37 @@ namespace Apache.NMS.EMS
                        get { return 
EMSConvert.ToNMSQueue(this.tibcoQueueBrowser.Queue); }
                }
 
+               internal class Enumerator : IEnumerator
+               {
+                       private IEnumerator innerEnumerator;
+
+                       public Enumerator(IEnumerator innerEnumerator)
+                       {
+                               this.innerEnumerator = innerEnumerator;
+                       }
+
+                       public object Current
+                       {
+                               get
+                               {
+                                       return 
EMSConvert.ToNMSMessage((TIBCO.EMS.Message)this.innerEnumerator.Current);
+                               }
+                       }
+
+                       public bool MoveNext()
+                       {
+                               return this.innerEnumerator.MoveNext();
+                       }
+
+                       public void Reset()
+                       {
+                               this.innerEnumerator.Reset();
+                       }
+               }
+
                public IEnumerator GetEnumerator()
                {
-                       // TODO: This enumerator will need to be adapted.  As 
it is now, the low-level EMS
-                       // objects will be enumerated.  We need to wrap these 
objects into the NMS interface
-                       // types to fit into the provider agnostic system.
-                       return this.tibcoQueueBrowser.GetEnumerator();
+                       return new 
Enumerator(this.tibcoQueueBrowser.GetEnumerator());
                }
        }
 }

Reply via email to