activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r507671 - in /activemq/activemq-dotnet/trunk: ./ src/main/csharp/ActiveMQ/ src/main/csharp/ActiveMQ/Commands/ src/main/csharp/NMS/
Date Wed, 14 Feb 2007 20:01:20 GMT
Author: jstrachan
Date: Wed Feb 14 12:01:19 2007
New Revision: 507671

URL: http://svn.apache.org/viewvc?view=rev&rev=507671
Log:
Added support for IObjectMessage together with adding more APIs to NMS for more control together
with providing public access to more attributes on session & producer. Also updated the
DLLs to use mixed case names rather than lowercase

Added:
    activemq/activemq-dotnet/trunk/src/main/csharp/NMS/IObjectMessage.cs
    activemq/activemq-dotnet/trunk/src/main/csharp/NMS/NMSConstants.cs
Modified:
    activemq/activemq-dotnet/trunk/nant.build
    activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Commands/ActiveMQObjectMessage.cs
    activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/MessageProducer.cs
    activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Session.cs
    activemq/activemq-dotnet/trunk/src/main/csharp/NMS/IMessageProducer.cs
    activemq/activemq-dotnet/trunk/src/main/csharp/NMS/ISession.cs

Modified: activemq/activemq-dotnet/trunk/nant.build
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/trunk/nant.build?view=diff&rev=507671&r1=507670&r2=507671
==============================================================================
--- activemq/activemq-dotnet/trunk/nant.build (original)
+++ activemq/activemq-dotnet/trunk/nant.build Wed Feb 14 12:01:19 2007
@@ -153,7 +153,7 @@
     </asminfo>
 
     <csc target="library" define="${current.build.defines}" warnaserror="false" debug="${build.debug}"
-      output="${build.bin.dir}/nms.dll" doc="${build.bin.dir}/nms.xml">
+      output="${build.bin.dir}/NMS.dll" doc="${build.bin.dir}/NMS.xml">
       <nowarn>
         <warning number="1591" /> <!-- do not report warnings for missing XML comments
-->        <warning number="0618" /> <!-- do not report deprecation warnings -->
       </nowarn>
@@ -199,7 +199,7 @@
     </asminfo>
 
     <csc target="library" define="${current.build.defines}" warnaserror="false" debug="${build.debug}"
-      output="${build.bin.dir}/nms-test.dll" doc="${build.bin.dir}/nms-test.xml">
+      output="${build.bin.dir}/NMS-test.dll" doc="${build.bin.dir}/NMS-test.xml">
       <nowarn>
         <warning number="1591" /> <!-- do not report warnings for missing XML comments
-->        <warning number="0618" /> <!-- do not report deprecation warnings -->
       </nowarn>
@@ -209,7 +209,7 @@
       <references failonempty="true">
         <include name="System.dll" asis="true"/>
         <include name="${lib.dir}/all/nunit/nunit.framework.dll"/>
-        <include name="${build.bin.dir}/nms.dll"/>
+        <include name="${build.bin.dir}/NMS.dll"/>
       </references>
     </csc>
   </target>
@@ -242,7 +242,7 @@
     </asminfo>
 
     <csc target="library" define="${current.build.defines}" warnaserror="false" debug="${build.debug}"
-      output="${build.bin.dir}/activemq.dll" doc="${build.bin.dir}/activemq.xml">
+      output="${build.bin.dir}/ActiveMQ.dll" doc="${build.bin.dir}/ActiveMQ.xml">
       <nowarn>
         <warning number="1591" /> <!-- do not report warnings for missing XML comments
-->        <warning number="0618" /> <!-- do not report deprecation warnings -->
       </nowarn>
@@ -252,7 +252,7 @@
       </sources>
       <references failonempty="true">
         <include name="System.dll" asis="true"/>
-        <include name="${build.bin.dir}/nms.dll"/>
+        <include name="${build.bin.dir}/NMS.dll"/>
       </references>
     </csc>
   </target>
@@ -285,7 +285,7 @@
     </asminfo>
 
     <csc target="library" define="${current.build.defines}" warnaserror="false" debug="${build.debug}"
-      output="${build.bin.dir}/activemq-test.dll" doc="${build.bin.dir}/activemq-test.xml">
+      output="${build.bin.dir}/ActiveMQ-test.dll" doc="${build.bin.dir}/ActiveMQ-test.xml">
       <nowarn>
         <warning number="1591" /> <!-- do not report warnings for missing XML comments
-->        <warning number="0618" /> <!-- do not report deprecation warnings -->
       </nowarn>
