You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2009/12/04 20:36:51 UTC
svn commit: r887330 [2/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/
Added: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/MessageAck.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/MessageAck.cs?rev=887330&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/MessageAck.cs (added)
+++ activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/MessageAck.cs Fri Dec 4 19:36:50 2009
@@ -0,0 +1,122 @@
+/*
+ * 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 MessageAck : BaseCommand
+ {
+ public const byte ID_MESSAGEACK = 22;
+
+ Destination destination;
+ TransactionId transactionId;
+ ConsumerId consumerId;
+ byte ackType;
+ MessageId firstMessageId;
+ MessageId lastMessageId;
+ int messageCount;
+
+ ///
+ /// <summery>
+ /// Get the unique identifier that this object and its own
+ /// Marshaler share.
+ /// </summery>
+ ///
+ public override byte GetDataStructureType()
+ {
+ return ID_MESSAGEACK;
+ }
+
+ ///
+ /// <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 + "[" +
+ "Destination=" + Destination +
+ "TransactionId=" + TransactionId +
+ "ConsumerId=" + ConsumerId +
+ "AckType=" + AckType +
+ "FirstMessageId=" + FirstMessageId +
+ "LastMessageId=" + LastMessageId +
+ "MessageCount=" + MessageCount +
+ "]";
+ }
+
+ public Destination Destination
+ {
+ get { return destination; }
+ set { this.destination = value; }
+ }
+
+ public TransactionId TransactionId
+ {
+ get { return transactionId; }
+ set { this.transactionId = value; }
+ }
+
+ public ConsumerId ConsumerId
+ {
+ get { return consumerId; }
+ set { this.consumerId = value; }
+ }
+
+ public byte AckType
+ {
+ get { return ackType; }
+ set { this.ackType = value; }
+ }
+
+ public MessageId FirstMessageId
+ {
+ get { return firstMessageId; }
+ set { this.firstMessageId = value; }
+ }
+
+ public MessageId LastMessageId
+ {
+ get { return lastMessageId; }
+ set { this.lastMessageId = value; }
+ }
+
+ public int MessageCount
+ {
+ get { return messageCount; }
+ set { this.messageCount = value; }
+ }
+
+ ///
+ /// <summery>
+ /// Return an answer of true to the isMessageAck() query.
+ /// </summery>
+ ///
+ public override bool IsMessageAck
+ {
+ get
+ {
+ return true;
+ }
+ }
+
+ };
+}
+
Propchange: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/MessageAck.cs
------------------------------------------------------------------------------
svn:eol-style = native
Added: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/MessageDispatch.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/MessageDispatch.cs?rev=887330&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/MessageDispatch.cs (added)
+++ activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/MessageDispatch.cs Fri Dec 4 19:36:50 2009
@@ -0,0 +1,129 @@
+/*
+ * 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 MessageDispatch : BaseCommand
+ {
+ public const byte ID_MESSAGEDISPATCH = 21;
+
+ ConsumerId consumerId;
+ Destination destination;
+ Message message;
+ int redeliveryCounter;
+
+ ///
+ /// <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 +
+ "Destination=" + Destination +
+ "Message=" + Message +
+ "RedeliveryCounter=" + RedeliveryCounter +
+ "]";
+ }
+
+ public ConsumerId ConsumerId
+ {
+ get { return consumerId; }
+ set { this.consumerId = value; }
+ }
+
+ public Destination Destination
+ {
+ get { return destination; }
+ set { this.destination = value; }
+ }
+
+ public Message Message
+ {
+ get { return message; }
+ set { this.message = value; }
+ }
+
+ public int RedeliveryCounter
+ {
+ get { return redeliveryCounter; }
+ set { this.redeliveryCounter = value; }
+ }
+
+ public override int GetHashCode()
+ {
+ int answer = 0;
+
+ answer = (answer * 37) + HashCode(ConsumerId);
+ answer = (answer * 37) + HashCode(Destination);
+ answer = (answer * 37) + HashCode(Message);
+ answer = (answer * 37) + HashCode(RedeliveryCounter);
+
+ return answer;
+ }
+
+ public override bool Equals(object that)
+ {
+ if(that is MessageDispatch)
+ {
+ return Equals((MessageDispatch) that);
+ }
+ return false;
+ }
+
+ public virtual bool Equals(MessageDispatch that)
+ {
+ if(!Equals(this.ConsumerId, that.ConsumerId))
+ {
+ return false;
+ }
+ if(!Equals(this.Destination, that.Destination))
+ {
+ return false;
+ }
+ if(!Equals(this.Message, that.Message))
+ {
+ return false;
+ }
+ if(!Equals(this.RedeliveryCounter, that.RedeliveryCounter))
+ {
+ return false;
+ }
+
+ return true;
+ }
+ ///
+ /// <summery>
+ /// Return an answer of true to the isMessageDispatch() query.
+ /// </summery>
+ ///
+ public override bool IsMessageDispatch
+ {
+ get
+ {
+ return true;
+ }
+ }
+
+ };
+}
+
Propchange: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/MessageDispatch.cs
------------------------------------------------------------------------------
svn:eol-style = native
Added: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/MessageId.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/MessageId.cs?rev=887330&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/MessageId.cs (added)
+++ activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/MessageId.cs Fri Dec 4 19:36:50 2009
@@ -0,0 +1,149 @@
+/*
+ * 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 MessageId : BaseDataStructure
+ {
+ public const byte ID_MESSAGEID = 110;
+
+ ProducerId producerId;
+ long producerSequenceId;
+ long brokerSequenceId;
+
+ private string key = null;
+
+ public MessageId() : base()
+ {
+ }
+
+ public MessageId(ProducerId producerId, long producerSequenceId) : base()
+ {
+ this.producerId = producerId;
+ this.producerSequenceId = producerSequenceId;
+ }
+
+ public MessageId(string value) : base()
+ {
+ this.SetValue(value);
+ }
+
+ ///
+ /// <summery>
+ /// Get the unique identifier that this object and its own
+ /// Marshaler share.
+ /// </summery>
+ ///
+ public override byte GetDataStructureType()
+ {
+ return ID_MESSAGEID;
+ }
+
+ ///
+ /// <summery>
+ /// Returns a string containing the information for this DataStructure
+ /// such as its type and value of its elements.
+ /// </summery>
+ ///
+ public override string ToString()
+ {
+ if(key == null)
+ {
+ key = producerId.ToString() + ":" + producerSequenceId;
+ }
+
+ return key;
+ }
+
+ /// <summary>
+ /// Sets the value as a String
+ /// </summary>
+ public void SetValue(string messageKey)
+ {
+ this.key = messageKey;
+
+ // Parse off the sequenceId
+ int p = messageKey.LastIndexOf(":");
+ if(p >= 0)
+ {
+ producerSequenceId = Int64.Parse(messageKey.Substring(p + 1));
+ messageKey = messageKey.Substring(0, p);
+ }
+ producerId = new ProducerId(messageKey);
+ }
+
+ public ProducerId ProducerId
+ {
+ get { return producerId; }
+ set { this.producerId = value; }
+ }
+
+ public long ProducerSequenceId
+ {
+ get { return producerSequenceId; }
+ set { this.producerSequenceId = value; }
+ }
+
+ public long BrokerSequenceId
+ {
+ get { return brokerSequenceId; }
+ set { this.brokerSequenceId = value; }
+ }
+
+ public override int GetHashCode()
+ {
+ int answer = 0;
+
+ answer = (answer * 37) + HashCode(ProducerId);
+ answer = (answer * 37) + HashCode(ProducerSequenceId);
+ answer = (answer * 37) + HashCode(BrokerSequenceId);
+
+ return answer;
+ }
+
+ public override bool Equals(object that)
+ {
+ if(that is MessageId)
+ {
+ return Equals((MessageId) that);
+ }
+ return false;
+ }
+
+ public virtual bool Equals(MessageId that)
+ {
+ if(!Equals(this.ProducerId, that.ProducerId))
+ {
+ return false;
+ }
+ if(!Equals(this.ProducerSequenceId, that.ProducerSequenceId))
+ {
+ return false;
+ }
+ if(!Equals(this.BrokerSequenceId, that.BrokerSequenceId))
+ {
+ return false;
+ }
+
+ return true;
+ }
+ };
+}
+
Propchange: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/MessageId.cs
------------------------------------------------------------------------------
svn:eol-style = native
Added: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/ProducerId.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/ProducerId.cs?rev=887330&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/ProducerId.cs (added)
+++ activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/ProducerId.cs Fri Dec 4 19:36:50 2009
@@ -0,0 +1,150 @@
+/*
+ * 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 ProducerId : BaseDataStructure
+ {
+ public const byte ID_PRODUCERID = 123;
+
+ private SessionId parentId;
+
+ string connectionId;
+ long value;
+ long sessionId;
+
+ public ProducerId()
+ {
+ }
+
+ public ProducerId(SessionId sessionId, long consumerId)
+ {
+ this.connectionId = sessionId.ConnectionId;
+ this.sessionId = sessionId.Value;
+ this.value = consumerId;
+ }
+
+ public ProducerId(string producerKey)
+ {
+ // Parse off the producerId
+ int p = producerKey.LastIndexOf(":");
+ if(p >= 0)
+ {
+ value = Int64.Parse(producerKey.Substring(p + 1));
+ producerKey = producerKey.Substring(0, p);
+ }
+ }
+
+ ///
+ /// <summery>
+ /// Get the unique identifier that this object and its own
+ /// Marshaler share.
+ /// </summery>
+ ///
+ public override byte GetDataStructureType()
+ {
+ return ID_PRODUCERID;
+ }
+
+ ///
+ /// <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 +
+ "Value=" + Value +
+ "SessionId=" + SessionId +
+ "]";
+ }
+
+ 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 Value
+ {
+ get { return value; }
+ set { this.value = value; }
+ }
+
+ public long SessionId
+ {
+ get { return sessionId; }
+ set { this.sessionId = value; }
+ }
+
+ public override int GetHashCode()
+ {
+ int answer = 0;
+
+ answer = (answer * 37) + HashCode(ConnectionId);
+ answer = (answer * 37) + HashCode(Value);
+ answer = (answer * 37) + HashCode(SessionId);
+
+ return answer;
+ }
+
+ public override bool Equals(object that)
+ {
+ if(that is ProducerId)
+ {
+ return Equals((ProducerId) that);
+ }
+ return false;
+ }
+
+ public virtual bool Equals(ProducerId that)
+ {
+ if(!Equals(this.ConnectionId, that.ConnectionId))
+ {
+ return false;
+ }
+ if(!Equals(this.Value, that.Value))
+ {
+ return false;
+ }
+ if(!Equals(this.SessionId, that.SessionId))
+ {
+ return false;
+ }
+
+ return true;
+ }
+ };
+}
+
Propchange: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/ProducerId.cs
------------------------------------------------------------------------------
svn:eol-style = native
Added: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/ProducerInfo.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/ProducerInfo.cs?rev=887330&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/ProducerInfo.cs (added)
+++ activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/ProducerInfo.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 ProducerInfo : BaseCommand
+ {
+ public const byte ID_PRODUCERINFO = 6;
+
+ ProducerId producerId;
+ Destination destination;
+ bool dispatchAsync;
+ int windowSize;
+
+ ///
+ /// <summery>
+ /// Get the unique identifier that this object and its own
+ /// Marshaler share.
+ /// </summery>
+ ///
+ public override byte GetDataStructureType()
+ {
+ return ID_PRODUCERINFO;
+ }
+
+ ///
+ /// <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 +
+ "DispatchAsync=" + DispatchAsync +
+ "WindowSize=" + WindowSize +
+ "]";
+ }
+
+ public ProducerId ProducerId
+ {
+ get { return producerId; }
+ set { this.producerId = value; }
+ }
+
+ public Destination Destination
+ {
+ get { return destination; }
+ set { this.destination = value; }
+ }
+
+ public bool DispatchAsync
+ {
+ get { return dispatchAsync; }
+ set { this.dispatchAsync = value; }
+ }
+
+ public int WindowSize
+ {
+ get { return windowSize; }
+ set { this.windowSize = value; }
+ }
+
+ ///
+ /// <summery>
+ /// Return an answer of true to the isProducerInfo() query.
+ /// </summery>
+ ///
+ public override bool IsProducerInfo
+ {
+ get
+ {
+ return true;
+ }
+ }
+
+ };
+}
+
Propchange: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/ProducerInfo.cs
------------------------------------------------------------------------------
svn:eol-style = native
Added: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/Queue.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/Queue.cs?rev=887330&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/Queue.cs (added)
+++ activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/Queue.cs Fri Dec 4 19:36:50 2009
@@ -0,0 +1,82 @@
+/*
+ * 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;
+
+namespace Apache.NMS.Stomp.Commands
+{
+ /// <summary>
+ /// Summary description for Queue.
+ /// </summary>
+ public class Queue : Destination, IQueue
+ {
+ public const byte ID_ACTIVEMQQUEUE = 100;
+
+ public Queue()
+ : base()
+ {
+ }
+
+ public Queue(String name)
+ : base(name)
+ {
+ }
+
+ override public DestinationType DestinationType
+ {
+ get
+ {
+ return DestinationType.Queue;
+ }
+ }
+
+ public String QueueName
+ {
+ get { return PhysicalName; }
+ }
+
+ public override byte GetDataStructureType()
+ {
+ return ID_ACTIVEMQQUEUE;
+ }
+
+ public override int GetDestinationType()
+ {
+ return STOMP_QUEUE;
+ }
+
+ public override Destination CreateDestination(String name)
+ {
+ return new Queue(name);
+ }
+
+ 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.
+ Queue o = (Queue) 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/Queue.cs
------------------------------------------------------------------------------
svn:eol-style = native
Added: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/RemoveInfo.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/RemoveInfo.cs?rev=887330&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/RemoveInfo.cs (added)
+++ activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/RemoveInfo.cs Fri Dec 4 19:36:50 2009
@@ -0,0 +1,84 @@
+/*
+ * 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.ActiveMQ.State;
+
+namespace Apache.NMS.Stomp.Commands
+{
+ public class RemoveInfo : BaseCommand
+ {
+ public const byte ID_REMOVEINFO = 12;
+
+ DataStructure objectId;
+ long lastDeliveredSequenceId;
+
+ ///
+ /// <summery>
+ /// Get the unique identifier that this object and its own
+ /// Marshaler share.
+ /// </summery>
+ ///
+ public override byte GetDataStructureType()
+ {
+ return ID_REMOVEINFO;
+ }
+
+ ///
+ /// <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 + "[" +
+ "ObjectId=" + ObjectId +
+ "LastDeliveredSequenceId=" + LastDeliveredSequenceId +
+ "]";
+ }
+
+ public DataStructure ObjectId
+ {
+ get { return objectId; }
+ set { this.objectId = value; }
+ }
+
+ public long LastDeliveredSequenceId
+ {
+ get { return lastDeliveredSequenceId; }
+ set { this.lastDeliveredSequenceId = value; }
+ }
+
+ ///
+ /// <summery>
+ /// Return an answer of true to the isRemoveInfo() query.
+ /// </summery>
+ ///
+ public override bool IsRemoveInfo
+ {
+ get
+ {
+ return true;
+ }
+ }
+
+ };
+}
+
Propchange: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/RemoveInfo.cs
------------------------------------------------------------------------------
svn:eol-style = native
Added: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/SessionId.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/SessionId.cs?rev=887330&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/SessionId.cs (added)
+++ activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/SessionId.cs Fri Dec 4 19:36:50 2009
@@ -0,0 +1,134 @@
+/*
+ * 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 SessionId : BaseDataStructure
+ {
+ public const byte ID_SESSIONID = 121;
+
+ private ConnectionId parentId;
+
+ string connectionId;
+ long value;
+
+ public SessionId()
+ {
+ }
+
+ public SessionId(ConnectionId connectionId, long sessionId)
+ {
+ this.ConnectionId = connectionId.Value;
+ this.value = sessionId;
+ }
+
+ public SessionId(ProducerId producerId)
+ {
+ this.ConnectionId = producerId.ConnectionId;
+ this.value = producerId.SessionId;
+ }
+
+ public SessionId(ConsumerId consumerId)
+ {
+ this.ConnectionId = consumerId.ConnectionId;
+ this.value = consumerId.SessionId;
+ }
+
+ ///
+ /// <summery>
+ /// Get the unique identifier that this object and its own
+ /// Marshaler share.
+ /// </summery>
+ ///
+ public override byte GetDataStructureType()
+ {
+ return ID_SESSIONID;
+ }
+
+ ///
+ /// <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 + "Value=" + Value + "]";
+ }
+
+ public ConnectionId ParentId
+ {
+ get
+ {
+ if(this.parentId == null)
+ {
+ this.parentId = new ConnectionId( this );
+ }
+ return this.parentId;
+ }
+ }
+
+ public string ConnectionId
+ {
+ get { return connectionId; }
+ set { this.connectionId = 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(Value);
+
+ return answer;
+ }
+
+ public override bool Equals(object that)
+ {
+ if(that is SessionId)
+ {
+ return Equals((SessionId) that);
+ }
+ return false;
+ }
+
+ public virtual bool Equals(SessionId that)
+ {
+ if(!Equals(this.ConnectionId, that.ConnectionId))
+ {
+ return false;
+ }
+ if(!Equals(this.Value, that.Value))
+ {
+ return false;
+ }
+
+ return true;
+ }
+ };
+}
+
Propchange: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/SessionId.cs
------------------------------------------------------------------------------
svn:eol-style = native
Added: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/SessionInfo.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/SessionInfo.cs?rev=887330&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/SessionInfo.cs (added)
+++ activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/SessionInfo.cs Fri Dec 4 19:36:50 2009
@@ -0,0 +1,81 @@
+/*
+ * 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 SessionInfo : BaseCommand
+ {
+ public const byte ID_SESSIONINFO = 4;
+
+ SessionId sessionId;
+
+ public SessionInfo()
+ {
+ }
+
+ public SessionInfo(ConnectionInfo connectionInfo, long sessionId)
+ {
+ this.sessionId = new SessionId(connectionInfo.ConnectionId, sessionId);
+ }
+
+ ///
+ /// <summery>
+ /// Get the unique identifier that this object and its own
+ /// Marshaler share.
+ /// </summery>
+ ///
+ public override byte GetDataStructureType()
+ {
+ return ID_SESSIONINFO;
+ }
+
+ ///
+ /// <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 + "[" + "SessionId=" + SessionId + "]";
+ }
+
+ public SessionId SessionId
+ {
+ get { return sessionId; }
+ set { this.sessionId = value; }
+ }
+
+ ///
+ /// <summery>
+ /// Return an answer of true to the isSessionInfo() query.
+ /// </summery>
+ ///
+ public override bool IsSessionInfo
+ {
+ get
+ {
+ return true;
+ }
+ }
+
+ };
+}
+
Propchange: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/SessionInfo.cs
------------------------------------------------------------------------------
svn:eol-style = native
Added: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/ShutdownInfo.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/ShutdownInfo.cs?rev=887330&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/ShutdownInfo.cs (added)
+++ activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/ShutdownInfo.cs Fri Dec 4 19:36:50 2009
@@ -0,0 +1,73 @@
+/*
+ * 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
+{
+ /*
+ *
+ * Command code for OpenWire format for ShutdownInfo
+ *
+ * NOTE!: This file is auto generated - do not modify!
+ * if you need to make a change, please see the Java Classes
+ * in the nms-activemq-openwire-generator module
+ *
+ */
+ public class ShutdownInfo : BaseCommand
+ {
+ public const byte ID_SHUTDOWNINFO = 11;
+
+ ///
+ /// <summery>
+ /// Get the unique identifier that this object and its own
+ /// Marshaler share.
+ /// </summery>
+ ///
+ public override byte GetDataStructureType()
+ {
+ return ID_SHUTDOWNINFO;
+ }
+
+ ///
+ /// <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 + "[" + "]";
+ }
+
+ ///
+ /// <summery>
+ /// Return an answer of true to the isShutdownInfo() query.
+ /// </summery>
+ ///
+ public override bool IsShutdownInfo
+ {
+ get
+ {
+ return true;
+ }
+ }
+
+ };
+}
+
Propchange: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/ShutdownInfo.cs
------------------------------------------------------------------------------
svn:eol-style = native
Added: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/StreamMessage.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/StreamMessage.cs?rev=887330&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/StreamMessage.cs (added)
+++ activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/StreamMessage.cs Fri Dec 4 19:36:50 2009
@@ -0,0 +1,915 @@
+/*
+ * 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.Collections;
+
+using Apache.NMS;
+using Apache.NMS.Util;
+using Apache.NMS.Stomp;
+
+namespace Apache.NMS.Stomp.Commands
+{
+ public class StreamMessage : Message, IStreamMessage
+ {
+ private EndianBinaryReader dataIn = null;
+ private EndianBinaryWriter dataOut = null;
+ private MemoryStream byteBuffer = null;
+ private int bytesRemaining = -1;
+
+ public const byte ID_ACTIVEMQSTREAMMESSAGE = 27;
+
+ public override byte GetDataStructureType()
+ {
+ return ID_ACTIVEMQSTREAMMESSAGE;
+ }
+
+ public bool ReadBoolean()
+ {
+ InitializeReading();
+
+ try
+ {
+ long startingPos = this.byteBuffer.Position;
+ try
+ {
+ int type = this.dataIn.ReadByte();
+
+ if(type == PrimitiveMap.BOOLEAN_TYPE)
+ {
+ return this.dataIn.ReadBoolean();
+ }
+ else if(type == PrimitiveMap.STRING_TYPE)
+ {
+ return Boolean.Parse(this.dataIn.ReadString16());
+ }
+ else if(type == PrimitiveMap.NULL)
+ {
+ this.byteBuffer.Seek(startingPos, SeekOrigin.Begin);
+ throw new NMSException("Cannot convert Null type to a bool");
+ }
+ else
+ {
+ this.byteBuffer.Seek(startingPos, SeekOrigin.Begin);
+ throw new MessageFormatException("Value is not a Boolean type.");
+ }
+ }
+ catch(FormatException e)
+ {
+ this.byteBuffer.Seek(startingPos, SeekOrigin.Begin);
+ throw NMSExceptionSupport.CreateMessageFormatException(e);
+ }
+ }
+ catch(EndOfStreamException e)
+ {
+ throw NMSExceptionSupport.CreateMessageEOFException(e);
+ }
+ catch(IOException e)
+ {
+ throw NMSExceptionSupport.CreateMessageFormatException(e);
+ }
+ }
+
+ public byte ReadByte()
+ {
+ InitializeReading();
+
+ try
+ {
+ long startingPos = this.byteBuffer.Position;
+ try
+ {
+ int type = this.dataIn.ReadByte();
+
+ if(type == PrimitiveMap.BYTE_TYPE)
+ {
+ return this.dataIn.ReadByte();
+ }
+ else if(type == PrimitiveMap.STRING_TYPE)
+ {
+ return Byte.Parse(this.dataIn.ReadString16());
+ }
+ else if(type == PrimitiveMap.NULL)
+ {
+ this.byteBuffer.Seek(startingPos, SeekOrigin.Begin);
+ throw new NMSException("Cannot convert Null type to a byte");
+ }
+ else
+ {
+ this.byteBuffer.Seek(startingPos, SeekOrigin.Begin);
+ throw new MessageFormatException("Value is not a Byte type.");
+ }
+ }
+ catch(FormatException e)
+ {
+ this.byteBuffer.Seek(startingPos, SeekOrigin.Begin);
+ throw NMSExceptionSupport.CreateMessageFormatException(e);
+ }
+ }
+ catch(EndOfStreamException e)
+ {
+ throw NMSExceptionSupport.CreateMessageEOFException(e);
+ }
+ catch(IOException e)
+ {
+ throw NMSExceptionSupport.CreateMessageFormatException(e);
+ }
+ }
+
+ public char ReadChar()
+ {
+ InitializeReading();
+
+ try
+ {
+ long startingPos = this.byteBuffer.Position;
+ try
+ {
+ int type = this.dataIn.ReadByte();
+
+ if(type == PrimitiveMap.CHAR_TYPE)
+ {
+ return this.dataIn.ReadChar();
+ }
+ else if(type == PrimitiveMap.NULL)
+ {
+ this.byteBuffer.Seek(startingPos, SeekOrigin.Begin);
+ throw new NMSException("Cannot convert Null type to a char");
+ }
+ else
+ {
+ this.byteBuffer.Seek(startingPos, SeekOrigin.Begin);
+ throw new MessageFormatException("Value is not a Char type.");
+ }
+ }
+ catch(FormatException e)
+ {
+ this.byteBuffer.Seek(startingPos, SeekOrigin.Begin);
+ throw NMSExceptionSupport.CreateMessageFormatException(e);
+ }
+ }
+ catch(EndOfStreamException e)
+ {
+ throw NMSExceptionSupport.CreateMessageEOFException(e);
+ }
+ catch(IOException e)
+ {
+ throw NMSExceptionSupport.CreateMessageFormatException(e);
+ }
+ }
+
+ public short ReadInt16()
+ {
+ InitializeReading();
+
+ try
+ {
+ long startingPos = this.byteBuffer.Position;
+ try
+ {
+ int type = this.dataIn.ReadByte();
+
+ if(type == PrimitiveMap.SHORT_TYPE)
+ {
+ return this.dataIn.ReadInt16();
+ }
+ else if(type == PrimitiveMap.BYTE_TYPE)
+ {
+ return this.dataIn.ReadByte();
+ }
+ else if(type == PrimitiveMap.STRING_TYPE)
+ {
+ return Int16.Parse(this.dataIn.ReadString16());
+ }
+ else if(type == PrimitiveMap.NULL)
+ {
+ this.byteBuffer.Seek(startingPos, SeekOrigin.Begin);
+ throw new NMSException("Cannot convert Null type to a short");
+ }
+ else
+ {
+ this.byteBuffer.Seek(startingPos, SeekOrigin.Begin);
+ throw new MessageFormatException("Value is not a Int16 type.");
+ }
+ }
+ catch(FormatException e)
+ {
+ this.byteBuffer.Seek(startingPos, SeekOrigin.Begin);
+ throw NMSExceptionSupport.CreateMessageFormatException(e);
+ }
+ }
+ catch(EndOfStreamException e)
+ {
+ throw NMSExceptionSupport.CreateMessageEOFException(e);
+ }
+ catch(IOException e)
+ {
+ throw NMSExceptionSupport.CreateMessageFormatException(e);
+ }
+ }
+
+ public int ReadInt32()
+ {
+ InitializeReading();
+
+ try
+ {
+ long startingPos = this.byteBuffer.Position;
+ try
+ {
+ int type = this.dataIn.ReadByte();
+
+ if(type == PrimitiveMap.INTEGER_TYPE)
+ {
+ return this.dataIn.ReadInt32();
+ }
+ else if(type == PrimitiveMap.SHORT_TYPE)
+ {
+ return this.dataIn.ReadInt16();
+ }
+ else if(type == PrimitiveMap.BYTE_TYPE)
+ {
+ return this.dataIn.ReadByte();
+ }
+ else if(type == PrimitiveMap.STRING_TYPE)
+ {
+ return Int32.Parse(this.dataIn.ReadString16());
+ }
+ else if(type == PrimitiveMap.NULL)
+ {
+ this.byteBuffer.Seek(startingPos, SeekOrigin.Begin);
+ throw new NMSException("Cannot convert Null type to a int");
+ }
+ else
+ {
+ this.byteBuffer.Seek(startingPos, SeekOrigin.Begin);
+ throw new MessageFormatException("Value is not a Int32 type.");
+ }
+ }
+ catch(FormatException e)
+ {
+ this.byteBuffer.Seek(startingPos, SeekOrigin.Begin);
+ throw NMSExceptionSupport.CreateMessageFormatException(e);
+ }
+ }
+ catch(EndOfStreamException e)
+ {
+ throw NMSExceptionSupport.CreateMessageEOFException(e);
+ }
+ catch(IOException e)
+ {
+ throw NMSExceptionSupport.CreateMessageFormatException(e);
+ }
+ }
+
+ public long ReadInt64()
+ {
+ InitializeReading();
+
+ try
+ {
+ long startingPos = this.byteBuffer.Position;
+ try
+ {
+ int type = this.dataIn.ReadByte();
+
+ if(type == PrimitiveMap.LONG_TYPE)
+ {
+ return this.dataIn.ReadInt64();
+ }
+ else if(type == PrimitiveMap.INTEGER_TYPE)
+ {
+ return this.dataIn.ReadInt32();
+ }
+ else if(type == PrimitiveMap.SHORT_TYPE)
+ {
+ return this.dataIn.ReadInt16();
+ }
+ else if(type == PrimitiveMap.BYTE_TYPE)
+ {
+ return this.dataIn.ReadByte();
+ }
+ else if(type == PrimitiveMap.STRING_TYPE)
+ {
+ return Int64.Parse(this.dataIn.ReadString16());
+ }
+ else if(type == PrimitiveMap.NULL)
+ {
+ this.byteBuffer.Seek(startingPos, SeekOrigin.Begin);
+ throw new NMSException("Cannot convert Null type to a long");
+ }
+ else
+ {
+ this.byteBuffer.Seek(startingPos, SeekOrigin.Begin);
+ throw new MessageFormatException("Value is not a Int64 type.");
+ }
+ }
+ catch(FormatException e)
+ {
+ this.byteBuffer.Seek(startingPos, SeekOrigin.Begin);
+ throw NMSExceptionSupport.CreateMessageFormatException(e);
+ }
+ }
+ catch(EndOfStreamException e)
+ {
+ throw NMSExceptionSupport.CreateMessageEOFException(e);
+ }
+ catch(IOException e)
+ {
+ throw NMSExceptionSupport.CreateMessageFormatException(e);
+ }
+ }
+
+ public float ReadSingle()
+ {
+ InitializeReading();
+
+ try
+ {
+ long startingPos = this.byteBuffer.Position;
+ try
+ {
+ int type = this.dataIn.ReadByte();
+
+ if(type == PrimitiveMap.FLOAT_TYPE)
+ {
+ return this.dataIn.ReadSingle();
+ }
+ else if(type == PrimitiveMap.STRING_TYPE)
+ {
+ return Single.Parse(this.dataIn.ReadString16());
+ }
+ else if(type == PrimitiveMap.NULL)
+ {
+ this.byteBuffer.Seek(startingPos, SeekOrigin.Begin);
+ throw new NMSException("Cannot convert Null type to a float");
+ }
+ else
+ {
+ this.byteBuffer.Seek(startingPos, SeekOrigin.Begin);
+ throw new MessageFormatException("Value is not a Single type.");
+ }
+ }
+ catch(FormatException e)
+ {
+ this.byteBuffer.Seek(startingPos, SeekOrigin.Begin);
+ throw NMSExceptionSupport.CreateMessageFormatException(e);
+ }
+ }
+ catch(EndOfStreamException e)
+ {
+ throw NMSExceptionSupport.CreateMessageEOFException(e);
+ }
+ catch(IOException e)
+ {
+ throw NMSExceptionSupport.CreateMessageFormatException(e);
+ }
+ }
+
+ public double ReadDouble()
+ {
+ InitializeReading();
+
+ try
+ {
+ long startingPos = this.byteBuffer.Position;
+ try
+ {
+ int type = this.dataIn.ReadByte();
+
+ if(type == PrimitiveMap.DOUBLE_TYPE)
+ {
+ return this.dataIn.ReadDouble();
+ }
+ else if(type == PrimitiveMap.FLOAT_TYPE)
+ {
+ return this.dataIn.ReadSingle();
+ }
+ else if(type == PrimitiveMap.STRING_TYPE)
+ {
+ return Single.Parse(this.dataIn.ReadString16());
+ }
+ else if(type == PrimitiveMap.NULL)
+ {
+ this.byteBuffer.Seek(startingPos, SeekOrigin.Begin);
+ throw new NMSException("Cannot convert Null type to a double");
+ }
+ else
+ {
+ this.byteBuffer.Seek(startingPos, SeekOrigin.Begin);
+ throw new MessageFormatException("Value is not a Double type.");
+ }
+ }
+ catch(FormatException e)
+ {
+ this.byteBuffer.Seek(startingPos, SeekOrigin.Begin);
+ throw NMSExceptionSupport.CreateMessageFormatException(e);
+ }
+ }
+ catch(EndOfStreamException e)
+ {
+ throw NMSExceptionSupport.CreateMessageEOFException(e);
+ }
+ catch(IOException e)
+ {
+ throw NMSExceptionSupport.CreateMessageFormatException(e);
+ }
+ }
+
+ public string ReadString()
+ {
+ InitializeReading();
+
+ long startingPos = this.byteBuffer.Position;
+
+ try
+ {
+ int type = this.dataIn.ReadByte();
+
+ if(type == PrimitiveMap.BIG_STRING_TYPE)
+ {
+ return this.dataIn.ReadString32();
+ }
+ else if(type == PrimitiveMap.STRING_TYPE)
+ {
+ return this.dataIn.ReadString16();
+ }
+ else if(type == PrimitiveMap.LONG_TYPE)
+ {
+ return this.dataIn.ReadInt64().ToString();
+ }
+ else if(type == PrimitiveMap.INTEGER_TYPE)
+ {
+ return this.dataIn.ReadInt32().ToString();
+ }
+ else if(type == PrimitiveMap.SHORT_TYPE)
+ {
+ return this.dataIn.ReadInt16().ToString();
+ }
+ else if(type == PrimitiveMap.FLOAT_TYPE)
+ {
+ return this.dataIn.ReadSingle().ToString();
+ }
+ else if(type == PrimitiveMap.DOUBLE_TYPE)
+ {
+ return this.dataIn.ReadDouble().ToString();
+ }
+ else if(type == PrimitiveMap.CHAR_TYPE)
+ {
+ return this.dataIn.ReadChar().ToString();
+ }
+ else if(type == PrimitiveMap.BYTE_TYPE)
+ {
+ return this.dataIn.ReadByte().ToString();
+ }
+ else if(type == PrimitiveMap.BOOLEAN_TYPE)
+ {
+ return this.dataIn.ReadBoolean().ToString();
+ }
+ else if(type == PrimitiveMap.NULL)
+ {
+ return null;
+ }
+ else
+ {
+ this.byteBuffer.Seek(startingPos, SeekOrigin.Begin);
+ throw new MessageFormatException("Value is not a known type.");
+ }
+ }
+ catch(FormatException e)
+ {
+ this.byteBuffer.Seek(startingPos, SeekOrigin.Begin);
+ throw NMSExceptionSupport.CreateMessageFormatException(e);
+ }
+ catch(EndOfStreamException e)
+ {
+ throw NMSExceptionSupport.CreateMessageEOFException(e);
+ }
+ catch(IOException e)
+ {
+ throw NMSExceptionSupport.CreateMessageFormatException(e);
+ }
+ }
+
+ public int ReadBytes(byte[] value)
+ {
+ InitializeReading();
+
+ if(value == null)
+ {
+ throw new NullReferenceException("Passed Byte Array is null");
+ }
+
+ try
+ {
+ if(this.bytesRemaining == -1)
+ {
+ long startingPos = this.byteBuffer.Position;
+ byte type = this.dataIn.ReadByte();
+
+ if(type != PrimitiveMap.BYTE_ARRAY_TYPE)
+ {
+ this.byteBuffer.Seek(startingPos, SeekOrigin.Begin);
+ throw new MessageFormatException("Not a byte array");
+ }
+
+ this.bytesRemaining = this.dataIn.ReadInt32();
+ }
+ else if(this.bytesRemaining == 0)
+ {
+ this.bytesRemaining = -1;
+ return -1;
+ }
+
+ if(value.Length <= this.bytesRemaining)
+ {
+ // small buffer
+ this.bytesRemaining -= value.Length;
+ this.dataIn.Read(value, 0, value.Length);
+ return value.Length;
+ }
+ else
+ {
+ // big buffer
+ int rc = this.dataIn.Read(value, 0, this.bytesRemaining);
+ this.bytesRemaining = 0;
+ return rc;
+ }
+ }
+ catch(EndOfStreamException ex)
+ {
+ throw NMSExceptionSupport.CreateMessageEOFException(ex);
+ }
+ catch(IOException ex)
+ {
+ throw NMSExceptionSupport.CreateMessageFormatException(ex);
+ }
+ }
+
+ public Object ReadObject()
+ {
+ InitializeReading();
+
+ long startingPos = this.byteBuffer.Position;
+
+ try
+ {
+ int type = this.dataIn.ReadByte();
+
+ if(type == PrimitiveMap.BIG_STRING_TYPE)
+ {
+ return this.dataIn.ReadString32();
+ }
+ else if(type == PrimitiveMap.STRING_TYPE)
+ {
+ return this.dataIn.ReadString16();
+ }
+ else if(type == PrimitiveMap.LONG_TYPE)
+ {
+ return this.dataIn.ReadInt64();
+ }
+ else if(type == PrimitiveMap.INTEGER_TYPE)
+ {
+ return this.dataIn.ReadInt32();
+ }
+ else if(type == PrimitiveMap.SHORT_TYPE)
+ {
+ return this.dataIn.ReadInt16();
+ }
+ else if(type == PrimitiveMap.FLOAT_TYPE)
+ {
+ return this.dataIn.ReadSingle();
+ }
+ else if(type == PrimitiveMap.DOUBLE_TYPE)
+ {
+ return this.dataIn.ReadDouble();
+ }
+ else if(type == PrimitiveMap.CHAR_TYPE)
+ {
+ return this.dataIn.ReadChar();
+ }
+ else if(type == PrimitiveMap.BYTE_TYPE)
+ {
+ return this.dataIn.ReadByte();
+ }
+ else if(type == PrimitiveMap.BOOLEAN_TYPE)
+ {
+ return this.dataIn.ReadBoolean();
+ }
+ else if(type == PrimitiveMap.BYTE_ARRAY_TYPE)
+ {
+ int length = this.dataIn.ReadInt32();
+ byte[] data = new byte[length];
+ this.dataIn.Read(data, 0, length);
+ return data;
+ }
+ else if(type == PrimitiveMap.NULL)
+ {
+ return null;
+ }
+ else
+ {
+ this.byteBuffer.Seek(startingPos, SeekOrigin.Begin);
+ throw new MessageFormatException("Value is not a known type.");
+ }
+ }
+ catch(FormatException e)
+ {
+ this.byteBuffer.Seek(startingPos, SeekOrigin.Begin);
+ throw NMSExceptionSupport.CreateMessageFormatException(e);
+ }
+ catch(EndOfStreamException e)
+ {
+ throw NMSExceptionSupport.CreateMessageEOFException(e);
+ }
+ catch(IOException e)
+ {
+ throw NMSExceptionSupport.CreateMessageFormatException(e);
+ }
+ }
+
+ public void WriteBoolean(bool value)
+ {
+ InitializeWriting();
+ try
+ {
+ this.dataOut.Write(PrimitiveMap.BOOLEAN_TYPE);
+ this.dataOut.Write(value);
+ }
+ catch(IOException e)
+ {
+ NMSExceptionSupport.Create(e);
+ }
+ }
+
+ public void WriteByte(byte value)
+ {
+ InitializeWriting();
+ try
+ {
+ this.dataOut.Write(PrimitiveMap.BYTE_TYPE);
+ this.dataOut.Write(value);
+ }
+ catch(IOException e)
+ {
+ NMSExceptionSupport.Create(e);
+ }
+ }
+
+ public void WriteBytes(byte[] value)
+ {
+ InitializeWriting();
+ this.WriteBytes(value, 0, value.Length);
+ }
+
+ public void WriteBytes(byte[] value, int offset, int length)
+ {
+ InitializeWriting();
+ try
+ {
+ this.dataOut.Write(PrimitiveMap.BYTE_ARRAY_TYPE);
+ this.dataOut.Write((int) length);
+ this.dataOut.Write(value, offset, length);
+ }
+ catch(IOException e)
+ {
+ NMSExceptionSupport.Create(e);
+ }
+ }
+
+ public void WriteChar(char value)
+ {
+ InitializeWriting();
+ try
+ {
+ this.dataOut.Write(PrimitiveMap.CHAR_TYPE);
+ this.dataOut.Write(value);
+ }
+ catch(IOException e)
+ {
+ NMSExceptionSupport.Create(e);
+ }
+ }
+
+ public void WriteInt16(short value)
+ {
+ InitializeWriting();
+ try
+ {
+ this.dataOut.Write(PrimitiveMap.SHORT_TYPE);
+ this.dataOut.Write(value);
+ }
+ catch(IOException e)
+ {
+ NMSExceptionSupport.Create(e);
+ }
+ }
+
+ public void WriteInt32(int value)
+ {
+ InitializeWriting();
+ try
+ {
+ this.dataOut.Write(PrimitiveMap.INTEGER_TYPE);
+ this.dataOut.Write(value);
+ }
+ catch(IOException e)
+ {
+ NMSExceptionSupport.Create(e);
+ }
+ }
+
+ public void WriteInt64(long value)
+ {
+ InitializeWriting();
+ try
+ {
+ this.dataOut.Write(PrimitiveMap.LONG_TYPE);
+ this.dataOut.Write(value);
+ }
+ catch(IOException e)
+ {
+ NMSExceptionSupport.Create(e);
+ }
+ }
+
+ public void WriteSingle(float value)
+ {
+ InitializeWriting();
+ try
+ {
+ this.dataOut.Write(PrimitiveMap.FLOAT_TYPE);
+ this.dataOut.Write(value);
+ }
+ catch(IOException e)
+ {
+ NMSExceptionSupport.Create(e);
+ }
+ }
+
+ public void WriteDouble(double value)
+ {
+ InitializeWriting();
+ try
+ {
+ this.dataOut.Write(PrimitiveMap.DOUBLE_TYPE);
+ this.dataOut.Write(value);
+ }
+ catch(IOException e)
+ {
+ NMSExceptionSupport.Create(e);
+ }
+ }
+
+ public void WriteString(string value)
+ {
+ InitializeWriting();
+ try
+ {
+ if( value.Length > 8192 )
+ {
+ this.dataOut.Write(PrimitiveMap.BIG_STRING_TYPE);
+ this.dataOut.WriteString32(value);
+ }
+ else
+ {
+ this.dataOut.Write(PrimitiveMap.STRING_TYPE);
+ this.dataOut.WriteString16(value);
+ }
+ }
+ catch(IOException e)
+ {
+ NMSExceptionSupport.Create(e);
+ }
+ }
+
+ public void WriteObject(Object value)
+ {
+ InitializeWriting();
+ if( value is System.Byte )
+ {
+ this.WriteByte( (byte) value );
+ }
+ else if( value is Char )
+ {
+ this.WriteChar( (char) value );
+ }
+ else if( value is Boolean )
+ {
+ this.WriteBoolean( (bool) value );
+ }
+ else if( value is Int16 )
+ {
+ this.WriteInt16( (short) value );
+ }
+ else if( value is Int32 )
+ {
+ this.WriteInt32( (int) value );
+ }
+ else if( value is Int64 )
+ {
+ this.WriteInt64( (long) value );
+ }
+ else if( value is Single )
+ {
+ this.WriteSingle( (float) value );
+ }
+ else if( value is Double )
+ {
+ this.WriteDouble( (double) value );
+ }
+ else if( value is byte[] )
+ {
+ this.WriteBytes( (byte[]) value );
+ }
+ else if( value is String )
+ {
+ this.WriteString( (string) value );
+ }
+ else
+ {
+ throw new MessageFormatException("Cannot write non-primitive type:" + value.GetType());
+ }
+ }
+
+ public override Object Clone()
+ {
+ StoreContent();
+ return base.Clone();
+ }
+
+ public override void OnSend()
+ {
+ base.OnSend();
+ StoreContent();
+ }
+
+ public override void ClearBody()
+ {
+ base.ClearBody();
+ this.byteBuffer = null;
+ this.dataIn = null;
+ this.dataOut = null;
+ this.bytesRemaining = -1;
+ }
+
+ public void Reset()
+ {
+ StoreContent();
+ this.dataIn = null;
+ this.dataOut = null;
+ this.byteBuffer = null;
+ this.bytesRemaining = -1;
+ this.ReadOnlyBody = true;
+ }
+
+ private void InitializeReading()
+ {
+ FailIfWriteOnlyBody();
+ if(this.dataIn == null)
+ {
+ this.byteBuffer = new MemoryStream(this.Content, false);
+ this.dataIn = new EndianBinaryReader(this.byteBuffer);
+ }
+ }
+
+ private void InitializeWriting()
+ {
+ FailIfReadOnlyBody();
+ if(this.dataOut == null)
+ {
+ this.byteBuffer = new MemoryStream();
+ this.dataOut = new EndianBinaryWriter(this.byteBuffer);
+ }
+ }
+
+ private void StoreContent()
+ {
+ if( dataOut != null)
+ {
+ dataOut.Close();
+
+ this.Content = byteBuffer.ToArray();
+ this.dataOut = null;
+ this.byteBuffer = null;
+ }
+ }
+
+ }
+}
+
Propchange: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/StreamMessage.cs
------------------------------------------------------------------------------
svn:eol-style = native
Added: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/SubscriptionInfo.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/SubscriptionInfo.cs?rev=887330&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/SubscriptionInfo.cs (added)
+++ activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/SubscriptionInfo.cs Fri Dec 4 19:36:50 2009
@@ -0,0 +1,93 @@
+/*
+ * 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 SubscriptionInfo : BaseDataStructure
+ {
+ public const byte ID_SUBSCRIPTIONINFO = 55;
+
+ string clientId;
+ Destination destination;
+ string selector;
+ string subscriptionName;
+ Destination subscribedDestination;
+
+ ///
+ /// <summery>
+ /// Get the unique identifier that this object and its own
+ /// Marshaler share.
+ /// </summery>
+ ///
+ public override byte GetDataStructureType()
+ {
+ return ID_SUBSCRIPTIONINFO;
+ }
+
+ ///
+ /// <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 + "[" +
+ "ClientId=" + ClientId +
+ "Destination=" + Destination +
+ "Selector=" + Selector +
+ "SubscriptionName=" + SubscriptionName +
+ "SubscribedDestination=" + SubscribedDestination +
+ "]";
+ }
+
+ public string ClientId
+ {
+ get { return clientId; }
+ set { this.clientId = value; }
+ }
+
+ public Destination Destination
+ {
+ get { return destination; }
+ set { this.destination = value; }
+ }
+
+ public string Selector
+ {
+ get { return selector; }
+ set { this.selector = value; }
+ }
+
+ public string SubscriptionName
+ {
+ get { return subscriptionName; }
+ set { this.subscriptionName = value; }
+ }
+
+ public Destination SubscribedDestination
+ {
+ get { return subscribedDestination; }
+ set { this.subscribedDestination = value; }
+ }
+
+ };
+}
+
Propchange: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/SubscriptionInfo.cs
------------------------------------------------------------------------------
svn:eol-style = native
Added: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/TempDestination.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/TempDestination.cs?rev=887330&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/TempDestination.cs (added)
+++ activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/TempDestination.cs Fri Dec 4 19:36:50 2009
@@ -0,0 +1,85 @@
+/*
+ * 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;
+
+namespace Apache.NMS.Stomp.Commands
+{
+ public abstract class TempDestination : Destination
+ {
+
+ /// <summary>
+ /// Method GetDestinationType
+ /// </summary>
+ /// <returns>An int</returns>
+ public override int GetDestinationType()
+ {
+ // TODO: Implement this method
+ return 0;
+ }
+
+ /// <summary>
+ /// Method CreateDestination
+ /// </summary>
+ /// <returns>An Destination</returns>
+ /// <param name="name">A String</param>
+ public override Destination CreateDestination(String name)
+ {
+ // TODO: Implement this method
+ return null;
+ }
+
+ abstract override public DestinationType DestinationType
+ {
+ get;
+ }
+
+ public const byte ID_ActiveMQTempDestination = 0;
+
+ public TempDestination()
+ : base()
+ {
+ }
+
+ public TempDestination(String name)
+ : base(name)
+ {
+ }
+
+ public override byte GetDataStructureType()
+ {
+ return ID_ActiveMQTempDestination;
+ }
+
+ 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.
+ TempDestination o = (TempDestination) 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/TempDestination.cs
------------------------------------------------------------------------------
svn:eol-style = native
Added: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/TempQueue.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/TempQueue.cs?rev=887330&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/TempQueue.cs (added)
+++ activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/TempQueue.cs Fri Dec 4 19:36:50 2009
@@ -0,0 +1,83 @@
+/*
+ * 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;
+
+namespace Apache.NMS.Stomp.Commands
+{
+ /// <summary>
+ /// A Temporary Queue
+ /// </summary>
+ public class TempQueue : TempDestination, ITemporaryQueue
+ {
+ public const byte ID_ACTIVEMQTEMPQUEUE = 102;
+
+ public TempQueue()
+ : base()
+ {
+ }
+
+ public TempQueue(String name)
+ : base(name)
+ {
+ }
+
+ override public DestinationType DestinationType
+ {
+ get
+ {
+ return DestinationType.TemporaryQueue;
+ }
+ }
+
+ public String GetQueueName()
+ {
+ return PhysicalName;
+ }
+
+ public override byte GetDataStructureType()
+ {
+ return ID_ACTIVEMQTEMPQUEUE;
+ }
+
+ public override int GetDestinationType()
+ {
+ return STOMP_TEMPORARY_QUEUE;
+ }
+
+ public override Destination CreateDestination(String name)
+ {
+ return new StompTempQueue(name);
+ }
+
+ 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.
+ TempQueue o = (TempQueue) 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/TempQueue.cs
------------------------------------------------------------------------------
svn:eol-style = native
Added: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/TempTopic.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/TempTopic.cs?rev=887330&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/TempTopic.cs (added)
+++ activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/TempTopic.cs Fri Dec 4 19:36:50 2009
@@ -0,0 +1,85 @@
+/*
+ * 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;
+
+namespace Apache.NMS.Stomp.Commands
+{
+
+ /// <summary>
+ /// A Temporary Topic
+ /// </summary>
+ public class TempTopic : TempDestination, ITemporaryTopic
+ {
+ public const byte ID_ACTIVEMQTEMPTOPIC = 103;
+
+ public TempTopic()
+ : base()
+ {
+ }
+
+ public TempTopic(String name)
+ : base(name)
+ {
+ }
+
+ override public DestinationType DestinationType
+ {
+ get
+ {
+ return DestinationType.TemporaryTopic;
+ }
+ }
+
+
+ public String GetTopicName()
+ {
+ return PhysicalName;
+ }
+
+ public override byte GetDataStructureType()
+ {
+ return ID_ACTIVEMQTEMPTOPIC;
+ }
+
+ public override int GetDestinationType()
+ {
+ return STOMP_TEMPORARY_TOPIC;
+ }
+
+ public override Destination CreateDestination(String name)
+ {
+ return new StompTempTopic(name);
+ }
+
+ 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.
+ TempTopic o = (TempTopic) 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/TempTopic.cs
------------------------------------------------------------------------------
svn:eol-style = native
Added: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/TextMessage.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/TextMessage.cs?rev=887330&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/TextMessage.cs (added)
+++ activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/TextMessage.cs Fri Dec 4 19:36:50 2009
@@ -0,0 +1,134 @@
+/*
+ * 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 Apache.NMS;
+using Apache.NMS.Util;
+using Apache.NMS.Stomp.Protocol;
+
+namespace Apache.NMS.Stomp.Commands
+{
+ public class TextMessage : Message, ITextMessage
+ {
+ public const byte ID_ACTIVEMQTEXTMESSAGE = 28;
+
+ private String text = null;
+
+ public TextMessage()
+ {
+ }
+
+ public TextMessage(String text)
+ {
+ this.Text = text;
+ }
+
+ public override string ToString()
+ {
+ string text = this.Text;
+
+ if(text != null && text.Length > 63)
+ {
+ text = text.Substring(0, 45) + "..." + text.Substring(text.Length - 12);
+ }
+ return base.ToString() + " Text = " + (text ?? "null");
+ }
+
+ public override void ClearBody()
+ {
+ base.ClearBody();
+ this.text = null;
+ }
+
+ public override byte GetDataStructureType()
+ {
+ return ID_ACTIVEMQTEXTMESSAGE;
+ }
+
+ // Properties
+
+ public string Text
+ {
+ get
+ {
+ try
+ {
+ if(this.text == null && this.Content != null)
+ {
+ Stream stream = new MemoryStream(this.Content);
+ EndianBinaryReader reader = new EndianBinaryReader(stream);
+ this.text = reader.ReadString32();
+ this.Content = null;
+ }
+ return this.text;
+ }
+ catch(IOException ex)
+ {
+ throw NMSExceptionSupport.Create(ex);
+ }
+ }
+
+ set
+ {
+ FailIfReadOnlyBody();
+ this.text = value;
+ this.Content = null;
+ }
+ }
+
+ public override void BeforeMarshall(StompWireFormat wireFormat)
+ {
+ base.BeforeMarshall(wireFormat);
+
+ if(this.Content == null && text != null)
+ {
+ byte[] data = null;
+
+ // Set initial size to the size of the string the UTF-8 encode could
+ // result in more if there are chars that encode to multibye values.
+ MemoryStream buffer = new MemoryStream(text.Length);
+ EndianBinaryWriter writer = new EndianBinaryWriter(buffer);
+ writer.WriteString32(text);
+ buffer.Close();
+ data = buffer.ToArray();
+
+ this.Content = data;
+ this.text = null;
+ }
+ }
+
+ public override int Size()
+ {
+ if(this.Content == null && text != null)
+ {
+ int size = DEFAULT_MINIMUM_MESSAGE_SIZE;
+
+ if(MarshalledProperties != null)
+ {
+ size += MarshalledProperties.Length;
+ }
+
+ return (size += this.text.Length * 2);
+ }
+
+ return base.Size();
+ }
+ }
+}
+
Propchange: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/TextMessage.cs
------------------------------------------------------------------------------
svn:eol-style = native