qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ai...@apache.org
Subject svn commit: r886940 [13/14] - in /qpid/trunk/qpid/dotnet/client-010: ./ addins/ addins/ExcelAddIn/ addins/ExcelAddInMessageProcessor/ addins/ExcelAddInProducer/ client/ client/client/ client/transport/ client/transport/codec/ client/transport/exception...
Date Thu, 03 Dec 2009 22:03:55 GMT
Modified: qpid/trunk/qpid/dotnet/client-010/wcf/model/QpidBinding.cs
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/dotnet/client-010/wcf/model/QpidBinding.cs?rev=886940&r1=886939&r2=886940&view=diff
==============================================================================
--- qpid/trunk/qpid/dotnet/client-010/wcf/model/QpidBinding.cs (original)
+++ qpid/trunk/qpid/dotnet/client-010/wcf/model/QpidBinding.cs Thu Dec  3 22:03:51 2009
@@ -1,185 +1,185 @@
-/*
-*
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements.  See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership.  The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License.  You may obtain a copy of the License at
-*
-*   http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing,
-* software distributed under the License is distributed on an
-* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-* KIND, either express or implied.  See the License for the
-* specific language governing permissions and limitations
-* under the License.
-*
-*/
-
-using System.Configuration;
-using System.ServiceModel;
-using System.ServiceModel.Channels;
-
-namespace org.apache.qpid.wcf.model
-{
-    public sealed class QpidBinding : Binding
-    {
-        private string _host;
-        private int _port;
-        private string _username;
-        private string _password;
-        private string _virtuaHost;
-        private readonly CompositeDuplexBindingElement _compositeDuplex;
-        private readonly MessageEncodingBindingElement _encoding;
-        private bool _oneWayOnly;
-        private readonly ReliableSessionBindingElement _session;
-        private readonly TransactionFlowBindingElement _transactionFlow;
-        private bool _transactionsEnabled;
-        private readonly QpidTransportBindingElement _transport;
-
-
-
-        public QpidBinding() : this("localhost", 5672, "guest", "guest", "test")
-        {
-        }
-
-
-        public QpidBinding(string host, int port ) : this (host, port, "guest", "guest", "test")
-        {
-        }
-
-        public QpidBinding(string host, int port, string username, string password, string virtualhost)
-        {
-            Host = host;
-            PortNumber = port;
-            UserName = username;
-            Password = password;
-            VirtualHost = virtualhost;
-            _transport = new QpidTransportBindingElement();
-            _transport.Host = host;
-            _transport.PortNumber = port;
-            _transport.Password = password;
-            _transport.UserName = username;
-            _transport.VirtualHost = virtualhost;
-            _encoding = new TextMessageEncodingBindingElement();
-            _session = new ReliableSessionBindingElement();
-            _compositeDuplex = new CompositeDuplexBindingElement();
-            _transactionFlow = new TransactionFlowBindingElement();
-        }       
-
-        public override BindingElementCollection CreateBindingElements()
-        {
-            var elements = new BindingElementCollection();
-
-            if (_transactionsEnabled)
-            {
-                elements.Add(_transactionFlow);
-            }
-            if (!OneWayOnly)
-            {
-                elements.Add(_session);
-                elements.Add(_compositeDuplex);
-            }
-            elements.Add(_encoding);
-            elements.Add(_transport);
-
-            return elements;
-        }
-
-       
-        
-        /// <summary>
-        /// Gets the scheme used by the binding, soap.amqp
-        /// </summary>
-        public override string Scheme
-        {
-            get { return "soap.amqp"; }
-        }
-
-        /// <summary>
-        /// Specifies the broker host 
-        /// </summary>
-        [ConfigurationProperty("host")]
-        public string Host
-        {
-            get { return _host; }
-            set { _host = value; }
-        }
-
-        /// <summary>
-        /// Specifies the broker port 
-        /// </summary>
-        public int PortNumber
-        {
-            get { return _port; }
-            set { _port = value; }
-        }
-
-        /// <summary>
-        /// Specifies the username
-        /// </summary>
-        public string UserName
-        {
-            get { return _username; }
-            set { _username = value; }
-        }
-
-        /// <summary>
-        /// Specifies the password
-        /// </summary>
-        public string Password
-        {
-            get { return _password; }
-            set { _password = value; }
-        }
-
-        /// <summary>
-        /// Specifies the virtualhost
-        /// </summary>
-        public string VirtualHost
-        {
-            get { return _virtuaHost; }
-            set { _virtuaHost = value; }
-        }
-
-
-        /// <summary>
-        /// Gets the AMQP _transport binding element
-        /// </summary>
-        public QpidTransportBindingElement Transport
-        {
-            get { return _transport; }
-        }
-
-        /// <summary>
-        /// Gets the reliable _session parameters for this binding instance
-        /// </summary>
-        public ReliableSession ReliableSession
-        {
-            get { return new ReliableSession(_session); }
-        }
-
-        /// <summary>
-        /// Determines whether or not the TransactionFlowBindingElement will 
-        /// be added to the channel stack
-        /// </summary>
-        public bool TransactionFlow
-        {
-            get { return _transactionsEnabled; }
-            set { _transactionsEnabled = value; }
-        }
-
-        /// <summary>
-        /// Specifies whether or not the CompositeDuplex and ReliableSession
-        /// binding elements are added to the channel stack.
-        /// </summary>
-        public bool OneWayOnly
-        {
-            get { return _oneWayOnly; }
-            set { _oneWayOnly = value; }
-        }
-    }
+/*
+*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*   http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied.  See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*
+*/
+
+using System.Configuration;
+using System.ServiceModel;
+using System.ServiceModel.Channels;
+
+namespace org.apache.qpid.wcf.model
+{
+    public sealed class QpidBinding : Binding
+    {
+        private string _host;
+        private int _port;
+        private string _username;
+        private string _password;
+        private string _virtuaHost;
+        private readonly CompositeDuplexBindingElement _compositeDuplex;
+        private readonly MessageEncodingBindingElement _encoding;
+        private bool _oneWayOnly;
+        private readonly ReliableSessionBindingElement _session;
+        private readonly TransactionFlowBindingElement _transactionFlow;
+        private bool _transactionsEnabled;
+        private readonly QpidTransportBindingElement _transport;
+
+
+
+        public QpidBinding() : this("localhost", 5672, "guest", "guest", "test")
+        {
+        }
+
+
+        public QpidBinding(string host, int port ) : this (host, port, "guest", "guest", "test")
+        {
+        }
+
+        public QpidBinding(string host, int port, string username, string password, string virtualhost)
+        {
+            Host = host;
+            PortNumber = port;
+            UserName = username;
+            Password = password;
+            VirtualHost = virtualhost;
+            _transport = new QpidTransportBindingElement();
+            _transport.Host = host;
+            _transport.PortNumber = port;
+            _transport.Password = password;
+            _transport.UserName = username;
+            _transport.VirtualHost = virtualhost;
+            _encoding = new TextMessageEncodingBindingElement();
+            _session = new ReliableSessionBindingElement();
+            _compositeDuplex = new CompositeDuplexBindingElement();
+            _transactionFlow = new TransactionFlowBindingElement();
+        }       
+
+        public override BindingElementCollection CreateBindingElements()
+        {
+            var elements = new BindingElementCollection();
+
+            if (_transactionsEnabled)
+            {
+                elements.Add(_transactionFlow);
+            }
+            if (!OneWayOnly)
+            {
+                elements.Add(_session);
+                elements.Add(_compositeDuplex);
+            }
+            elements.Add(_encoding);
+            elements.Add(_transport);
+
+            return elements;
+        }
+
+       
+        
+        /// <summary>
+        /// Gets the scheme used by the binding, soap.amqp
+        /// </summary>
+        public override string Scheme
+        {
+            get { return "soap.amqp"; }
+        }
+
+        /// <summary>
+        /// Specifies the broker host 
+        /// </summary>
+        [ConfigurationProperty("host")]
+        public string Host
+        {
+            get { return _host; }
+            set { _host = value; }
+        }
+
+        /// <summary>
+        /// Specifies the broker port 
+        /// </summary>
+        public int PortNumber
+        {
+            get { return _port; }
+            set { _port = value; }
+        }
+
+        /// <summary>
+        /// Specifies the username
+        /// </summary>
+        public string UserName
+        {
+            get { return _username; }
+            set { _username = value; }
+        }
+
+        /// <summary>
+        /// Specifies the password
+        /// </summary>
+        public string Password
+        {
+            get { return _password; }
+            set { _password = value; }
+        }
+
+        /// <summary>
+        /// Specifies the virtualhost
+        /// </summary>
+        public string VirtualHost
+        {
+            get { return _virtuaHost; }
+            set { _virtuaHost = value; }
+        }
+
+
+        /// <summary>
+        /// Gets the AMQP _transport binding element
+        /// </summary>
+        public QpidTransportBindingElement Transport
+        {
+            get { return _transport; }
+        }
+
+        /// <summary>
+        /// Gets the reliable _session parameters for this binding instance
+        /// </summary>
+        public ReliableSession ReliableSession
+        {
+            get { return new ReliableSession(_session); }
+        }
+
+        /// <summary>
+        /// Determines whether or not the TransactionFlowBindingElement will 
+        /// be added to the channel stack
+        /// </summary>
+        public bool TransactionFlow
+        {
+            get { return _transactionsEnabled; }
+            set { _transactionsEnabled = value; }
+        }
+
+        /// <summary>
+        /// Specifies whether or not the CompositeDuplex and ReliableSession
+        /// binding elements are added to the channel stack.
+        /// </summary>
+        public bool OneWayOnly
+        {
+            get { return _oneWayOnly; }
+            set { _oneWayOnly = value; }
+        }
+    }
 }
\ No newline at end of file

Modified: qpid/trunk/qpid/dotnet/client-010/wcf/model/QpidChannelBase.cs
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/dotnet/client-010/wcf/model/QpidChannelBase.cs?rev=886940&r1=886939&r2=886940&view=diff
==============================================================================
--- qpid/trunk/qpid/dotnet/client-010/wcf/model/QpidChannelBase.cs (original)
+++ qpid/trunk/qpid/dotnet/client-010/wcf/model/QpidChannelBase.cs Thu Dec  3 22:03:51 2009
@@ -1,167 +1,167 @@
-/*
-*
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements.  See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership.  The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License.  You may obtain a copy of the License at
-*
-*   http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing,
-* software distributed under the License is distributed on an
-* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-* KIND, either express or implied.  See the License for the
-* specific language governing permissions and limitations
-* under the License.
-*
-*/
-
-using System;
-using System.ServiceModel;
-using System.ServiceModel.Channels;
-
-namespace org.apache.qpid.wcf.model
-{
-    internal abstract class QpidChannelBase : IChannel
-    {
-        private readonly CommunicationOperation _closeMethod;
-        private readonly BindingContext _context;
-        private readonly CommunicationOperation _openMethod;
-        private CommunicationState _state;
-
-        private QpidChannelBase()
-        {
-            _state = CommunicationState.Created;
-            _closeMethod = Close;
-            _openMethod = Open;
-        }
-
-        protected QpidChannelBase(BindingContext context)
-            : this()
-        {
-            _context = context;
-        }
-
-        public abstract void Close(TimeSpan timeout);
-
-        public abstract void Open(TimeSpan timeout);
-
-        public virtual void Abort()
-        {
-            Close();
-        }
-
-        public virtual void Close()
-        {
-            Close(_context.Binding.CloseTimeout);
-        }
-
-        public virtual T GetProperty<T>() where T : class
-        {
-            return default(T);
-        }
-
-        public virtual void Open()
-        {
-            Open(_context.Binding.OpenTimeout);
-        }
-
-        #region Async Methods
-
-        public virtual IAsyncResult BeginClose(TimeSpan timeout, AsyncCallback callback, object state)
-        {
-            return _closeMethod.BeginInvoke(timeout, callback, state);
-        }
-
-        public virtual IAsyncResult BeginClose(AsyncCallback callback, object state)
-        {
-            return _closeMethod.BeginInvoke(_context.Binding.CloseTimeout, callback, state);
-        }
-
-        public virtual IAsyncResult BeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
-        {
-            return _openMethod.BeginInvoke(timeout, callback, state);
-        }
-
-        public virtual IAsyncResult BeginOpen(AsyncCallback callback, object state)
-        {
-            return _openMethod.BeginInvoke(_context.Binding.OpenTimeout, callback, state);
-        }
-
-        public virtual void EndClose(IAsyncResult result)
-        {
-            _closeMethod.EndInvoke(result);
-        }
-
-        public virtual void EndOpen(IAsyncResult result)
-        {
-            _openMethod.EndInvoke(result);
-        }
-
-        #endregion
-
-        #region Event Raising Methods
-
-        protected void OnOpening()
-        {
-            _state = CommunicationState.Opening;
-            if (Opening != null)
-                Opening(this, null);
-        }
-
-        protected void OnOpened()
-        {
-            _state = CommunicationState.Opened;
-            if (Opened != null)
-                Opened(this, null);
-        }
-
-        protected void OnClosing()
-        {
-            _state = CommunicationState.Closing;
-            if (Closing != null)
-                Closing(this, null);
-        }
-
-        protected void OnClosed()
-        {
-            _state = CommunicationState.Closed;
-            if (Closed != null)
-                Closed(this, null);
-        }
-
-        protected void OnFaulted()
-        {
-            _state = CommunicationState.Faulted;
-            if (Faulted != null)
-                Faulted(this, null);
-        }
-
-        #endregion
-
-
-        public CommunicationState State
-        {
-            get { return _state; }
-        }
-
-        protected BindingContext Context
-        {
-            get { return _context; }
-        }
-
-
-        public event EventHandler Closed;
-
-        public event EventHandler Closing;
-
-        public event EventHandler Faulted;
-
-        public event EventHandler Opened;
-
-        public event EventHandler Opening;
-    }
-}
+/*
+*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*   http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied.  See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*
+*/
+
+using System;
+using System.ServiceModel;
+using System.ServiceModel.Channels;
+
+namespace org.apache.qpid.wcf.model
+{
+    internal abstract class QpidChannelBase : IChannel
+    {
+        private readonly CommunicationOperation _closeMethod;
+        private readonly BindingContext _context;
+        private readonly CommunicationOperation _openMethod;
+        private CommunicationState _state;
+
+        private QpidChannelBase()
+        {
+            _state = CommunicationState.Created;
+            _closeMethod = Close;
+            _openMethod = Open;
+        }
+
+        protected QpidChannelBase(BindingContext context)
+            : this()
+        {
+            _context = context;
+        }
+
+        public abstract void Close(TimeSpan timeout);
+
+        public abstract void Open(TimeSpan timeout);
+
+        public virtual void Abort()
+        {
+            Close();
+        }
+
+        public virtual void Close()
+        {
+            Close(_context.Binding.CloseTimeout);
+        }
+
+        public virtual T GetProperty<T>() where T : class
+        {
+            return default(T);
+        }
+
+        public virtual void Open()
+        {
+            Open(_context.Binding.OpenTimeout);
+        }
+
+        #region Async Methods
+
+        public virtual IAsyncResult BeginClose(TimeSpan timeout, AsyncCallback callback, object state)
+        {
+            return _closeMethod.BeginInvoke(timeout, callback, state);
+        }
+
+        public virtual IAsyncResult BeginClose(AsyncCallback callback, object state)
+        {
+            return _closeMethod.BeginInvoke(_context.Binding.CloseTimeout, callback, state);
+        }
+
+        public virtual IAsyncResult BeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
+        {
+            return _openMethod.BeginInvoke(timeout, callback, state);
+        }
+
+        public virtual IAsyncResult BeginOpen(AsyncCallback callback, object state)
+        {
+            return _openMethod.BeginInvoke(_context.Binding.OpenTimeout, callback, state);
+        }
+
+        public virtual void EndClose(IAsyncResult result)
+        {
+            _closeMethod.EndInvoke(result);
+        }
+
+        public virtual void EndOpen(IAsyncResult result)
+        {
+            _openMethod.EndInvoke(result);
+        }
+
+        #endregion
+
+        #region Event Raising Methods
+
+        protected void OnOpening()
+        {
+            _state = CommunicationState.Opening;
+            if (Opening != null)
+                Opening(this, null);
+        }
+
+        protected void OnOpened()
+        {
+            _state = CommunicationState.Opened;
+            if (Opened != null)
+                Opened(this, null);
+        }
+
+        protected void OnClosing()
+        {
+            _state = CommunicationState.Closing;
+            if (Closing != null)
+                Closing(this, null);
+        }
+
+        protected void OnClosed()
+        {
+            _state = CommunicationState.Closed;
+            if (Closed != null)
+                Closed(this, null);
+        }
+
+        protected void OnFaulted()
+        {
+            _state = CommunicationState.Faulted;
+            if (Faulted != null)
+                Faulted(this, null);
+        }
+
+        #endregion
+
+
+        public CommunicationState State
+        {
+            get { return _state; }
+        }
+
+        protected BindingContext Context
+        {
+            get { return _context; }
+        }
+
+
+        public event EventHandler Closed;
+
+        public event EventHandler Closing;
+
+        public event EventHandler Faulted;
+
+        public event EventHandler Opened;
+
+        public event EventHandler Opening;
+    }
+}

Modified: qpid/trunk/qpid/dotnet/client-010/wcf/model/QpidChannelFactory.cs
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/dotnet/client-010/wcf/model/QpidChannelFactory.cs?rev=886940&r1=886939&r2=886940&view=diff
==============================================================================
--- qpid/trunk/qpid/dotnet/client-010/wcf/model/QpidChannelFactory.cs (original)
+++ qpid/trunk/qpid/dotnet/client-010/wcf/model/QpidChannelFactory.cs Thu Dec  3 22:03:51 2009
@@ -1,74 +1,74 @@
-/*
-*
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements.  See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership.  The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License.  You may obtain a copy of the License at
-*
-*   http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing,
-* software distributed under the License is distributed on an
-* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-* KIND, either express or implied.  See the License for the
-* specific language governing permissions and limitations
-* under the License.
-*
-*/
-
-using System;
-using System.ServiceModel;
-using System.ServiceModel.Channels;
-using org.apache.qpid.client;
-
-namespace org.apache.qpid.wcf.model
-{
-    public class QpidChannelFactory : ChannelFactoryBase<IOutputChannel>
-    {
-        private readonly BindingContext _context;
-        private readonly CommunicationOperation _openMethod;
-        private readonly QpidTransportBindingElement _bindingElement;
-        private ClientSession _session;
-
-        public QpidChannelFactory(BindingContext context)
-        {
-            _context = context;
-            _openMethod = Open;
-            _bindingElement = context.Binding.Elements.Find<QpidTransportBindingElement>();            
-        }
-
-        protected override IOutputChannel OnCreateChannel(EndpointAddress address, Uri via)
-        {
-            return new QpidOutputChannel(_context, _session, address);
-        }
-        
-        protected override IAsyncResult OnBeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
-        {
-            return _openMethod.BeginInvoke(timeout, callback, state);
-        }
-
-        protected override void OnEndOpen(IAsyncResult result)
-        {
-            _openMethod.EndInvoke(result);
-        }
-
-        protected override void OnOpen(TimeSpan timeout)
-        {
-            _session = _bindingElement.Open(timeout.Milliseconds);
-       }
-
-        protected override void OnClose(TimeSpan timeout)
-        {           
-            _bindingElement.Close();
-        }
-
-        protected override void OnAbort()
-        {
-            base.OnAbort();
-            OnClose(_context.Binding.CloseTimeout);
-        }
-    }
-}
+/*
+*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*   http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied.  See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*
+*/
+
+using System;
+using System.ServiceModel;
+using System.ServiceModel.Channels;
+using org.apache.qpid.client;
+
+namespace org.apache.qpid.wcf.model
+{
+    public class QpidChannelFactory : ChannelFactoryBase<IOutputChannel>
+    {
+        private readonly BindingContext _context;
+        private readonly CommunicationOperation _openMethod;
+        private readonly QpidTransportBindingElement _bindingElement;
+        private ClientSession _session;
+
+        public QpidChannelFactory(BindingContext context)
+        {
+            _context = context;
+            _openMethod = Open;
+            _bindingElement = context.Binding.Elements.Find<QpidTransportBindingElement>();            
+        }
+
+        protected override IOutputChannel OnCreateChannel(EndpointAddress address, Uri via)
+        {
+            return new QpidOutputChannel(_context, _session, address);
+        }
+        
+        protected override IAsyncResult OnBeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
+        {
+            return _openMethod.BeginInvoke(timeout, callback, state);
+        }
+
+        protected override void OnEndOpen(IAsyncResult result)
+        {
+            _openMethod.EndInvoke(result);
+        }
+
+        protected override void OnOpen(TimeSpan timeout)
+        {
+            _session = _bindingElement.Open(timeout.Milliseconds);
+       }
+
+        protected override void OnClose(TimeSpan timeout)
+        {           
+            _bindingElement.Close();
+        }
+
+        protected override void OnAbort()
+        {
+            base.OnAbort();
+            OnClose(_context.Binding.CloseTimeout);
+        }
+    }
+}

Modified: qpid/trunk/qpid/dotnet/client-010/wcf/model/QpidChannelListener.cs
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/dotnet/client-010/wcf/model/QpidChannelListener.cs?rev=886940&r1=886939&r2=886940&view=diff
==============================================================================
--- qpid/trunk/qpid/dotnet/client-010/wcf/model/QpidChannelListener.cs (original)
+++ qpid/trunk/qpid/dotnet/client-010/wcf/model/QpidChannelListener.cs Thu Dec  3 22:03:51 2009
@@ -1,79 +1,79 @@
-/*
-*
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements.  See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership.  The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License.  You may obtain a copy of the License at
-*
-*   http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing,
-* software distributed under the License is distributed on an
-* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-* KIND, either express or implied.  See the License for the
-* specific language governing permissions and limitations
-* under the License.
-*
-*/
-
-using System;
-using System.ServiceModel;
-using System.ServiceModel.Channels;
-using org.apache.qpid.client;
-
-namespace org.apache.qpid.wcf.model
-{
-    public sealed class QpidChannelListener : QpidChannelListenerBase<IInputChannel>
-    {
-
-        private IInputChannel _channel;
-        private ClientSession _session;
-      
-        public QpidChannelListener(BindingContext context)
-            : base(context)
-        {
-           _channel = null;
-            _session = null;          
-        }
-
-        protected override IInputChannel OnAcceptChannel(TimeSpan timeout)
-        {
-            // Since only one connection to a broker is required (even for communication
-            // with multiple exchanges 
-            if (_channel != null)
-                return null;
-
-            _channel = new QpidInputChannel(Context, _session, new EndpointAddress(Uri.ToString()));
-            _channel.Closed += ListenChannelClosed;
-            return _channel;
-        }
-        
-        protected override bool OnWaitForChannel(TimeSpan timeout)
-        {
-            return false;
-        }
-
-        protected override void OnOpen(TimeSpan timeout)
-        {
-            _session = _bindingElement.Open(timeout.Milliseconds);
-        }
-
-        protected override void OnClose(TimeSpan timeout)
-        {
-            if (_channel != null)
-            {
-                _channel.Close();
-                _channel = null;
-            }
-            _bindingElement.Close();
-        }
-
-        private void ListenChannelClosed(object sender, EventArgs args)
-        {
-            Close();
-        }
-}
-}
+/*
+*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*   http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied.  See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*
+*/
+
+using System;
+using System.ServiceModel;
+using System.ServiceModel.Channels;
+using org.apache.qpid.client;
+
+namespace org.apache.qpid.wcf.model
+{
+    public sealed class QpidChannelListener : QpidChannelListenerBase<IInputChannel>
+    {
+
+        private IInputChannel _channel;
+        private ClientSession _session;
+      
+        public QpidChannelListener(BindingContext context)
+            : base(context)
+        {
+           _channel = null;
+            _session = null;          
+        }
+
+        protected override IInputChannel OnAcceptChannel(TimeSpan timeout)
+        {
+            // Since only one connection to a broker is required (even for communication
+            // with multiple exchanges 
+            if (_channel != null)
+                return null;
+
+            _channel = new QpidInputChannel(Context, _session, new EndpointAddress(Uri.ToString()));
+            _channel.Closed += ListenChannelClosed;
+            return _channel;
+        }
+        
+        protected override bool OnWaitForChannel(TimeSpan timeout)
+        {
+            return false;
+        }
+
+        protected override void OnOpen(TimeSpan timeout)
+        {
+            _session = _bindingElement.Open(timeout.Milliseconds);
+        }
+
+        protected override void OnClose(TimeSpan timeout)
+        {
+            if (_channel != null)
+            {
+                _channel.Close();
+                _channel = null;
+            }
+            _bindingElement.Close();
+        }
+
+        private void ListenChannelClosed(object sender, EventArgs args)
+        {
+            Close();
+        }
+}
+}

Modified: qpid/trunk/qpid/dotnet/client-010/wcf/model/QpidChannelListenerBase.cs
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/dotnet/client-010/wcf/model/QpidChannelListenerBase.cs?rev=886940&r1=886939&r2=886940&view=diff
==============================================================================
--- qpid/trunk/qpid/dotnet/client-010/wcf/model/QpidChannelListenerBase.cs (original)
+++ qpid/trunk/qpid/dotnet/client-010/wcf/model/QpidChannelListenerBase.cs Thu Dec  3 22:03:51 2009
@@ -1,111 +1,111 @@
-/*
-*
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements.  See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership.  The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License.  You may obtain a copy of the License at
-*
-*   http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing,
-* software distributed under the License is distributed on an
-* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-* KIND, either express or implied.  See the License for the
-* specific language governing permissions and limitations
-* under the License.
-*
-*/
-
-using System;
-using System.ServiceModel.Channels;
-using System.ServiceModel.Description;
-
-namespace org.apache.qpid.wcf.model
-{
-    public abstract class QpidChannelListenerBase<TChannel> : ChannelListenerBase<TChannel> where TChannel: class, IChannel
-    {
-        private readonly Uri _listenUri;
-        private readonly BindingContext _context;
-        protected QpidTransportBindingElement _bindingElement;
-        private readonly CommunicationOperation _closeMethod;
-        private readonly CommunicationOperation _openMethod;
-        private readonly CommunicationOperation<TChannel> _acceptChannelMethod;
-        private readonly CommunicationOperation<bool> _waitForChannelMethod;
-       
-        protected QpidChannelListenerBase(BindingContext context)
-        {
-            _context = context;
-            _bindingElement = context.Binding.Elements.Find<QpidTransportBindingElement>();
-            _closeMethod = OnClose;
-            _openMethod = OnOpen;
-            _waitForChannelMethod = OnWaitForChannel;
-            _acceptChannelMethod = OnAcceptChannel;
-            if (context.ListenUriMode == ListenUriMode.Explicit && context.ListenUriBaseAddress != null)
-            {
-                _listenUri = new Uri(context.ListenUriBaseAddress, context.ListenUriRelativeAddress);
-            }
-            else
-            {
-                _listenUri = new Uri(new Uri("soap.amqp:///"), Guid.NewGuid().ToString());
-            }
-         }
-
-        protected override void OnAbort()
-        {
-            OnClose(_context.Binding.CloseTimeout);
-        }
-
-        protected override IAsyncResult OnBeginAcceptChannel(TimeSpan timeout, AsyncCallback callback, object state)
-        {
-            return _acceptChannelMethod.BeginInvoke(timeout, callback, state);
-        }
-
-        protected override TChannel OnEndAcceptChannel(IAsyncResult result)
-        {
-            return _acceptChannelMethod.EndInvoke(result);
-        }
-
-        protected override IAsyncResult OnBeginWaitForChannel(TimeSpan timeout, AsyncCallback callback, object state)
-        {
-            return _waitForChannelMethod.BeginInvoke(timeout, callback, state);
-        }
-
-        protected override bool OnEndWaitForChannel(IAsyncResult result)
-        {
-            return _waitForChannelMethod.EndInvoke(result);
-        }
-        
-        protected override IAsyncResult OnBeginClose(TimeSpan timeout, AsyncCallback callback, object state)
-        {
-            return _closeMethod.BeginInvoke(timeout, callback, state);
-        }
-
-        protected override IAsyncResult OnBeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
-        {
-            return _openMethod.BeginInvoke(timeout, callback, state);
-        }
-
-        protected override void OnEndClose(IAsyncResult result)
-        {
-            _closeMethod.EndInvoke(result);
-        }
-
-        protected override void OnEndOpen(IAsyncResult result)
-        {
-            _openMethod.EndInvoke(result);
-        }
-
-        public override Uri Uri
-        {
-            get { return _listenUri; }
-        }
-
-        protected BindingContext Context
-        {
-            get { return _context; }
-        }
-    }
-}
+/*
+*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*   http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied.  See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*
+*/
+
+using System;
+using System.ServiceModel.Channels;
+using System.ServiceModel.Description;
+
+namespace org.apache.qpid.wcf.model
+{
+    public abstract class QpidChannelListenerBase<TChannel> : ChannelListenerBase<TChannel> where TChannel: class, IChannel
+    {
+        private readonly Uri _listenUri;
+        private readonly BindingContext _context;
+        protected QpidTransportBindingElement _bindingElement;
+        private readonly CommunicationOperation _closeMethod;
+        private readonly CommunicationOperation _openMethod;
+        private readonly CommunicationOperation<TChannel> _acceptChannelMethod;
+        private readonly CommunicationOperation<bool> _waitForChannelMethod;
+       
+        protected QpidChannelListenerBase(BindingContext context)
+        {
+            _context = context;
+            _bindingElement = context.Binding.Elements.Find<QpidTransportBindingElement>();
+            _closeMethod = OnClose;
+            _openMethod = OnOpen;
+            _waitForChannelMethod = OnWaitForChannel;
+            _acceptChannelMethod = OnAcceptChannel;
+            if (context.ListenUriMode == ListenUriMode.Explicit && context.ListenUriBaseAddress != null)
+            {
+                _listenUri = new Uri(context.ListenUriBaseAddress, context.ListenUriRelativeAddress);
+            }
+            else
+            {
+                _listenUri = new Uri(new Uri("soap.amqp:///"), Guid.NewGuid().ToString());
+            }
+         }
+
+        protected override void OnAbort()
+        {
+            OnClose(_context.Binding.CloseTimeout);
+        }
+
+        protected override IAsyncResult OnBeginAcceptChannel(TimeSpan timeout, AsyncCallback callback, object state)
+        {
+            return _acceptChannelMethod.BeginInvoke(timeout, callback, state);
+        }
+
+        protected override TChannel OnEndAcceptChannel(IAsyncResult result)
+        {
+            return _acceptChannelMethod.EndInvoke(result);
+        }
+
+        protected override IAsyncResult OnBeginWaitForChannel(TimeSpan timeout, AsyncCallback callback, object state)
+        {
+            return _waitForChannelMethod.BeginInvoke(timeout, callback, state);
+        }
+
+        protected override bool OnEndWaitForChannel(IAsyncResult result)
+        {
+            return _waitForChannelMethod.EndInvoke(result);
+        }
+        
+        protected override IAsyncResult OnBeginClose(TimeSpan timeout, AsyncCallback callback, object state)
+        {
+            return _closeMethod.BeginInvoke(timeout, callback, state);
+        }
+
+        protected override IAsyncResult OnBeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
+        {
+            return _openMethod.BeginInvoke(timeout, callback, state);
+        }
+
+        protected override void OnEndClose(IAsyncResult result)
+        {
+            _closeMethod.EndInvoke(result);
+        }
+
+        protected override void OnEndOpen(IAsyncResult result)
+        {
+            _openMethod.EndInvoke(result);
+        }
+
+        public override Uri Uri
+        {
+            get { return _listenUri; }
+        }
+
+        protected BindingContext Context
+        {
+            get { return _context; }
+        }
+    }
+}

Modified: qpid/trunk/qpid/dotnet/client-010/wcf/model/QpidInputChannel.cs
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/dotnet/client-010/wcf/model/QpidInputChannel.cs?rev=886940&r1=886939&r2=886940&view=diff
==============================================================================
--- qpid/trunk/qpid/dotnet/client-010/wcf/model/QpidInputChannel.cs (original)
+++ qpid/trunk/qpid/dotnet/client-010/wcf/model/QpidInputChannel.cs Thu Dec  3 22:03:51 2009
@@ -1,218 +1,218 @@
-/*
-*
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements.  See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership.  The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License.  You may obtain a copy of the License at
-*
-*   http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing,
-* software distributed under the License is distributed on an
-* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-* KIND, either express or implied.  See the License for the
-* specific language governing permissions and limitations
-* under the License.
-*
-*/
-
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.ServiceModel;
-using System.ServiceModel.Channels;
-using System.Text;
-using System.Threading;
-using org.apache.qpid.client;
-using org.apache.qpid.transport;
-using org.apache.qpid.transport.util;
-
-namespace org.apache.qpid.wcf.model
-{
-    internal sealed class QpidInputChannel : QpidInputChannelBase
-    {
-        private static readonly Logger _log = Logger.get(typeof (QpidInputChannel));
-
-        private readonly QpidTransportBindingElement _bindingElement;
-        private readonly MessageEncoder _encoder;
-        private readonly ClientSession _session;
-        private readonly string _queueName;
-        private BlockingQueue _queue;
-        private bool _closed = false;
-
-        public QpidInputChannel(BindingContext context, ClientSession session, EndpointAddress address)
-            : base(context, address)
-        {
-            _bindingElement = context.Binding.Elements.Find<QpidTransportBindingElement>();
-            var encoderElem = context.BindingParameters.Find<MessageEncodingBindingElement>();
-            if (encoderElem != null)
-            {
-                _encoder = encoderElem.CreateMessageEncoderFactory().Encoder;
-            }
-            _session = session;
-            _queueName = address.Uri.ToString();
-            _queue = new BlockingQueue();
-        }
-
-
-        public override System.ServiceModel.Channels.Message Receive(TimeSpan timeout)
-        {
-            _session.messageFlow("myDest", MessageCreditUnit.MESSAGE, 1);
-            _session.sync();
-            IMessage m = _queue.Dequeue();
-            System.ServiceModel.Channels.Message result = null;
-            if (m != null)
-            {              
-                var reader = new BinaryReader(m.Body, Encoding.UTF8);
-                var body = new byte[m.Body.Length - m.Body.Position];
-                reader.Read(body, 0, body.Length);
-                try
-                {
-                    result = _encoder.ReadMessage(new MemoryStream(body),
-                                                  (int) _bindingElement.MaxReceivedMessageSize);
-                }
-                catch(Exception e)
-                {
-                    Console.WriteLine(e.StackTrace);
-                }
-                result.Headers.To = LocalAddress.Uri;
-
-                var ack = new RangeSet();
-                // ack this message 
-                ack.add(m.Id);
-                _session.messageAccept(ack);
-                _session.sync();
-            }
-            else
-            {
-                if(! _closed )
-                {
-                   return Receive(timeout); 
-                }
-            }
-            return result;
-        }
-
-        public override bool TryReceive(TimeSpan timeout, out System.ServiceModel.Channels.Message message)
-        {            
-            message = Receive(timeout);
-            return message != null;
-        }
-
-        public override bool WaitForMessage(TimeSpan timeout)
-        {
-            throw new NotImplementedException();
-        }
-
-        public override void Close(TimeSpan timeout)
-        {
-            _closed = true;
-            _queue = null;
-        }
-
-        public override void Open(TimeSpan timeout)
-        {
-            if (State != CommunicationState.Created && State != CommunicationState.Closed)
-                throw new InvalidOperationException(string.Format("Cannot open the channel from the {0} state.", State));
-
-            OnOpening();
-
-            var qr = (QueueQueryResult) _session.queueQuery(_queueName).Result;
-            if (qr.getQueue() == null)
-            {
-                // create the queue 
-                _session.queueDeclare(_queueName, null, null);
-            }
-            // bind the queue 
-            _session.exchangeBind(_queueName, "amq.direct", _queueName, null);
-            var myListener = new WCFListener(_queue);
-            _session.attachMessageListener(myListener, "myDest");
-            _session.messageSubscribe(_queueName, "myDest", MessageAcceptMode.EXPLICIT, MessageAcquireMode.PRE_ACQUIRED,
-                                      null,
-                                      0, null);
-            // issue credits     
-            _session.messageSetFlowMode("myDest", MessageFlowMode.WINDOW);
-            _session.messageFlow("myDest", MessageCreditUnit.BYTE, ClientSession.MESSAGE_FLOW_MAX_BYTES);
-            _session.sync();
-
-            OnOpened();
-        }
-    }
-
-    internal class WCFListener : IMessageListener
-    {
-        private static readonly Logger _log = Logger.get(typeof (WCFListener));
-        private readonly BlockingQueue _q;
-
-        public WCFListener(BlockingQueue q)
-        {
-            _q = q;
-        }
-
-        public void messageTransfer(IMessage m)
-        {
-            _log.debug("message received by listener");
-            _q.Enqueue(m);
-        }
-    }
-
-    internal class BlockingQueue
-    {
-        private int _count;
-        private readonly Queue<IMessage> _queue = new Queue<IMessage>();
-
-        public IMessage Dequeue(TimeSpan timeout)
-        {
-            lock (_queue)
-            {
-                DateTime start = DateTime.Now;
-                long elapsed = 0;
-                while (_count <= 0 && elapsed < timeout.Milliseconds)
-                {
-                    Monitor.Wait(_queue, new TimeSpan(timeout.Milliseconds - elapsed));
-                    elapsed = DateTime.Now.Subtract(start).Milliseconds;                 
-                }
-                if (_count > 0)
-                {
-                    _count--;
-                    return _queue.Dequeue();
-                }
-                return null;
-            }
-        }
-
-        public IMessage Dequeue()
-        {
-            lock (_queue)
-            {               
-                while (_count <= 0)
-                {
-                    Monitor.Wait(_queue);                   
-                }
-                if (_count > 0)
-                {
-                    _count--;
-                    return _queue.Dequeue();
-                }
-                return null;
-            }
-        }
-
-        public void Enqueue(IMessage data)
-        {
-            if (data != null)
-            {
-                lock (_queue)
-                {
-                    _queue.Enqueue(data);
-                    _count++;
-                    Monitor.Pulse(_queue);
-                }
-            }
-        }
-    }
-}
-
+/*
+*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*   http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied.  See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*
+*/
+
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.ServiceModel;
+using System.ServiceModel.Channels;
+using System.Text;
+using System.Threading;
+using org.apache.qpid.client;
+using org.apache.qpid.transport;
+using org.apache.qpid.transport.util;
+
+namespace org.apache.qpid.wcf.model
+{
+    internal sealed class QpidInputChannel : QpidInputChannelBase
+    {
+        private static readonly Logger _log = Logger.get(typeof (QpidInputChannel));
+
+        private readonly QpidTransportBindingElement _bindingElement;
+        private readonly MessageEncoder _encoder;
+        private readonly ClientSession _session;
+        private readonly string _queueName;
+        private BlockingQueue _queue;
+        private bool _closed = false;
+
+        public QpidInputChannel(BindingContext context, ClientSession session, EndpointAddress address)
+            : base(context, address)
+        {
+            _bindingElement = context.Binding.Elements.Find<QpidTransportBindingElement>();
+            var encoderElem = context.BindingParameters.Find<MessageEncodingBindingElement>();
+            if (encoderElem != null)
+            {
+                _encoder = encoderElem.CreateMessageEncoderFactory().Encoder;
+            }
+            _session = session;
+            _queueName = address.Uri.ToString();
+            _queue = new BlockingQueue();
+        }
+
+
+        public override System.ServiceModel.Channels.Message Receive(TimeSpan timeout)
+        {
+            _session.messageFlow("myDest", MessageCreditUnit.MESSAGE, 1);
+            _session.sync();
+            IMessage m = _queue.Dequeue();
+            System.ServiceModel.Channels.Message result = null;
+            if (m != null)
+            {              
+                var reader = new BinaryReader(m.Body, Encoding.UTF8);
+                var body = new byte[m.Body.Length - m.Body.Position];
+                reader.Read(body, 0, body.Length);
+                try
+                {
+                    result = _encoder.ReadMessage(new MemoryStream(body),
+                                                  (int) _bindingElement.MaxReceivedMessageSize);
+                }
+                catch(Exception e)
+                {
+                    Console.WriteLine(e.StackTrace);
+                }
+                result.Headers.To = LocalAddress.Uri;
+
+                var ack = new RangeSet();
+                // ack this message 
+                ack.add(m.Id);
+                _session.messageAccept(ack);
+                _session.sync();
+            }
+            else
+            {
+                if(! _closed )
+                {
+                   return Receive(timeout); 
+                }
+            }
+            return result;
+        }
+
+        public override bool TryReceive(TimeSpan timeout, out System.ServiceModel.Channels.Message message)
+        {            
+            message = Receive(timeout);
+            return message != null;
+        }
+
+        public override bool WaitForMessage(TimeSpan timeout)
+        {
+            throw new NotImplementedException();
+        }
+
+        public override void Close(TimeSpan timeout)
+        {
+            _closed = true;
+            _queue = null;
+        }
+
+        public override void Open(TimeSpan timeout)
+        {
+            if (State != CommunicationState.Created && State != CommunicationState.Closed)
+                throw new InvalidOperationException(string.Format("Cannot open the channel from the {0} state.", State));
+
+            OnOpening();
+
+            var qr = (QueueQueryResult) _session.queueQuery(_queueName).Result;
+            if (qr.getQueue() == null)
+            {
+                // create the queue 
+                _session.queueDeclare(_queueName, null, null);
+            }
+            // bind the queue 
+            _session.exchangeBind(_queueName, "amq.direct", _queueName, null);
+            var myListener = new WCFListener(_queue);
+            _session.attachMessageListener(myListener, "myDest");
+            _session.messageSubscribe(_queueName, "myDest", MessageAcceptMode.EXPLICIT, MessageAcquireMode.PRE_ACQUIRED,
+                                      null,
+                                      0, null);
+            // issue credits     
+            _session.messageSetFlowMode("myDest", MessageFlowMode.WINDOW);
+            _session.messageFlow("myDest", MessageCreditUnit.BYTE, ClientSession.MESSAGE_FLOW_MAX_BYTES);
+            _session.sync();
+
+            OnOpened();
+        }
+    }
+
+    internal class WCFListener : IMessageListener
+    {
+        private static readonly Logger _log = Logger.get(typeof (WCFListener));
+        private readonly BlockingQueue _q;
+
+        public WCFListener(BlockingQueue q)
+        {
+            _q = q;
+        }
+
+        public void messageTransfer(IMessage m)
+        {
+            _log.debug("message received by listener");
+            _q.Enqueue(m);
+        }
+    }
+
+    internal class BlockingQueue
+    {
+        private int _count;
+        private readonly Queue<IMessage> _queue = new Queue<IMessage>();
+
+        public IMessage Dequeue(TimeSpan timeout)
+        {
+            lock (_queue)
+            {
+                DateTime start = DateTime.Now;
+                long elapsed = 0;
+                while (_count <= 0 && elapsed < timeout.Milliseconds)
+                {
+                    Monitor.Wait(_queue, new TimeSpan(timeout.Milliseconds - elapsed));
+                    elapsed = DateTime.Now.Subtract(start).Milliseconds;                 
+                }
+                if (_count > 0)
+                {
+                    _count--;
+                    return _queue.Dequeue();
+                }
+                return null;
+            }
+        }
+
+        public IMessage Dequeue()
+        {
+            lock (_queue)
+            {               
+                while (_count <= 0)
+                {
+                    Monitor.Wait(_queue);                   
+                }
+                if (_count > 0)
+                {
+                    _count--;
+                    return _queue.Dequeue();
+                }
+                return null;
+            }
+        }
+
+        public void Enqueue(IMessage data)
+        {
+            if (data != null)
+            {
+                lock (_queue)
+                {
+                    _queue.Enqueue(data);
+                    _count++;
+                    Monitor.Pulse(_queue);
+                }
+            }
+        }
+    }
+}
+

Modified: qpid/trunk/qpid/dotnet/client-010/wcf/model/QpidInputChannelBase.cs
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/dotnet/client-010/wcf/model/QpidInputChannelBase.cs?rev=886940&r1=886939&r2=886940&view=diff
==============================================================================
--- qpid/trunk/qpid/dotnet/client-010/wcf/model/QpidInputChannelBase.cs (original)
+++ qpid/trunk/qpid/dotnet/client-010/wcf/model/QpidInputChannelBase.cs Thu Dec  3 22:03:51 2009
@@ -1,101 +1,101 @@
-/*
-*
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements.  See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership.  The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License.  You may obtain a copy of the License at
-*
-*   http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing,
-* software distributed under the License is distributed on an
-* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-* KIND, either express or implied.  See the License for the
-* specific language governing permissions and limitations
-* under the License.
-*
-*/
-
-using System;
-using System.ServiceModel;
-using System.ServiceModel.Channels;
-
-namespace org.apache.qpid.wcf.model
-{
-    internal abstract class QpidInputChannelBase : QpidChannelBase, IInputChannel
-    {
-        private readonly EndpointAddress _localAddress;
-        private readonly CommunicationOperation<Message> _receiveMethod;
-        private readonly CommunicationOperation<bool, Message> _tryReceiveMethod;
-        private readonly CommunicationOperation<bool> _waitForMessage;
-
-
-        protected QpidInputChannelBase(BindingContext context, EndpointAddress localAddress)
-        :base(context)
-        {
-            _localAddress = localAddress;
-            _receiveMethod = Receive;
-            _tryReceiveMethod = TryReceive;
-            _waitForMessage = WaitForMessage;
-        }
-
-
-        #region Async Methods
-        public virtual IAsyncResult BeginReceive(TimeSpan timeout, AsyncCallback callback, object state)
-        {
-            return _receiveMethod.BeginInvoke(timeout, callback, state);
-        }
-
-        public virtual IAsyncResult BeginReceive(AsyncCallback callback, object state)
-        {
-            return _receiveMethod.BeginInvoke(Context.Binding.ReceiveTimeout, callback, state);
-        }
-
-        public virtual IAsyncResult BeginTryReceive(TimeSpan timeout, AsyncCallback callback, object state)
-        {
-           Message message;
-           return _tryReceiveMethod.BeginInvoke(timeout, out message, callback, state);           
-        }
-
-        public virtual IAsyncResult BeginWaitForMessage(TimeSpan timeout, AsyncCallback callback, object state)
-        {
-            return _waitForMessage.BeginInvoke(timeout, callback, state);
-        }
-
-        public virtual Message EndReceive(IAsyncResult result)
-        {
-            return _receiveMethod.EndInvoke(result);
-        }
-
-        public virtual bool EndTryReceive(IAsyncResult result, out Message message)
-        {
-            return _tryReceiveMethod.EndInvoke(out message, result);                      
-        }
-
-        public virtual bool EndWaitForMessage(IAsyncResult result)
-        {
-            return _waitForMessage.EndInvoke(result);
-        }
-        #endregion
-
-        public abstract Message Receive(TimeSpan timeout);
-
-        public abstract bool TryReceive(TimeSpan timeout, out Message message);
-
-        public abstract bool WaitForMessage(TimeSpan timeout);
-
-        public virtual Message Receive()
-        {
-            return Receive(Context.Binding.ReceiveTimeout);
-        }
-
-        
-        public EndpointAddress LocalAddress
-        {
-            get { return _localAddress; }
-        }
-    }
-}
+/*
+*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*   http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied.  See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*
+*/
+
+using System;
+using System.ServiceModel;
+using System.ServiceModel.Channels;
+
+namespace org.apache.qpid.wcf.model
+{
+    internal abstract class QpidInputChannelBase : QpidChannelBase, IInputChannel
+    {
+        private readonly EndpointAddress _localAddress;
+        private readonly CommunicationOperation<Message> _receiveMethod;
+        private readonly CommunicationOperation<bool, Message> _tryReceiveMethod;
+        private readonly CommunicationOperation<bool> _waitForMessage;
+
+
+        protected QpidInputChannelBase(BindingContext context, EndpointAddress localAddress)
+        :base(context)
+        {
+            _localAddress = localAddress;
+            _receiveMethod = Receive;
+            _tryReceiveMethod = TryReceive;
+            _waitForMessage = WaitForMessage;
+        }
+
+
+        #region Async Methods
+        public virtual IAsyncResult BeginReceive(TimeSpan timeout, AsyncCallback callback, object state)
+        {
+            return _receiveMethod.BeginInvoke(timeout, callback, state);
+        }
+
+        public virtual IAsyncResult BeginReceive(AsyncCallback callback, object state)
+        {
+            return _receiveMethod.BeginInvoke(Context.Binding.ReceiveTimeout, callback, state);
+        }
+
+        public virtual IAsyncResult BeginTryReceive(TimeSpan timeout, AsyncCallback callback, object state)
+        {
+           Message message;
+           return _tryReceiveMethod.BeginInvoke(timeout, out message, callback, state);           
+        }
+
+        public virtual IAsyncResult BeginWaitForMessage(TimeSpan timeout, AsyncCallback callback, object state)
+        {
+            return _waitForMessage.BeginInvoke(timeout, callback, state);
+        }
+
+        public virtual Message EndReceive(IAsyncResult result)
+        {
+            return _receiveMethod.EndInvoke(result);
+        }
+
+        public virtual bool EndTryReceive(IAsyncResult result, out Message message)
+        {
+            return _tryReceiveMethod.EndInvoke(out message, result);                      
+        }
+
+        public virtual bool EndWaitForMessage(IAsyncResult result)
+        {
+            return _waitForMessage.EndInvoke(result);
+        }
+        #endregion
+
+        public abstract Message Receive(TimeSpan timeout);
+
+        public abstract bool TryReceive(TimeSpan timeout, out Message message);
+
+        public abstract bool WaitForMessage(TimeSpan timeout);
+
+        public virtual Message Receive()
+        {
+            return Receive(Context.Binding.ReceiveTimeout);
+        }
+
+        
+        public EndpointAddress LocalAddress
+        {
+            get { return _localAddress; }
+        }
+    }
+}

Modified: qpid/trunk/qpid/dotnet/client-010/wcf/model/QpidOutputChannel.cs
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/dotnet/client-010/wcf/model/QpidOutputChannel.cs?rev=886940&r1=886939&r2=886940&view=diff
==============================================================================
--- qpid/trunk/qpid/dotnet/client-010/wcf/model/QpidOutputChannel.cs (original)
+++ qpid/trunk/qpid/dotnet/client-010/wcf/model/QpidOutputChannel.cs Thu Dec  3 22:03:51 2009
@@ -1,89 +1,89 @@
-/*
-*
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements.  See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership.  The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License.  You may obtain a copy of the License at
-*
-*   http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing,
-* software distributed under the License is distributed on an
-* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-* KIND, either express or implied.  See the License for the
-* specific language governing permissions and limitations
-* under the License.
-*
-*/
-
-using System;
-using System.IO;
-using System.ServiceModel;
-using System.ServiceModel.Channels;
-using org.apache.qpid.client;
-using org.apache.qpid.transport;
-using org.apache.qpid.transport.util;
-
-namespace org.apache.qpid.wcf.model
-{
-    internal sealed class QpidOutputChannel : QpidOutputChannelBase
-    {
-        private readonly MessageEncoder _encoder;
-        private readonly ClientSession _session;
-        private readonly string _queueName;
-
-        public QpidOutputChannel(BindingContext context, ClientSession session, EndpointAddress address)
-            : base(context, address)
-        {
-            var encoderElement = context.Binding.Elements.Find<MessageEncodingBindingElement>();
-            if (encoderElement != null)
-            {
-                _encoder = encoderElement.CreateMessageEncoderFactory().Encoder;
-            }
-            _queueName = address.Uri.ToString();
-            _session = session;            
-        }
-
-        public override void Send(System.ServiceModel.Channels.Message message, TimeSpan timeout)
-        {
-            if (message.State != MessageState.Closed)
-            {
-                byte[] body;
-                using (var str = new MemoryStream())
-                {
-                    _encoder.WriteMessage(message, str);
-                    body = str.ToArray();
-                }
-                _session.messageTransfer("amq.direct", MessageAcceptMode.NONE, MessageAcquireMode.PRE_ACQUIRED,
-                                         new Header(new DeliveryProperties().setRoutingKey(_queueName),
-                                                    new transport.MessageProperties().setMessageId(UUID.randomUUID())),
-                                         body);
-            }
-        }
-
-        public override void Close(TimeSpan timeout)
-        {
-            if (State == CommunicationState.Closed || State == CommunicationState.Closing)
-                return; // Ignore the call, we're already closing.
-            OnClosing();
-            OnClosed();
-        }
-
-        public override void Open(TimeSpan timeout)
-        {
-            if (State != CommunicationState.Created && State != CommunicationState.Closed)
-                throw new InvalidOperationException(string.Format("Cannot open the channel from the {0} state.", State));
-            OnOpening();
-            var qr = (QueueQueryResult) _session.queueQuery(_queueName).Result;
-            if (qr.getQueue() == null)
-            {
-                // create the queue 
-                _session.queueDeclare(_queueName, null, null);
-            }
-            OnOpened();
-        }
-    }
-}
+/*
+*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*   http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied.  See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*
+*/
+
+using System;
+using System.IO;
+using System.ServiceModel;
+using System.ServiceModel.Channels;
+using org.apache.qpid.client;
+using org.apache.qpid.transport;
+using org.apache.qpid.transport.util;
+
+namespace org.apache.qpid.wcf.model
+{
+    internal sealed class QpidOutputChannel : QpidOutputChannelBase
+    {
+        private readonly MessageEncoder _encoder;
+        private readonly ClientSession _session;
+        private readonly string _queueName;
+
+        public QpidOutputChannel(BindingContext context, ClientSession session, EndpointAddress address)
+            : base(context, address)
+        {
+            var encoderElement = context.Binding.Elements.Find<MessageEncodingBindingElement>();
+            if (encoderElement != null)
+            {
+                _encoder = encoderElement.CreateMessageEncoderFactory().Encoder;
+            }
+            _queueName = address.Uri.ToString();
+            _session = session;            
+        }
+
+        public override void Send(System.ServiceModel.Channels.Message message, TimeSpan timeout)
+        {
+            if (message.State != MessageState.Closed)
+            {
+                byte[] body;
+                using (var str = new MemoryStream())
+                {
+                    _encoder.WriteMessage(message, str);
+                    body = str.ToArray();
+                }
+                _session.messageTransfer("amq.direct", MessageAcceptMode.NONE, MessageAcquireMode.PRE_ACQUIRED,
+                                         new Header(new DeliveryProperties().setRoutingKey(_queueName),
+                                                    new transport.MessageProperties().setMessageId(UUID.randomUUID())),
+                                         body);
+            }
+        }
+
+        public override void Close(TimeSpan timeout)
+        {
+            if (State == CommunicationState.Closed || State == CommunicationState.Closing)
+                return; // Ignore the call, we're already closing.
+            OnClosing();
+            OnClosed();
+        }
+
+        public override void Open(TimeSpan timeout)
+        {
+            if (State != CommunicationState.Created && State != CommunicationState.Closed)
+                throw new InvalidOperationException(string.Format("Cannot open the channel from the {0} state.", State));
+            OnOpening();
+            var qr = (QueueQueryResult) _session.queueQuery(_queueName).Result;
+            if (qr.getQueue() == null)
+            {
+                // create the queue 
+                _session.queueDeclare(_queueName, null, null);
+            }
+            OnOpened();
+        }
+    }
+}

Modified: qpid/trunk/qpid/dotnet/client-010/wcf/model/QpidOutputChannelBase.cs
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/dotnet/client-010/wcf/model/QpidOutputChannelBase.cs?rev=886940&r1=886939&r2=886940&view=diff
==============================================================================
--- qpid/trunk/qpid/dotnet/client-010/wcf/model/QpidOutputChannelBase.cs (original)
+++ qpid/trunk/qpid/dotnet/client-010/wcf/model/QpidOutputChannelBase.cs Thu Dec  3 22:03:51 2009
@@ -1,77 +1,77 @@
-/*
-*
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements.  See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership.  The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License.  You may obtain a copy of the License at
-*
-*   http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing,
-* software distributed under the License is distributed on an
-* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-* KIND, either express or implied.  See the License for the
-* specific language governing permissions and limitations
-* under the License.
-*
-*/
-
-using System;
-using System.ServiceModel;
-using System.ServiceModel.Channels;
-
-namespace org.apache.qpid.wcf.model
-{
-    internal abstract class QpidOutputChannelBase : QpidChannelBase, IOutputChannel
-    {        
-        
-        private readonly SendOperation _sendMethod;
-        private readonly EndpointAddress _address;
-
-        protected QpidOutputChannelBase(BindingContext context, EndpointAddress address)
-            : base(context)
-        {
-            _address = address;
-            _sendMethod = Send;
-        }
-
-        #region Async Methods
-
-        public IAsyncResult BeginSend(Message message, TimeSpan timeout, AsyncCallback callback, object state)
-        {
-            return _sendMethod.BeginInvoke(message, timeout, callback, state);
-        }
-
-        public IAsyncResult BeginSend(Message message, AsyncCallback callback, object state)
-        {
-            return _sendMethod.BeginInvoke(message, Context.Binding.SendTimeout, callback, state);
-        }
-
-        public void EndSend(IAsyncResult result)
-        {
-            _sendMethod.EndInvoke(result);
-        }
-
-        #endregion
-
-        public abstract void Send(Message message, TimeSpan timeout);
-
-        public virtual void Send(Message message)
-        {
-            Send(message, Context.Binding.SendTimeout);
-        }
-
-        public EndpointAddress RemoteAddress
-        {
-            get { return _address; }
-        }
-
-        public Uri Via
-        {
-            get { throw new NotImplementedException(); }
-        }
-    }
-}
+/*
+*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*   http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied.  See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*
+*/
+
+using System;
+using System.ServiceModel;
+using System.ServiceModel.Channels;
+
+namespace org.apache.qpid.wcf.model
+{
+    internal abstract class QpidOutputChannelBase : QpidChannelBase, IOutputChannel
+    {        
+        
+        private readonly SendOperation _sendMethod;
+        private readonly EndpointAddress _address;
+
+        protected QpidOutputChannelBase(BindingContext context, EndpointAddress address)
+            : base(context)
+        {
+            _address = address;
+            _sendMethod = Send;
+        }
+
+        #region Async Methods
+
+        public IAsyncResult BeginSend(Message message, TimeSpan timeout, AsyncCallback callback, object state)
+        {
+            return _sendMethod.BeginInvoke(message, timeout, callback, state);
+        }
+
+        public IAsyncResult BeginSend(Message message, AsyncCallback callback, object state)
+        {
+            return _sendMethod.BeginInvoke(message, Context.Binding.SendTimeout, callback, state);
+        }
+
+        public void EndSend(IAsyncResult result)
+        {
+            _sendMethod.EndInvoke(result);
+        }
+
+        #endregion
+
+        public abstract void Send(Message message, TimeSpan timeout);
+
+        public virtual void Send(Message message)
+        {
+            Send(message, Context.Binding.SendTimeout);
+        }
+
+        public EndpointAddress RemoteAddress
+        {
+            get { return _address; }
+        }
+
+        public Uri Via
+        {
+            get { throw new NotImplementedException(); }
+        }
+    }
+}



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org


Mime
View raw message