You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by jg...@apache.org on 2010/06/18 20:09:50 UTC

svn commit: r956074 - in /activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp: MapMessage.cs MessageProperties.cs

Author: jgomes
Date: Fri Jun 18 18:09:50 2010
New Revision: 956074

URL: http://svn.apache.org/viewvc?rev=956074&view=rev
Log:
Implemented new SetBytes/GetBytes API in EMS Provider.
Fixes [AMQNET-257]. (See https://issues.apache.org/activemq/browse/AMQNET-257)

Modified:
    activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/MapMessage.cs
    activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/MessageProperties.cs

Modified: activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/MapMessage.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/MapMessage.cs?rev=956074&r1=956073&r2=956074&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/MapMessage.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/MapMessage.cs Fri Jun 18 18:09:50 2010
@@ -429,6 +429,43 @@ namespace Apache.NMS.EMS
 			}
 		}
 
+		public void SetBytes(string key, byte[] value)
+		{
+			try
+			{
+				this.tibcoMapMessage.SetBytes(key, value);
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+			}
+		}
+
+		public void SetBytes(string key, byte[] value, int offset, int length)
+		{
+			try
+			{
+				this.tibcoMapMessage.SetBytes(key, value, offset, length);
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+			}
+		}
+
+		public byte[] GetBytes(string key)
+		{
+			try
+			{
+				return this.tibcoMapMessage.GetBytes(key);
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+				return null;
+			}
+		}
+
 		public IDictionary GetDictionary(string key)
 		{
 			try

Modified: activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/MessageProperties.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/MessageProperties.cs?rev=956074&r1=956073&r2=956074&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/MessageProperties.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/MessageProperties.cs Fri Jun 18 18:09:50 2010
@@ -408,6 +408,50 @@ namespace Apache.NMS.EMS
 			}
 		}
 
+		public void SetBytes(string key, byte[] value)
+		{
+			try
+			{
+				this.tibcoMessage.SetObjectProperty(key, value);
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+			}
+		}
+
+		public void SetBytes(string key, byte[] value, int offset, int length)
+		{
+			try
+			{
+				byte[] byteSection = new byte[length];
+
+				for(int srcIndex = offset, destIndex = 0; srcIndex < (offset + length); srcIndex++, destIndex++)
+				{
+					byteSection[destIndex] = value[srcIndex];
+				}
+
+				this.tibcoMessage.SetObjectProperty(key, byteSection);
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+			}
+		}
+
+		public byte[] GetBytes(string key)
+		{
+			try
+			{
+				return (byte[]) this.tibcoMessage.GetObjectProperty(key);
+			}
+			catch(Exception ex)
+			{
+				ExceptionUtil.WrapAndThrowNMSException(ex);
+				return null;
+			}
+		}
+
 		public IDictionary GetDictionary(string key)
 		{
 			try