activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r887330 [1/3] - in /activemq/activemq-dotnet/Apache.NMS.Stomp/trunk: ./ src/main/csharp/Commands/ src/main/csharp/Protocol/ src/main/csharp/Transport/ src/main/csharp/Transport/Tcp/
Date Fri, 04 Dec 2009 19:36:51 GMT
Author: tabish
Date: Fri Dec  4 19:36:50 2009
New Revision: 887330

URL: http://svn.apache.org/viewvc?rev=887330&view=rev
Log:
Fixing some compiler errors and bringing in more NMS Implementation for Stomp.

Added:
    activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/BaseMessage.cs   (with props)
    activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/BrokerError.cs   (with props)
    activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/BytesMessage.cs   (with props)
    activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/ConnectionId.cs   (with props)
    activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/ConnectionInfo.cs   (with props)
    activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/ConsumerId.cs   (with props)
    activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/ConsumerInfo.cs   (with props)
    activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/Destination.cs   (with props)
    activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/ExceptionResponse.cs   (with props)
    activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/MapMessage.cs   (with props)
    activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/MarshallAware.cs   (with props)
    activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/Message.cs   (with props)
    activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/MessageAck.cs   (with props)
    activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/MessageDispatch.cs   (with props)
    activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/MessageId.cs   (with props)
    activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/ProducerId.cs   (with props)
    activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/ProducerInfo.cs   (with props)
    activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/Queue.cs   (with props)
    activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/RemoveInfo.cs   (with props)
    activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/SessionId.cs   (with props)
    activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/SessionInfo.cs   (with props)
    activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/ShutdownInfo.cs   (with props)
    activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/StreamMessage.cs   (with props)
    activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/SubscriptionInfo.cs   (with props)
    activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/TempDestination.cs   (with props)
    activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/TempQueue.cs   (with props)
    activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/TempTopic.cs   (with props)
    activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/TextMessage.cs   (with props)
    activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/Topic.cs   (with props)
    activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/TransactionId.cs   (with props)
    activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/TransactionInfo.cs   (with props)
Modified:
    activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Protocol/StompHelper.cs
    activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Protocol/StompWireFormat.cs
    activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Transport/Tcp/TcpTransportFactory.cs
    activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Transport/TransportFactory.cs
    activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/vs2008-stomp.csproj

