5 // Peter Van Isacker (sclytrack@planetinternet.be)
6 // Rafael Teixeira (rafaelteixeirabr@hotmail.com)
8 // (C) 2003 Peter Van Isacker
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
;
34 using System
.ComponentModel
;
36 using System
.Messaging
.Design
;
38 namespace System
.Messaging
40 [TypeConverter (typeof(MessageQueueConverter
))]
41 [Editor ("System.Messaging.Design.QueuePathEditor", "System.Drawing.Design.UITypeEditor, " + Consts
.AssemblySystem_Drawing
)]
42 [Designer ("Microsoft.VisualStudio.Install.MessageQueueInstallableComponentDesigner, " + Consts
.AssemblyMicrosoft_VisualStudio
)]
43 [InstallerType (typeof(MessageQueueInstaller
))]
44 [DefaultEvent ("ReceiveCompleted")]
45 public class MessageQueue
: Component
, IEnumerable
49 public static readonly long InfiniteQueueSize
;
50 public static readonly TimeSpan InfiniteTimeout
;
52 private bool isPrivate
= false;
53 private string queueName
;
54 private string machineName
;
63 public MessageQueue ()
65 throw new NotImplementedException ();
69 public MessageQueue (string path
) {
71 this.isPrivate
= false;
75 private MessageQueue (string queueName
, string machineName
, bool isPrivate
)
77 this.queueName
= queueName
;
78 this.machineName
= machineName
;
79 this.isPrivate
= isPrivate
;
83 public MessageQueue (string path
, bool sharedModeDenyReceive
)
85 throw new NotImplementedException ();
88 #endregion //Constructor
92 [DesignerSerializationVisibility (DesignerSerializationVisibility
.Hidden
)]
93 [MessagingDescription ("MQ_Authenticate")]
94 public bool Authenticate
{
97 throw new NotImplementedException ();
101 throw new NotImplementedException ();
105 [DesignerSerializationVisibility (DesignerSerializationVisibility
.Hidden
)]
106 [MessagingDescription ("MQ_BasePriority")]
107 public short BasePriority
{
110 throw new NotImplementedException ();
114 throw new NotImplementedException ();
118 [DesignerSerializationVisibility (DesignerSerializationVisibility
.Hidden
)]
120 [MessagingDescription ("MQ_CanRead")]
121 public bool CanRead
{
124 throw new NotImplementedException ();
128 [DesignerSerializationVisibility (DesignerSerializationVisibility
.Hidden
)]
130 [MessagingDescription ("MQ_CanWrite")]
131 public bool CanWrite
{
134 throw new NotImplementedException ();
138 [DesignerSerializationVisibility (DesignerSerializationVisibility
.Hidden
)]
139 [MessagingDescription ("MQ_Category")]
140 public Guid Category
{
143 throw new NotImplementedException ();
147 throw new NotImplementedException ();
151 [DesignerSerializationVisibility (DesignerSerializationVisibility
.Hidden
)]
152 [MessagingDescription ("MQ_CreateTime")]
153 public DateTime CreateTime
{
156 throw new NotImplementedException ();
160 [DesignerSerializationVisibility (DesignerSerializationVisibility
.Content
)]
162 [MessagingDescription ("MQ_DefaultPropertiesToSend")]
163 public DefaultPropertiesToSend DefaultPropertiesToSend
{
166 throw new NotImplementedException ();
170 throw new NotImplementedException ();
175 [DefaultValue (false)]
176 [MessagingDescription ("MQ_DenySharedReceive")]
177 public bool DenySharedReceive
{
180 throw new NotImplementedException ();
184 throw new NotImplementedException ();
189 public static bool EnableConnectionCache
{
192 throw new NotImplementedException ();
196 throw new NotImplementedException ();
200 [DesignerSerializationVisibility (DesignerSerializationVisibility
.Hidden
)]
201 [MessagingDescription ("MQ_EncryptionRequired")]
202 public EncryptionRequired EncryptionRequired
{
205 throw new NotImplementedException ();
209 throw new NotImplementedException ();
213 [DesignerSerializationVisibility (DesignerSerializationVisibility
.Hidden
)]
214 [MessagingDescription ("MQ_FormatName")]
215 public string FormatName
{
218 throw new NotImplementedException ();
223 [DefaultValue (null)]
224 [TypeConverter (typeof(MessageFormatterConverter
))]
225 [MessagingDescription ("MQ_Formatter")]
226 public IMessageFormatter Formatter
{
229 throw new NotImplementedException ();
233 throw new NotImplementedException ();
237 [DesignerSerializationVisibility (DesignerSerializationVisibility
.Hidden
)]
238 [MessagingDescription ("MQ_GuidId")]
242 throw new NotImplementedException ();
246 [DesignerSerializationVisibility (DesignerSerializationVisibility
.Hidden
)]
247 [MessagingDescription ("MQ_Label")]
248 public string Label
{
251 throw new NotImplementedException ();
255 throw new NotImplementedException ();
259 [DesignerSerializationVisibility (DesignerSerializationVisibility
.Hidden
)]
260 [MessagingDescription ("MQ_LastModifyTime")]
261 public DateTime LastModifyTime
{
264 throw new NotImplementedException ();
269 [DesignerSerializationVisibility (DesignerSerializationVisibility
.Hidden
)]
270 [MessagingDescription ("MQ_MachineName")]
271 public string MachineName
{
280 [DesignerSerializationVisibility (DesignerSerializationVisibility
.Hidden
)]
281 [TypeConverter (typeof(SizeConverter
))]
282 [MessagingDescription ("MQ_MaximumJournalSize")]
283 public long MaximumJournalSize
{
286 throw new NotImplementedException ();
290 throw new NotImplementedException ();
294 [DesignerSerializationVisibility (DesignerSerializationVisibility
.Hidden
)]
295 [TypeConverter (typeof(SizeConverter
))]
296 [MessagingDescription ("MQ_MaximumQueueSize")]
297 public long MaximumQueueSize
{
300 throw new NotImplementedException ();
304 throw new NotImplementedException ();
309 [DesignerSerializationVisibility (DesignerSerializationVisibility
.Content
)]
310 [MessagingDescription ("MQ_MessageReadPropertyFilter")]
311 public MessagePropertyFilter MessageReadPropertyFilter
{
314 throw new NotImplementedException ();
318 throw new NotImplementedException ();
322 [RecommendedAsConfigurable (true)]
323 [Editor ("System.Messaging.Design.QueuePathEditor", "System.Drawing.Design.UITypeEditor, " + Consts
.AssemblySystem_Drawing
)]
326 [TypeConverter ("System.Diagnostics.Design.StringValueConverter, " + Consts
.AssemblySystem_Design
)]
327 [MessagingDescription ("MQ_Path")]
330 return machineName
+ ":" + queueName
;
332 [MonoTODO ("split input")]
334 throw new NotImplementedException ();
339 [DesignerSerializationVisibility (DesignerSerializationVisibility
.Hidden
)]
340 [MessagingDescription ("MQ_QueueName")]
341 public string QueueName
{
351 [DesignerSerializationVisibility (DesignerSerializationVisibility
.Hidden
)]
352 [MessagingDescription ("MQ_ReadHandle")]
353 public IntPtr ReadHandle
{
356 throw new NotImplementedException ();
361 [DefaultValue (null)]
362 [MessagingDescription ("MQ_SynchronizingObject")]
363 public ISynchronizeInvoke SynchronizingObject
{
366 throw new NotImplementedException ();
370 throw new NotImplementedException ();
374 [DesignerSerializationVisibility (DesignerSerializationVisibility
.Hidden
)]
375 [MessagingDescription ("MQ_Transactional")]
376 public bool Transactional
{
379 throw new NotImplementedException ();
383 [DesignerSerializationVisibility (DesignerSerializationVisibility
.Hidden
)]
384 [MessagingDescription ("MQ_WriteHandle")]
385 public bool UseJournalQueue
{
388 throw new NotImplementedException ();
392 throw new NotImplementedException ();
397 [DesignerSerializationVisibility (DesignerSerializationVisibility
.Hidden
)]
398 [MessagingDescription ("MQ_WriteHandle")]
399 public IntPtr WriteHandle
{
402 throw new NotImplementedException ();
406 #endregion //Properties
411 public IAsyncResult
BeginPeek ()
413 throw new NotImplementedException ();
416 public IAsyncResult
BeginPeek (TimeSpan timeout
)
418 throw new NotImplementedException ();
421 public IAsyncResult
BeginPeek (TimeSpan timeout
, object stateObject
)
423 throw new NotImplementedException ();
426 public IAsyncResult
BeginPeek (TimeSpan timeout
,
428 AsyncCallback callback
)
430 throw new NotImplementedException ();
433 public IAsyncResult
BeginReceive ()
435 throw new NotImplementedException ();
438 public IAsyncResult
BeginReceive (TimeSpan timeout
)
440 throw new NotImplementedException ();
443 public IAsyncResult
BeginReceive (TimeSpan timeout
, object stateObject
)
445 throw new NotImplementedException ();
448 public IAsyncResult
BeginReceive (TimeSpan timeout
, object stateObject
, AsyncCallback callback
)
450 throw new NotImplementedException ();
453 public static void ClearConnectionCache ()
455 throw new NotImplementedException ();
460 throw new NotImplementedException ();
463 public static MessageQueue
Create (string path
)
465 throw new NotImplementedException ();
468 public static MessageQueue
Create (string path
, bool transactional
)
470 throw new NotImplementedException ();
473 public static void Delete (string path
)
475 throw new NotImplementedException ();
478 public Message
EndPeek (IAsyncResult asyncResult
)
480 throw new NotImplementedException ();
483 public Message
EndReceive (IAsyncResult asyncResult
)
485 throw new NotImplementedException ();
488 public static bool Exists (string path
)
490 throw new NotImplementedException ();
493 public Message
[] GetAllMessages ()
495 throw new NotImplementedException ();
498 public IEnumerator
GetEnumerator ()
500 throw new NotImplementedException ();
503 public static Guid
GetMachineId (string machineName
)
505 throw new NotImplementedException ();
508 public MessageEnumerator
GetMessageEnumerator ()
510 throw new NotImplementedException ();
513 private static ArrayList currentQueueList
;
515 static MessageQueue ()
517 currentQueueList
= new ArrayList ();
518 // for testing purposes
519 currentQueueList
.Add (new MessageQueue (@"localhost:\public\TestQueue"));
520 currentQueueList
.Add (new MessageQueue (@"\private\AnotherTestQueue", "localhost", true));
523 public static MessageQueueEnumerator
GetMessageQueueEnumerator ()
525 return new MessageQueueEnumerator (currentQueueList
);
528 private static ArrayList
filteredQueueList (MessageQueueCriteria criteria
)
530 ArrayList list
= new ArrayList ();
531 foreach (MessageQueue queue
in currentQueueList
)
532 if (criteria
.Match (queue
.Id
, queue
.CreateTime
, queue
.Label
, queue
.MachineName
, queue
.LastModifyTime
))
537 public static MessageQueueEnumerator
GetMessageQueueEnumerator (MessageQueueCriteria criteria
)
539 return new MessageQueueEnumerator (filteredQueueList (criteria
));
542 public static MessageQueue
[] GetPrivateQueuesByMachine (string machineName
)
544 if (machineName
== null || machineName
.Length
== 0)
545 throw new ArgumentException ();
546 ArrayList list
= new ArrayList ();
547 foreach (MessageQueue queue
in currentQueueList
)
548 if (queue
.machineName
== machineName
&& queue
.isPrivate
)
550 return (MessageQueue
[]) list
.ToArray (typeof(MessageQueue
));
554 public static MessageQueue
[] GetPublicQueues ()
556 throw new NotImplementedException ();
559 public static MessageQueue
[] GetPublicQueues (MessageQueueCriteria criteria
)
561 throw new NotImplementedException ();
564 public static MessageQueue
[] GetPublicQueuesByCategory (Guid category
)
566 throw new NotImplementedException ();
569 public static MessageQueue
[] GetPublicQueuesByLabel (string label
)
571 throw new NotImplementedException ();
574 public static MessageQueue
[] GetPublicQueuesByMachine (string machineName
)
576 throw new NotImplementedException ();
579 public Message
Peek ()
581 throw new NotImplementedException ();
584 public Message
Peek (TimeSpan timeout
)
586 throw new NotImplementedException ();
589 public Message
PeekByCorrelationId (string correlationId
)
591 throw new NotImplementedException ();
594 public Message
PeekByCorrelationId (string correlationId
, TimeSpan timeout
)
596 throw new NotImplementedException ();
599 public Message
PeekById (string id
)
601 throw new NotImplementedException ();
604 public Message
PeekById (string id
, TimeSpan timeout
)
606 throw new NotImplementedException ();
611 throw new NotImplementedException ();
614 public Message
Receive ()
616 throw new NotImplementedException ();
619 public Message
Receive (MessageQueueTransaction transaction
)
621 throw new NotImplementedException ();
624 public Message
Receive (MessageQueueTransactionType transactionType
)
626 throw new NotImplementedException ();
629 public Message
Receive (TimeSpan timeout
)
631 throw new NotImplementedException ();
634 public Message
Receive (TimeSpan timeout
, MessageQueueTransaction transaction
)
636 throw new NotImplementedException ();
639 public Message
Receive (TimeSpan timeout
, MessageQueueTransactionType transactionType
)
641 throw new NotImplementedException ();
644 public Message
ReceiveByCorrelationId (string correlationId
)
646 throw new NotImplementedException ();
649 public Message
ReceiveByCorrelationId (string correlationId
, MessageQueueTransaction transaction
)
651 throw new NotImplementedException ();
654 public Message
ReceiveByCorrelationId (string correlationId
, MessageQueueTransactionType transactionType
)
656 throw new NotImplementedException ();
659 public Message
ReceiveByCorrelationId (string correlationId
, TimeSpan timeout
)
661 throw new NotImplementedException ();
664 public Message
ReceiveByCorrelationId (string correlationId
, TimeSpan timeout
, MessageQueueTransaction transaction
)
666 throw new NotImplementedException ();
669 public Message
ReceiveByCorrelationId (string correlationId
, TimeSpan timeout
, MessageQueueTransactionType transactionType
)
671 throw new NotImplementedException ();
674 public Message
ReceiveById (string id
)
676 throw new NotImplementedException ();
679 public Message
ReceiveById (string id
, MessageQueueTransaction transaction
)
681 throw new NotImplementedException ();
684 public Message
ReceiveById (string id
, MessageQueueTransactionType transactionType
)
686 throw new NotImplementedException ();
689 public Message
ReceiveById (string id
, TimeSpan timeout
)
691 throw new NotImplementedException ();
694 public Message
ReceiveById (string id
, TimeSpan timeout
, MessageQueueTransaction transaction
)
696 throw new NotImplementedException ();
699 public Message
ReceiveById (string id
, TimeSpan timeout
, MessageQueueTransactionType transactionType
)
701 throw new NotImplementedException ();
704 public void Refresh ()
706 throw new NotImplementedException ();
709 public void ResetPermissions ()
711 throw new NotImplementedException ();
714 public void Send (object obj
)
716 throw new NotImplementedException ();
719 public void Send (object obj
, MessageQueueTransaction transaction
)
721 throw new NotImplementedException ();
724 public void Send (object obj
, MessageQueueTransactionType transactionType
)
726 throw new NotImplementedException ();
729 public void Send (object obj
, string label
)
731 throw new NotImplementedException ();
734 public void Send (object obj
, string label
, MessageQueueTransaction transaction
)
736 throw new NotImplementedException ();
739 public void Send (object obj
, string label
, MessageQueueTransactionType transactionType
)
741 throw new NotImplementedException ();
744 public void SetPermissions (AccessControlList dacl
)
746 throw new NotImplementedException ();
749 public void SetPermissions (MessageQueueAccessControlEntry ace
)
751 throw new NotImplementedException ();
754 public void SetPermissions (string user
, MessageQueueAccessRights rights
)
756 throw new NotImplementedException ();
759 public void SetPermissions (string user
, MessageQueueAccessRights rights
, AccessControlEntryType entryType
)
761 throw new NotImplementedException ();
764 protected override void Dispose (bool disposing
)
766 throw new NotImplementedException ();
771 //TODO: Use these events.
773 [MessagingDescription ("MQ_PeekCompleted")]
774 public event PeekCompletedEventHandler PeekCompleted
;
776 [MessagingDescription ("MQ_ReceiveCompleted")]
777 public event ReceiveCompletedEventHandler ReceiveCompleted
;