2
0
Эх сурвалжийг харах

2007-09-14 Atsushi Enomoto <[email protected]>

	* MsmqIntegrationMessageProperty.cs, MsmqMessage.cs:
	  cleanup couple of warnings.


svn path=/trunk/mcs/; revision=141883
Atsushi Eno 16 жил өмнө
parent
commit
5f5c1dabb2

+ 5 - 0
mcs/class/System.ServiceModel/System.ServiceModel.MsmqIntegration/ChangeLog

@@ -1,3 +1,8 @@
+2007-09-14  Atsushi Enomoto  <[email protected]>
+
+	* MsmqIntegrationMessageProperty.cs, MsmqMessage.cs:
+	  cleanup couple of warnings.
+
 2007-07-05  Atsushi Enomoto  <[email protected]>
 
 	* MsmqIntegrationMessageProperty.cs MsmqIntegrationBinding.cs

+ 67 - 80
mcs/class/System.ServiceModel/System.ServiceModel.MsmqIntegration/MsmqIntegrationMessageProperty.cs

@@ -31,6 +31,8 @@ using System.ServiceModel;
 using System.ServiceModel.Channels;
 
 using SMessage = System.ServiceModel.Channels.Message;
+using MQMessage = System.Messaging.Message;
+using MQMessageType = System.Messaging.MessageType;
 
 namespace System.ServiceModel.MsmqIntegration
 {
@@ -48,104 +50,89 @@ namespace System.ServiceModel.MsmqIntegration
 			throw new NotImplementedException ();
 		}
 
-		AcknowledgeTypes? ack_type;
-		Acknowledgment? ack;
-		Uri adm_queue, dst_queue, res_queue;
-		int? app_specific, body_type;
-		DateTime? arrived_time, sent_time;
-		bool? authenticated;
-		object body;
-		string correlation_id, id, label;
-		byte [] extension, sender_id;
-		MessageType? msg_type;
-		MessagePriority? priority;
-		TimeSpan? ttrq;
-
-		public AcknowledgeTypes? AcknowledgeType {
-			get { return ack_type; }
-			set { ack_type = value; }
+		// not verified / consider queue property filter
+		internal static MsmqIntegrationMessageProperty Get (MQMessage message)
+		{
+			if (message == null)
+				throw new ArgumentNullException ("message");
+			var p = new MsmqIntegrationMessageProperty ();
+			p.Id = message.Id;
+			p.Label = message.Label;
+			p.CorrelationId = message.CorrelationId;
+			p.Body = message.Body;
+			p.Extension = message.Extension;
+			p.SenderId = message.SenderId;
+
+			p.DestinationQueue = CreateUriFromQueue (message.DestinationQueue);
+			if (message.AdministrationQueue != null)
+				p.AdministrationQueue = CreateUriFromQueue (message.AdministrationQueue);
+			if (message.ResponseQueue != null)
+				p.ResponseQueue = CreateUriFromQueue (message.ResponseQueue);
+
+			// FIXME: check property filter in the queue
+			p.AppSpecific = message.AppSpecific;
+			p.ArrivedTime = message.ArrivedTime;
+			p.Authenticated = message.Authenticated;
+			p.Priority = message.Priority;
+			p.SentTime = message.SentTime;
+			p.TimeToReachQueue = message.TimeToReachQueue;
+
+			switch (message.MessageType) {
+			case MQMessageType.Acknowledgment:
+				p.AcknowledgeType = message.AcknowledgeType;
+				p.Acknowledgment = message.Acknowledgment;
+				break;
+			case MQMessageType.Normal:
+			case MQMessageType.Report:
+				// anything to do?
+				break;
+			}
+
+			return p;
+		}
+
+		static Uri CreateUriFromQueue (MessageQueue queue)
+		{
+			// FIXME: implement
+			throw new NotImplementedException ();
 		}
 
-		public Acknowledgment? Acknowledgment {
-			get { return ack; }
-		}
+		public AcknowledgeTypes? AcknowledgeType { get; set; }
+
+		public Acknowledgment? Acknowledgment { get; private set; }
 		
-		public Uri AdministrationQueue {
-			get { return adm_queue; }
-			set { adm_queue = value; }
-		}
+		public Uri AdministrationQueue { get; set; }
 
-		public int? AppSpecific {
-			get { return app_specific; }
-			set { app_specific = value; }
-		}
+		public int? AppSpecific { get; set; }
 
-		public DateTime? ArrivedTime {
-			get { return arrived_time; }
-		}
+		public DateTime? ArrivedTime { get; private set; }
 
-		public bool? Authenticated {
-			get { return authenticated; }
-		}
+		public bool? Authenticated { get; private set; }
 
-		public object Body {
-			get { return body; }
-			set { body = value; }
-		}
+		public object Body { get; set; }
 
-		public int? BodyType {
-			get { return body_type; }
-			set { body_type = value; }
-		}
+		public int? BodyType { get; set; }
 
-		public string CorrelationId {
-			get { return correlation_id; }
-			set { correlation_id = value; }
-		}
+		public string CorrelationId { get; set; }
 
-		public Uri DestinationQueue {
-			get { return dst_queue; }
-		}
+		public Uri DestinationQueue { get; private set; }
 
-		public byte [] Extension {
-			get { return extension; }
-			set { extension = value; }
-		}
+		public byte [] Extension { get; set; }
 
-		public string Id {
-			get { return id; }
-		}
+		public string Id { get; private set; }
 
-		public string Label {
-			get { return label; }
-			set { label = value; }
-		}
+		public string Label { get; set; }
 
-		public MessageType? MessageType {
-			get { return msg_type; }
-		}
+		public MessageType? MessageType { get; private set; }
 
-		public MessagePriority? Priority {
-			get { return priority; }
-			set { priority = value; }
-		}
+		public MessagePriority? Priority { get; set; }
 
-		public Uri ResponseQueue {
-			get { return res_queue; }
-			set { res_queue = value; }
-		}
+		public Uri ResponseQueue { get; set; }
 
-		public byte [] SenderId {
-			get { return sender_id; }
-		}
+		public byte [] SenderId { get; private set; }
 
-		public DateTime? SentTime {
-			get { return sent_time; }
-		}
+		public DateTime? SentTime { get; private set; }
 
-		public TimeSpan? TimeToReachQueue {
-			get { return ttrq; }
-			set { ttrq = value; }
-		}
+		public TimeSpan? TimeToReachQueue { get; set; }
 	}
 }

