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 [3/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/Topic.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/Topic.cs?rev=887330&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/Topic.cs (added)
+++ activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/Topic.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;
+
+namespace Apache.NMS.Stomp.Commands
+{
+
+    /// <summary>
+    /// Summary description for Topic.
+    /// </summary>
+    public class StompTopic : Destination, ITopic
+    {
+        public const byte ID_ACTIVEMQTOPIC = 101;
+
+        public StompTopic() : base()
+        {
+        }
+
+        public StompTopic(String name) : base(name)
+        {
+        }
+
+        override public DestinationType DestinationType
+        {
+            get
+            {
+                return DestinationType.Topic;
+            }
+        }
+
+        public String TopicName
+        {
+            get { return PhysicalName; }
+        }
+
+        public override byte GetDataStructureType()
+        {
+            return ID_ACTIVEMQTOPIC;
+        }
+
+        public override int GetDestinationType()
+        {
+            return ACTIVEMQ_TOPIC;
+        }
+
+        public override Destination CreateDestination(String name)
+        {
+            return new Topic(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.
+            Topic o = (Topic) 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/Topic.cs
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/TransactionId.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/TransactionId.cs?rev=887330&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/TransactionId.cs (added)
+++ activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/TransactionId.cs Fri Dec  4 19:36:50 2009
@@ -0,0 +1,101 @@
+/*
+ * 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 TransactionId
+    {
+        public const byte ID_TRANSACTIONID = 111;
+
+        long value;
+        ConnectionId connectionId;
+
+        ///
+        /// <summery>
+        ///  Get the unique identifier that this object and its own
+        ///  Marshaler share.
+        /// </summery>
+        ///
+        public byte GetDataStructureType()
+        {
+            return ID_LOCALTRANSACTIONID;
+        }
+
+        ///
+        /// <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 +
+                "ConnectionId=" + ConnectionId +
+                "]";
+        }
+
+        public long Value
+        {
+            get { return value; }
+            set { this.value = value; }
+        }
+
+        public ConnectionId ConnectionId
+        {
+            get { return connectionId; }
+            set { this.connectionId = value; }
+        }
+
+        public override int GetHashCode()
+        {
+            int answer = 0;
+
+            answer = (answer * 37) + HashCode(Value);
+            answer = (answer * 37) + HashCode(ConnectionId);
+
+            return answer;
+        }
+
+        public override bool Equals(object that)
+        {
+            if(that is TransactionId)
+            {
+                return Equals((TransactionId) that);
+            }
+            return false;
+        }
+
+        public virtual bool Equals(TransactionId that)
+        {
+            if(!Equals(this.Value, that.Value))
+            {
+                return false;
+            }
+            if(!Equals(this.ConnectionId, that.ConnectionId))
+            {
+                return false;
+            }
+
+            return true;
+        }
+    };
+}
+

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

Added: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/TransactionInfo.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/TransactionInfo.cs?rev=887330&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/TransactionInfo.cs (added)
+++ activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/TransactionInfo.cs Fri Dec  4 19:36:50 2009
@@ -0,0 +1,94 @@
+/*
+ * 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 TransactionInfo : BaseCommand
+    {
+        public const byte ID_TRANSACTIONINFO = 7;
+
+        public const byte BEGIN = 0;
+        public const byte ROLLBACK = 1;
+        public const byte COMMIT = 2;
+
+        ConnectionId connectionId;
+        TransactionId transactionId;
+        byte type;
+
+        ///
+        /// <summery>
+        ///  Get the unique identifier that this object and its own
+        ///  Marshaler share.
+        /// </summery>
+        ///
+        public override byte GetDataStructureType()
+        {
+            return ID_TRANSACTIONINFO;
+        }
+
+        ///
+        /// <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 +
+                "TransactionId=" + TransactionId +
+                "Type=" + Type +
+                "]";
+        }
+
+        public ConnectionId ConnectionId
+        {
+            get { return connectionId; }
+            set { this.connectionId = value; }
+        }
+
+        public TransactionId TransactionId
+        {
+            get { return transactionId; }
+            set { this.transactionId = value; }
+        }
+
+        public byte Type
+        {
+            get { return type; }
+            set { this.type = value; }
+        }
+
+        ///
+        /// <summery>
+        ///  Return an answer of true to the isTransactionInfo() query.
+        /// </summery>
+        ///
+        public override bool IsTransactionInfo
+        {
+            get
+            {
+                return true;
+            }
+        }
+
+    };
+}
+

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

Modified: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Protocol/StompHelper.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Protocol/StompHelper.cs?rev=887330&r1=887329&r2=887330&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Protocol/StompHelper.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Protocol/StompHelper.cs Fri Dec  4 19:36:50 2009
@@ -50,14 +50,14 @@
             return 0;
         }
 
-        public static ActiveMQDestination ToDestination(string text)
+        public static Destination ToDestination(string text)
         {
             if(text == null)
             {
                 return null;
             }
 
-            int type = ActiveMQDestination.ACTIVEMQ_QUEUE;
+            int type = Destination.STOMP_QUEUE;
             string lowertext = text.ToLower();
             if(lowertext.StartsWith("/queue/"))
             {
@@ -66,31 +66,31 @@
             else if(lowertext.StartsWith("/topic/"))
             {
                 text = text.Substring("/topic/".Length);
-                type = ActiveMQDestination.ACTIVEMQ_TOPIC;
+                type = Destination.STOMP_TOPIC;
             }
             else if(lowertext.StartsWith("/temp-topic/"))
             {
                 text = text.Substring("/temp-topic/".Length);
-                type = ActiveMQDestination.ACTIVEMQ_TEMPORARY_TOPIC;
+                type = Destination.STOMP_TEMPORARY_TOPIC;
             }
             else if(lowertext.StartsWith("/temp-queue/"))
             {
                 text = text.Substring("/temp-queue/".Length);
-                type = ActiveMQDestination.ACTIVEMQ_TEMPORARY_QUEUE;
+                type = Destination.STOMP_TEMPORARY_QUEUE;
             }
             else if(lowertext.StartsWith("/remote-temp-topic/"))
             {
-                type = ActiveMQDestination.ACTIVEMQ_TEMPORARY_TOPIC;
+                type = Destination.STOMP_TEMPORARY_TOPIC;
             }
             else if(lowertext.StartsWith("/remote-temp-queue/"))
             {
-                type = ActiveMQDestination.ACTIVEMQ_TEMPORARY_QUEUE;
+                type = Destination.STOMP_TEMPORARY_QUEUE;
             }
 
-            return ActiveMQDestination.CreateDestination(type, text);
+            return Destination.CreateDestination(type, text);
         }
 
-        public static string ToStomp(ActiveMQDestination destination)
+        public static string ToStomp(Destination destination)
         {
             if(destination == null)
             {
@@ -248,17 +248,7 @@
 
         public static string ToStomp(TransactionId id)
         {
-            if(id is LocalTransactionId)
-            {
-                return ToStomp(id as LocalTransactionId);
-            }
-
-            return id.ToString();
-        }
-
-        public static string ToStomp(LocalTransactionId transactionId)
-        {
-            return transactionId.ConnectionId.Value + ":" + transactionId.Value;
+            return id.ConnectionId.Value + ":" + id.Value;
         }
 
         public static bool ToBool(string text, bool defaultValue)

Modified: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Protocol/StompWireFormat.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Protocol/StompWireFormat.cs?rev=887330&r1=887329&r2=887330&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Protocol/StompWireFormat.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Protocol/StompWireFormat.cs Fri Dec  4 19:36:50 2009
@@ -444,7 +444,7 @@
             }
         }
 
-        protected virtual void WriteMessage(ActiveMQMessage command, StompFrameStream ss)
+        protected virtual void WriteMessage(Message command, StompFrameStream ss)
         {
             ss.WriteCommand(command, "SEND");
             ss.WriteHeader("destination", StompHelper.ToStomp(command.Destination));
@@ -466,7 +466,7 @@
             // lets force the content to be marshalled
 
             command.BeforeMarshall(null);
-            if (command is ActiveMQTextMessage)
+            if (command is TextMessage)
             {
                 ActiveMQTextMessage textMessage = command as ActiveMQTextMessage;
                 ss.Content = encoding.GetBytes(textMessage.Text);

Modified: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Transport/Tcp/TcpTransportFactory.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Transport/Tcp/TcpTransportFactory.cs?rev=887330&r1=887329&r2=887330&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Transport/Tcp/TcpTransportFactory.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Transport/Tcp/TcpTransportFactory.cs Fri Dec  4 19:36:50 2009
@@ -19,7 +19,7 @@
 using System.Collections.Specialized;
 using System.Net;
 using System.Net.Sockets;
-using Apache.NMS.Stomp.Transport.Stomp;
+using Apache.NMS.Stomp.Transport;
 using Apache.NMS.Util;
 
 namespace Apache.NMS.Stomp.Transport.Tcp

Modified: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Transport/TransportFactory.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Transport/TransportFactory.cs?rev=887330&r1=887329&r2=887330&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Transport/TransportFactory.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Transport/TransportFactory.cs Fri Dec  4 19:36:50 2009
@@ -16,9 +16,7 @@
  */
 
 using System;
-using Apache.NMS.Stomp.Transport.Discovery;
-using Apache.NMS.Stomp.Transport.Failover;
-using Apache.NMS.Stomp.Transport.Mock;
+
 using Apache.NMS.Stomp.Transport.Tcp;
 
 namespace Apache.NMS.Stomp.Transport

Modified: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/vs2008-stomp.csproj
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/vs2008-stomp.csproj?rev=887330&r1=887329&r2=887330&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/vs2008-stomp.csproj (original)
+++ activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/vs2008-stomp.csproj Fri Dec  4 19:36:50 2009
@@ -49,7 +49,7 @@
     <Compile Include="src\main\csharp\Commands\DataStructure.cs" />
     <Compile Include="src\main\csharp\Commands\ExceptionResponse.cs" />
     <Compile Include="src\main\csharp\Commands\MarshallAware.cs" />
-    <Compile Include="src\main\csharp\Commands\Message.cs" />
+    <Compile Include="src\main\csharp\Commands\BaseMessage.cs" />
     <Compile Include="src\main\csharp\Commands\MessageAck.cs" />
     <Compile Include="src\main\csharp\Commands\MessageId.cs" />
     <Compile Include="src\main\csharp\Commands\ProducerId.cs" />
@@ -58,17 +58,17 @@
     <Compile Include="src\main\csharp\Commands\Response.cs" />
     <Compile Include="src\main\csharp\Commands\SessionId.cs" />
     <Compile Include="src\main\csharp\Commands\SessionInfo.cs" />
-    <Compile Include="src\main\csharp\Commands\StompBytesMessage.cs" />
-    <Compile Include="src\main\csharp\Commands\StompDestination.cs" />
-    <Compile Include="src\main\csharp\Commands\StompMapMessage.cs" />
-    <Compile Include="src\main\csharp\Commands\StompMessage.cs" />
-    <Compile Include="src\main\csharp\Commands\StompQueue.cs" />
-    <Compile Include="src\main\csharp\Commands\StompStreamMessage.cs" />
-    <Compile Include="src\main\csharp\Commands\StompTempDestination.cs" />
-    <Compile Include="src\main\csharp\Commands\StompTempQueue.cs" />
-    <Compile Include="src\main\csharp\Commands\StompTempTopic.cs" />
-    <Compile Include="src\main\csharp\Commands\StompTextMessage.cs" />
-    <Compile Include="src\main\csharp\Commands\StompTopic.cs" />
+    <Compile Include="src\main\csharp\Commands\BytesMessage.cs" />
+    <Compile Include="src\main\csharp\Commands\Destination.cs" />
+    <Compile Include="src\main\csharp\Commands\MapMessage.cs" />
+    <Compile Include="src\main\csharp\Commands\Message.cs" />
+    <Compile Include="src\main\csharp\Commands\Queue.cs" />
+    <Compile Include="src\main\csharp\Commands\StreamMessage.cs" />
+    <Compile Include="src\main\csharp\Commands\TempDestination.cs" />
+    <Compile Include="src\main\csharp\Commands\TempQueue.cs" />
+    <Compile Include="src\main\csharp\Commands\TempTopic.cs" />
+    <Compile Include="src\main\csharp\Commands\TextMessage.cs" />
+    <Compile Include="src\main\csharp\Commands\Topic.cs" />
     <Compile Include="src\main\csharp\Commands\SubscriptionInfo.cs" />
     <Compile Include="src\main\csharp\Commands\TransactionId.cs" />
     <Compile Include="src\main\csharp\Commands\TransactionInfo.cs" />
@@ -91,6 +91,8 @@
     <Compile Include="src\main\csharp\Connection.cs" />
     <Compile Include="src\main\csharp\ConnectionFactory.cs" />
     <Compile Include="src\main\csharp\ConnectionMetaData.cs" />
+    <Compile Include="src\main\csharp\Commands\MessageDispatch.cs" />
+    <Compile Include="src\main\csharp\Commands\ShutdownInfo.cs" />
   </ItemGroup>
   <ItemGroup>
     <None Include="keyfile\NMSKey.snk" />