@@ -295,9 +295,9 @@
       <references failonempty="true">
         <include name="System.dll" asis="true"/>
         <include name="${lib.dir}/all/nunit/nunit.framework.dll"/>
-        <include name="${build.bin.dir}/nms.dll"/>
-        <include name="${build.bin.dir}/nms-test.dll"/>
-        <include name="${build.bin.dir}/activemq.dll"/>
+        <include name="${build.bin.dir}/NMS.dll"/>
+        <include name="${build.bin.dir}/NMS-test.dll"/>
+        <include name="${build.bin.dir}/ActiveMQ.dll"/>
       </references>
     </csc>
   </target>
@@ -340,9 +340,9 @@
       <references failonempty="true">
         <include name="System.dll" asis="true"/>
         <include name="${lib.dir}/all/nunit/nunit.framework.dll"/>
-        <include name="${build.bin.dir}/nms.dll"/>
-        <include name="${build.bin.dir}/nms-test.dll"/>
-        <include name="${build.bin.dir}/activemq.dll"/>
+        <include name="${build.bin.dir}/NMS.dll"/>
+        <include name="${build.bin.dir}/NMS-test.dll"/>
+        <include name="${build.bin.dir}/ActiveMQ.dll"/>
       </references>
     </csc>
   </target>
@@ -385,7 +385,7 @@
       <references failonempty="true">
         <include name="System.dll" asis="true"/>
         <include name="${lib.framework.dir}/System.Messaging.dll" />
-        <include name="${build.bin.dir}/nms.dll"/>
+        <include name="${build.bin.dir}/NMS.dll"/>
       </references>
     </csc>
   </target>
@@ -429,8 +429,8 @@
         <include name="System.dll" asis="true"/>
         <include name="${lib.framework.dir}/System.Messaging.dll" />
         <include name="${lib.dir}/all/nunit/nunit.framework.dll"/>
-        <include name="${build.bin.dir}/nms.dll"/>
-        <include name="${build.bin.dir}/nms-test.dll"/>
+        <include name="${build.bin.dir}/NMS.dll"/>
+        <include name="${build.bin.dir}/NMS-test.dll"/>
         <include name="${build.bin.dir}/msmq.dll"/>
       </references>
     </csc>
@@ -443,14 +443,14 @@
   <target name="test" depends="build-activemq-test" description="Runs all the NUnit test
cases">
     <nunit2>
       <formatter type="Plain" />
-      <test assemblyname="${build.bin.dir}/activemq-test.dll"></test>
+      <test assemblyname="${build.bin.dir}/ActiveMQ-test.dll"></test>
     </nunit2>
   </target>
 
   <target name="test-case" depends="build-activemq-test" description="Run a specific NUnit
test case using the 'test' variable">
     <nunit2>
       <formatter type="Plain" />
-      <test assemblyname="${build.bin.dir}/activemq-test.dll" testname="${test}"></test>
+      <test assemblyname="${build.bin.dir}/ActiveMQ-test.dll" testname="${test}"></test>
     </nunit2>
   </target>
 
@@ -475,7 +475,7 @@
     <mkdir dir="${doc.dir}/nms"/>
     <ndoc failonerror="false">
       <assemblies basedir="${build.bin.dir}">
-        <include name="nms.dll" />
+        <include name="NMS.dll" />
       </assemblies>
       <summaries basedir="${basedir}/src/main/ndoc">
         <include name="NamespaceSummary.xml" />
@@ -511,8 +511,8 @@
     <mkdir dir="${doc.dir}/all"/>
     <ndoc failonerror="false">
       <assemblies basedir="${build.bin.dir}">
-        <include name="nms.dll" />
-        <include name="activemq.dll" />
+        <include name="NMS.dll" />
+        <include name="ActiveMQ.dll" />
         <include name="msmq.dll" if="${platform::is-win32()}"/>
       </assemblies>
       <summaries basedir="${basedir}/src/main/ndoc">

Modified: activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Commands/ActiveMQObjectMessage.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Commands/ActiveMQObjectMessage.cs?view=diff&rev=507671&r1=507670&r2=507671
==============================================================================
--- activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Commands/ActiveMQObjectMessage.cs
(original)
+++ activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Commands/ActiveMQObjectMessage.cs
Wed Feb 14 12:01:19 2007
@@ -17,9 +17,13 @@
 
 using System;
 using System.Collections;
+using System.IO;
+using System.Runtime.Serialization;
+using System.Runtime.Serialization.Formatters.Binary;
 
 using ActiveMQ.OpenWire;
 using ActiveMQ.Commands;
