summaryrefslogtreecommitdiff
path: root/qpid
diff options
context:
space:
mode:
Diffstat (limited to 'qpid')
-rw-r--r--qpid/dotnet/Qpid.Buffer/HeapByteBuffer.cs7
-rw-r--r--qpid/dotnet/Qpid.Client/Client/AmqChannel.cs21
-rw-r--r--qpid/dotnet/Qpid.Client/Client/Message/AbstractQmsMessage.cs363
-rw-r--r--qpid/dotnet/Qpid.Client/Client/Message/QpidBytesMessage.cs76
-rw-r--r--qpid/dotnet/Qpid.Client/Client/Message/QpidHeaders.cs356
-rw-r--r--qpid/dotnet/Qpid.Client/Client/Message/QpidTextMessage.cs6
-rw-r--r--qpid/dotnet/Qpid.Client/Qpid.Client.csproj9
-rw-r--r--qpid/dotnet/Qpid.Codec/Support/SimpleProtocolEncoderOutput.cs1
-rw-r--r--qpid/dotnet/Qpid.Common/Framing/FieldTable.cs2
-rw-r--r--qpid/dotnet/Qpid.Common/Qpid.Common.csproj8
10 files changed, 465 insertions, 384 deletions
diff --git a/qpid/dotnet/Qpid.Buffer/HeapByteBuffer.cs b/qpid/dotnet/Qpid.Buffer/HeapByteBuffer.cs
index c54272b33f..ea3b11b60d 100644
--- a/qpid/dotnet/Qpid.Buffer/HeapByteBuffer.cs
+++ b/qpid/dotnet/Qpid.Buffer/HeapByteBuffer.cs
@@ -126,8 +126,11 @@ namespace Qpid.Buffer
}
public override byte[] ToByteArray()
- {
- return _underlyingData;
+ {
+ // Return copy of bytes remaining.
+ byte[] result = new byte[Remaining];
+ Array.Copy(_underlyingData, _position, result, 0, Remaining);
+ return result;
}
private void CheckSpace(int size)
diff --git a/qpid/dotnet/Qpid.Client/Client/AmqChannel.cs b/qpid/dotnet/Qpid.Client/Client/AmqChannel.cs
index 2ffd6505c6..a66e4f8a8a 100644
--- a/qpid/dotnet/Qpid.Client/Client/AmqChannel.cs
+++ b/qpid/dotnet/Qpid.Client/Client/AmqChannel.cs
@@ -23,6 +23,7 @@ using System.Collections;
using System.Text.RegularExpressions;
using System.Threading;
using log4net;
+using Qpid.Buffer;
using Qpid.Client.Message;
using Qpid.Collections;
using Qpid.Framing;
@@ -801,7 +802,25 @@ namespace Qpid.Client
currentTime = DateTime.UtcNow.Ticks;
message.Timestamp = currentTime;
}
- byte[] payload = message.Data.ToByteArray();
+
+ //
+ // Very nasty temporary hack for GRM. Will be altered ASAP.
+ //
+ if (message is QpidBytesMessage)
+ {
+ QpidBytesMessage msg = (QpidBytesMessage) message;
+ if (!msg.IsReadable)
+ {
+ msg.Reset();
+ }
+ }
+
+ ByteBuffer buf = message.Data;
+ byte[] payload = null;
+ if (buf != null)
+ {
+ payload = buf.ToByteArray();
+ }
BasicContentHeaderProperties contentHeaderProperties = message.ContentHeaderProperties;
if (timeToLive > 0)
diff --git a/qpid/dotnet/Qpid.Client/Client/Message/AbstractQmsMessage.cs b/qpid/dotnet/Qpid.Client/Client/Message/AbstractQmsMessage.cs
index 4c4adb8063..444d00cd04 100644
--- a/qpid/dotnet/Qpid.Client/Client/Message/AbstractQmsMessage.cs
+++ b/qpid/dotnet/Qpid.Client/Client/Message/AbstractQmsMessage.cs
@@ -37,6 +37,7 @@ namespace Qpid.Client.Message
protected bool _redelivered;
protected ByteBuffer _data;
+ private bool _readableMessage = false;
//protected AbstractQmsMessage() : base(new BasicContentHeaderProperties())
//{
@@ -64,6 +65,7 @@ namespace Qpid.Client.Message
{
_data.Acquire();
}
+ _readableMessage = (data != null);
}
protected AbstractQmsMessage(long deliveryTag, BasicContentHeaderProperties contentHeader, ByteBuffer data)
@@ -74,6 +76,7 @@ namespace Qpid.Client.Message
{
_data.Acquire();
}
+ _readableMessage = data != null;
}
protected AbstractQmsMessage(BasicContentHeaderProperties contentHeader, long deliveryTag) : base(contentHeader, deliveryTag)
@@ -113,6 +116,14 @@ namespace Qpid.Client.Message
}
}
+ protected void CheckReadable()
+ {
+ if (!_readableMessage)
+ {
+ throw new MessageNotReadableException("You need to call reset() to make the message readable");
+ }
+ }
+
public byte[] CorrelationIdAsBytes
{
get
@@ -339,7 +350,13 @@ namespace Qpid.Client.Message
get { return new QpidHeaders(this); }
}
- public abstract void ClearBody();
+ public abstract void ClearBodyImpl();
+
+ public void ClearBody()
+ {
+ ClearBodyImpl();
+ _readableMessage = false;
+ }
/// <summary>
/// Get a String representation of the body of the message. Used in the
@@ -471,352 +488,20 @@ namespace Qpid.Client.Message
return (BasicContentHeaderProperties) _contentHeaderProperties;
}
}
- }
-
- internal class QpidHeaders : IHeaders
- {
- public const char BOOLEAN_PROPERTY_PREFIX = 'B';
- public const char BYTE_PROPERTY_PREFIX = 'b';
- public const char SHORT_PROPERTY_PREFIX = 's';
- public const char INT_PROPERTY_PREFIX = 'i';
- public const char LONG_PROPERTY_PREFIX = 'l';
- public const char FLOAT_PROPERTY_PREFIX = 'f';
- public const char DOUBLE_PROPERTY_PREFIX = 'd';
- public const char STRING_PROPERTY_PREFIX = 'S';
-
- AbstractQmsMessage _message;
-
- public QpidHeaders(AbstractQmsMessage message)
- {
- _message = message;
- }
-
- public bool Contains(string name)
- {
- CheckPropertyName(name);
- if (_message.ContentHeaderProperties.Headers == null)
- {
- return false;
- }
- else
- {
- // TODO: fix this
- return _message.ContentHeaderProperties.Headers.Contains(STRING_PROPERTY_PREFIX + name);
- }
- }
-
- public void Clear()
- {
- if (_message.ContentHeaderProperties.Headers != null)
- {
- _message.ContentHeaderProperties.Headers.Clear();
- }
- }
-
- public string this[string name]
- {
- get
- {
- return GetString(name);
- }
- set
- {
- SetString(name, value);
- }
- }
-
- public bool GetBoolean(string name)
- {
- CheckPropertyName(name);
- if (_message.ContentHeaderProperties.Headers == null)
- {
- return false;
- }
- else
- {
- object b = _message.ContentHeaderProperties.Headers[BOOLEAN_PROPERTY_PREFIX + name];
-
- if (b == null)
- {
- return false;
- }
- else
- {
- return (bool)b;
- }
- }
- }
-
- public void SetBoolean(string name, bool b)
- {
- CheckPropertyName(name);
- _message.ContentHeaderProperties.Headers[BOOLEAN_PROPERTY_PREFIX + name] = b;
- }
-
- public byte GetByte(string propertyName)
- {
- CheckPropertyName(propertyName);
- if (_message.ContentHeaderProperties.Headers == null)
- {
- return 0;
- }
- else
- {
- object b = _message.ContentHeaderProperties.Headers[BYTE_PROPERTY_PREFIX + propertyName];
- if (b == null)
- {
- return 0;
- }
- else
- {
- return (byte)b;
- }
- }
- }
-
- public void SetByte(string propertyName, byte b)
- {
- CheckPropertyName(propertyName);
- _message.ContentHeaderProperties.Headers[BYTE_PROPERTY_PREFIX + propertyName] = b;
- }
-
- public short GetShort(string propertyName)
- {
- CheckPropertyName(propertyName);
- if (_message.ContentHeaderProperties.Headers == null)
- {
- return 0;
- }
- else
- {
- object s = _message.ContentHeaderProperties.Headers[SHORT_PROPERTY_PREFIX + propertyName];
- if (s == null)
- {
- return 0;
- }
- else
- {
- return (short)s;
- }
- }
- }
- public void SetShort(string propertyName, short i)
+ protected void Reset()
{
- CheckPropertyName(propertyName);
- _message.ContentHeaderProperties.Headers[SHORT_PROPERTY_PREFIX + propertyName] = i;
+ _readableMessage = true;
}
- public int GetInt(string propertyName)
+ public bool IsReadable
{
- CheckPropertyName(propertyName);
- if (_message.ContentHeaderProperties.Headers == null)
- {
- return 0;
- }
- else
- {
- object i = _message.ContentHeaderProperties.Headers[INT_PROPERTY_PREFIX + propertyName];
- if (i == null)
- {
- return 0;
- }
- else
- {
- return (int)i;
- }
- }
+ get { return _readableMessage; }
}
- public void SetInt(string propertyName, int i)
+ public bool isWritable
{
- CheckPropertyName(propertyName);
- _message.ContentHeaderProperties.Headers[INT_PROPERTY_PREFIX + propertyName] = i;
- }
-
- public long GetLong(string propertyName)
- {
- CheckPropertyName(propertyName);
- if (_message.ContentHeaderProperties.Headers == null)
- {
- return 0;
- }
- else
- {
- object l = _message.ContentHeaderProperties.Headers[LONG_PROPERTY_PREFIX + propertyName];
- if (l == null)
- {
- // temp - the spec says do this but this throws a NumberFormatException
- //return Long.valueOf(null).longValue();
- return 0;
- }
- else
- {
- return (long)l;
- }
- }
- }
-
- public void SetLong(string propertyName, long l)
- {
- CheckPropertyName(propertyName);
- _message.ContentHeaderProperties.Headers[LONG_PROPERTY_PREFIX + propertyName] = l;
- }
-
- public float GetFloat(String propertyName)
- {
- CheckPropertyName(propertyName);
- if (_message.ContentHeaderProperties.Headers == null)
- {
- return 0;
- }
- else
- {
- object f = _message.ContentHeaderProperties.Headers[FLOAT_PROPERTY_PREFIX + propertyName];
- if (f == null)
- {
- return 0;
- }
- else
- {
- return (float)f;
- }
- }
- }
-
- public void SetFloat(string propertyName, float f)
- {
- CheckPropertyName(propertyName);
- _message.ContentHeaderProperties.Headers[FLOAT_PROPERTY_PREFIX + propertyName] = f;
- }
-
- public double GetDouble(string propertyName)
- {
- CheckPropertyName(propertyName);
- if (_message.ContentHeaderProperties.Headers == null)
- {
- return 0;
- }
- else
- {
- object d = _message.ContentHeaderProperties.Headers[DOUBLE_PROPERTY_PREFIX + propertyName];
- if (d == null)
- {
- return 0;
- }
- else
- {
- return (double)d;
- }
- }
- }
-
- public void SetDouble(string propertyName, double v)
- {
- CheckPropertyName(propertyName);
- _message.ContentHeaderProperties.Headers[DOUBLE_PROPERTY_PREFIX + propertyName] = v;
- }
-
- public string GetString(string propertyName)
- {
- CheckPropertyName(propertyName);
- if (_message.ContentHeaderProperties.Headers == null)
- {
- return null;
- }
- else
- {
- return (string)_message.ContentHeaderProperties.Headers[STRING_PROPERTY_PREFIX + propertyName];
- }
- }
-
- public void SetString(string propertyName, string value)
- {
- CheckPropertyName(propertyName);
- CreatePropertyMapIfRequired();
- propertyName = STRING_PROPERTY_PREFIX + propertyName;
- _message.ContentHeaderProperties.Headers[propertyName] = value;
- }
-
- private void CheckPropertyName(string propertyName)
- {
- if (propertyName == null)
- {
- throw new ArgumentException("Property name must not be null");
- }
- else if ("".Equals(propertyName))
- {
- throw new ArgumentException("Property name must not be the empty string");
- }
-
- if (_message.ContentHeaderProperties.Headers == null)
- {
- _message.ContentHeaderProperties.Headers = new FieldTable();
- }
- }
-
- private void CreatePropertyMapIfRequired()
- {
- if (_message.ContentHeaderProperties.Headers == null)
- {
- _message.ContentHeaderProperties.Headers = new FieldTable();
- }
- }
-
- public override string ToString()
- {
- StringBuilder buf = new StringBuilder("{");
- int i = 0;
- foreach (DictionaryEntry entry in _message.ContentHeaderProperties.Headers)
- {
- ++i;
- if (i > 1)
- {
- buf.Append(", ");
- }
- string propertyName = (string)entry.Key;
- if (propertyName == null)
- {
- buf.Append("\nInternal error: Property with NULL key defined");
- }
- else
- {
- buf.Append(propertyName.Substring(1));
-
- buf.Append(" : ");
-
- char typeIdentifier = propertyName[0];
- buf.Append(typeIdentifierToName(typeIdentifier));
- buf.Append(" = ").Append(entry.Value);
- }
- }
- buf.Append("}");
- return buf.ToString();
- }
-
- private static string typeIdentifierToName(char typeIdentifier)
- {
- switch (typeIdentifier)
- {
- case BOOLEAN_PROPERTY_PREFIX:
- return "boolean";
- case BYTE_PROPERTY_PREFIX:
- return "byte";
- case SHORT_PROPERTY_PREFIX:
- return "short";
- case INT_PROPERTY_PREFIX:
- return "int";
- case LONG_PROPERTY_PREFIX:
- return "long";
- case FLOAT_PROPERTY_PREFIX:
- return "float";
- case DOUBLE_PROPERTY_PREFIX:
- return "double";
- case STRING_PROPERTY_PREFIX:
- return "string";
- default:
- return "unknown ( '" + typeIdentifier + "')";
- }
+ get { return !_readableMessage; }
}
}
}
diff --git a/qpid/dotnet/Qpid.Client/Client/Message/QpidBytesMessage.cs b/qpid/dotnet/Qpid.Client/Client/Message/QpidBytesMessage.cs
index 9ff3d543d8..866d0d25af 100644
--- a/qpid/dotnet/Qpid.Client/Client/Message/QpidBytesMessage.cs
+++ b/qpid/dotnet/Qpid.Client/Client/Message/QpidBytesMessage.cs
@@ -31,6 +31,8 @@ namespace Qpid.Client.Message
{
private const string MIME_TYPE = "application/octet-stream";
+ private const int DEFAULT_BUFFER_INITIAL_SIZE = 1024;
+
/// <summary>
/// The backingstore for the data
/// </summary>
@@ -57,6 +59,8 @@ namespace Qpid.Client.Message
ContentHeaderProperties.ContentType = MIME_TYPE;
if (data == null)
{
+ _data = ByteBuffer.Allocate(DEFAULT_BUFFER_INITIAL_SIZE);
+ //_data.AutoExpand = true;
_dataStream = new MemoryStream();
_writer = new BinaryWriter(_dataStream);
}
@@ -76,22 +80,27 @@ namespace Qpid.Client.Message
_dataStream = new MemoryStream(data.ToByteArray());
_bodyLength = data.ToByteArray().Length;
_reader = new BinaryReader(_dataStream);
+
}
-
- public override void ClearBody()
+ public override void ClearBodyImpl()
{
- if (_reader != null)
- {
- _reader.Close();
- _reader = null;
- }
- _dataStream = new MemoryStream();
- _bodyLength = 0;
-
- _writer = new BinaryWriter(_dataStream);
+ _data.Clear();
}
+// public override void ClearBody()
+// {
+// if (_reader != null)
+// {
+// _reader.Close();
+// _reader = null;
+// }
+// _dataStream = new MemoryStream();
+// _bodyLength = 0;
+//
+// _writer = new BinaryWriter(_dataStream);
+// }
+
public override string ToBodyString()
{
CheckReadable();
@@ -156,7 +165,8 @@ namespace Qpid.Client.Message
get
{
CheckReadable();
- return _bodyLength;
+ return _data.Limit; // XXX
+// return _bodyLength;
}
}
@@ -164,13 +174,14 @@ namespace Qpid.Client.Message
///
/// </summary>
/// <exception cref="MessageNotReadableException">if the message is in write mode</exception>
- private void CheckReadable()
- {
- if (_reader == null)
- {
- throw new MessageNotReadableException("You need to call reset() to make the message readable");
- }
- }
+// private void CheckReadable()
+// {
+//
+// if (_reader == null)
+// {
+// throw new MessageNotReadableException("You need to call reset() to make the message readable");
+// }
+// }
private void CheckWritable()
{
@@ -565,18 +576,21 @@ namespace Qpid.Client.Message
public void Reset()
{
- CheckWritable();
- try
- {
- _writer.Close();
- _writer = null;
- _reader = new BinaryReader(_dataStream);
- _bodyLength = (int) _dataStream.Length;
- }
- catch (IOException e)
- {
- throw new QpidException(e.ToString(), e);
- }
+ base.Reset();
+ _data.Flip();
+
+// CheckWritable();
+// try
+// {
+// _writer.Close();
+// _writer = null;
+// _reader = new BinaryReader(_dataStream);
+// _bodyLength = (int) _dataStream.Length;
+// }
+// catch (IOException e)
+// {
+// throw new QpidException(e.ToString(), e);
+// }
}
}
}
diff --git a/qpid/dotnet/Qpid.Client/Client/Message/QpidHeaders.cs b/qpid/dotnet/Qpid.Client/Client/Message/QpidHeaders.cs
new file mode 100644
index 0000000000..3b44dbc45d
--- /dev/null
+++ b/qpid/dotnet/Qpid.Client/Client/Message/QpidHeaders.cs
@@ -0,0 +1,356 @@
+using System;
+using System.Collections;
+using System.Text;
+using Qpid.Framing;
+using Qpid.Messaging;
+
+namespace Qpid.Client.Message
+{
+ internal class QpidHeaders : IHeaders
+ {
+ public const char BOOLEAN_PROPERTY_PREFIX = 'B';
+ public const char BYTE_PROPERTY_PREFIX = 'b';
+ public const char SHORT_PROPERTY_PREFIX = 's';
+ public const char INT_PROPERTY_PREFIX = 'i';
+ public const char LONG_PROPERTY_PREFIX = 'l';
+ public const char FLOAT_PROPERTY_PREFIX = 'f';
+ public const char DOUBLE_PROPERTY_PREFIX = 'd';
+ public const char STRING_PROPERTY_PREFIX = 'S';
+
+ AbstractQmsMessage _message;
+
+ public QpidHeaders(AbstractQmsMessage message)
+ {
+ _message = message;
+ }
+
+ public bool Contains(string name)
+ {
+ CheckPropertyName(name);
+ if (_message.ContentHeaderProperties.Headers == null)
+ {
+ return false;
+ }
+ else
+ {
+ // TODO: fix this
+ return _message.ContentHeaderProperties.Headers.Contains(STRING_PROPERTY_PREFIX + name);
+ }
+ }
+
+ public void Clear()
+ {
+ if (_message.ContentHeaderProperties.Headers != null)
+ {
+ _message.ContentHeaderProperties.Headers.Clear();
+ }
+ }
+
+ public string this[string name]
+ {
+ get
+ {
+ return GetString(name);
+ }
+ set
+ {
+ SetString(name, value);
+ }
+ }
+
+ public bool GetBoolean(string name)
+ {
+ CheckPropertyName(name);
+ if (_message.ContentHeaderProperties.Headers == null)
+ {
+ return false;
+ }
+ else
+ {
+ object b = _message.ContentHeaderProperties.Headers[BOOLEAN_PROPERTY_PREFIX + name];
+
+ if (b == null)
+ {
+ return false;
+ }
+ else
+ {
+ return (bool)b;
+ }
+ }
+ }
+
+ public void SetBoolean(string name, bool b)
+ {
+ CheckPropertyName(name);
+ _message.ContentHeaderProperties.Headers[BOOLEAN_PROPERTY_PREFIX + name] = b;
+ }
+
+ public byte GetByte(string propertyName)
+ {
+ CheckPropertyName(propertyName);
+ if (_message.ContentHeaderProperties.Headers == null)
+ {
+ return 0;
+ }
+ else
+ {
+ object b = _message.ContentHeaderProperties.Headers[BYTE_PROPERTY_PREFIX + propertyName];
+ if (b == null)
+ {
+ return 0;
+ }
+ else
+ {
+ return (byte)b;
+ }
+ }
+ }
+
+ public void SetByte(string propertyName, byte b)
+ {
+ CheckPropertyName(propertyName);
+ _message.ContentHeaderProperties.Headers[BYTE_PROPERTY_PREFIX + propertyName] = b;
+ }
+
+ public short GetShort(string propertyName)
+ {
+ CheckPropertyName(propertyName);
+ if (_message.ContentHeaderProperties.Headers == null)
+ {
+ return 0;
+ }
+ else
+ {
+ object s = _message.ContentHeaderProperties.Headers[SHORT_PROPERTY_PREFIX + propertyName];
+ if (s == null)
+ {
+ return 0;
+ }
+ else
+ {
+ return (short)s;
+ }
+ }
+ }
+
+ public void SetShort(string propertyName, short i)
+ {
+ CheckPropertyName(propertyName);
+ _message.ContentHeaderProperties.Headers[SHORT_PROPERTY_PREFIX + propertyName] = i;
+ }
+
+ public int GetInt(string propertyName)
+ {
+ CheckPropertyName(propertyName);
+ if (_message.ContentHeaderProperties.Headers == null)
+ {
+ return 0;
+ }
+ else
+ {
+ object i = _message.ContentHeaderProperties.Headers[INT_PROPERTY_PREFIX + propertyName];
+ if (i == null)
+ {
+ return 0;
+ }
+ else
+ {
+ return (int)i;
+ }
+ }
+ }
+
+ public void SetInt(string propertyName, int i)
+ {
+ CheckPropertyName(propertyName);
+ _message.ContentHeaderProperties.Headers[INT_PROPERTY_PREFIX + propertyName] = i;
+ }
+
+ public long GetLong(string propertyName)
+ {
+ CheckPropertyName(propertyName);
+ if (_message.ContentHeaderProperties.Headers == null)
+ {
+ return 0;
+ }
+ else
+ {
+ object l = _message.ContentHeaderProperties.Headers[LONG_PROPERTY_PREFIX + propertyName];
+ if (l == null)
+ {
+ // temp - the spec says do this but this throws a NumberFormatException
+ //return Long.valueOf(null).longValue();
+ return 0;
+ }
+ else
+ {
+ return (long)l;
+ }
+ }
+ }
+
+ public void SetLong(string propertyName, long l)
+ {
+ CheckPropertyName(propertyName);
+ _message.ContentHeaderProperties.Headers[LONG_PROPERTY_PREFIX + propertyName] = l;
+ }
+
+ public float GetFloat(String propertyName)
+ {
+ CheckPropertyName(propertyName);
+ if (_message.ContentHeaderProperties.Headers == null)
+ {
+ return 0;
+ }
+ else
+ {
+ object f = _message.ContentHeaderProperties.Headers[FLOAT_PROPERTY_PREFIX + propertyName];
+ if (f == null)
+ {
+ return 0;
+ }
+ else
+ {
+ return (float)f;
+ }
+ }
+ }
+
+ public void SetFloat(string propertyName, float f)
+ {
+ CheckPropertyName(propertyName);
+ _message.ContentHeaderProperties.Headers[FLOAT_PROPERTY_PREFIX + propertyName] = f;
+ }
+
+ public double GetDouble(string propertyName)
+ {
+ CheckPropertyName(propertyName);
+ if (_message.ContentHeaderProperties.Headers == null)
+ {
+ return 0;
+ }
+ else
+ {
+ object d = _message.ContentHeaderProperties.Headers[DOUBLE_PROPERTY_PREFIX + propertyName];
+ if (d == null)
+ {
+ return 0;
+ }
+ else
+ {
+ return (double)d;
+ }
+ }
+ }
+
+ public void SetDouble(string propertyName, double v)
+ {
+ CheckPropertyName(propertyName);
+ _message.ContentHeaderProperties.Headers[DOUBLE_PROPERTY_PREFIX + propertyName] = v;
+ }
+
+ public string GetString(string propertyName)
+ {
+ CheckPropertyName(propertyName);
+ if (_message.ContentHeaderProperties.Headers == null)
+ {
+ return null;
+ }
+ else
+ {
+ return (string)_message.ContentHeaderProperties.Headers[STRING_PROPERTY_PREFIX + propertyName];
+ }
+ }
+
+ public void SetString(string propertyName, string value)
+ {
+ CheckPropertyName(propertyName);
+ CreatePropertyMapIfRequired();
+ propertyName = STRING_PROPERTY_PREFIX + propertyName;
+ _message.ContentHeaderProperties.Headers[propertyName] = value;
+ }
+
+ private void CheckPropertyName(string propertyName)
+ {
+ if (propertyName == null)
+ {
+ throw new ArgumentException("Property name must not be null");
+ }
+ else if ("".Equals(propertyName))
+ {
+ throw new ArgumentException("Property name must not be the empty string");
+ }
+
+ if (_message.ContentHeaderProperties.Headers == null)
+ {
+ _message.ContentHeaderProperties.Headers = new FieldTable();
+ }
+ }
+
+ private void CreatePropertyMapIfRequired()
+ {
+ if (_message.ContentHeaderProperties.Headers == null)
+ {
+ _message.ContentHeaderProperties.Headers = new FieldTable();
+ }
+ }
+
+ public override string ToString()
+ {
+ StringBuilder buf = new StringBuilder("{");
+ int i = 0;
+ foreach (DictionaryEntry entry in _message.ContentHeaderProperties.Headers)
+ {
+ ++i;
+ if (i > 1)
+ {
+ buf.Append(", ");
+ }
+ string propertyName = (string)entry.Key;
+ if (propertyName == null)
+ {
+ buf.Append("\nInternal error: Property with NULL key defined");
+ }
+ else
+ {
+ buf.Append(propertyName.Substring(1));
+
+ buf.Append(" : ");
+
+ char typeIdentifier = propertyName[0];
+ buf.Append(typeIdentifierToName(typeIdentifier));
+ buf.Append(" = ").Append(entry.Value);
+ }
+ }
+ buf.Append("}");
+ return buf.ToString();
+ }
+
+ private static string typeIdentifierToName(char typeIdentifier)
+ {
+ switch (typeIdentifier)
+ {
+ case BOOLEAN_PROPERTY_PREFIX:
+ return "boolean";
+ case BYTE_PROPERTY_PREFIX:
+ return "byte";
+ case SHORT_PROPERTY_PREFIX:
+ return "short";
+ case INT_PROPERTY_PREFIX:
+ return "int";
+ case LONG_PROPERTY_PREFIX:
+ return "long";
+ case FLOAT_PROPERTY_PREFIX:
+ return "float";
+ case DOUBLE_PROPERTY_PREFIX:
+ return "double";
+ case STRING_PROPERTY_PREFIX:
+ return "string";
+ default:
+ return "unknown ( '" + typeIdentifier + "')";
+ }
+ }
+
+ }
+} \ No newline at end of file
diff --git a/qpid/dotnet/Qpid.Client/Client/Message/QpidTextMessage.cs b/qpid/dotnet/Qpid.Client/Client/Message/QpidTextMessage.cs
index ae5e2b7e66..a9b7d629db 100644
--- a/qpid/dotnet/Qpid.Client/Client/Message/QpidTextMessage.cs
+++ b/qpid/dotnet/Qpid.Client/Client/Message/QpidTextMessage.cs
@@ -86,8 +86,12 @@ namespace Qpid.Client.Message
Text = text;
}
- public override void ClearBody()
+ public override void ClearBodyImpl()
{
+ if (_data != null)
+ {
+ _data.Release();
+ }
_data = null;
_decodedValue = null;
}
diff --git a/qpid/dotnet/Qpid.Client/Qpid.Client.csproj b/qpid/dotnet/Qpid.Client/Qpid.Client.csproj
index b3a17a7a6d..84ada2a94b 100644
--- a/qpid/dotnet/Qpid.Client/Qpid.Client.csproj
+++ b/qpid/dotnet/Qpid.Client/Qpid.Client.csproj
@@ -42,6 +42,7 @@
<Compile Include="Client\AMQConnectionException.cs" />
<Compile Include="Client\AMQDestination.cs" />
<Compile Include="Client\AmqChannel.cs" />
+ <Compile Include="Client\Message\QpidHeaders.cs" />
<Compile Include="Client\QpidConnectionInfo.cs" />
<Compile Include="Client\BasicMessageConsumer.cs" />
<Compile Include="Client\BasicMessageProducer.cs" />
@@ -106,14 +107,14 @@
<Compile Include="qms\UrlSyntaxException.cs" />
</ItemGroup>
<ItemGroup>
- <ProjectReference Include="..\Qpid.Codec\Qpid.Codec.csproj">
- <Project>{22D0D0C2-77AF-4DE3-B456-7FF3893F9F88}</Project>
- <Name>Qpid.Codec</Name>
- </ProjectReference>
<ProjectReference Include="..\Qpid.Buffer\Qpid.Buffer.csproj">
<Project>{44384DF2-B0A4-4580-BDBC-EE4BAA87D995}</Project>
<Name>Qpid.Buffer</Name>
</ProjectReference>
+ <ProjectReference Include="..\Qpid.Codec\Qpid.Codec.csproj">
+ <Project>{22D0D0C2-77AF-4DE3-B456-7FF3893F9F88}</Project>
+ <Name>Qpid.Codec</Name>
+ </ProjectReference>
<ProjectReference Include="..\Qpid.Messaging\Qpid.Messaging.csproj">
<Project>{6688F826-C58E-4C1B-AA1F-22AFAB4B7D07}</Project>
<Name>Qpid.Messaging</Name>
diff --git a/qpid/dotnet/Qpid.Codec/Support/SimpleProtocolEncoderOutput.cs b/qpid/dotnet/Qpid.Codec/Support/SimpleProtocolEncoderOutput.cs
index 6f4f5cbb28..1e4d437d1c 100644
--- a/qpid/dotnet/Qpid.Codec/Support/SimpleProtocolEncoderOutput.cs
+++ b/qpid/dotnet/Qpid.Codec/Support/SimpleProtocolEncoderOutput.cs
@@ -41,4 +41,3 @@ namespace Qpid.Codec.Support
}
}
}
-
diff --git a/qpid/dotnet/Qpid.Common/Framing/FieldTable.cs b/qpid/dotnet/Qpid.Common/Framing/FieldTable.cs
index a7abc9d6e5..4c613aa80d 100644
--- a/qpid/dotnet/Qpid.Common/Framing/FieldTable.cs
+++ b/qpid/dotnet/Qpid.Common/Framing/FieldTable.cs
@@ -74,7 +74,7 @@ namespace Qpid.Framing
value = buffer.GetUnsignedInt();
break;
default:
- throw new AMQFrameDecodingException("Unsupported field table type: " + type);
+ throw new AMQFrameDecodingException("Unsupported field table type: '" + type + "' charcode" + (int)type);
}
sizeRead += (sizeRemaining - buffer.Remaining);
diff --git a/qpid/dotnet/Qpid.Common/Qpid.Common.csproj b/qpid/dotnet/Qpid.Common/Qpid.Common.csproj
index b392b48d83..65d0d87559 100644
--- a/qpid/dotnet/Qpid.Common/Qpid.Common.csproj
+++ b/qpid/dotnet/Qpid.Common/Qpid.Common.csproj
@@ -168,14 +168,14 @@
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
- <ProjectReference Include="..\Qpid.Codec\Qpid.Codec.csproj">
- <Project>{22D0D0C2-77AF-4DE3-B456-7FF3893F9F88}</Project>
- <Name>Qpid.Codec</Name>
- </ProjectReference>
<ProjectReference Include="..\Qpid.Buffer\Qpid.Buffer.csproj">
<Project>{44384DF2-B0A4-4580-BDBC-EE4BAA87D995}</Project>
<Name>Qpid.Buffer</Name>
</ProjectReference>
+ <ProjectReference Include="..\Qpid.Codec\Qpid.Codec.csproj">
+ <Project>{22D0D0C2-77AF-4DE3-B456-7FF3893F9F88}</Project>
+ <Name>Qpid.Codec</Name>
+ </ProjectReference>
<ProjectReference Include="..\Qpid.Messaging\Qpid.Messaging.csproj">
<Project>{6688F826-C58E-4C1B-AA1F-22AFAB4B7D07}</Project>
<Name>Qpid.Messaging</Name>