+ 33 - 43
mcs/class/System.ServiceModel/System.ServiceModel.MsmqIntegration/MsmqMessage.cs

@@ -34,109 +34,99 @@ namespace System.ServiceModel.MsmqIntegration
 	[MessageContract]
 	public sealed class MsmqMessage<T>
 	{
-		AcknowledgeTypes? ack_type;
-		Acknowledgment? ack;
-		Uri adm_queue, dst_queue, res_queue;
-		int? app_specific, body_type;
-		DateTime? arrived_time, sent_time;
-		bool? authenticated;
-		T body;
-		string correlation_id, id, label;
-		byte [] extension, sender_id;
-		MessageType? msg_type;
-		MessagePriority? priority;
-		TimeSpan? ttrq;
+		MsmqIntegrationMessageProperty prop;
 
 		public MsmqMessage (T body)
 		{
-			this.body = body;
+			prop = new MsmqIntegrationMessageProperty ();
+			Body = body;
 		}
 
 		public AcknowledgeTypes? AcknowledgeType {
-			get { return ack_type; }
-			set { ack_type = value; }
+			get { return prop.AcknowledgeType; }
+			set { prop.AcknowledgeType = value; }
 		}
 
 		public Acknowledgment? Acknowledgment {
-			get { return ack; }
+			get { return prop.Acknowledgment; }
 		}
 		
 		public Uri AdministrationQueue {
-			get { return adm_queue; }
-			set { adm_queue = value; }
+			get { return prop.AdministrationQueue; }
+			set { prop.AdministrationQueue = value; }
 		}
 
 		public int? AppSpecific {
-			get { return app_specific; }
-			set { app_specific = value; }
+			get { return prop.AppSpecific; }
+			set { prop.AppSpecific = value; }
 		}
 
 		public DateTime? ArrivedTime {
-			get { return arrived_time; }
+			get { return prop.ArrivedTime; }
 		}
 
 		public bool? Authenticated {
-			get { return authenticated; }
+			get { return prop.Authenticated; }
 		}
 
 		public T Body {
-			get { return body; }
-			set { body = value; }
+			get { return (T) prop.Body; }
+			set { prop.Body = value; }
 		}
 
 		public int? BodyType {
-			get { return body_type; }
-			set { body_type = value; }
+			get { return prop.BodyType; }
+			set { prop.BodyType = value; }
 		}
 
 		public string CorrelationId {
-			get { return correlation_id; }
-			set { correlation_id = value; }
+			get { return prop.CorrelationId; }
+			set { prop.CorrelationId = value; }
 		}
 
 		public Uri DestinationQueue {
-			get { return dst_queue; }
+			get { return prop.DestinationQueue; }
 		}
 
 		public byte [] Extension {
-			get { return extension; }
-			set { extension = value; }
+			get { return prop.Extension; }
+			set { prop.Extension = value; }
 		}
 
 		public string Id {
-			get { return id; }
+			get { return prop.Id; }
 		}
 
 		public string Label {
-			get { return label; }
-			set { label = value; }
+			get { return prop.Label; }
+			set { prop.Label = value; }
 		}
 
 		public MessageType? MessageType {
-			get { return msg_type; }
+			get { return prop.MessageType; }
 		}
 
 		public MessagePriority? Priority {
-			get { return priority; }
-			set { priority = value; }
+			get { return prop.Priority; }
+			set { prop.Priority = value; }
 		}
 
 		public Uri ResponseQueue {
-			get { return res_queue; }
-			set { res_queue = value; }
+			get { return prop.ResponseQueue; }
+			set { prop.ResponseQueue = value; }
 		}
 
 		public byte [] SenderId {
-			get { return sender_id; }
+			get { return prop.SenderId; }
 		}
 
 		public DateTime? SentTime {
-			get { return sent_time; }
+			get { return prop.SentTime; }
 		}
 
 		public TimeSpan? TimeToReachQueue {
-			get { return ttrq; }
-			set { ttrq = value; }
+			get { return prop.TimeToReachQueue; }
+			set { prop.TimeToReachQueue = value; }
 		}
 	}
 }