Return-Path: Delivered-To: apmail-qpid-commits-archive@www.apache.org Received: (qmail 52862 invoked from network); 3 Dec 2009 22:04:38 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 3 Dec 2009 22:04:38 -0000 Received: (qmail 46012 invoked by uid 500); 3 Dec 2009 22:04:38 -0000 Delivered-To: apmail-qpid-commits-archive@qpid.apache.org Received: (qmail 46000 invoked by uid 500); 3 Dec 2009 22:04:38 -0000 Mailing-List: contact commits-help@qpid.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@qpid.apache.org Delivered-To: mailing list commits@qpid.apache.org Received: (qmail 45991 invoked by uid 99); 3 Dec 2009 22:04:37 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 03 Dec 2009 22:04:37 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 03 Dec 2009 22:04:25 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 2AB1C23888EC; Thu, 3 Dec 2009 22:04:02 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r886940 [2/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 -0000 To: commits@qpid.apache.org From: aidan@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20091203220402.2AB1C23888EC@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Modified: qpid/trunk/qpid/dotnet/client-010/client/client/Client.cs URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/dotnet/client-010/client/client/Client.cs?rev=886940&r1=886939&r2=886940&view=diff ============================================================================== --- qpid/trunk/qpid/dotnet/client-010/client/client/Client.cs (original) +++ qpid/trunk/qpid/dotnet/client-010/client/client/Client.cs Thu Dec 3 22:03:51 2009 @@ -1,145 +1,145 @@ -/* -* 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.Text; -using System.Threading; -using org.apache.qpid.transport; -using org.apache.qpid.transport.network.io; -using org.apache.qpid.transport.util; - -namespace org.apache.qpid.client -{ - public class Client : ClientInterface - { - private Connection _conn; - private static readonly Logger _log = Logger.get(typeof (Client)); - private const long timeout = 60000; - private bool _closed; - private readonly Object _closeOK; - private ClosedListener _closedListner; - - public bool Closed - { - get { return _closed; } - set { _closed = value; } - } - - public Object CloseOk - { - get { return _closeOK; } - } - - public Client() - { - _closed = false; - _closeOK = new object(); - } - - #region Interface ClientInterface - - /// - /// Establishes a connection with a broker using the provided user auths - /// - /// - /// Host name on which a broker is deployed - /// Broker port - /// virtual host name - /// User Name - /// Password - public void connect(String host, int port, String virtualHost, String username, String password) - { - _log.debug(String.Format("Client Connecting to host {0}; port {1}; virtualHost {2}; username {3}", host, - port, virtualHost, username)); - ConnectionDelegate connectionDelegate = new ClientConnectionDelegate(this, username, password); - ManualResetEvent negotiationComplete = new ManualResetEvent(false); - connectionDelegate.setCondition(negotiationComplete); - connectionDelegate.VirtualHost = virtualHost; - _conn = IoTransport.connect(host, port, connectionDelegate); - - _conn.send(new ProtocolHeader(1, 0, 10)); - negotiationComplete.WaitOne(); - } - - /// - /// Establishes a connection with a broker using SSL - /// - /// - /// Host name on which a broker is deployed - /// Broker port - /// virtual host name - /// User Name - /// Password - /// Name of the SSL server - /// Path to the X509 certificate to be used for client authentication - /// If true connection will not be established if the broker is not trusted - public void connectSSL(String host, int port, String virtualHost, String username, String password, string serverName, string certPath, bool rejectUntrusted) - { - _log.debug(String.Format("Client Connecting to host {0}; port {1}; virtualHost {2}; username {3}", host, - port, virtualHost, username)); - _log.debug(String.Format("SSL paramters: serverName: {0}; certPath: {1}; rejectUntrusted: {2}", serverName, certPath, rejectUntrusted)); - ConnectionDelegate connectionDelegate = new ClientConnectionDelegate(this, username, password); - ManualResetEvent negotiationComplete = new ManualResetEvent(false); - connectionDelegate.setCondition(negotiationComplete); - connectionDelegate.VirtualHost = virtualHost; - _conn = IoSSLTransport.connect(host, port, serverName, certPath, rejectUntrusted, connectionDelegate); - - _conn.send(new ProtocolHeader(1, 0, 10)); - negotiationComplete.WaitOne(); - } - - public void close() - { - Channel ch = _conn.getChannel(0); - ch.connectionClose(ConnectionCloseCode.NORMAL, "client is closing"); - lock (CloseOk) - { - DateTime start = DateTime.Now; - long elapsed = 0; - while (!Closed && elapsed < timeout) - { - Monitor.Wait(CloseOk, (int) (timeout - elapsed)); - elapsed = DateTime.Now.Subtract(start).Milliseconds; - } - if (!Closed) - { - throw new Exception("Timed out when closing connection"); - } - _conn.close(); - } - } - - public ClientSession createSession(long expiryInSeconds) - { - Channel ch = _conn.getChannel(); - ClientSession ssn = new ClientSession(Encoding.UTF8.GetBytes(UUID.randomUUID().ToString())); - ssn.attach(ch); - ssn.sessionAttach(ssn.getName()); - ssn.sessionRequestTimeout(expiryInSeconds); - return ssn; - } - - public ClosedListener ClosedListener - { - set { _closedListner = value; } - get { return _closedListner; } - } - - #endregion - } -} +/* +* 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.Text; +using System.Threading; +using org.apache.qpid.transport; +using org.apache.qpid.transport.network.io; +using org.apache.qpid.transport.util; + +namespace org.apache.qpid.client +{ + public class Client : ClientInterface + { + private Connection _conn; + private static readonly Logger _log = Logger.get(typeof (Client)); + private const long timeout = 60000; + private bool _closed; + private readonly Object _closeOK; + private ClosedListener _closedListner; + + public bool Closed + { + get { return _closed; } + set { _closed = value; } + } + + public Object CloseOk + { + get { return _closeOK; } + } + + public Client() + { + _closed = false; + _closeOK = new object(); + } + + #region Interface ClientInterface + + /// + /// Establishes a connection with a broker using the provided user auths + /// + /// + /// Host name on which a broker is deployed + /// Broker port + /// virtual host name + /// User Name + /// Password + public void connect(String host, int port, String virtualHost, String username, String password) + { + _log.debug(String.Format("Client Connecting to host {0}; port {1}; virtualHost {2}; username {3}", host, + port, virtualHost, username)); + ConnectionDelegate connectionDelegate = new ClientConnectionDelegate(this, username, password); + ManualResetEvent negotiationComplete = new ManualResetEvent(false); + connectionDelegate.setCondition(negotiationComplete); + connectionDelegate.VirtualHost = virtualHost; + _conn = IoTransport.connect(host, port, connectionDelegate); + + _conn.send(new ProtocolHeader(1, 0, 10)); + negotiationComplete.WaitOne(); + } + + /// + /// Establishes a connection with a broker using SSL + /// + /// + /// Host name on which a broker is deployed + /// Broker port + /// virtual host name + /// User Name + /// Password + /// Name of the SSL server + /// Path to the X509 certificate to be used for client authentication + /// If true connection will not be established if the broker is not trusted + public void connectSSL(String host, int port, String virtualHost, String username, String password, string serverName, string certPath, bool rejectUntrusted) + { + _log.debug(String.Format("Client Connecting to host {0}; port {1}; virtualHost {2}; username {3}", host, + port, virtualHost, username)); + _log.debug(String.Format("SSL paramters: serverName: {0}; certPath: {1}; rejectUntrusted: {2}", serverName, certPath, rejectUntrusted)); + ConnectionDelegate connectionDelegate = new ClientConnectionDelegate(this, username, password); + ManualResetEvent negotiationComplete = new ManualResetEvent(false); + connectionDelegate.setCondition(negotiationComplete); + connectionDelegate.VirtualHost = virtualHost; + _conn = IoSSLTransport.connect(host, port, serverName, certPath, rejectUntrusted, connectionDelegate); + + _conn.send(new ProtocolHeader(1, 0, 10)); + negotiationComplete.WaitOne(); + } + + public void close() + { + Channel ch = _conn.getChannel(0); + ch.connectionClose(ConnectionCloseCode.NORMAL, "client is closing"); + lock (CloseOk) + { + DateTime start = DateTime.Now; + long elapsed = 0; + while (!Closed && elapsed < timeout) + { + Monitor.Wait(CloseOk, (int) (timeout - elapsed)); + elapsed = DateTime.Now.Subtract(start).Milliseconds; + } + if (!Closed) + { + throw new Exception("Timed out when closing connection"); + } + _conn.close(); + } + } + + public ClientSession createSession(long expiryInSeconds) + { + Channel ch = _conn.getChannel(); + ClientSession ssn = new ClientSession(Encoding.UTF8.GetBytes(UUID.randomUUID().ToString())); + ssn.attach(ch); + ssn.sessionAttach(ssn.getName()); + ssn.sessionRequestTimeout(expiryInSeconds); + return ssn; + } + + public ClosedListener ClosedListener + { + set { _closedListner = value; } + get { return _closedListner; } + } + + #endregion + } +} Modified: qpid/trunk/qpid/dotnet/client-010/client/client/ClientConnectionDelegate.cs URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/dotnet/client-010/client/client/ClientConnectionDelegate.cs?rev=886940&r1=886939&r2=886940&view=diff ============================================================================== --- qpid/trunk/qpid/dotnet/client-010/client/client/ClientConnectionDelegate.cs (original) +++ qpid/trunk/qpid/dotnet/client-010/client/client/ClientConnectionDelegate.cs Thu Dec 3 22:03:51 2009 @@ -1,97 +1,97 @@ -/* -* 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.Text; -using System.Threading; -using org.apache.qpid.transport; -using org.apache.qpid.transport.util; - -namespace org.apache.qpid.client -{ - internal class ClientConnectionDelegate : ClientDelegate - { - private static readonly Logger log = Logger.get(typeof (ClientConnectionDelegate)); - private readonly Client _client; - private string _username; - private string _password; - - public ClientConnectionDelegate(Client client, string username, string pasword) - { - _client = client; - _username = username; - _password = pasword; - } - - public override SessionDelegate getSessionDelegate() - { - return new ClientSessionDelegate(); - } - - public override void exception(Exception t) - { - throw t; - } - - public override void connectionStart(Channel context, ConnectionStart mystruct) - { - const string mechanism = "PLAIN"; - MemoryStream stResponse = new MemoryStream(); - byte[] part = Encoding.UTF8.GetBytes(_username); - stResponse.WriteByte(0); - stResponse.Write(part, 0, part.Length); - stResponse.WriteByte(0); - part = Encoding.UTF8.GetBytes(_password); - stResponse.Write(part, 0, part.Length); - Dictionary props = new Dictionary(); - context.connectionStartOk(props, mechanism, stResponse.ToArray(), "utf8"); - } - - public override void closed() - { - log.debug("Delegate closed"); - lock (_client.CloseOk) - { - try - { - _client.Closed = true; - Monitor.PulseAll(_client.CloseOk); - } - catch (Exception e) - { - throw new SystemException("Error when closing client", e); - } - } - } - - public override void connectionClose(Channel context, ConnectionClose connectionClose) - { - base.connectionClose(context, connectionClose); - ErrorCode errorCode = ErrorCode.getErrorCode((int) connectionClose.getReplyCode()); - if (_client.ClosedListener == null && errorCode.Code != (int) QpidErrorCode.NO_ERROR) - { - throw new Exception ("Server closed the connection: Reason " + - connectionClose.getReplyText()); - } - _client.ClosedListener.onClosed(errorCode, connectionClose.getReplyText(), null); - } - } -} +/* +* 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.Text; +using System.Threading; +using org.apache.qpid.transport; +using org.apache.qpid.transport.util; + +namespace org.apache.qpid.client +{ + internal class ClientConnectionDelegate : ClientDelegate + { + private static readonly Logger log = Logger.get(typeof (ClientConnectionDelegate)); + private readonly Client _client; + private string _username; + private string _password; + + public ClientConnectionDelegate(Client client, string username, string pasword) + { + _client = client; + _username = username; + _password = pasword; + } + + public override SessionDelegate getSessionDelegate() + { + return new ClientSessionDelegate(); + } + + public override void exception(Exception t) + { + throw t; + } + + public override void connectionStart(Channel context, ConnectionStart mystruct) + { + const string mechanism = "PLAIN"; + MemoryStream stResponse = new MemoryStream(); + byte[] part = Encoding.UTF8.GetBytes(_username); + stResponse.WriteByte(0); + stResponse.Write(part, 0, part.Length); + stResponse.WriteByte(0); + part = Encoding.UTF8.GetBytes(_password); + stResponse.Write(part, 0, part.Length); + Dictionary props = new Dictionary(); + context.connectionStartOk(props, mechanism, stResponse.ToArray(), "utf8"); + } + + public override void closed() + { + log.debug("Delegate closed"); + lock (_client.CloseOk) + { + try + { + _client.Closed = true; + Monitor.PulseAll(_client.CloseOk); + } + catch (Exception e) + { + throw new SystemException("Error when closing client", e); + } + } + } + + public override void connectionClose(Channel context, ConnectionClose connectionClose) + { + base.connectionClose(context, connectionClose); + ErrorCode errorCode = ErrorCode.getErrorCode((int) connectionClose.getReplyCode()); + if (_client.ClosedListener == null && errorCode.Code != (int) QpidErrorCode.NO_ERROR) + { + throw new Exception ("Server closed the connection: Reason " + + connectionClose.getReplyText()); + } + _client.ClosedListener.onClosed(errorCode, connectionClose.getReplyText(), null); + } + } +} Modified: qpid/trunk/qpid/dotnet/client-010/client/client/ClientInterface.cs URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/dotnet/client-010/client/client/ClientInterface.cs?rev=886940&r1=886939&r2=886940&view=diff ============================================================================== --- qpid/trunk/qpid/dotnet/client-010/client/client/ClientInterface.cs (original) +++ qpid/trunk/qpid/dotnet/client-010/client/client/ClientInterface.cs Thu Dec 3 22:03:51 2009 @@ -1,59 +1,59 @@ -/* -* 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; - -namespace org.apache.qpid.client -{ - public interface ClientInterface - { - /// - /// Establish a connection with the broker using the given parameters - /// - /// - /// host name - /// port number - /// virtualHost the virtual host name - /// username user name - /// password password - void connect(String host, int port, String virtualHost, String username, String passwor); - - /// - /// Close this client - /// - void close(); - - /// - /// Create a session for this connection. - /// The returned session is suspended - /// (i.e. this session is not attached to an underlying channel) - /// - /// Expiry time expressed in seconds, if the value is less than - /// or equal to 0 then the session does not expire. - /// A newly created (suspended) session. - ClientSession createSession(long expiryInSeconds); - - /// - /// If the communication layer detects a serious problem with a connection, it - // informs the client's ClosedListener - /// - /// - ClosedListener ClosedListener { set; } - } -} +/* +* 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; + +namespace org.apache.qpid.client +{ + public interface ClientInterface + { + /// + /// Establish a connection with the broker using the given parameters + /// + /// + /// host name + /// port number + /// virtualHost the virtual host name + /// username user name + /// password password + void connect(String host, int port, String virtualHost, String username, String passwor); + + /// + /// Close this client + /// + void close(); + + /// + /// Create a session for this connection. + /// The returned session is suspended + /// (i.e. this session is not attached to an underlying channel) + /// + /// Expiry time expressed in seconds, if the value is less than + /// or equal to 0 then the session does not expire. + /// A newly created (suspended) session. + ClientSession createSession(long expiryInSeconds); + + /// + /// If the communication layer detects a serious problem with a connection, it + // informs the client's ClosedListener + /// + /// + ClosedListener ClosedListener { set; } + } +} Modified: qpid/trunk/qpid/dotnet/client-010/client/client/ClientSessionDelegate.cs URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/dotnet/client-010/client/client/ClientSessionDelegate.cs?rev=886940&r1=886939&r2=886940&view=diff ============================================================================== --- qpid/trunk/qpid/dotnet/client-010/client/client/ClientSessionDelegate.cs (original) +++ qpid/trunk/qpid/dotnet/client-010/client/client/ClientSessionDelegate.cs Thu Dec 3 22:03:51 2009 @@ -1,55 +1,55 @@ -/* -* 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 org.apache.qpid.transport; -using org.apache.qpid.transport.util; - -namespace org.apache.qpid.client -{ - public class ClientSessionDelegate : SessionDelegate - { - private static readonly Logger _log = Logger.get(typeof (ClientSessionDelegate)); - - // -------------------------------------------- - // Message methods - // -------------------------------------------- - public override void messageTransfer(Session session, MessageTransfer xfr) - { - if (((ClientSession) session).MessageListeners.ContainsKey(xfr.getDestination())) - { - IMessageListener listener = ((ClientSession)session).MessageListeners[xfr.getDestination()]; - listener.messageTransfer( new Message(xfr)); - } - else - { - _log.warn("No listener set for: {0}", xfr); - } - } - - public override void messageReject(Session session, MessageReject mstruct) - { - foreach (Range range in mstruct.getTransfers()) - { - for (long l = range.Lower; l <= range.Upper; l++) - { - _log.warn("message rejected: " + session.getCommand((int) l)); - } - } - } - } +/* +* 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 org.apache.qpid.transport; +using org.apache.qpid.transport.util; + +namespace org.apache.qpid.client +{ + public class ClientSessionDelegate : SessionDelegate + { + private static readonly Logger _log = Logger.get(typeof (ClientSessionDelegate)); + + // -------------------------------------------- + // Message methods + // -------------------------------------------- + public override void messageTransfer(Session session, MessageTransfer xfr) + { + if (((ClientSession) session).MessageListeners.ContainsKey(xfr.getDestination())) + { + IMessageListener listener = ((ClientSession)session).MessageListeners[xfr.getDestination()]; + listener.messageTransfer( new Message(xfr)); + } + else + { + _log.warn("No listener set for: {0}", xfr); + } + } + + public override void messageReject(Session session, MessageReject mstruct) + { + foreach (Range range in mstruct.getTransfers()) + { + for (long l = range.Lower; l <= range.Upper; l++) + { + _log.warn("message rejected: " + session.getCommand((int) l)); + } + } + } + } } \ No newline at end of file Modified: qpid/trunk/qpid/dotnet/client-010/client/client/ClosedListenerInterface.cs URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/dotnet/client-010/client/client/ClosedListenerInterface.cs?rev=886940&r1=886939&r2=886940&view=diff ============================================================================== --- qpid/trunk/qpid/dotnet/client-010/client/client/ClosedListenerInterface.cs (original) +++ qpid/trunk/qpid/dotnet/client-010/client/client/ClosedListenerInterface.cs Thu Dec 3 22:03:51 2009 @@ -1,29 +1,29 @@ -/* -* 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; - -namespace org.apache.qpid.client -{ - public interface ClosedListener - { - - void onClosed(ErrorCode errorCode, String reason, Exception t); - } -} +/* +* 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; + +namespace org.apache.qpid.client +{ + public interface ClosedListener + { + + void onClosed(ErrorCode errorCode, String reason, Exception t); + } +} Modified: qpid/trunk/qpid/dotnet/client-010/client/client/ErrorCode.cs URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/dotnet/client-010/client/client/ErrorCode.cs?rev=886940&r1=886939&r2=886940&view=diff ============================================================================== --- qpid/trunk/qpid/dotnet/client-010/client/client/ErrorCode.cs (original) +++ qpid/trunk/qpid/dotnet/client-010/client/client/ErrorCode.cs Thu Dec 3 22:03:51 2009 @@ -1,140 +1,140 @@ -/* -* 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; - -namespace org.apache.qpid.client -{ - public enum QpidErrorCode - { - NO_ERROR = 200, - CONTENT_TOO_LARGE = 311, - NO_ROUTE = 312, - NO_CONSUMERS = 313, - CONNECTION_FORCED = 320, - INVALID_PATH = 402, - ACCESS_REFUSED = 403, - NOT_FOUND = 404, - RESOURCE_LOCKED = 405, - PRE_CONDITION_FAILED = 406, - FRAME_ERROR = 501, - SYNTAX_ERROR = 502, - COMMAND_INVALID = 503, - SESSION_ERROR = 504, - NOT_ALLOWED = 530, - NOT_IMPLEMENTED = 540, - INTERNAL_ERROR = 541, - INVALID_ARGUMENT = 542, - UNDEFINED = 1 - } - - public struct ErrorCode - { - private int _code; - private String _desc; - private readonly bool _hardError; - - public ErrorCode(int code, String desc, bool hardError) - { - _code = code; - _desc = desc; - _hardError = hardError; - } - - public int Code - { - get { return _code; } - set { _code = value; } - } - - public String Description - { - get { return _desc; } - set { _desc = value; } - } - - public bool ISHardError - { - get { return _hardError; } - } - - public static ErrorCode getErrorCode(int code) - { - switch (code) - { - case 200: - return - new ErrorCode(200, "reply-success", true); - case 311: - return - new ErrorCode(311, "content-too-large", false); - case 312: - return - new ErrorCode(312, "no-route", false); - case 313: - return - new ErrorCode(313, "content-consumers", false); - case 320: - return - new ErrorCode(320, "connection-forced", true); - case 402: - return - new ErrorCode(402, "invalid-path", true); - case 403: - return - new ErrorCode(403, "access-refused", false); - case 404: - return - new ErrorCode(404, "not-found", false); - case 405: - return - new ErrorCode(405, "resource-locked", false); - case 406: - return - new ErrorCode(406, "precondition-failed", false); - case 501: - return - new ErrorCode(501, "frame_error", true); - case 502: - return - new ErrorCode(502, "syntax_error", true); - case 503: - return - new ErrorCode(503, "command_invalid", true); - case 504: - return - new ErrorCode(504, "sesion_error", true); - case 530: - return - new ErrorCode(530, "not_allowed", true); - case 540: - return - new ErrorCode(540, "not_implemented", true); - case 541: - return - new ErrorCode(541, "internal_error", true); - case 542: - return - new ErrorCode(542, "invalid_argument", true); - default: - return new ErrorCode(1, "undefined", true); - } - } - } +/* +* 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; + +namespace org.apache.qpid.client +{ + public enum QpidErrorCode + { + NO_ERROR = 200, + CONTENT_TOO_LARGE = 311, + NO_ROUTE = 312, + NO_CONSUMERS = 313, + CONNECTION_FORCED = 320, + INVALID_PATH = 402, + ACCESS_REFUSED = 403, + NOT_FOUND = 404, + RESOURCE_LOCKED = 405, + PRE_CONDITION_FAILED = 406, + FRAME_ERROR = 501, + SYNTAX_ERROR = 502, + COMMAND_INVALID = 503, + SESSION_ERROR = 504, + NOT_ALLOWED = 530, + NOT_IMPLEMENTED = 540, + INTERNAL_ERROR = 541, + INVALID_ARGUMENT = 542, + UNDEFINED = 1 + } + + public struct ErrorCode + { + private int _code; + private String _desc; + private readonly bool _hardError; + + public ErrorCode(int code, String desc, bool hardError) + { + _code = code; + _desc = desc; + _hardError = hardError; + } + + public int Code + { + get { return _code; } + set { _code = value; } + } + + public String Description + { + get { return _desc; } + set { _desc = value; } + } + + public bool ISHardError + { + get { return _hardError; } + } + + public static ErrorCode getErrorCode(int code) + { + switch (code) + { + case 200: + return + new ErrorCode(200, "reply-success", true); + case 311: + return + new ErrorCode(311, "content-too-large", false); + case 312: + return + new ErrorCode(312, "no-route", false); + case 313: + return + new ErrorCode(313, "content-consumers", false); + case 320: + return + new ErrorCode(320, "connection-forced", true); + case 402: + return + new ErrorCode(402, "invalid-path", true); + case 403: + return + new ErrorCode(403, "access-refused", false); + case 404: + return + new ErrorCode(404, "not-found", false); + case 405: + return + new ErrorCode(405, "resource-locked", false); + case 406: + return + new ErrorCode(406, "precondition-failed", false); + case 501: + return + new ErrorCode(501, "frame_error", true); + case 502: + return + new ErrorCode(502, "syntax_error", true); + case 503: + return + new ErrorCode(503, "command_invalid", true); + case 504: + return + new ErrorCode(504, "sesion_error", true); + case 530: + return + new ErrorCode(530, "not_allowed", true); + case 540: + return + new ErrorCode(540, "not_implemented", true); + case 541: + return + new ErrorCode(541, "internal_error", true); + case 542: + return + new ErrorCode(542, "invalid_argument", true); + default: + return new ErrorCode(1, "undefined", true); + } + } + } } \ No newline at end of file Modified: qpid/trunk/qpid/dotnet/client-010/client/client/IMessage.cs URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/dotnet/client-010/client/client/IMessage.cs?rev=886940&r1=886939&r2=886940&view=diff ============================================================================== --- qpid/trunk/qpid/dotnet/client-010/client/client/IMessage.cs (original) +++ qpid/trunk/qpid/dotnet/client-010/client/client/IMessage.cs Thu Dec 3 22:03:51 2009 @@ -1,48 +1,48 @@ -/* -* -* 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 org.apache.qpid.transport; - -namespace org.apache.qpid.client -{ - public interface IMessage - { - int Id { get; } - - Header Header { get; set; } - - MessageProperties MessageProperties { get; set; } - - DeliveryProperties DeliveryProperties { get; set; } - - Dictionary ApplicationHeaders { get; set; } - - void appendData(byte[] bytes); - - MemoryStream Body { get; } - - string Destination { get; } - - void clearData(); - } -} +/* +* +* 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 org.apache.qpid.transport; + +namespace org.apache.qpid.client +{ + public interface IMessage + { + int Id { get; } + + Header Header { get; set; } + + MessageProperties MessageProperties { get; set; } + + DeliveryProperties DeliveryProperties { get; set; } + + Dictionary ApplicationHeaders { get; set; } + + void appendData(byte[] bytes); + + MemoryStream Body { get; } + + string Destination { get; } + + void clearData(); + } +} Modified: qpid/trunk/qpid/dotnet/client-010/client/client/Message.cs URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/dotnet/client-010/client/client/Message.cs?rev=886940&r1=886939&r2=886940&view=diff ============================================================================== --- qpid/trunk/qpid/dotnet/client-010/client/client/Message.cs (original) +++ qpid/trunk/qpid/dotnet/client-010/client/client/Message.cs Thu Dec 3 22:03:51 2009 @@ -1,131 +1,131 @@ -/* -* -* 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.Collections.Generic; -using System.IO; -using org.apache.qpid.transport; - -namespace org.apache.qpid.client -{ - public class Message : IMessage - { - private readonly MessageTransfer _message; - - public Message(MessageTransfer m) - { - _message = m; - } - - public Message() - { - _message = new MessageTransfer(); - _message.Header = new Header( new MessageProperties(), new DeliveryProperties()); - ((MessageProperties) _message.Header.Structs[0]).setApplicationHeaders(new Dictionary()); - } - - public MessageProperties MessageProperties - { - get - { - if (_message.Header != null && Header.Structs.Length > 1) - return (MessageProperties) Header.Structs[0]; - return null; - } - set - { - if (_message.Header != null) - { - Header.Structs[0] = value; - } - } - } - - public DeliveryProperties DeliveryProperties - { - get - { - if (Header != null) - { - if( Header.Structs.Length > 1 ) - return (DeliveryProperties)Header.Structs[1]; - return (DeliveryProperties)Header.Structs[0]; - } - - return null; - } - set - { - if (Header != null) - { - Header.Structs[1] = value; - } - } - } - - public Dictionary ApplicationHeaders - { - get - { - if (Header != null) - return ((MessageProperties) Header.Structs[0]).getApplicationHeaders(); - return null; - } - set - { - if (Header != null) - { - ((MessageProperties) Header.Structs[0]).setApplicationHeaders(value); - } - } - } - - public void appendData(byte[] bytes) - { - Body.Write(bytes, 0, bytes.Length); - } - - public void clearData() - { - Body.Seek(0, SeekOrigin.Begin); - } - - public Header Header - { - get{ return _message.Header;} - set{ _message.Header = value;} - } - - public MemoryStream Body - { - get { return _message.Body; } - set { _message.Body = value; } - } - - public int Id - { - get { return _message.Id; } - } - - public string Destination - { - get{ return _message.getDestination();} - } - } -} +/* +* +* 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.Collections.Generic; +using System.IO; +using org.apache.qpid.transport; + +namespace org.apache.qpid.client +{ + public class Message : IMessage + { + private readonly MessageTransfer _message; + + public Message(MessageTransfer m) + { + _message = m; + } + + public Message() + { + _message = new MessageTransfer(); + _message.Header = new Header( new MessageProperties(), new DeliveryProperties()); + ((MessageProperties) _message.Header.Structs[0]).setApplicationHeaders(new Dictionary()); + } + + public MessageProperties MessageProperties + { + get + { + if (_message.Header != null && Header.Structs.Length > 1) + return (MessageProperties) Header.Structs[0]; + return null; + } + set + { + if (_message.Header != null) + { + Header.Structs[0] = value; + } + } + } + + public DeliveryProperties DeliveryProperties + { + get + { + if (Header != null) + { + if( Header.Structs.Length > 1 ) + return (DeliveryProperties)Header.Structs[1]; + return (DeliveryProperties)Header.Structs[0]; + } + + return null; + } + set + { + if (Header != null) + { + Header.Structs[1] = value; + } + } + } + + public Dictionary ApplicationHeaders + { + get + { + if (Header != null) + return ((MessageProperties) Header.Structs[0]).getApplicationHeaders(); + return null; + } + set + { + if (Header != null) + { + ((MessageProperties) Header.Structs[0]).setApplicationHeaders(value); + } + } + } + + public void appendData(byte[] bytes) + { + Body.Write(bytes, 0, bytes.Length); + } + + public void clearData() + { + Body.Seek(0, SeekOrigin.Begin); + } + + public Header Header + { + get{ return _message.Header;} + set{ _message.Header = value;} + } + + public MemoryStream Body + { + get { return _message.Body; } + set { _message.Body = value; } + } + + public int Id + { + get { return _message.Id; } + } + + public string Destination + { + get{ return _message.getDestination();} + } + } +} Modified: qpid/trunk/qpid/dotnet/client-010/client/client/MessageListenerInterface.cs URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/dotnet/client-010/client/client/MessageListenerInterface.cs?rev=886940&r1=886939&r2=886940&view=diff ============================================================================== --- qpid/trunk/qpid/dotnet/client-010/client/client/MessageListenerInterface.cs (original) +++ qpid/trunk/qpid/dotnet/client-010/client/client/MessageListenerInterface.cs Thu Dec 3 22:03:51 2009 @@ -1,31 +1,31 @@ -/* -* 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. -*/ - - -namespace org.apache.qpid.client -{ - public interface IMessageListener - { - /// - /// Inform the listener of the message transfer - /// - /// The message transfer object - void messageTransfer(IMessage xfr); - } -} +/* +* 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. +*/ + + +namespace org.apache.qpid.client +{ + public interface IMessageListener + { + /// + /// Inform the listener of the message transfer + /// + /// The message transfer object + void messageTransfer(IMessage xfr); + } +} Modified: qpid/trunk/qpid/dotnet/client-010/client/transport/Binary.cs URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/dotnet/client-010/client/transport/Binary.cs?rev=886940&r1=886939&r2=886940&view=diff ============================================================================== --- qpid/trunk/qpid/dotnet/client-010/client/transport/Binary.cs (original) +++ qpid/trunk/qpid/dotnet/client-010/client/transport/Binary.cs Thu Dec 3 22:03:51 2009 @@ -1,129 +1,129 @@ -/* -* -* 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. -* -*/ - -namespace org.apache.qpid.transport -{ - - - /// - /// Binary - /// - - public sealed class Binary - { - - private readonly byte[] bytes; - private readonly int offset_Renamed_Field; - private readonly int size_Renamed_Field; - private int hash = 0; - - public Binary(byte[] bytes, int offset, int size) - { - if (offset + size > bytes.Length) - { - throw new System.IndexOutOfRangeException(); - } - - this.bytes = bytes; - offset_Renamed_Field = offset; - size_Renamed_Field = size; - } - - public Binary(byte[] bytes):this(bytes, 0, bytes.Length) - { - } - - public byte[] array() - { - return bytes; - } - - public int offset() - { - return offset_Renamed_Field; - } - - public int size() - { - return size_Renamed_Field; - } - - public Binary slice(int low, int high) - { - int sz; - - if (high < 0) - { - sz = size_Renamed_Field + high; - } - else - { - sz = high - low; - } - - if (sz < 0) - { - sz = 0; - } - - return new Binary(bytes, offset_Renamed_Field + low, sz); - } - - public override int GetHashCode() - { - if (hash == 0) - { - int hc = 0; - for (int i = 0; i < size_Renamed_Field; i++) - { - hc = 31 * hc + (0xFF & bytes[offset_Renamed_Field + i]); - } - hash = hc; - } - - return hash; - } - - public override bool Equals(System.Object o) - { - if (!(o is Binary)) - { - return false; - } - - Binary buf = (Binary) o; - if (size_Renamed_Field != buf.size_Renamed_Field) - { - return false; - } - - for (int i = 0; i < size_Renamed_Field; i++) - { - if (bytes[offset_Renamed_Field + i] != buf.bytes[buf.offset_Renamed_Field + i]) - { - return false; - } - } - - return true; - } - } +/* +* +* 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. +* +*/ + +namespace org.apache.qpid.transport +{ + + + /// + /// Binary + /// + + public sealed class Binary + { + + private readonly byte[] bytes; + private readonly int offset_Renamed_Field; + private readonly int size_Renamed_Field; + private int hash = 0; + + public Binary(byte[] bytes, int offset, int size) + { + if (offset + size > bytes.Length) + { + throw new System.IndexOutOfRangeException(); + } + + this.bytes = bytes; + offset_Renamed_Field = offset; + size_Renamed_Field = size; + } + + public Binary(byte[] bytes):this(bytes, 0, bytes.Length) + { + } + + public byte[] array() + { + return bytes; + } + + public int offset() + { + return offset_Renamed_Field; + } + + public int size() + { + return size_Renamed_Field; + } + + public Binary slice(int low, int high) + { + int sz; + + if (high < 0) + { + sz = size_Renamed_Field + high; + } + else + { + sz = high - low; + } + + if (sz < 0) + { + sz = 0; + } + + return new Binary(bytes, offset_Renamed_Field + low, sz); + } + + public override int GetHashCode() + { + if (hash == 0) + { + int hc = 0; + for (int i = 0; i < size_Renamed_Field; i++) + { + hc = 31 * hc + (0xFF & bytes[offset_Renamed_Field + i]); + } + hash = hc; + } + + return hash; + } + + public override bool Equals(System.Object o) + { + if (!(o is Binary)) + { + return false; + } + + Binary buf = (Binary) o; + if (size_Renamed_Field != buf.size_Renamed_Field) + { + return false; + } + + for (int i = 0; i < size_Renamed_Field; i++) + { + if (bytes[offset_Renamed_Field + i] != buf.bytes[buf.offset_Renamed_Field + i]) + { + return false; + } + } + + return true; + } + } } \ No newline at end of file Modified: qpid/trunk/qpid/dotnet/client-010/client/transport/Binding.cs URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/dotnet/client-010/client/transport/Binding.cs?rev=886940&r1=886939&r2=886940&view=diff ============================================================================== --- qpid/trunk/qpid/dotnet/client-010/client/transport/Binding.cs (original) +++ qpid/trunk/qpid/dotnet/client-010/client/transport/Binding.cs Thu Dec 3 22:03:51 2009 @@ -1,34 +1,34 @@ -/* -* -* 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; - -namespace org.apache.qpid.transport -{ - /// - /// Binding - /// - internal interface Binding - { - E endpoint(Sender sender); - - Receiver receiver(E endpoint) where R : EventArgs; - } +/* +* +* 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; + +namespace org.apache.qpid.transport +{ + /// + /// Binding + /// + internal interface Binding + { + E endpoint(Sender sender); + + Receiver receiver(E endpoint) where R : EventArgs; + } } \ No newline at end of file Modified: qpid/trunk/qpid/dotnet/client-010/client/transport/Channel.cs URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/dotnet/client-010/client/transport/Channel.cs?rev=886940&r1=886939&r2=886940&view=diff ============================================================================== --- qpid/trunk/qpid/dotnet/client-010/client/transport/Channel.cs (original) +++ qpid/trunk/qpid/dotnet/client-010/client/transport/Channel.cs Thu Dec 3 22:03:51 2009 @@ -1,174 +1,174 @@ -/* -* -* 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 org.apache.qpid.transport.network; -using org.apache.qpid.transport.util; - -namespace org.apache.qpid.transport -{ - /// - /// Channel - /// - public class Channel : Invoker, ProtocolDelegate - { - private static readonly Logger log = Logger.get(typeof (Channel)); - - private readonly Connection _connection; - private readonly int _channel; - private readonly MethodDelegate _methoddelegate; - private readonly SessionDelegate _sessionDelegate; - // session may be null - private Session _session; - - public Channel(Connection connection, int channel, SessionDelegate sessionDelegate) - { - _connection = connection; - _channel = channel; - _methoddelegate = new ChannelDelegate(); - _sessionDelegate = sessionDelegate; - } - - public Connection Connection - { - get { return _connection; } - } - - // Invoked when a network event is received - public void On_ReceivedEvent(object sender, ReceivedPayload payload) - { - if (payload.Payload.Channel == _channel) - { - payload.Payload.ProcessProtocolEvent(null, this); - } - } - - #region ProtocolDelegate - - public void Init(Object v, ProtocolHeader hdr) - { - _connection.ConnectionDelegate.init(this, hdr); - } - - public void Control(Object v, Method method) - { - switch (method.EncodedTrack) - { - case Frame.L1: - method.dispatch(this, _connection.ConnectionDelegate); - break; - case Frame.L2: - method.dispatch(this, _methoddelegate); - break; - case Frame.L3: - method.ProcessProtocolEvent(_session, _sessionDelegate); - break; - default: - throw new Exception("unknown track: " + method.EncodedTrack); - } - } - - public void Command(Object v, Method method) - { - method.ProcessProtocolEvent(_session, _sessionDelegate); - } - - public void Error(Object v, ProtocolError error) - { - throw new Exception(error.Message); - } - - #endregion - - public void exception(Exception t) - { - _session.exception(t); - } - - public void closedFromConnection() - { - log.debug("channel closed: ", this); - if (_session != null) - { - _session.closed(); - } - } - - public void closed() - { - log.debug("channel closed: ", this); - if (_session != null) - { - _session.closed(); - } - _connection.removeChannel(_channel); - } - - public int EncodedChannel - { - get { return _channel; } - } - - public Session Session - { - get { return _session; } - set { _session = value; } - } - - public void closeCode(ConnectionClose close) - { - if (_session != null) - { - _session.closeCode(close); - } - } - - private void emit(ProtocolEvent pevent) - { - pevent.Channel = _channel; - _connection.send(pevent); - } - - public void method(Method m) - { - emit(m); - - if (!m.Batch) - { - _connection.flush(); - } - } - - protected override void invoke(Method m) - { - method(m); - } - - public override Future invoke(Method m, Future future) - { - throw new Exception("UnsupportedOperation"); - } - - public String toString() - { - return String.Format("{0}:{1}", _connection, _channel); - } - } +/* +* +* 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 org.apache.qpid.transport.network; +using org.apache.qpid.transport.util; + +namespace org.apache.qpid.transport +{ + /// + /// Channel + /// + public class Channel : Invoker, ProtocolDelegate + { + private static readonly Logger log = Logger.get(typeof (Channel)); + + private readonly Connection _connection; + private readonly int _channel; + private readonly MethodDelegate _methoddelegate; + private readonly SessionDelegate _sessionDelegate; + // session may be null + private Session _session; + + public Channel(Connection connection, int channel, SessionDelegate sessionDelegate) + { + _connection = connection; + _channel = channel; + _methoddelegate = new ChannelDelegate(); + _sessionDelegate = sessionDelegate; + } + + public Connection Connection + { + get { return _connection; } + } + + // Invoked when a network event is received + public void On_ReceivedEvent(object sender, ReceivedPayload payload) + { + if (payload.Payload.Channel == _channel) + { + payload.Payload.ProcessProtocolEvent(null, this); + } + } + + #region ProtocolDelegate + + public void Init(Object v, ProtocolHeader hdr) + { + _connection.ConnectionDelegate.init(this, hdr); + } + + public void Control(Object v, Method method) + { + switch (method.EncodedTrack) + { + case Frame.L1: + method.dispatch(this, _connection.ConnectionDelegate); + break; + case Frame.L2: + method.dispatch(this, _methoddelegate); + break; + case Frame.L3: + method.ProcessProtocolEvent(_session, _sessionDelegate); + break; + default: + throw new Exception("unknown track: " + method.EncodedTrack); + } + } + + public void Command(Object v, Method method) + { + method.ProcessProtocolEvent(_session, _sessionDelegate); + } + + public void Error(Object v, ProtocolError error) + { + throw new Exception(error.Message); + } + + #endregion + + public void exception(Exception t) + { + _session.exception(t); + } + + public void closedFromConnection() + { + log.debug("channel closed: ", this); + if (_session != null) + { + _session.closed(); + } + } + + public void closed() + { + log.debug("channel closed: ", this); + if (_session != null) + { + _session.closed(); + } + _connection.removeChannel(_channel); + } + + public int EncodedChannel + { + get { return _channel; } + } + + public Session Session + { + get { return _session; } + set { _session = value; } + } + + public void closeCode(ConnectionClose close) + { + if (_session != null) + { + _session.closeCode(close); + } + } + + private void emit(ProtocolEvent pevent) + { + pevent.Channel = _channel; + _connection.send(pevent); + } + + public void method(Method m) + { + emit(m); + + if (!m.Batch) + { + _connection.flush(); + } + } + + protected override void invoke(Method m) + { + method(m); + } + + public override Future invoke(Method m, Future future) + { + throw new Exception("UnsupportedOperation"); + } + + public String toString() + { + return String.Format("{0}:{1}", _connection, _channel); + } + } } \ No newline at end of file Modified: qpid/trunk/qpid/dotnet/client-010/client/transport/ChannelDelegate.cs URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/dotnet/client-010/client/transport/ChannelDelegate.cs?rev=886940&r1=886939&r2=886940&view=diff ============================================================================== --- qpid/trunk/qpid/dotnet/client-010/client/transport/ChannelDelegate.cs (original) +++ qpid/trunk/qpid/dotnet/client-010/client/transport/ChannelDelegate.cs Thu Dec 3 22:03:51 2009 @@ -1,41 +1,41 @@ -/* -* -* 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. -* -*/ -namespace org.apache.qpid.transport -{ - /// - /// ChannelDelegate - /// - /// - internal class ChannelDelegate : MethodDelegate - { - public override void sessionDetached(Channel channel, SessionDetached closed) - { - channel.closed(); - } - - public override void sessionDetach(Channel channel, SessionDetach dtc) - { - channel.Session.closed(); - channel.sessionDetached(dtc.getName(), SessionDetachCode.NORMAL); - channel.closed(); - } - } +/* +* +* 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. +* +*/ +namespace org.apache.qpid.transport +{ + /// + /// ChannelDelegate + /// + /// + internal class ChannelDelegate : MethodDelegate + { + public override void sessionDetached(Channel channel, SessionDetached closed) + { + channel.closed(); + } + + public override void sessionDetach(Channel channel, SessionDetach dtc) + { + channel.Session.closed(); + channel.sessionDetached(dtc.getName(), SessionDetachCode.NORMAL); + channel.closed(); + } + } } \ No newline at end of file Modified: qpid/trunk/qpid/dotnet/client-010/client/transport/ClientDelegate.cs URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/dotnet/client-010/client/transport/ClientDelegate.cs?rev=886940&r1=886939&r2=886940&view=diff ============================================================================== --- qpid/trunk/qpid/dotnet/client-010/client/transport/ClientDelegate.cs (original) +++ qpid/trunk/qpid/dotnet/client-010/client/transport/ClientDelegate.cs Thu Dec 3 22:03:51 2009 @@ -1,35 +1,35 @@ -/* -* -* 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 org.apache.qpid.transport; - -namespace org.apache.qpid.transport -{ - abstract class ClientDelegate : ConnectionDelegate - { - public override void init(Channel ch, ProtocolHeader hdr) - { - if (hdr.Major != 0 && hdr.Minor != 10) - { - throw new ProtocolVersionException((sbyte) hdr.Major, (sbyte) hdr.Minor); - } - } - } -} +/* +* +* 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 org.apache.qpid.transport; + +namespace org.apache.qpid.transport +{ + abstract class ClientDelegate : ConnectionDelegate + { + public override void init(Channel ch, ProtocolHeader hdr) + { + if (hdr.Major != 0 && hdr.Minor != 10) + { + throw new ProtocolVersionException((sbyte) hdr.Major, (sbyte) hdr.Minor); + } + } + } +} --------------------------------------------------------------------- Apache Qpid - AMQP Messaging Implementation Project: http://qpid.apache.org Use/Interact: mailto:commits-subscribe@qpid.apache.org