5 // Peter Van Isacker (sclytrack@planetinternet.be)
\r
6 // Rafael Teixeira (rafaelteixeirabr@hotmail.com)
\r
8 // (C) 2003 Peter Van Isacker
\r
12 // Permission is hereby granted, free of charge, to any person obtaining
13 // a copy of this software and associated documentation files (the
14 // "Software"), to deal in the Software without restriction, including
15 // without limitation the rights to use, copy, modify, merge, publish,
16 // distribute, sublicense, and/or sell copies of the Software, and to
17 // permit persons to whom the Software is furnished to do so, subject to
18 // the following conditions:
20 // The above copyright notice and this permission notice shall be
21 // included in all copies or substantial portions of the Software.
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
33 using System.Collections;
\r
34 using System.ComponentModel;
\r
35 using System.Drawing;
\r
36 using System.Messaging.Design;
\r
38 namespace System.Messaging
\r
40 [TypeConverter (typeof(MessageQueueConverter))]
\r
41 [Editor ("System.Messaging.Design.QueuePathEditor", "System.Drawing.Design.UITypeEditor, " + Consts.AssemblySystem_Drawing)]
\r
42 [Designer ("Microsoft.VisualStudio.Install.MessageQueueInstallableComponentDesigner, " + Consts.AssemblyMicrosoft_VisualStudio)]
\r
43 [InstallerType (typeof(MessageQueueInstaller))]
\r
44 [DefaultEvent ("ReceiveCompleted")]
\r
45 public class MessageQueue : Component, IEnumerable
\r
49 public static readonly long InfiniteQueueSize;
\r
50 public static readonly TimeSpan InfiniteTimeout;
\r
52 private bool isPrivate = false;
\r
53 private string queueName;
\r
54 private string machineName;
\r
63 public MessageQueue ()
\r
65 throw new NotImplementedException ();
\r
69 public MessageQueue (string path) {
\r
71 this.isPrivate = false;
\r
75 private MessageQueue (string queueName, string machineName, bool isPrivate)
\r
77 this.queueName = queueName;
\r
78 this.machineName = machineName;
\r
79 this.isPrivate = isPrivate;
\r
83 public MessageQueue (string path, bool sharedModeDenyReceive)
\r
85 throw new NotImplementedException ();
\r
88 #endregion //Constructor
\r
92 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
\r
93 [MessagingDescription ("MQ_Authenticate")]
\r
94 public bool Authenticate {
\r
97 throw new NotImplementedException ();
\r
101 throw new NotImplementedException ();
\r
105 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
\r
106 [MessagingDescription ("MQ_BasePriority")]
\r
107 public short BasePriority {
\r
110 throw new NotImplementedException ();
\r
114 throw new NotImplementedException ();
\r
118 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
\r
119 [Browsable (false)]
\r
120 [MessagingDescription ("MQ_CanRead")]
\r
121 public bool CanRead {
\r
124 throw new NotImplementedException ();
\r
128 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
\r
129 [Browsable (false)]
\r
130 [MessagingDescription ("MQ_CanWrite")]
\r
131 public bool CanWrite {
\r
134 throw new NotImplementedException ();
\r
138 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
\r
139 [MessagingDescription ("MQ_Category")]
\r
140 public Guid Category {
\r
143 throw new NotImplementedException ();
\r
147 throw new NotImplementedException ();
\r
151 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
\r
152 [MessagingDescription ("MQ_CreateTime")]
\r
153 public DateTime CreateTime {
\r
156 throw new NotImplementedException ();
\r
160 [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
\r
161 [Browsable (false)]
\r
162 [MessagingDescription ("MQ_DefaultPropertiesToSend")]
\r
163 public DefaultPropertiesToSend DefaultPropertiesToSend {
\r
166 throw new NotImplementedException ();
\r
170 throw new NotImplementedException ();
\r
174 [Browsable (false)]
\r
175 [DefaultValue (false)]
\r
176 [MessagingDescription ("MQ_DenySharedReceive")]
\r
177 public bool DenySharedReceive {
\r
180 throw new NotImplementedException ();
\r
184 throw new NotImplementedException ();
\r
188 [Browsable (false)]
\r
189 public static bool EnableConnectionCache {
\r
192 throw new NotImplementedException ();
\r
196 throw new NotImplementedException ();
\r
200 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
\r
201 [MessagingDescription ("MQ_EncryptionRequired")]
\r
202 public EncryptionRequired EncryptionRequired {
\r
205 throw new NotImplementedException ();
\r
209 throw new NotImplementedException ();
\r
213 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
\r
214 [MessagingDescription ("MQ_FormatName")]
\r
215 public string FormatName {
\r
218 throw new NotImplementedException ();
\r
222 [Browsable (false)]
\r
223 [DefaultValue (null)]
\r
224 [TypeConverter (typeof(MessageFormatterConverter))]
\r
225 [MessagingDescription ("MQ_Formatter")]
\r
226 public IMessageFormatter Formatter {
\r
229 throw new NotImplementedException ();
\r
233 throw new NotImplementedException ();
\r
237 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
\r
238 [MessagingDescription ("MQ_GuidId")]
\r
242 throw new NotImplementedException ();
\r
246 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
\r
247 [MessagingDescription ("MQ_Label")]
\r
248 public string Label {
\r
251 throw new NotImplementedException ();
\r
255 throw new NotImplementedException ();
\r
259 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
\r
260 [MessagingDescription ("MQ_LastModifyTime")]
\r
261 public DateTime LastModifyTime {
\r
264 throw new NotImplementedException ();
\r
268 [Browsable (false)]
\r
269 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
\r
270 [MessagingDescription ("MQ_MachineName")]
\r
271 public string MachineName {
\r
273 return machineName;
\r
276 machineName = value;
\r
280 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
\r
281 [TypeConverter (typeof(SizeConverter))]
\r
282 [MessagingDescription ("MQ_MaximumJournalSize")]
\r
283 public long MaximumJournalSize {
\r
286 throw new NotImplementedException ();
\r
290 throw new NotImplementedException ();
\r
294 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
\r
295 [TypeConverter (typeof(SizeConverter))]
\r
296 [MessagingDescription ("MQ_MaximumQueueSize")]
\r
297 public long MaximumQueueSize {
\r
300 throw new NotImplementedException ();
\r
304 throw new NotImplementedException ();
\r
308 [Browsable (false)]
\r
309 [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
\r
310 [MessagingDescription ("MQ_MessageReadPropertyFilter")]
\r
311 public MessagePropertyFilter MessageReadPropertyFilter {
\r
314 throw new NotImplementedException ();
\r
318 throw new NotImplementedException ();
\r
322 [RecommendedAsConfigurable (true)]
\r
323 [Editor ("System.Messaging.Design.QueuePathEditor", "System.Drawing.Design.UITypeEditor, " + Consts.AssemblySystem_Drawing)]
\r
324 [Browsable (false)]
\r
325 [DefaultValue ("")]
\r
326 [TypeConverter ("System.Diagnostics.Design.StringValueConverter, " + Consts.AssemblySystem_Design)]
\r
327 [MessagingDescription ("MQ_Path")]
\r
328 public string Path {
\r
330 return machineName + ":" + queueName;
\r
332 [MonoTODO ("split input")]
\r
334 throw new NotImplementedException ();
\r
338 [Browsable (false)]
\r
339 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
\r
340 [MessagingDescription ("MQ_QueueName")]
\r
341 public string QueueName {
\r
350 [Browsable (false)]
\r
351 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
\r
352 [MessagingDescription ("MQ_ReadHandle")]
\r
353 public IntPtr ReadHandle {
\r
356 throw new NotImplementedException ();
\r
360 [Browsable (false)]
\r
361 [DefaultValue (null)]
\r
362 [MessagingDescription ("MQ_SynchronizingObject")]
\r
363 public ISynchronizeInvoke SynchronizingObject {
\r
366 throw new NotImplementedException ();
\r
370 throw new NotImplementedException ();
\r
374 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
\r
375 [MessagingDescription ("MQ_Transactional")]
\r
376 public bool Transactional {
\r
379 throw new NotImplementedException ();
\r
383 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
\r
384 [MessagingDescription ("MQ_WriteHandle")]
\r
385 public bool UseJournalQueue {
\r
388 throw new NotImplementedException ();
\r
392 throw new NotImplementedException ();
\r
396 [Browsable (false)]
\r
397 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
\r
398 [MessagingDescription ("MQ_WriteHandle")]
\r
399 public IntPtr WriteHandle {
\r
402 throw new NotImplementedException ();
\r
406 #endregion //Properties
\r
411 public IAsyncResult BeginPeek ()
\r
413 throw new NotImplementedException ();
\r
416 public IAsyncResult BeginPeek (TimeSpan timeout)
\r
418 throw new NotImplementedException ();
\r
421 public IAsyncResult BeginPeek (TimeSpan timeout, object stateObject)
\r
423 throw new NotImplementedException ();
\r
426 public IAsyncResult BeginPeek (TimeSpan timeout,
\r
427 object stateObject,
\r
428 AsyncCallback callback)
\r
430 throw new NotImplementedException ();
\r
433 public IAsyncResult BeginReceive ()
\r
435 throw new NotImplementedException ();
\r
438 public IAsyncResult BeginReceive (TimeSpan timeout)
\r
440 throw new NotImplementedException ();
\r
443 public IAsyncResult BeginReceive (TimeSpan timeout, object stateObject)
\r
445 throw new NotImplementedException ();
\r
448 public IAsyncResult BeginReceive (TimeSpan timeout, object stateObject, AsyncCallback callback)
\r
450 throw new NotImplementedException ();
\r
453 public static void ClearConnectionCache ()
\r
455 throw new NotImplementedException ();
\r
458 public void Close ()
\r
460 throw new NotImplementedException ();
\r
463 public static MessageQueue Create (string path)
\r
465 throw new NotImplementedException ();
\r
468 public static MessageQueue Create (string path, bool transactional)
\r
470 throw new NotImplementedException ();
\r
473 public static void Delete (string path)
\r
475 throw new NotImplementedException ();
\r
478 public Message EndPeek (IAsyncResult asyncResult)
\r
480 throw new NotImplementedException ();
\r
483 public Message EndReceive (IAsyncResult asyncResult)
\r
485 throw new NotImplementedException ();
\r
488 public static bool Exists (string path)
\r
490 throw new NotImplementedException ();
\r
493 public Message[] GetAllMessages ()
\r
495 throw new NotImplementedException ();
\r
498 public IEnumerator GetEnumerator ()
\r
500 throw new NotImplementedException ();
\r
503 public static Guid GetMachineId (string machineName)
\r
505 throw new NotImplementedException ();
\r
508 public MessageEnumerator GetMessageEnumerator ()
\r
510 throw new NotImplementedException ();
\r
513 private static ArrayList currentQueueList;
\r
515 static MessageQueue ()
\r
517 currentQueueList = new ArrayList ();
\r
518 // for testing purposes
\r
519 currentQueueList.Add (new MessageQueue (@"localhost:\public\TestQueue"));
\r
520 currentQueueList.Add (new MessageQueue (@"\private\AnotherTestQueue", "localhost", true));
\r
523 public static MessageQueueEnumerator GetMessageQueueEnumerator ()
\r
525 return new MessageQueueEnumerator (currentQueueList);
\r
528 private static ArrayList filteredQueueList (MessageQueueCriteria criteria)
\r
530 ArrayList list = new ArrayList ();
\r
531 foreach (MessageQueue queue in currentQueueList)
\r
532 if (criteria.Match (queue.Id, queue.CreateTime, queue.Label, queue.MachineName, queue.LastModifyTime))
\r
537 public static MessageQueueEnumerator GetMessageQueueEnumerator (MessageQueueCriteria criteria)
\r
539 return new MessageQueueEnumerator (filteredQueueList (criteria));
\r
542 public static MessageQueue[] GetPrivateQueuesByMachine (string machineName)
\r
544 if (machineName == null || machineName.Length == 0)
\r
545 throw new ArgumentException ();
\r
546 ArrayList list = new ArrayList ();
\r
547 foreach (MessageQueue queue in currentQueueList)
\r
548 if (queue.machineName == machineName && queue.isPrivate)
\r
550 return (MessageQueue[]) list.ToArray (typeof(MessageQueue));
\r
554 public static MessageQueue[] GetPublicQueues ()
\r
556 throw new NotImplementedException ();
\r
559 public static MessageQueue[] GetPublicQueues (MessageQueueCriteria criteria)
\r
561 throw new NotImplementedException ();
\r
564 public static MessageQueue[] GetPublicQueuesByCategory (Guid category)
\r
566 throw new NotImplementedException ();
\r
569 public static MessageQueue[] GetPublicQueuesByLabel (string label)
\r
571 throw new NotImplementedException ();
\r
574 public static MessageQueue[] GetPublicQueuesByMachine (string machineName)
\r
576 throw new NotImplementedException ();
\r
579 public Message Peek ()
\r
581 throw new NotImplementedException ();
\r
584 public Message Peek (TimeSpan timeout)
\r
586 throw new NotImplementedException ();
\r
589 public Message PeekByCorrelationId (string correlationId)
\r
591 throw new NotImplementedException ();
\r
594 public Message PeekByCorrelationId (string correlationId, TimeSpan timeout)
\r
596 throw new NotImplementedException ();
\r
599 public Message PeekById (string id)
\r
601 throw new NotImplementedException ();
\r
604 public Message PeekById (string id, TimeSpan timeout)
\r
606 throw new NotImplementedException ();
\r
609 public void Purge ()
\r
611 throw new NotImplementedException ();
\r
614 public Message Receive ()
\r
616 throw new NotImplementedException ();
\r
619 public Message Receive (MessageQueueTransaction transaction)
\r
621 throw new NotImplementedException ();
\r
624 public Message Receive (MessageQueueTransactionType transactionType)
\r
626 throw new NotImplementedException ();
\r
629 public Message Receive (TimeSpan timeout)
\r
631 throw new NotImplementedException ();
\r
634 public Message Receive (TimeSpan timeout, MessageQueueTransaction transaction)
\r
636 throw new NotImplementedException ();
\r
639 public Message Receive (TimeSpan timeout, MessageQueueTransactionType transactionType)
\r
641 throw new NotImplementedException ();
\r
644 public Message ReceiveByCorrelationId (string correlationId)
\r
646 throw new NotImplementedException ();
\r
649 public Message ReceiveByCorrelationId (string correlationId, MessageQueueTransaction transaction)
\r
651 throw new NotImplementedException ();
\r
654 public Message ReceiveByCorrelationId (string correlationId, MessageQueueTransactionType transactionType)
\r
656 throw new NotImplementedException ();
\r
659 public Message ReceiveByCorrelationId (string correlationId, TimeSpan timeout)
\r
661 throw new NotImplementedException ();
\r
664 public Message ReceiveByCorrelationId (string correlationId, TimeSpan timeout, MessageQueueTransaction transaction)
\r
666 throw new NotImplementedException ();
\r
669 public Message ReceiveByCorrelationId (string correlationId, TimeSpan timeout, MessageQueueTransactionType transactionType)
\r
671 throw new NotImplementedException ();
\r
674 public Message ReceiveById (string id)
\r
676 throw new NotImplementedException ();
\r
679 public Message ReceiveById (string id, MessageQueueTransaction transaction)
\r
681 throw new NotImplementedException ();
\r
684 public Message ReceiveById (string id, MessageQueueTransactionType transactionType)
\r
686 throw new NotImplementedException ();
\r
689 public Message ReceiveById (string id, TimeSpan timeout)
\r
691 throw new NotImplementedException ();
\r
694 public Message ReceiveById (string id, TimeSpan timeout, MessageQueueTransaction transaction)
\r
696 throw new NotImplementedException ();
\r
699 public Message ReceiveById (string id, TimeSpan timeout, MessageQueueTransactionType transactionType)
\r
701 throw new NotImplementedException ();
\r
704 public void Refresh ()
\r
706 throw new NotImplementedException ();
\r
709 public void ResetPermissions ()
\r
711 throw new NotImplementedException ();
\r
714 public void Send (object obj)
\r
716 throw new NotImplementedException ();
\r
719 public void Send (object obj, MessageQueueTransaction transaction)
\r
721 throw new NotImplementedException ();
\r
724 public void Send (object obj, MessageQueueTransactionType transactionType)
\r
726 throw new NotImplementedException ();
\r
729 public void Send (object obj, string label)
\r
731 throw new NotImplementedException ();
\r
734 public void Send (object obj, string label, MessageQueueTransaction transaction)
\r
736 throw new NotImplementedException ();
\r
739 public void Send (object obj, string label, MessageQueueTransactionType transactionType)
\r
741 throw new NotImplementedException ();
\r
744 public void SetPermissions (AccessControlList dacl)
\r
746 throw new NotImplementedException ();
\r
749 public void SetPermissions (MessageQueueAccessControlEntry ace)
\r
751 throw new NotImplementedException ();
\r
754 public void SetPermissions (string user, MessageQueueAccessRights rights)
\r
756 throw new NotImplementedException ();
\r
759 public void SetPermissions (string user, MessageQueueAccessRights rights, AccessControlEntryType entryType)
\r
761 throw new NotImplementedException ();
\r
764 protected override void Dispose (bool disposing)
\r
766 throw new NotImplementedException ();
\r
769 #endregion //Methods
\r
771 //TODO: Use these events.
\r
773 [MessagingDescription ("MQ_PeekCompleted")]
\r
774 public event PeekCompletedEventHandler PeekCompleted;
\r
776 [MessagingDescription ("MQ_ReceiveCompleted")]
\r
777 public event ReceiveCompletedEventHandler ReceiveCompleted;
\r