+using NMS;
 
 namespace ActiveMQ.Commands
 {
@@ -31,25 +35,76 @@
     //         if you need to make a change, please see the Groovy scripts in the
     //         activemq-core module
     //
-    public class ActiveMQObjectMessage : ActiveMQMessage
+    public class ActiveMQObjectMessage : ActiveMQMessage, IObjectMessage
     {
         public const byte ID_ActiveMQObjectMessage = 26;
     			
+        private ISerializable body;
+		private IFormatter formatter;
+
 
 		public override string ToString() {
             return GetType().Name + "["
                 + " ]";
-
 		}
 	
-
-
         public override byte GetDataStructureType() {
             return ID_ActiveMQObjectMessage;
         }
 
 
         // Properties
+	    
+        public ISerializable Body
+        {
+            get 
+			{
+                if (body == null)
+                {
+                    body = (ISerializable) Formatter.Deserialize(new MemoryStream(Content));
+                }
+                return body;
+            }
+
+			set 
+			{
+				body = value;
+			}
+        }
+        
+        public override void BeforeMarshall(OpenWireFormat wireFormat)
+        {
+            if (body == null)
+            {
+                Content = null;
+            }
+            else
+            {
+				MemoryStream stream = new MemoryStream();
+				Formatter.Serialize(stream, body);
+                Content = stream.ToArray();
+            }
+            
+            //Console.WriteLine("BeforeMarshalling, content is: " + Content);
+			
+            base.BeforeMarshall(wireFormat);
+        }
 
+		public IFormatter Formatter
+		{
+			get
+			{
+				if (formatter == null)
+				{
+					formatter = new BinaryFormatter();
+				}
+				return formatter;
+			}
+			
+			set 
+			{
+				formatter = value;
+			}
+		}
     }
 }

Modified: activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/MessageProducer.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/MessageProducer.cs?view=diff&rev=507671&r1=507670&r2=507671
==============================================================================
--- activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/MessageProducer.cs (original)
+++ activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/MessageProducer.cs Wed Feb 14
12:01:19 2007
@@ -30,11 +30,11 @@
         private ProducerInfo info;
         private long messageCounter;
         
-        bool persistent;
-        TimeSpan timeToLive;
-        int priority;
-        bool disableMessageID;
-        bool disableMessageTimestamp;
+        private bool persistent = NMSConstants.defaultPersistence;
+        private TimeSpan timeToLive;
+        private byte priority = NMSConstants.defaultPriority;
+        private bool disableMessageID = false;
+        private bool disableMessageTimestamp = false;
         
         public MessageProducer(Session session, ProducerInfo info)
         {
@@ -49,6 +49,11 @@
         
         public void Send(IDestination destination, IMessage message)
         {
+			Send(destination, message, Persistent, Priority, TimeToLive);
+		}
+		
+        public void Send(IDestination destination, IMessage message, bool persistent, byte
priority, TimeSpan timeToLive)
+        {
 			ActiveMQMessage activeMessage = (ActiveMQMessage)message;
 
 			if (!disableMessageID)
@@ -76,7 +81,7 @@
                 activeMessage.TransactionId = session.TransactionContext.TransactionId;
             }
             
-            session.DoSend(destination, message);
+            session.DoSend(destination, message, persistent, priority, timeToLive);
         }
         
         public void Dispose()
@@ -95,7 +100,8 @@
             get { return timeToLive; }
             set { this.timeToLive = value; }
         }
-        public int Priority
+
+        public byte Priority
         {
             get { return priority; }
             set { this.priority = value; }

Modified: activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Session.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Session.cs?view=diff&rev=507671&r1=507670&r2=507671
==============================================================================
--- activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Session.cs (original)
+++ activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Session.cs Wed Feb 14 12:01:19
2007
@@ -135,7 +135,14 @@
 
                 public IMessageConsumer CreateConsumer(IDestination destination, string selector)
                 {
+	                return CreateConsumer(destination, null, false);
+				}
+				
+                public IMessageConsumer CreateConsumer(IDestination destination, string selector,
bool noLocal)
+                {
                         ConsumerInfo command = CreateConsumerInfo(destination, selector);
+                        command.NoLocal = noLocal;
+
                         ConsumerId consumerId = command.ConsumerId;
 
                         try
@@ -309,6 +316,10 @@
                         get { return info.SessionId; } 
                 }
 
+                public AcknowledgementMode AcknowledgementMode {
+                        get { return acknowledgementMode; } 
+                }
+
                 public bool Transacted {
                         get { return acknowledgementMode == AcknowledgementMode.Transactional;
} 
                 }
@@ -318,10 +329,14 @@
                 }
 
                 // Implementation methods