Added: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/BaseMessage.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/BaseMessage.cs?rev=887330&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/BaseMessage.cs (added)
+++ activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/BaseMessage.cs Fri Dec  4 19:36:50 2009
@@ -0,0 +1,282 @@
+/*
+ * 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;
+using System.Collections;
+
+using Apache.NMS.Util;
+
+namespace Apache.NMS.Stomp.Commands
+{
+    public class BaseMessage : BaseCommand, MarshallAware, ICloneable
+    {
+        public const byte ID_MESSAGE = 0;
+
+        ProducerId producerId;
+        Destination destination;
+        TransactionId transactionId;
+        MessageId messageId;
+        TransactionId originalTransactionId;
+        string groupID;
+        int groupSequence;
+        string correlationId;
+        bool persistent;
+        long expiration;
+        byte priority;
+        Destination replyTo;
+        long timestamp;
+        string type;
+        byte[] content;
+        byte[] marshalledProperties;
+        ConsumerId targetConsumerId;
+        int redeliveryCounter;
+
+        private bool readOnlyMsgProperties;
+        private bool readOnlyMsgBody;
+
+        public const int DEFAULT_MINIMUM_MESSAGE_SIZE = 1024;
+
+        ///
+        /// <summery>
+        ///  Get the unique identifier that this object and its own
+        ///  Marshaler share.
+        /// </summery>
+        ///
+        public override byte GetDataStructureType()
+        {
+            return ID_MESSAGE;
+        }
+
+        ///
+        /// <summery>
+        ///  Clone this object and return a new instance that the caller now owns.
+        /// </summery>
+        ///
+        public override Object Clone()
+        {
+            // Since we are a derived class use the base's Clone()
+            // to perform the shallow copy. Since it is shallow it
+            // will include our derived class. Since we are derived,
+            // this method is an override.
+            Message o = (Message) base.Clone();
+
+            if( this.messageId != null )
+            {
+                o.MessageId = (MessageId) this.messageId.Clone();
+            }
+
+            return o;
+        }
+
+        ///
+        /// <summery>
+        ///  Returns a string containing the information for this DataStructure
+        ///  such as its type and value of its elements.
+        /// </summery>
+        ///
+        public override string ToString()
+        {
+            return GetType().Name + "[" +
+                "ProducerId=" + ProducerId +
+                "Destination=" + Destination +
+                "TransactionId=" + TransactionId +
+                "MessageId=" + MessageId +
+                "OriginalTransactionId=" + OriginalTransactionId +
+                "GroupID=" + GroupID +
+                "GroupSequence=" + GroupSequence +
+                "CorrelationId=" + CorrelationId +
+                "Persistent=" + Persistent +
+                "Expiration=" + Expiration +
+                "Priority=" + Priority +
+                "ReplyTo=" + ReplyTo +
+                "Timestamp=" + Timestamp +
+                "Type=" + Type +
+                "Content=" + Content +
+                "MarshalledProperties=" + MarshalledProperties +
+                "TargetConsumerId=" + TargetConsumerId +
+                "RedeliveryCounter=" + RedeliveryCounter +
+                "]";
+        }
+
+        public virtual int Size()
+        {
+            int size = DEFAULT_MINIMUM_MESSAGE_SIZE;
+
+            if(marshalledProperties != null)
+            {
+                size += marshalledProperties.Length;
+            }
+            if(content != null)
+            {
+                size += content.Length;
+            }
+
+            return size;
+        }
+
+        public virtual void OnSend()
+        {
+            this.ReadOnlyProperties = true;
+            this.ReadOnlyBody = true;
+        }
+
+        public virtual void OnMessageRollback()
+        {
+            this.redeliveryCounter++;
+        }
+
+        public bool IsExpired()
+        {
+            return this.expiration == 0 ? false : DateTime.UtcNow > DateUtils.ToDateTimeUtc(this.expiration);
+        }
+
+        public ProducerId ProducerId
+        {
+            get { return producerId; }
+            set { this.producerId = value; }
+        }
+
+        public Destination Destination
+        {
+            get { return destination; }
+            set { this.destination = value; }
+        }
+
+        public TransactionId TransactionId
+        {
+            get { return transactionId; }
+            set { this.transactionId = value; }
+        }
+
+        public MessageId MessageId
+        {
+            get { return messageId; }
+            set { this.messageId = value; }
+        }
+
+        public TransactionId OriginalTransactionId
+        {
+            get { return originalTransactionId; }
+            set { this.originalTransactionId = value; }
+        }
+
+        public string GroupID
+        {
+            get { return groupID; }
+            set { this.groupID = value; }
+        }
+
+        public int GroupSequence
+        {
+            get { return groupSequence; }
+            set { this.groupSequence = value; }
+        }
+
+        public string CorrelationId
+        {
+            get { return correlationId; }
+            set { this.correlationId = value; }
+        }
+
+        public bool Persistent
+        {
+            get { return persistent; }
+            set { this.persistent = value; }
+        }
+
+        public long Expiration
+        {
+            get { return expiration; }
+            set { this.expiration = value; }
+        }
+
+        public byte Priority
+        {
+            get { return priority; }
+            set { this.priority = value; }
+        }
+
+        public Destination ReplyTo
+        {
+            get { return replyTo; }
+            set { this.replyTo = value; }
+        }
+
+        public long Timestamp
+        {
+            get { return timestamp; }
+            set { this.timestamp = value; }
+        }
+
+        public string Type
+        {
+            get { return type; }
+            set { this.type = value; }
+        }
+
+        public byte[] Content
+        {
+            get { return content; }
+            set { this.content = value; }
+        }
+
+        public byte[] MarshalledProperties
+        {
+            get { return marshalledProperties; }
+            set { this.marshalledProperties = value; }
+        }
+
+        public ConsumerId TargetConsumerId
+        {
+            get { return targetConsumerId; }
+            set { this.targetConsumerId = value; }
+        }
+
+        public int RedeliveryCounter
+        {
+            get { return redeliveryCounter; }
+            set { this.redeliveryCounter = value; }
+        }
+
+        public virtual bool ReadOnlyProperties
+        {
+            get { return this.readOnlyMsgProperties; }
+            set { this.readOnlyMsgProperties = value; }
+        }
+
+        public virtual bool ReadOnlyBody
+        {
+            get { return this.readOnlyMsgBody; }
+            set { this.readOnlyMsgBody = value; }
+        }
+
+        ///
+        /// <summery>
+        ///  Return an answer of true to the isMessage() query.
+        /// </summery>
+        ///
+        public override bool IsMessage
+        {
+            get
+            {
+                return true;
+            }
+        }
+
+    };
+}
+

Propchange: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/BaseMessage.cs
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/BrokerError.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/BrokerError.cs?rev=887330&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/BrokerError.cs (added)
+++ activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/BrokerError.cs Fri Dec  4 19:36:50 2009
@@ -0,0 +1,90 @@
+/*
+ * 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;
+using System.IO;
+
+namespace Apache.NMS.Stomp.Commands
+{
+    public struct StackTraceElement
+    {
+        public string ClassName;
+        public string FileName;
+        public string MethodName;
+        public int LineNumber;
+    }
+
+    /// <summary>
+    /// Represents an exception on the broker
+    /// </summary>
+    public class BrokerError : BaseCommand
+    {
+        private string message;
+        private string exceptionClass;
+        private StackTraceElement[] stackTraceElements = {};
+        private BrokerError cause;
+
+        public string Message
+        {
+            get { return message; }
+            set { message = value; }
+        }
+
+        public string ExceptionClass
+        {
+            get { return exceptionClass; }
+            set { exceptionClass = value; }
+        }
+
+        public StackTraceElement[] StackTraceElements
+        {
+            get { return stackTraceElements; }
+            set { stackTraceElements = value; }
+        }
+
+        public BrokerError Cause
+        {
+            get { return cause; }
+            set { cause = value; }
+        }
+
+        public String StackTrace
+        {
+            get {
+                StringWriter writer = new StringWriter();
+                PrintStackTrace(writer);
+                return writer.ToString();
+            }
+        }
+
+        public void PrintStackTrace(TextWriter writer)
+        {
+            writer.WriteLine(exceptionClass + ": " + message);
+            for (int i = 0; i < stackTraceElements.Length; i++)
+            {
+                StackTraceElement element = stackTraceElements[i];
+                writer.WriteLine("    at " + element.ClassName + "." + element.MethodName + "(" + element.FileName + ":" + element.LineNumber + ")");
+            }
+            if (cause != null)
+            {
+                writer.WriteLine("Nested Exception:");
+                cause.PrintStackTrace(writer);
+            }
+        }
+    }
+}
+

Propchange: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/BrokerError.cs
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/BrokerError.cs
------------------------------------------------------------------------------
    svn:executable = *

Added: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/BytesMessage.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/BytesMessage.cs?rev=887330&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/BytesMessage.cs (added)
+++ activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/BytesMessage.cs Fri Dec  4 19:36:50 2009
@@ -0,0 +1,524 @@
+/*
+ * 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 Apache.NMS;
+using Apache.NMS.Util;
+using System;
+using System.Collections;
+using System.IO;
+
+namespace Apache.NMS.Stomp.Commands
+{
+    public class BytesMessage : Message, IBytesMessage
+    {
+        public const byte ID_ACTIVEMQBYTESMESSAGE = 24;
+
+        private EndianBinaryReader dataIn = null;
+        private EndianBinaryWriter dataOut = null;
+        private MemoryStream outputBuffer = null;
+        private int length = 0;
+
+        public override byte GetDataStructureType()
+        {
+            return ID_ACTIVEMQBYTESMESSAGE;
+        }
+
+        public override Object Clone()
+        {
+            StoreContent();
+            return base.Clone();
+        }
+
+        public override void OnSend()
+        {
+            base.OnSend();
+            StoreContent();
+        }
+
+        public override void ClearBody()
+        {
+            base.ClearBody();
+            this.outputBuffer = null;
+            this.dataIn = null;
+            this.dataOut = null;
+            this.length = 0;
+        }
+
+        public long BodyLength
+        {
+            get
+            {
+                InitializeReading();
+                return this.length;
+            }
+        }
+
+        public byte ReadByte()
+        {
+            InitializeReading();
+            try
+            {
+                return dataIn.ReadByte();
+            }
+            catch(EndOfStreamException e)
+            {
+                throw NMSExceptionSupport.CreateMessageEOFException(e);
+            }
+            catch(IOException e)
+            {
+                throw NMSExceptionSupport.CreateMessageFormatException(e);
+            }
+        }
+
+        public void WriteByte( byte value )
+        {
+            InitializeWriting();
+            try
+            {
+                dataOut.Write( value );
+            }
+            catch(Exception e)
+            {
+                throw NMSExceptionSupport.Create(e);
+            }
+        }
+
+        public bool ReadBoolean()
+        {
+            InitializeReading();
+            try
+            {
+                return dataIn.ReadBoolean();
+            }
+            catch(EndOfStreamException e)
+            {
+                throw NMSExceptionSupport.CreateMessageEOFException(e);
+            }
+            catch(IOException e)
+            {
+                throw NMSExceptionSupport.CreateMessageFormatException(e);
+            }
+        }
+
+        public void WriteBoolean( bool value )
+        {
+            InitializeWriting();
+            try
+            {
+                dataOut.Write( value );
+            }
+            catch(Exception e)
+            {
+                throw NMSExceptionSupport.Create(e);
+            }
+        }
+
+        public char ReadChar()
+        {
+            InitializeReading();
+            try
+            {
+                return dataIn.ReadChar();
+            }
+            catch(EndOfStreamException e)
+            {
+                throw NMSExceptionSupport.CreateMessageEOFException(e);
+            }
+            catch(IOException e)
+            {
+                throw NMSExceptionSupport.CreateMessageFormatException(e);
+            }
+        }
+
+        public void WriteChar( char value )
+        {
+            InitializeWriting();
+            try
+            {
+                dataOut.Write( value );
+            }
+            catch(Exception e)
+            {
+                throw NMSExceptionSupport.Create(e);
+            }
+        }
+
+        public short ReadInt16()
+        {
+            InitializeReading();
+            try
+            {
+                return dataIn.ReadInt16();
+            }
+            catch(EndOfStreamException e)
+            {
+                throw NMSExceptionSupport.CreateMessageEOFException(e);
+            }
+            catch(IOException e)
+            {
+                throw NMSExceptionSupport.CreateMessageFormatException(e);
+            }
+        }
+
+        public void WriteInt16( short value )
+        {
+            InitializeWriting();
+            try
+            {
+                dataOut.Write( value );
+            }
+            catch(Exception e)
+            {
+                throw NMSExceptionSupport.Create(e);
+            }
+        }
+
+        public int ReadInt32()
+        {
+            InitializeReading();
+            try
+            {
+                return dataIn.ReadInt32();
+            }
+            catch(EndOfStreamException e)
+            {
+                throw NMSExceptionSupport.CreateMessageEOFException(e);
+            }
+            catch(IOException e)
+            {
+                throw NMSExceptionSupport.CreateMessageFormatException(e);
+            }
+        }
+
+        public void WriteInt32( int value )
+        {
+            InitializeWriting();
+            try
+            {
+                dataOut.Write( value );
+            }
+            catch(Exception e)
+            {
+                throw NMSExceptionSupport.Create(e);
+            }
+        }
+
+        public long ReadInt64()
+        {
+            InitializeReading();
+            try
+            {
+                return dataIn.ReadInt64();
+            }
+            catch(EndOfStreamException e)
+            {
+                throw NMSExceptionSupport.CreateMessageEOFException(e);
+            }
+            catch(IOException e)
+            {
+                throw NMSExceptionSupport.CreateMessageFormatException(e);
+            }
+        }
+
+        public void WriteInt64( long value )
+        {
+            InitializeWriting();
+            try
+            {
+                dataOut.Write( value );
+            }
+            catch(Exception e)
+            {
+                throw NMSExceptionSupport.Create(e);
+            }
+        }
+
+        public float ReadSingle()
+        {
+            InitializeReading();
+            try
+            {
+                return dataIn.ReadSingle();
+            }
+            catch(EndOfStreamException e)
+            {
+                throw NMSExceptionSupport.CreateMessageEOFException(e);
+            }
+            catch(IOException e)
+            {
+                throw NMSExceptionSupport.CreateMessageFormatException(e);
+            }
+        }
+
+        public void WriteSingle( float value )
+        {
+            InitializeWriting();
+            try
+            {
+                dataOut.Write( value );
+            }
+            catch(Exception e)
+            {
+                throw NMSExceptionSupport.Create(e);
+            }
+        }
+
+        public double ReadDouble()
+        {
+            InitializeReading();
+            try
+            {
+                return dataIn.ReadDouble();
+            }
+            catch(EndOfStreamException e)
+            {
+                throw NMSExceptionSupport.CreateMessageEOFException(e);
+            }
+            catch(IOException e)
+            {
+                throw NMSExceptionSupport.CreateMessageFormatException(e);
+            }
+        }
+
+        public void WriteDouble( double value )
+        {
+            InitializeWriting();
+            try
+            {
+                dataOut.Write( value );
+            }
+            catch(Exception e)
+            {
+                throw NMSExceptionSupport.Create(e);
+            }
+        }
+
+        public int ReadBytes( byte[] value )
+        {
+            InitializeReading();
+            try
+            {
+                return dataIn.Read( value, 0, value.Length );
+            }
+            catch(EndOfStreamException e)
+            {
+                throw NMSExceptionSupport.CreateMessageEOFException(e);
+            }
+            catch(IOException e)
+            {
+                throw NMSExceptionSupport.CreateMessageFormatException(e);
+            }
+        }
+
+        public int ReadBytes( byte[] value, int length )
+        {
+            InitializeReading();
+            try
+            {
+                return dataIn.Read( value, 0, length );
+            }
+            catch(EndOfStreamException e)
+            {
+                throw NMSExceptionSupport.CreateMessageEOFException(e);
+            }
+            catch(IOException e)
+            {
+                throw NMSExceptionSupport.CreateMessageFormatException(e);
+            }
+        }
+
+        public void WriteBytes( byte[] value )
+        {
+            InitializeWriting();
+            try
+            {
+                dataOut.Write( value, 0, value.Length );
+            }
+            catch(Exception e)
+            {
+                throw NMSExceptionSupport.Create(e);
+            }
+        }
+
+        public void WriteBytes( byte[] value, int offset, int length )
+        {
+            InitializeWriting();
+            try
+            {
+                dataOut.Write( value, offset, length );
+            }
+            catch(Exception e)
+            {
+                throw NMSExceptionSupport.Create(e);
+            }
+        }
+
+        public string ReadString()
+        {
+            InitializeReading();
+            try
+            {
+                // JMS, CMS and NMS all encode the String using a 16 bit size header.
+                return dataIn.ReadString16();
+            }
+            catch(EndOfStreamException e)
+            {
+                throw NMSExceptionSupport.CreateMessageEOFException(e);
+            }
+            catch(IOException e)
+            {
+                throw NMSExceptionSupport.CreateMessageFormatException(e);
+            }
+        }
+
+        public void WriteString( string value )
+        {
+            InitializeWriting();
+            try
+            {
+                // JMS, CMS and NMS all encode the String using a 16 bit size header.
+                dataOut.WriteString16(value);
+            }
+            catch(Exception e)
+            {
+                throw NMSExceptionSupport.Create(e);
+            }
+        }
+
+        public void WriteObject( System.Object value )
+        {
+            InitializeWriting();
+            if( value is System.Byte )
+            {
+                this.dataOut.Write( (byte) value );
+            }
+            else if( value is Char )
+            {
+                this.dataOut.Write( (char) value );
+            }
+            else if( value is Boolean )
+            {
+                this.dataOut.Write( (bool) value );
+            }
+            else if( value is Int16 )
+            {
+                this.dataOut.Write( (short) value );
+            }
+            else if( value is Int32 )
+            {
+                this.dataOut.Write( (int) value );
+            }
+            else if( value is Int64 )
+            {
+                this.dataOut.Write( (long) value );
+            }
+            else if( value is Single )
+            {
+                this.dataOut.Write( (float) value );
+            }
+            else if( value is Double )
+            {
+                this.dataOut.Write( (double) value );
+            }
+            else if( value is byte[] )
+            {
+                this.dataOut.Write( (byte[]) value );
+            }
+            else if( value is String )
+            {
+                this.dataOut.WriteString16( (string) value );
+            }
+            else
+            {
+                throw new MessageFormatException("Cannot write non-primitive type:" + value.GetType());
+            }
+        }
+
+        public new byte[] Content
+        {
+            get
+            {
+                byte[] buffer = null;
+                InitializeReading();
+                if(this.length != 0)
+                {
+                    buffer = new byte[this.length];
+                    this.dataIn.Read(buffer, 0, buffer.Length);
+                }
+                return buffer;
+            }
+
+            set
+            {
+                InitializeWriting();
+                this.dataOut.Write(value, 0, value.Length);
+            }
+        }
+
+        public void Reset()
+        {
+            StoreContent();
+            this.dataIn = null;
+            this.dataOut = null;
+            this.outputBuffer = null;
+            this.ReadOnlyBody = true;
+        }
+
+        private void InitializeReading()
+        {
+            FailIfWriteOnlyBody();
+            if(this.dataIn == null)
+            {
+                byte[] data = base.Content;
+
+                if(base.Content == null)
+                {
+                    data = new byte[0];
+                }
+
+                Stream target = new MemoryStream(data, false);
+
+                this.length = data.Length;
+                this.dataIn = new EndianBinaryReader(target);
+            }
+        }
+
+        private void InitializeWriting()
+        {
+            FailIfReadOnlyBody();
+            if(this.dataOut == null)
+            {
+                this.outputBuffer = new MemoryStream();
+                this.dataOut = new EndianBinaryWriter(this.outputBuffer);
+            }
+        }
+
+        private void StoreContent()
+        {
+            if(this.dataOut != null)
+            {
+                this.dataOut.Close();
+                base.Content = outputBuffer.ToArray();
+
+                this.dataOut = null;
+                this.outputBuffer = null;
+            }
+        }
+
+    }
+}
+

Propchange: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/BytesMessage.cs
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/ConnectionId.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/ConnectionId.cs?rev=887330&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/ConnectionId.cs (added)
+++ activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/ConnectionId.cs Fri Dec  4 19:36:50 2009
@@ -0,0 +1,105 @@
+/*
+ * 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;
+using System.Collections;
+
+namespace Apache.NMS.Stomp.Commands
+{
+    public class ConnectionId : BaseDataStructure
+    {
+        public const byte ID_CONNECTIONID = 120;
+
+        string value;
+
+        public ConnectionId()
+        {
+        }
+
+        public ConnectionId(SessionId sessionId)
+        {
+            this.value = sessionId.ConnectionId;
+        }
+
+        public ConnectionId(ProducerId producerId)
+        {
+            this.value = producerId.ConnectionId;
+        }
+
+        public ConnectionId(ConsumerId consumerId)
+        {
+            this.value = consumerId.ConnectionId;
+        }
+
+        ///
+        /// <summery>
+        ///  Get the unique identifier that this object and its own
+        ///  Marshaler share.
+        /// </summery>
+        ///
+        public override byte GetDataStructureType()
+        {
+            return ID_CONNECTIONID;
+        }
+
+        ///
+        /// <summery>
+        ///  Returns a string containing the information for this DataStructure
+        ///  such as its type and value of its elements.
+        /// </summery>
+        ///
+        public override string ToString()
+        {
+            return GetType().Name + "[Value=" + Value + "]";
+        }
+
+        public string Value
+        {
+            get { return value; }
+            set { this.value = value; }
+        }
+
+        public override int GetHashCode()
+        {
+            int answer = 0;
+
+            answer = (answer * 37) + HashCode(Value);
+
+            return answer;
+        }
+
+        public override bool Equals(object that)
+        {
+            if(that is ConnectionId)
+            {
+                return Equals((ConnectionId) that);
+            }
+            return false;
+        }
+
+        public virtual bool Equals(ConnectionId that)
+        {
+            if(!Equals(this.Value, that.Value))
+            {
+                return false;
+            }
+
+            return true;
+        }
+    };
+}
+

Propchange: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/ConnectionId.cs
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/ConnectionInfo.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/ConnectionInfo.cs?rev=887330&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/ConnectionInfo.cs (added)
+++ activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/ConnectionInfo.cs Fri Dec  4 19:36:50 2009
@@ -0,0 +1,98 @@
+/*
+ * 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;
+using System.Collections;
+
+namespace Apache.NMS.Stomp.Commands
+{
+    public class ConnectionInfo : BaseCommand
+    {
+        public const byte ID_CONNECTIONINFO = 3;
+
+        ConnectionId connectionId;
+        string clientId;
+        string password;
+        string userName;
+
+        ///
+        /// <summery>
+        ///  Get the unique identifier that this object and its own
+        ///  Marshaler share.
+        /// </summery>
+        ///
+        public override byte GetDataStructureType()
+        {
+            return ID_CONNECTIONINFO;
+        }
+
+        ///
+        /// <summery>
+        ///  Returns a string containing the information for this DataStructure
+        ///  such as its type and value of its elements.
+        /// </summery>
+        ///
+        public override string ToString()
+        {
+            return GetType().Name + "[" +
+                "ConnectionId=" + ConnectionId +
+                "ClientId=" + ClientId +
+                "Password=" + Password +
+                "UserName=" + UserName +
+                "]";
+        }
+
+        public ConnectionId ConnectionId
+        {
+            get { return connectionId; }
+            set { this.connectionId = value; }
+        }
+
+        public string ClientId
+        {
+            get { return clientId; }
+            set { this.clientId = value; }
+        }
+
+        public string Password
+        {
+            get { return password; }
+            set { this.password = value; }
+        }
+
+        public string UserName
+        {
+            get { return userName; }
+            set { this.userName = value; }
+        }
+
+        ///
+        /// <summery>
+        ///  Return an answer of true to the isConnectionInfo() query.
+        /// </summery>
+        ///
+        public override bool IsConnectionInfo
+        {
+            get
+            {
+                return true;
+            }
+        }
+
+    };
+}
+

Propchange: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/ConnectionInfo.cs
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/ConsumerId.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/ConsumerId.cs?rev=887330&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/ConsumerId.cs (added)
+++ activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/ConsumerId.cs Fri Dec  4 19:36:50 2009
@@ -0,0 +1,138 @@
+/*
+ * 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;
+using System.Collections;
+
+namespace Apache.NMS.Stomp.Commands
+{
+    public class ConsumerId : BaseDataStructure
+    {
+        public const byte ID_CONSUMERID = 122;
+
+        private SessionId parentId = null;
+
+        string connectionId;
+        long sessionId;
+        long value;
+
+        public ConsumerId()
+        {
+        }
+
+        public ConsumerId( SessionId sessionId, long consumerId )
+        {
+            this.connectionId = sessionId.ConnectionId;
+            this.sessionId = sessionId.Value;
+            this.value = consumerId;
+        }
+
+        ///
+        /// <summery>
+        ///  Get the unique identifier that this object and its own
+        ///  Marshaler share.
+        /// </summery>
+        ///
+        public override byte GetDataStructureType()
+        {
+            return ID_CONSUMERID;
+        }
+
+        ///
+        /// <summery>
+        ///  Returns a string containing the information for this DataStructure
+        ///  such as its type and value of its elements.
+        /// </summery>
+        ///
+        public override string ToString()
+        {
+            return GetType().Name + "[" +
+                "ConnectionId=" + ConnectionId +
+                "SessionId=" + SessionId +
+                "Value=" + Value +
+                "]";
+        }
+
+        public SessionId ParentId
+        {
+            get
+            {
+                 if( this.parentId == null ) {
+                     this.parentId = new SessionId( this );
+                 }
+                 return this.parentId;
+            }
+        }
+
+        public string ConnectionId
+        {
+            get { return connectionId; }
+            set { this.connectionId = value; }
+        }
+
+        public long SessionId
+        {
+            get { return sessionId; }
+            set { this.sessionId = value; }
+        }
+
+        public long Value
+        {
+            get { return value; }
+            set { this.value = value; }
+        }
+
+        public override int GetHashCode()
+        {
+            int answer = 0;
+
+            answer = (answer * 37) + HashCode(ConnectionId);
+            answer = (answer * 37) + HashCode(SessionId);
+            answer = (answer * 37) + HashCode(Value);
+
+            return answer;
+        }
+
+        public override bool Equals(object that)
+        {
+            if(that is ConsumerId)
+            {
+                return Equals((ConsumerId) that);
+            }
+            return false;
+        }
+
+        public virtual bool Equals(ConsumerId that)
+        {
+            if(!Equals(this.ConnectionId, that.ConnectionId))
+            {
+                return false;
+            }
+            if(!Equals(this.SessionId, that.SessionId))
+            {
+                return false;
+            }
+            if(!Equals(this.Value, that.Value))
+            {
+                return false;
+            }
+
+            return true;
+        }
+    };
+}
+

Propchange: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/ConsumerId.cs
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/ConsumerInfo.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/ConsumerInfo.cs?rev=887330&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/ConsumerInfo.cs (added)
+++ activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/ConsumerInfo.cs Fri Dec  4 19:36:50 2009
@@ -0,0 +1,162 @@
+/*
+ * 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;
+using System.Collections;
+
+namespace Apache.NMS.Stomp.Commands
+{
+    public class ConsumerInfo : BaseCommand
+    {
+        public const byte ID_CONSUMERINFO = 5;
+
+        ConsumerId consumerId;
+        bool browser;
+        Destination destination;
+        int prefetchSize;
+        int maximumPendingMessageLimit;
+        bool dispatchAsync;
+        string selector;
+        string subscriptionName;
+        bool noLocal;
+        bool exclusive;
+        bool retroactive;
+        byte priority;
+
+        ///
+        /// <summery>
+        ///  Get the unique identifier that this object and its own
+        ///  Marshaler share.
+        /// </summery>
+        ///
+        public override byte GetDataStructureType()
+        {
+            return ID_CONSUMERINFO;
+        }
+
+        ///
+        /// <summery>
+        ///  Returns a string containing the information for this DataStructure
+        ///  such as its type and value of its elements.
+        /// </summery>
+        ///
+        public override string ToString()
+        {
+            return GetType().Name + "[" +
+                "ConsumerId=" + ConsumerId +
+                "Browser=" + Browser +
+                "Destination=" + Destination +
+                "PrefetchSize=" + PrefetchSize +
+                "MaximumPendingMessageLimit=" + MaximumPendingMessageLimit +
+                "DispatchAsync=" + DispatchAsync +
+                "Selector=" + Selector +
+                "SubscriptionName=" + SubscriptionName +
+                "NoLocal=" + NoLocal +
+                "Exclusive=" + Exclusive +
+                "Retroactive=" + Retroactive +
+                "Priority=" + Priority +
+                "]";
+        }
+
+        public ConsumerId ConsumerId
+        {
+            get { return consumerId; }
+            set { this.consumerId = value; }
+        }
+
+        public bool Browser
+        {
+            get { return browser; }
+            set { this.browser = value; }
+        }
+
+        public Destination Destination
+        {
+            get { return destination; }
+            set { this.destination = value; }
+        }
+
+        public int PrefetchSize
+        {
+            get { return prefetchSize; }
+            set { this.prefetchSize = value; }
+        }
+
+        public int MaximumPendingMessageLimit
+        {
+            get { return maximumPendingMessageLimit; }
+            set { this.maximumPendingMessageLimit = value; }
+        }
+
+        public bool DispatchAsync
+        {
+            get { return dispatchAsync; }
+            set { this.dispatchAsync = value; }
+        }
+
+        public string Selector
+        {
+            get { return selector; }
+            set { this.selector = value; }
+        }
+
+        public string SubscriptionName
+        {
+            get { return subscriptionName; }
+            set { this.subscriptionName = value; }
+        }
+
+        public bool NoLocal
+        {
+            get { return noLocal; }
+            set { this.noLocal = value; }
+        }
+
+        public bool Exclusive
+        {
+            get { return exclusive; }
+            set { this.exclusive = value; }
+        }
+
+        public bool Retroactive
+        {
+            get { return retroactive; }
+            set { this.retroactive = value; }
+        }
+
+        public byte Priority
+        {
+            get { return priority; }
+            set { this.priority = value; }
+        }
+
+        ///
+        /// <summery>
+        ///  Return an answer of true to the isConsumerInfo() query.
+        /// </summery>
+        ///
+        public override bool IsConsumerInfo
+        {
+            get
+            {
+                return true;
+            }
+        }
+
+    };
+}
+

Propchange: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/ConsumerInfo.cs
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/Destination.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/Destination.cs?rev=887330&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/Destination.cs (added)
+++ activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/Destination.cs Fri Dec  4 19:36:50 2009
@@ -0,0 +1,566 @@
+/*
+ * 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;
+using System.Collections.Specialized;
+using Apache.NMS.Util;
+
+namespace Apache.NMS.Stomp.Commands
+{
+    /// <summary>
+    /// Summary description for Destination.
+    /// </summary>
+    public abstract class Destination : BaseDataStructure, IDestination
+    {
+        /// <summary>
+        /// Topic Destination object
+        /// </summary>
+        public const int STOMP_TOPIC = 1;
+        /// <summary>
+        /// Temporary Topic Destination object
+        /// </summary>
+        public const int STOMP_TEMPORARY_TOPIC = 2;
+        /// <summary>
+        /// Queue Destination object
+        /// </summary>
+        public const int STOMP_QUEUE = 3;
+        /// <summary>
+        /// Temporary Queue Destination object
+        /// </summary>
+        public const int STOMP_TEMPORARY_QUEUE = 4;
+        /// <summary>
+        /// prefix for Advisory message destinations
+        /// </summary>
+        public const String ADVISORY_PREFIX = "ActiveMQ.Advisory.";
+        /// <summary>
+        /// prefix for consumer advisory destinations
+        /// </summary>
+        public const String CONSUMER_ADVISORY_PREFIX = ADVISORY_PREFIX + "Consumers.";
+        /// <summary>
+        /// prefix for producer advisory destinations
+        /// </summary>
+        public const String PRODUCER_ADVISORY_PREFIX = ADVISORY_PREFIX + "Producers.";
+        /// <summary>
+        /// prefix for connection advisory destinations
+        /// </summary>
+        public const String CONNECTION_ADVISORY_PREFIX = ADVISORY_PREFIX + "Connections.";
+
+        /// <summary>
+        /// The default target for ordered destinations
+        /// </summary>
+        public const String DEFAULT_ORDERED_TARGET = "coordinator";
+
+        private const String TEMP_PREFIX = "{TD{";
+        private const String TEMP_POSTFIX = "}TD}";
+        private const String COMPOSITE_SEPARATOR = ",";
+
+        private String physicalName = "";
+        private StringDictionary options = null;
+
+        // Cached transient data
+        private bool exclusive;
+        private bool ordered;
+        private bool advisory;
+        private String orderedTarget = DEFAULT_ORDERED_TARGET;
+
+        /// <summary>
+        /// The Default Constructor
+        /// </summary>
+        protected Destination()
+        {
+        }
+
+        /// <summary>
+        /// Construct the Destination with a defined physical name;
+        /// </summary>
+        /// <param name="name"></param>
+        protected Destination(String name)
+        {
+            setPhysicalName(name);
+            //this.advisory = name != null && name.StartsWith(ADVISORY_PREFIX);
+        }
+
+        public bool IsTopic
+        {
+            get
+            {
+                int destinationType = GetDestinationType();
+                return STOMP_TOPIC == destinationType
+                    || STOMP_TEMPORARY_TOPIC == destinationType;
+            }
+        }
+
+        public bool IsQueue
+        {
+            get
+            {
+                int destinationType = GetDestinationType();
+                return STOMP_QUEUE == destinationType
+                    || STOMP_TEMPORARY_QUEUE == destinationType;
+            }
+        }
+
+        public bool IsTemporary
+        {
+            get
+            {
+                int destinationType = GetDestinationType();
+                return STOMP_TEMPORARY_QUEUE == destinationType
+                    || STOMP_TEMPORARY_TOPIC == destinationType;
+            }
+        }
+
+        /// <summary>
+        /// Dictionary of name/value pairs representing option values specified
+        /// in the URI used to create this Destination.  A null value is returned
+        /// if no options were specified.
+        /// </summary>
+        internal StringDictionary Options
+        {
+            get { return this.options; }
+        }
+
+        private void setPhysicalName(string name)
+        {
+            this.physicalName = name;
+
+            int p = name.IndexOf('?');
+            if(p >= 0)
+            {
+                String optstring = physicalName.Substring(p + 1);
+                this.physicalName = name.Substring(0, p);
+                options = URISupport.ParseQuery(optstring);
+            }
+        }
+
+        /// <summary>
+        /// </summary>
+        /// <returns>Returns the advisory.</returns>
+        public bool IsAdvisory()
+        {
+            return advisory;
+        }
+
+        /// <summary>
+        /// </summary>
+        /// <param name="advisory">The advisory to set.</param>
+        public void SetAdvisory(bool advisory)
+        {
+            this.advisory = advisory;
+        }
+
+        /// <summary>
+        /// </summary>
+        /// <returns>true if this is a destination for Consumer advisories</returns>
+        public bool IsConsumerAdvisory()
+        {
+            return IsAdvisory() && physicalName.StartsWith(CONSUMER_ADVISORY_PREFIX);
+        }
+
+        /// <summary>
+        /// </summary>
+        /// <returns>true if this is a destination for Producer advisories</returns>
+        public bool IsProducerAdvisory()
+        {
+            return IsAdvisory() && physicalName.StartsWith(PRODUCER_ADVISORY_PREFIX);
+        }
+
+        /// <summary>
+        /// </summary>
+        /// <returns>true if this is a destination for Connection advisories</returns>
+        public bool IsConnectionAdvisory()
+        {
+            return IsAdvisory() && physicalName.StartsWith(CONNECTION_ADVISORY_PREFIX);
+        }
+
+        /// <summary>
+        /// </summary>
+        /// <returns>Returns the exclusive.</returns>
+        public bool IsExclusive()
+        {
+            return exclusive;
+        }
+
+        /// <summary>
+        /// </summary>
+        /// <param name="exclusive">The exclusive to set.</param>
+        public void SetExclusive(bool exclusive)
+        {
+            this.exclusive = exclusive;
+        }
+
+        /// <summary>
+        /// </summary>
+        /// <returns>Returns the ordered.</returns>
+        public bool IsOrdered()
+        {
+            return ordered;
+        }
+
+        /// <summary>
+        /// </summary>
+        /// <param name="ordered">The ordered to set.</param>
+        public void SetOrdered(bool ordered)
+        {
+            this.ordered = ordered;
+        }
+
+        /// <summary>
+        /// </summary>
+        /// <returns>Returns the orderedTarget.</returns>
+        public String GetOrderedTarget()
+        {
+            return orderedTarget;
+        }
+
+        /// <summary>
+        /// </summary>
+        /// <param name="orderedTarget">The orderedTarget to set.</param>
+        public void SetOrderedTarget(String orderedTarget)
+        {
+            this.orderedTarget = orderedTarget;
+        }
+
+        /// <summary>
+        /// A helper method to return a descriptive string for the topic or queue
+        /// </summary>
+        /// <param name="destination"></param>
+        /// <returns>a descriptive string for this queue or topic</returns>
+        public static String Inspect(Destination destination)
+        {
+            if(destination is ITopic)
+            {
+                return "Topic(" + destination.ToString() + ")";
+            }
+            else
+            {
+                return "Queue(" + destination.ToString() + ")";
+            }
+        }
+
+        /// <summary>
+        /// </summary>
+        /// <param name="destination"></param>
+        /// <returns></returns>
+        public static Destination Transform(IDestination destination)
+        {
+            Destination result = null;
+            if(destination != null)
+            {
+                if(destination is Destination)
+                {
+                    result = (Destination) destination;
+                }
+                else
+                {
+                    if(destination is ITemporaryQueue)
+                    {
+                        result = new ActiveMQTempQueue(((IQueue) destination).QueueName);
+                    }
+                    else if(destination is ITemporaryTopic)
+                    {
+                        result = new ActiveMQTempTopic(((ITopic) destination).TopicName);
+                    }
+                    else if(destination is IQueue)
+                    {
+                        result = new ActiveMQQueue(((IQueue) destination).QueueName);
+                    }
+                    else if(destination is ITopic)
+                    {
+                        result = new ActiveMQTopic(((ITopic) destination).TopicName);
+                    }
+                }
+            }
+            return result;
+        }
+
+        /// <summary>
+        /// Create a Destination
+        /// </summary>
+        /// <param name="type"></param>
+        /// <param name="pyhsicalName"></param>
+        /// <returns></returns>
+        public static Destination CreateDestination(int type, String pyhsicalName)
+        {
+            Destination result = null;
+            if(pyhsicalName == null)
+            {
+                return null;
+            }
+            else if(type == STOMP_TOPIC)
+            {
+                result = new Topic(pyhsicalName);
+            }
+            else if(type == STOMP_TEMPORARY_TOPIC)
+            {
+                result = new TempTopic(pyhsicalName);
+            }
+            else if(type == STOMP_QUEUE)
+            {
+                result = new Queue(pyhsicalName);
+            }
+            else
+            {
+                result = new TempQueue(pyhsicalName);
+            }
+            return result;
+        }
+
+        /// <summary>
+        /// Create a temporary name from the clientId
+        /// </summary>
+        /// <param name="clientId"></param>
+        /// <returns></returns>
+        public static String CreateTemporaryName(String clientId)
+        {
+            return TEMP_PREFIX + clientId + TEMP_POSTFIX;
+        }
+
+        /// <summary>
+        /// From a temporary destination find the clientId of the Connection that created it
+        /// </summary>
+        /// <param name="destination"></param>
+        /// <returns>the clientId or null if not a temporary destination</returns>
+        public static String GetClientId(Destination destination)
+        {
+            String answer = null;
+            if(destination != null && destination.IsTemporary)
+            {
+                String name = destination.PhysicalName;
+                int start = name.IndexOf(TEMP_PREFIX);
+                if(start >= 0)
+                {
+                    start += TEMP_PREFIX.Length;
+                    int stop = name.LastIndexOf(TEMP_POSTFIX);
+                    if(stop > start && stop < name.Length)
+                    {
+                        answer = name.Substring(start, stop);
+                    }
+                }
+            }
+            return answer;
+        }
+
+        /// <summary>
+        /// </summary>
+        /// <param name="o">object to compare</param>
+        /// <returns>1 if this is less than o else 0 if they are equal or -1 if this is less than o</returns>
+        public int CompareTo(Object o)
+        {
+            if(o is Destination)
+            {
+                return CompareTo((Destination) o);
+            }
+            return -1;
+        }
+
+        /// <summary>
+        /// Lets sort by name first then lets sort topics greater than queues
+        /// </summary>
+        /// <param name="that">another destination to compare against</param>
+        /// <returns>1 if this is less than o else 0 if they are equal or -1 if this is less than o</returns>
+        public int CompareTo(Destination that)
+        {
+            int answer = 0;
+            if(physicalName != that.physicalName)
+            {
+                if(physicalName == null)
+                {
+                    return -1;
+                }
+                else if(that.physicalName == null)
+                {
+                    return 1;
+                }
+                answer = physicalName.CompareTo(that.physicalName);
+            }
+
+            if(answer == 0)
+            {
+                if(IsTopic)
+                {
+                    if(that.IsQueue)
+                    {
+                        return 1;
+                    }
+                }
+                else
+                {
+                    if(that.IsTopic)
+                    {
+                        return -1;
+                    }
+                }
+            }
+            return answer;
+        }
+
+        /// <summary>
+        /// </summary>
+        /// <returns>Returns the Destination type</returns>
+        public abstract int GetDestinationType();
+
+        public String PhysicalName
+        {
+            get { return this.physicalName; }
+            set
+            {
+                this.physicalName = value;
+                this.advisory = (value != null && value.StartsWith(ADVISORY_PREFIX));
+            }
+        }
+
+        /// <summary>
+        /// Returns true if this destination represents a collection of
+        /// destinations; allowing a set of destinations to be published to or subscribed
+        /// from in one NMS operation.
+        /// <p/>
+        /// If this destination is a composite then you can call {@link #getChildDestinations()}
+        /// to return the list of child destinations.
+        /// </summary>
+        public bool IsComposite
+        {
+            get
+            {
+                return physicalName.IndexOf(COMPOSITE_SEPARATOR) > 0;
+            }
+        }
+
+        /*public List GetChildDestinations() {
+         List answer = new ArrayList();
+         StringTokenizer iter = new StringTokenizer(physicalName, COMPOSITE_SEPARATOR);
+         while (iter.hasMoreTokens()) {
+         String name = iter.nextToken();
+         Destination child = null;
+         if (name.StartsWith(QUEUE_PREFIX)) {
+         child = new ActiveMQQueue(name.Substring(QUEUE_PREFIX.Length));
+         }
+         else if (name.StartsWith(TOPIC_PREFIX)) {
+         child = new ActiveMQTopic(name.Substring(TOPIC_PREFIX.Length));
+         }
+         else {
+         child = createDestination(name);
+         }
+         answer.add(child);
+         }
+         if (answer.size() == 1) {
+         // lets put ourselves inside the collection
+         // as we are not really a composite destination
+         answer.set(0, this);
+         }
+         return answer;
+         }*/
+
+        /// <summary>
+        /// </summary>
+        /// <returns>string representation of this instance</returns>
+        public override String ToString()
+        {
+            switch(DestinationType)
+            {
+            case DestinationType.Topic:
+            return "topic://" + PhysicalName;
+
+            case DestinationType.TemporaryTopic:
+            return "temp-topic://" + PhysicalName;
+
+            case DestinationType.TemporaryQueue:
+            return "temp-queue://" + PhysicalName;
+
+            default:
+            return "queue://" + PhysicalName;
+            }
+        }
+
+        /// <summary>
+        /// </summary>
+        /// <returns>hashCode for this instance</returns>
+        public override int GetHashCode()
+        {
+            int answer = 37;
+
+            if(this.physicalName != null)
+            {
+                answer = physicalName.GetHashCode();
+            }
+            if(IsTopic)
+            {
+                answer ^= 0xfabfab;
+            }
+            return answer;
+        }
+
+        /// <summary>
+        /// if the object passed in is equivalent, return true
+        /// </summary>
+        /// <param name="obj">the object to compare</param>
+        /// <returns>true if this instance and obj are equivalent</returns>
+        public override bool Equals(Object obj)
+        {
+            bool result = this == obj;
+            if(!result && obj != null && obj is Destination)
+            {
+                Destination other = (Destination) obj;
+                result = this.GetDestinationType() == other.GetDestinationType()
+                    && this.physicalName.Equals(other.physicalName);
+            }
+            return result;
+        }
+
+        /// <summary>
+        /// </summary>
+        /// <returns>true if the destination matches multiple possible destinations</returns>
+        public bool IsWildcard()
+        {
+            if(physicalName != null)
+            {
+                return physicalName.IndexOf(DestinationFilter.ANY_CHILD) >= 0
+                    || physicalName.IndexOf(DestinationFilter.ANY_DESCENDENT) >= 0;
+            }
+            return false;
+        }
+
+        /// <summary>
+        /// Factory method to create a child destination if this destination is a composite
+        /// </summary>
+        /// <param name="name"></param>
+        /// <returns>the created Destination</returns>
+        public abstract Destination CreateDestination(String name);
+
+
+        public abstract DestinationType DestinationType
+        {
+            get;
+        }
+
+        public override Object Clone()
+        {
+            // Since we are a derived class use the base's Clone()
+            // to perform the shallow copy. Since it is shallow it
+            // will include our derived class. Since we are derived,
+            // this method is an override.
+            Destination o = (Destination) base.Clone();
+
+            // Now do the deep work required
+            // If any new variables are added then this routine will
+            // likely need updating
+
+            return o;
+        }
+    }
+}
+

