Ref parameter was not covered by ParameterInfo.IsOut. Fixed bug #696784.
[mono.git] / mcs / class / System.ServiceModel / System.ServiceModel.MsmqIntegration / MsmqIntegrationMessageProperty.cs
1 //
2 // MsmqIntegrationMessageProperty.cs
3 //
4 // Author: Atsushi Enomoto  <atsushi@ximian.com>
5 //
6 // Copyright (C) 2007 Novell, Inc (http://www.novell.com)
7 //
8 // Permission is hereby granted, free of charge, to any person obtaining
9 // a copy of this software and associated documentation files (the
10 // "Software"), to deal in the Software without restriction, including
11 // without limitation the rights to use, copy, modify, merge, publish,
12 // distribute, sublicense, and/or sell copies of the Software, and to
13 // permit persons to whom the Software is furnished to do so, subject to
14 // the following conditions:
15 // 
16 // The above copyright notice and this permission notice shall be
17 // included in all copies or substantial portions of the Software.
18 // 
19 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
23 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
24 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
25 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 //
27
28 using System;
29 using System.Messaging;
30 using System.ServiceModel;
31 using System.ServiceModel.Channels;
32
33 using SMessage = System.ServiceModel.Channels.Message;
34 using MQMessage = System.Messaging.Message;
35 using MQMessageType = System.Messaging.MessageType;
36
37 namespace System.ServiceModel.MsmqIntegration
38 {
39         public sealed class MsmqIntegrationMessageProperty
40         {
41                 public const string Name = "MsmqIntegrationMessageProperty";
42
43                 public MsmqIntegrationMessageProperty ()
44                 {
45                 }
46
47                 [MonoTODO]
48                 public static MsmqIntegrationMessageProperty Get (SMessage message)
49                 {
50                         throw new NotImplementedException ();
51                 }
52
53                 // not verified / consider queue property filter
54                 internal static MsmqIntegrationMessageProperty Get (MQMessage message)
55                 {
56                         if (message == null)
57                                 throw new ArgumentNullException ("message");
58                         var p = new MsmqIntegrationMessageProperty ();
59                         p.Id = message.Id;
60                         p.Label = message.Label;
61                         p.CorrelationId = message.CorrelationId;
62                         p.Body = message.Body;
63                         p.Extension = message.Extension;
64                         p.SenderId = message.SenderId;
65
66                         p.DestinationQueue = CreateUriFromQueue (message.DestinationQueue);
67                         if (message.AdministrationQueue != null)
68                                 p.AdministrationQueue = CreateUriFromQueue (message.AdministrationQueue);
69                         if (message.ResponseQueue != null)
70                                 p.ResponseQueue = CreateUriFromQueue (message.ResponseQueue);
71
72                         // FIXME: check property filter in the queue
73                         p.AppSpecific = message.AppSpecific;
74                         p.ArrivedTime = message.ArrivedTime;
75                         p.Authenticated = message.Authenticated;
76                         p.Priority = message.Priority;
77                         p.SentTime = message.SentTime;
78                         p.TimeToReachQueue = message.TimeToReachQueue;
79
80                         switch (message.MessageType) {
81                         case MQMessageType.Acknowledgment:
82                                 p.AcknowledgeType = message.AcknowledgeType;
83                                 p.Acknowledgment = message.Acknowledgment;
84                                 break;
85                         case MQMessageType.Normal:
86                         case MQMessageType.Report:
87                                 // anything to do?
88                                 break;
89                         }
90
91                         return p;
92                 }
93
94                 static Uri CreateUriFromQueue (MessageQueue queue)
95                 {
96                         // FIXME: implement
97                         throw new NotImplementedException ();
98                 }
99
100                 public AcknowledgeTypes? AcknowledgeType { get; set; }
101
102                 public Acknowledgment? Acknowledgment { get; private set; }
103                 
104                 public Uri AdministrationQueue { get; set; }
105
106                 public int? AppSpecific { get; set; }
107
108                 public DateTime? ArrivedTime { get; private set; }
109
110                 public bool? Authenticated { get; private set; }
111
112                 public object Body { get; set; }
113
114                 public int? BodyType { get; set; }
115
116                 public string CorrelationId { get; set; }
117
118                 public Uri DestinationQueue { get; private set; }
119
120                 public byte [] Extension { get; set; }
121
122                 public string Id { get; private set; }
123
124                 public string Label { get; set; }
125
126                 public MessageType? MessageType { get; private set; }
127
128                 public MessagePriority? Priority { get; set; }
129
130                 public Uri ResponseQueue { get; set; }
131
132                 public byte [] SenderId { get; private set; }
133
134                 public DateTime? SentTime { get; private set; }
135
136                 public TimeSpan? TimeToReachQueue { get; set; }
137         }
138 }