-                public void DoSend(IDestination destination, IMessage message)
+                public void DoSend(IDestination destination, IMessage message, bool persistent,
byte priority, TimeSpan timeToLive)
                 {
                         ActiveMQMessage command = ActiveMQMessage.Transform(message);
-                        // TODO complete packet
+						command.Persistent = persistent;
+						command.Priority = priority;
+						
+                        // TODO add time to live
+
                         connection.SyncRequest(command);
                 }
 

Modified: activemq/activemq-dotnet/trunk/src/main/csharp/NMS/IMessageProducer.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/trunk/src/main/csharp/NMS/IMessageProducer.cs?view=diff&rev=507671&r1=507670&r2=507671
==============================================================================
--- activemq/activemq-dotnet/trunk/src/main/csharp/NMS/IMessageProducer.cs (original)
+++ activemq/activemq-dotnet/trunk/src/main/csharp/NMS/IMessageProducer.cs Wed Feb 14 12:01:19
2007
@@ -35,6 +35,12 @@
         /// </summary>
         void Send(IDestination destination, IMessage message);
 		
+        /// <summary>
+        /// Sends the message to the given destination with the explicit QoS configuration
+        /// </summary>
+		void Send(IDestination destination, IMessage message, bool persistent, byte priority, TimeSpan
timeToLive);
+        
+
 		bool Persistent
 		{
 			get;
@@ -47,7 +53,7 @@
 			set;
 		}
 		
-		int Priority
+		byte Priority
 		{
 			get;
 			set;
@@ -64,7 +70,6 @@
 			get;
 			set;
 		}
-		
     }
 }
 

Added: activemq/activemq-dotnet/trunk/src/main/csharp/NMS/IObjectMessage.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/trunk/src/main/csharp/NMS/IObjectMessage.cs?view=auto&rev=507671
==============================================================================
--- activemq/activemq-dotnet/trunk/src/main/csharp/NMS/IObjectMessage.cs (added)
+++ activemq/activemq-dotnet/trunk/src/main/csharp/NMS/IObjectMessage.cs Wed Feb 14 12:01:19
2007
@@ -0,0 +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.Runtime.Serialization;
+
+namespace NMS
+{
+	/// <summary>
+	/// Represents an Object message which contains a serializable .Net object.
+	/// </summary>
+	public interface IObjectMessage : IMessage
+    {
+        ISerializable Body
+		{
+            get;
+        }
+    }
+}
+
+
+

Modified: activemq/activemq-dotnet/trunk/src/main/csharp/NMS/ISession.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/trunk/src/main/csharp/NMS/ISession.cs?view=diff&rev=507671&r1=507670&r2=507671
==============================================================================
--- activemq/activemq-dotnet/trunk/src/main/csharp/NMS/ISession.cs (original)
+++ activemq/activemq-dotnet/trunk/src/main/csharp/NMS/ISession.cs Wed Feb 14 12:01:19 2007
@@ -43,6 +43,11 @@
                 IMessageConsumer CreateConsumer(IDestination destination, string selector);
 
                 /// <summary>
+                /// Creates a consumer of messages on a given destination with a selector
+                /// </summary>
+                IMessageConsumer CreateConsumer(IDestination destination, string selector,
bool noLocal);
+
+                /// <summary>
                 /// Creates a named durable consumer of messages on a given destination with
a selector
                 /// </summary>
                 IMessageConsumer CreateDurableConsumer(ITopic destination, string name, string
selector, bool noLocal);
@@ -120,5 +125,15 @@
                 /// send and acknowledgements for producers and consumers in this session
                 /// </summary>
                 void Rollback();
+
+				// Attributes
+				
+				bool Transacted {
+                        get;
+                }
+
+                AcknowledgementMode AcknowledgementMode {
+                        get;
+                }
         }
 }

Added: activemq/activemq-dotnet/trunk/src/main/csharp/NMS/NMSConstants.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/trunk/src/main/csharp/NMS/NMSConstants.cs?view=auto&rev=507671
==============================================================================
--- activemq/activemq-dotnet/trunk/src/main/csharp/NMS/NMSConstants.cs (added)
+++ activemq/activemq-dotnet/trunk/src/main/csharp/NMS/NMSConstants.cs Wed Feb 14 12:01:19
2007
@@ -0,0 +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.
+ */
+using System;
+
+namespace NMS
+{
+	/// <summary>
+	/// Defines a number of constants
+	/// </summary>
+	public class NMSConstants
+    {
+		public const int defaultPriority = 5;
+		public const bool defaultPersistence = true;
+    }
+}
+
+



Mime
View raw message