Propchange: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/Destination.cs
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/ExceptionResponse.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/ExceptionResponse.cs?rev=887330&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/ExceptionResponse.cs (added)
+++ activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/ExceptionResponse.cs Fri Dec  4 19:36:50 2009
@@ -0,0 +1,61 @@
+/*
+ * 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;
+using System.Collections;
+
+namespace Apache.NMS.Stomp.Commands
+{
+    public class ExceptionResponse : Response
+    {
+        public const byte ID_EXCEPTIONRESPONSE = 31;
+
+        BrokerError exception;
+
+        ///
+        /// <summery>
+        ///  Get the unique identifier that this object and its own
+        ///  Marshaler share.
+        /// </summery>
+        ///
+        public override byte GetDataStructureType()
+        {
+            return ID_EXCEPTIONRESPONSE;
+        }
+
+        ///
+        /// <summery>
+        ///  Returns a string containing the information for this DataStructure
+        ///  such as its type and value of its elements.
+        /// </summery>
+        ///
+        public override string ToString()
+        {
+            return GetType().Name + "[" +
+                "Exception=" + Exception +
+                "]";
+        }
+
+        public BrokerError Exception
+        {
+            get { return exception; }
+            set { this.exception = value; }
+        }
+
+    };
+}
+

Propchange: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/ExceptionResponse.cs
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/MapMessage.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/MapMessage.cs?rev=887330&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/MapMessage.cs (added)
+++ activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/MapMessage.cs Fri Dec  4 19:36:50 2009
@@ -0,0 +1,107 @@
+/*
+ * 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;
+using System.IO;
+using System.IO.Compression;
+using Apache.NMS.Util;
+using Apache.NMS.Stomp.Protocol;
+
+namespace Apache.NMS.Stomp.Commands
+{
+    public class MapMessage : Message, IMapMessage
+    {
+        public const byte ID_ACTIVEMQMAPMESSAGE = 25;
+
+        private PrimitiveMap body;
+        private PrimitiveMapInterceptor typeConverter;
+
+        public override byte GetDataStructureType()
+        {
+            return ID_ACTIVEMQMAPMESSAGE;
+        }
+
+        public override void ClearBody()
+        {
+            this.body = null;
+            this.typeConverter = null;
+            base.ClearBody();
+        }
+
+        public override bool ReadOnlyBody
+        {
+            get
+            {
+                return base.ReadOnlyBody;
+            }
+
+            set
+            {
+                if(this.typeConverter != null)
+                {
+                    this.typeConverter.ReadOnly = true;
+                }
+
+                base.ReadOnlyBody = value;
+            }
+        }
+
+
+        public IPrimitiveMap Body
+        {
+            get
+            {
+                if(this.body == null)
+                {
+                    if(this.Content != null && this.Content.Length > 0)
+                    {
+                        MemoryStream buffer = new MemoryStream(this.Content);
+                        this.body = PrimitiveMap.Unmarshal(buffer);
+                    }
+                    else
+                    {
+                        this.body = new PrimitiveMap();
+                    }
+
+                    this.typeConverter = new PrimitiveMapInterceptor(this, this.body);
+                }
+
+                return this.typeConverter;
+            }
+        }
+
+        public override void BeforeMarshall(StompWireFormat wireFormat)
+        {
+            if(body == null)
+            {
+                Content = null;
+            }
+            else
+            {
+                MemoryStream buffer = new MemoryStream();
+                this.body.Marshal(buffer);
+                target.Close();
+
+                this.Content = buffer.ToArray();
+            }
+
+            Tracer.Debug("BeforeMarshalling, content is: " + Content);
+
+            base.BeforeMarshall(wireFormat);
+        }
+    }
+}

Propchange: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/MapMessage.cs
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/MarshallAware.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/MarshallAware.cs?rev=887330&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/MarshallAware.cs (added)
+++ activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/MarshallAware.cs Fri Dec  4 19:36:50 2009
@@ -0,0 +1,37 @@
+/*
+ * 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 Apache.NMS.Stomp.Protocol;
+
+namespace Apache.NMS.Stomp.Commands
+{
+
+    /// <summary>
+    /// Represents a marshallable entity
+    /// </summary>
+    public interface MarshallAware
+    {
+        void BeforeMarshall(StompWireFormat wireFormat);
+        void AfterMarshall(StompWireFormat wireFormat);
+
+        void BeforeUnmarshall(StompWireFormat wireFormat);
+        void AfterUnmarshall(StompWireFormat wireFormat);
+
+        void SetMarshalledForm(StompWireFormat wireFormat, byte[] data);
+        byte[] GetMarshalledForm(StompWireFormat wireFormat);
+    }
+}
+

Propchange: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/MarshallAware.cs
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/Message.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/Message.cs?rev=887330&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/Message.cs (added)
+++ activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/Message.cs Fri Dec  4 19:36:50 2009
@@ -0,0 +1,384 @@
+/*
+ * 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;
+
+using Apache.NMS.Util;
+using Apache.NMS.Stomp.Protocol;
+
+namespace Apache.NMS.Stomp.Commands
+{
+    public delegate void AcknowledgeHandler(ActiveMQMessage message);
+
+    public class Message : BaseMessage, IMessage, MarshallAware
+    {
+        public const byte ID_ACTIVEMQMESSAGE = 23;
+
+        private MessagePropertyIntercepter propertyHelper;
+        private PrimitiveMap properties;
+        private Connection connection;
+
+        public event AcknowledgeHandler Acknowledger;
+
+        public static Message Transform(IMessage message)
+        {
+            return (Message) message;
+        }
+
+        public Message() : base()
+        {
+            Timestamp = DateUtils.ToJavaTimeUtc(DateTime.UtcNow);
+        }
+
+        public override int GetHashCode()
+        {
+            MessageId id = this.MessageId;
+
+            if(id != null)
+            {
+                return id.GetHashCode();
+            }
+            else
+            {
+                return base.GetHashCode();
+            }
+        }
+
+        public override byte GetDataStructureType()
+        {
+            return ID_ACTIVEMQMESSAGE;
+        }
+
+        public override bool Equals(object that)
+        {
+            if(that is Message)
+            {
+                return Equals((Message) that);
+            }
+            return false;
+        }
+
+        public virtual bool Equals(Message that)
+        {
+            MessageId oMsg = that.MessageId;
+            MessageId thisMsg = this.MessageId;
+
+            return thisMsg != null && oMsg != null && oMsg.Equals(thisMsg);
+        }
+
+        public void Acknowledge()
+        {
+            if(null == Acknowledger)
+            {
+                throw new NMSException("No Acknowledger has been associated with this message: " + this);
+            }
+            else
+            {
+                Acknowledger(this);
+            }
+        }
+
+        public virtual void ClearBody()
+        {
+            this.ReadOnlyBody = false;
+            this.Content = null;
+        }
+
+        public virtual void ClearProperties()
+        {
+            this.MarshalledProperties = null;
+            this.ReadOnlyProperties = false;
+            this.Properties.Clear();
+        }
+
+        protected void FailIfReadOnlyBody()
+        {
+            if(ReadOnlyBody == true)
+            {
+                throw new MessageNotWriteableException("Message is in Read-Only mode.");
+            }
+        }
+
+        protected void FailIfWriteOnlyBody()
+        {
+            if( ReadOnlyBody == false )
+            {
+                throw new MessageNotReadableException("Message is in Write-Only mode.");
+            }
+        }
+
+        public override bool ReadOnlyProperties
+        {
+            get{ return base.ReadOnlyProperties; }
+
+            set
+            {
+                if(this.propertyHelper != null)
+                {
+                    this.propertyHelper.ReadOnly = value;
+                }
+                base.ReadOnlyProperties = value;
+            }
+        }
+
+        #region Properties
+
+        public IPrimitiveMap Properties
+        {
+            get
+            {
+                if(null == properties)
+                {
+                    properties = PrimitiveMap.Unmarshal(MarshalledProperties);
+                    propertyHelper = new MessagePropertyIntercepter(this, properties, this.ReadOnlyProperties);
+                }
+
+                return propertyHelper;
+            }
+        }
+
+        public IDestination FromDestination
+        {
+            get { return Destination; }
+            set { this.Destination = Destination.Transform(value); }
+        }
+
+        public Connection Connection
+        {
+            get { return this.connection; }
+            set { this.connection = value; }
+        }
+
+        /// <summary>
+        /// The correlation ID used to correlate messages with conversations or long running business processes
+        /// </summary>
+        public string NMSCorrelationID
+        {
+            get { return CorrelationId; }
+            set { CorrelationId = value; }
+        }
+
+        /// <summary>
+        /// The destination of the message
+        /// </summary>
+        public IDestination NMSDestination
+        {
+            get { return Destination; }
+        }
+
+        private TimeSpan timeToLive = TimeSpan.FromMilliseconds(0);
+        /// <summary>
+        /// The time in milliseconds that this message should expire in
+        /// </summary>
+        public TimeSpan NMSTimeToLive
+        {
+            get { return timeToLive; }
+
+            set
+            {
+                timeToLive = value;
+                if(timeToLive.TotalMilliseconds > 0)
+                {
+                    Expiration = Timestamp + (long) timeToLive.TotalMilliseconds;
+                }
+                else
+                {
+                    Expiration = 0;
+                }
+            }
+        }
+
+        /// <summary>
+        /// The message ID which is set by the provider
+        /// </summary>
+        public string NMSMessageId
+        {
+            get
+            {
+                if(null != MessageId)
+                {
+                    return BaseDataStreamMarshaller.ToString(MessageId);
+                }
+
+                return String.Empty;
+            }
+
+            set
+            {
+                if(value != null)
+                {
+                    try
+                    {
+                        MessageId id = new MessageId(value);
+                        this.MessageId = id;
+                    }
+                    catch(FormatException)
+                    {
+                        // we must be some foreign JMS provider or strange user-supplied
+                        // String so lets set the IDs to be 1
+                        MessageId id = new MessageId();
+                        this.MessageId = id;
+                    }
+                }
+                else
+                {
+                    this.MessageId = null;
+                }
+            }
+        }
+
+        /// <summary>
+        /// Whether or not this message is persistent
+        /// </summary>
+        public MsgDeliveryMode NMSDeliveryMode
+        {
+            get { return (Persistent ? MsgDeliveryMode.Persistent : MsgDeliveryMode.NonPersistent); }
+            set { Persistent = (MsgDeliveryMode.Persistent == value); }
+        }
+
+        /// <summary>
+        /// The Priority on this message
+        /// </summary>
+        public MsgPriority NMSPriority
+        {
+            get { return (MsgPriority) Priority; }
+            set { Priority = (byte) value; }
+        }
+
+        /// <summary>
+        /// Returns true if this message has been redelivered to this or another consumer before being acknowledged successfully.
+        /// </summary>
+        public bool NMSRedelivered
+        {
+            get { return (RedeliveryCounter > 0); }
+        }
+
+        /// <summary>
+        /// The destination that the consumer of this message should send replies to
+        /// </summary>
+        public IDestination NMSReplyTo
+        {
+            get { return ReplyTo; }
+            set { ReplyTo = Destination.Transform(value); }
+        }
+
+        /// <summary>
+        /// The timestamp the broker added to the message
+        /// </summary>
+        public DateTime NMSTimestamp
+        {
+            get { return DateUtils.ToDateTime(Timestamp); }
+            set
+            {
+                Timestamp = DateUtils.ToJavaTimeUtc(value);
+                if(timeToLive.TotalMilliseconds > 0)
+                {
+                    Expiration = Timestamp + (long) timeToLive.TotalMilliseconds;
+                }
+            }
+        }
+
+        /// <summary>
+        /// The type name of this message
+        /// </summary>
+        public string NMSType
+        {
+            get { return Type; }
+            set { Type = value; }
+        }
+
+        #endregion
+
+        #region NMS Extension headers
+
+        /// <summary>
+        /// Returns the number of times this message has been redelivered to other consumers without being acknowledged successfully.
+        /// </summary>
+        public int NMSXDeliveryCount
+        {
+            get { return RedeliveryCounter + 1; }
+        }
+
+        /// <summary>
+        /// The Message Group ID used to group messages together to the same consumer for the same group ID value
+        /// </summary>
+        public string NMSXGroupID
+        {
+            get { return GroupID; }
+            set { GroupID = value; }
+        }
+        /// <summary>
+        /// The Message Group Sequence counter to indicate the position in a group
+        /// </summary>
+        public int NMSXGroupSeq
+        {
+            get { return GroupSequence; }
+            set { GroupSequence = value; }
+        }
+
+        /// <summary>
+        /// Returns the ID of the producers transaction
+        /// </summary>
+        public string NMSXProducerTXID
+        {
+            get
+            {
+                TransactionId txnId = OriginalTransactionId;
+                if(null == txnId)
+                {
+                    txnId = TransactionId;
+                }
+
+                if(null != txnId)
+                {
+                    return BaseDataStreamMarshaller.ToString(txnId);
+                }
+
+                return String.Empty;
+            }
+        }
+
+        #endregion
+
+        public object GetObjectProperty(string name)
+        {
+            return Properties[name];
+        }
+
+        public void SetObjectProperty(string name, object value)
+        {
+            Properties[name] = value;
+        }
+
+        // MarshallAware interface
+        public override bool IsMarshallAware()
+        {
+            return true;
+        }
+
+        public override void BeforeMarshall(StompWireFormat wireFormat)
+        {
+            MarshalledProperties = null;
+            if(properties != null)
+            {
+                MarshalledProperties = properties.Marshal();
+            }
+        }
+
+    }
+}
+

Propchange: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/Message.cs
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message