You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by jg...@apache.org on 2008/10/24 23:10:23 UTC
svn commit: r707747 [1/4] - in
/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk: ./ src/main/csharp/
src/main/csharp/Commands/ src/main/csharp/State/ src/main/csharp/Threads/
src/main/csharp/Transport/ src/main/csharp/Transport/Failover/ src/main/cs...
Author: jgomes
Date: Fri Oct 24 14:10:22 2008
New Revision: 707747
URL: http://svn.apache.org/viewvc?rev=707747&view=rev
Log:
Initial implementation of failover contributed by Allan Schrum. Thanks, Allan!
Fixes [AMQNET-26]. (See https://issues.apache.org/activemq/browse/AMQNET-26)
Added:
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/ProducerAck.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/IOException.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/State/
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/State/CommandVisitorAdapter.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/State/ConnectionState.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/State/ConnectionStateTracker.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/State/ConsumerState.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/State/ICommandVisitor.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/State/ProducerState.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/State/SessionState.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/State/SynchronizedObjects.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/State/ThreadSimulator.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/State/Tracked.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/State/TransactionState.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Threads/
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Threads/DefaultThreadPools.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Threads/PooledTaskRunner.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Threads/Task.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Threads/TaskRunner.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Threads/TaskRunnerFactory.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Failover/
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Failover/BackupTransport.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Failover/FailoverTransport.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Failover/FailoverTransportFactory.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/ICompositeTransport.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/TransportFactory.cs
Modified:
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/ActiveMQDestination.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/ActiveMQMessage.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/ActiveMQQueue.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/ActiveMQTempDestination.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/ActiveMQTempQueue.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/ActiveMQTempTopic.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/ActiveMQTopic.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/BaseCommand.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/BaseDataStructure.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/BrokerId.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/BrokerInfo.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/Command.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/ConnectionControl.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/ConnectionError.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/ConnectionId.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/ConnectionInfo.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/ConsumerControl.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/ConsumerId.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/ConsumerInfo.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/ControlCommand.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/DataStructure.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/DataStructureSupport.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/DestinationInfo.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/FlushCommand.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/KeepAliveInfo.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/LastPartialCommand.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/Message.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/MessageAck.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/MessageDispatch.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/MessageDispatchNotification.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/MessagePull.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/PartialCommand.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/ProducerId.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/ProducerInfo.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/RemoveInfo.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/RemoveSubscriptionInfo.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/ReplayCommand.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/Response.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/SessionId.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/SessionInfo.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/ShutdownInfo.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/TransactionInfo.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/WireFormatInfo.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Connection.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/ConnectionFactory.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Session.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/ITransport.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/ITransportFactory.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Tcp/TcpTransport.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Tcp/TcpTransportFactory.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/TransportFilter.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/vs2008-activemq.csproj
Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/ActiveMQDestination.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/ActiveMQDestination.cs?rev=707747&r1=707746&r2=707747&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/ActiveMQDestination.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/ActiveMQDestination.cs Fri Oct 24 14:10:22 2008
@@ -14,94 +14,85 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-using Apache.NMS;
+
using System;
using System.Collections.Specialized;
+using Apache.NMS.Util;
namespace Apache.NMS.ActiveMQ.Commands
{
-
- /// <summary>
- /// Summary description for ActiveMQDestination.
- /// </summary>
- public abstract class ActiveMQDestination : BaseDataStructure, IDestination
- {
-
- /**
- * Topic Destination object
- */
- public const int ACTIVEMQ_TOPIC = 1;
- /**
- * Temporary Topic Destination object
- */
- public const int ACTIVEMQ_TEMPORARY_TOPIC = 2;
-
- /**
- * Queue Destination object
- */
- public const int ACTIVEMQ_QUEUE = 3;
- /**
- * Temporary Queue Destination object
- */
- public const int ACTIVEMQ_TEMPORARY_QUEUE = 4;
-
- /**
- * prefix for Advisory message destinations
- */
- public const String ADVISORY_PREFIX = "ActiveMQ.Advisory.";
-
- /**
- * prefix for consumer advisory destinations
- */
- public const String CONSUMER_ADVISORY_PREFIX = ADVISORY_PREFIX + "Consumers.";
-
- /**
- * prefix for producer advisory destinations
- */
- public const String PRODUCER_ADVISORY_PREFIX = ADVISORY_PREFIX + "Producers.";
-
- /**
- * prefix for connection advisory destinations
- */
- public const String CONNECTION_ADVISORY_PREFIX = ADVISORY_PREFIX + "Connections.";
-
- /**
- * The default target for ordered destinations
- */
- 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 = "";
+ /// <summary>
+ /// Summary description for ActiveMQDestination.
+ /// </summary>
+ public abstract class ActiveMQDestination : BaseDataStructure, IDestination
+ {
+ /// <summary>
+ /// Topic Destination object
+ /// </summary>
+ public const int ACTIVEMQ_TOPIC = 1;
+ /// <summary>
+ /// Temporary Topic Destination object
+ /// </summary>
+ public const int ACTIVEMQ_TEMPORARY_TOPIC = 2;
+ /// <summary>
+ /// Queue Destination object
+ /// </summary>
+ public const int ACTIVEMQ_QUEUE = 3;
+ /// <summary>
+ /// Temporary Queue Destination object
+ /// </summary>
+ public const int ACTIVEMQ_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;
-
-
- /**
- * The Default Constructor
- */
- protected ActiveMQDestination()
- {
- }
-
- /**
- * Construct the Destination with a defined physical name;
- *
- * @param name
- */
- protected ActiveMQDestination(String name)
- {
- setPhysicalName(name);
- //this.advisory = name != null && name.StartsWith(ADVISORY_PREFIX);
- }
+ // Cached transient data
+ private bool exclusive;
+ private bool ordered;
+ private bool advisory;
+ private String orderedTarget = DEFAULT_ORDERED_TARGET;
+
+ /// <summary>
+ /// The Default Constructor
+ /// </summary>
+ protected ActiveMQDestination()
+ {
+ }
+
+ /// <summary>
+ /// Construct the Destination with a defined physical name;
+ /// </summary>
+ /// <param name="name"></param>
+ protected ActiveMQDestination(String name)
+ {
+ setPhysicalName(name);
+ //this.advisory = name != null && name.StartsWith(ADVISORY_PREFIX);
+ }
public bool IsTopic
{
@@ -112,7 +103,7 @@
|| ACTIVEMQ_TEMPORARY_TOPIC == destinationType;
}
}
-
+
public bool IsQueue
{
get
@@ -122,7 +113,7 @@
|| ACTIVEMQ_TEMPORARY_QUEUE == destinationType;
}
}
-
+
public bool IsTemporary
{
get
@@ -148,422 +139,432 @@
this.physicalName = name;
int p = name.IndexOf('?');
- if (p >= 0)
+ if(p >= 0)
{
String optstring = physicalName.Substring(p + 1);
this.physicalName = name.Substring(0, p);
- options = Util.URISupport.ParseQuery(optstring);
+ 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(ActiveMQDestination destination)
+ {
+ if(destination is ITopic)
+ {
+ return "Topic(" + destination.ToString() + ")";
+ }
+ else
+ {
+ return "Queue(" + destination.ToString() + ")";
+ }
+ }
+
+ /// <summary>
+ /// </summary>
+ /// <param name="destination"></param>
+ /// <returns></returns>
+ public static ActiveMQDestination Transform(IDestination destination)
+ {
+ ActiveMQDestination result = null;
+ if(destination != null)
+ {
+ if(destination is ActiveMQDestination)
+ {
+ result = (ActiveMQDestination) 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;
}
-
- /**
- * @return Returns the advisory.
- */
- public bool IsAdvisory()
- {
- return advisory;
- }
- /**
- * @param advisory The advisory to set.
- */
- public void SetAdvisory(bool advisory)
- {
- this.advisory = advisory;
- }
-
- /**
- * @return true if this is a destination for Consumer advisories
- */
- public bool IsConsumerAdvisory()
- {
- return IsAdvisory() && physicalName.StartsWith(CONSUMER_ADVISORY_PREFIX);
- }
-
- /**
- * @return true if this is a destination for Producer advisories
- */
- public bool IsProducerAdvisory()
- {
- return IsAdvisory() && physicalName.StartsWith(PRODUCER_ADVISORY_PREFIX);
- }
-
- /**
- * @return true if this is a destination for Connection advisories
- */
- public bool IsConnectionAdvisory()
- {
- return IsAdvisory() && physicalName.StartsWith(CONNECTION_ADVISORY_PREFIX);
- }
-
- /**
- * @return Returns the exclusive.
- */
- public bool IsExclusive()
- {
- return exclusive;
- }
- /**
- * @param exclusive The exclusive to set.
- */
- public void SetExclusive(bool exclusive)
- {
- this.exclusive = exclusive;
- }
- /**
- * @return Returns the ordered.
- */
- public bool IsOrdered()
- {
- return ordered;
- }
- /**
- * @param ordered The ordered to set.
- */
- public void SetOrdered(bool ordered)
- {
- this.ordered = ordered;
- }
- /**
- * @return Returns the orderedTarget.
- */
- public String GetOrderedTarget()
- {
- return orderedTarget;
- }
- /**
- * @param orderedTarget The orderedTarget to set.
- */
- public void SetOrderedTarget(String orderedTarget)
- {
- this.orderedTarget = orderedTarget;
- }
- /**
- * A helper method to return a descriptive string for the topic or queue
- * @param destination
- *
- * @return a descriptive string for this queue or topic
- */
- public static String Inspect(ActiveMQDestination destination)
- {
- if (destination is ITopic)
- {
- return "Topic(" + destination.ToString() + ")";
- }
- else
- {
- return "Queue(" + destination.ToString() + ")";
- }
- }
-
- /**
- * @param destination
- */
- public static ActiveMQDestination Transform(IDestination destination)
- {
- ActiveMQDestination result = null;
- if (destination != null)
- {
- if (destination is ActiveMQDestination)
- {
- result = (ActiveMQDestination) 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;
- }
-
- /**
- * Create a Destination
- * @param type
- * @param pyhsicalName
- * @return
- */
- public static ActiveMQDestination CreateDestination(int type, String pyhsicalName)
- {
- ActiveMQDestination result = null;
- if (pyhsicalName == null)
+
+ /// <summary>
+ /// Create a Destination
+ /// </summary>
+ /// <param name="type"></param>
+ /// <param name="pyhsicalName"></param>
+ /// <returns></returns>
+ public static ActiveMQDestination CreateDestination(int type, String pyhsicalName)
+ {
+ ActiveMQDestination result = null;
+ if(pyhsicalName == null)
{
return null;
}
- else if (type == ACTIVEMQ_TOPIC)
- {
- result = new ActiveMQTopic(pyhsicalName);
- }
- else if (type == ACTIVEMQ_TEMPORARY_TOPIC)
- {
- result = new ActiveMQTempTopic(pyhsicalName);
- }
- else if (type == ACTIVEMQ_QUEUE)
- {
- result = new ActiveMQQueue(pyhsicalName);
- }
- else
- {
- result = new ActiveMQTempQueue(pyhsicalName);
- }
- return result;
- }
-
- /**
- * Create a temporary name from the clientId
- *
- * @param clientId
- * @return
- */
- public static String CreateTemporaryName(String clientId)
- {
- return TEMP_PREFIX + clientId + TEMP_POSTFIX;
- }
-
- /**
- * From a temporary destination find the clientId of the Connection that created it
- *
- * @param destination
- * @return the clientId or null if not a temporary destination
- */
- public static String GetClientId(ActiveMQDestination 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;
- }
-
-
- /**
- * @param o object to compare
- * @return 1 if this is less than o else 0 if they are equal or -1 if this is less than o
- */
- public int CompareTo(Object o)
- {
- if (o is ActiveMQDestination)
- {
- return CompareTo((ActiveMQDestination) o);
- }
- return -1;
- }
-
- /**
- * Lets sort by name first then lets sort topics greater than queues
- *
- * @param that another destination to compare against
- * @return 1 if this is less than o else 0 if they are equal or -1 if this is less than o
- */
- public int CompareTo(ActiveMQDestination 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;
- }
-
-
- /**
- * @return Returns the Destination type
- */
-
- public abstract int GetDestinationType();
-
-
- public String PhysicalName
- {
- get { return this.physicalName; }
- set { this.physicalName = value;
- this.advisory = value != null && value.StartsWith(ADVISORY_PREFIX);
- }
- }
-
- /**
- * 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.
- *
- * @return true if this destination represents a collection of child destinations.
- */
- public bool IsComposite
- {
+ else if(type == ACTIVEMQ_TOPIC)
+ {
+ result = new ActiveMQTopic(pyhsicalName);
+ }
+ else if(type == ACTIVEMQ_TEMPORARY_TOPIC)
+ {
+ result = new ActiveMQTempTopic(pyhsicalName);
+ }
+ else if(type == ACTIVEMQ_QUEUE)
+ {
+ result = new ActiveMQQueue(pyhsicalName);
+ }
+ else
+ {
+ result = new ActiveMQTempQueue(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(ActiveMQDestination 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 ActiveMQDestination)
+ {
+ return CompareTo((ActiveMQDestination) 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(ActiveMQDestination 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;
+ return physicalName.IndexOf(COMPOSITE_SEPARATOR) > 0;
+ }
+ }
+
+ /// <summary>
+ /// </summary>
+ /// <returns>a list of child destinations if this destination represents a composite destination.</returns>
+
+ /*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 ActiveMQDestination)
+ {
+ ActiveMQDestination other = (ActiveMQDestination) 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;
}
- }
-
- /*
- * Returns a list of child destinations if this destination represents a composite
- * destination.
- *
- * @return
- */
- /*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;
- }*/
-
- /**
- * @return string representation of this instance
- */
-
- 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;
- }
- }
-
- /**
- * @return hashCode for this instance
- */
- public override int GetHashCode()
- {
- int answer = 37;
-
- if (this.physicalName != null)
- {
- answer = physicalName.GetHashCode();
- }
- if (IsTopic)
- {
- answer ^= 0xfabfab;
- }
- return answer;
- }
-
- /**
- * if the object passed in is equivalent, return true
- *
- * @param obj the object to compare
- * @return true if this instance and obj are equivalent
- */
- public override bool Equals(Object obj)
- {
- bool result = this == obj;
- if (!result && obj != null && obj is ActiveMQDestination)
- {
- ActiveMQDestination other = (ActiveMQDestination) obj;
- result = this.GetDestinationType() == other.GetDestinationType()
- && this.physicalName.Equals(other.physicalName);
- }
- return result;
- }
-
-
- /**
- * @return true if the destination matches multiple possible destinations
- */
- public bool IsWildcard()
- {
- if (physicalName != null)
- {
- return physicalName.IndexOf(DestinationFilter.ANY_CHILD) >= 0
- || physicalName.IndexOf(DestinationFilter.ANY_DESCENDENT) >= 0;
- }
- return false;
- }
-
-
- /**
- * Factory method to create a child destination if this destination is a composite
- * @param name
- * @return the created Destination
- */
- public abstract ActiveMQDestination CreateDestination(String name);
+ 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 ActiveMQDestination 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.
+ ActiveMQDestination o = (ActiveMQDestination) base.Clone();
+
+ // Now do the deep work required
+ // If any new variables are added then this routine will
+ // likely need updating
+
+ return o;
+ }
+ }
}
Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/ActiveMQMessage.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/ActiveMQMessage.cs?rev=707747&r1=707746&r2=707747&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/ActiveMQMessage.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/ActiveMQMessage.cs Fri Oct 24 14:10:22 2008
@@ -14,18 +14,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+using System;
+
using Apache.NMS.ActiveMQ.OpenWire;
-using Apache.NMS;
+using Apache.NMS.ActiveMQ.State;
using Apache.NMS.Util;
-using System;
namespace Apache.NMS.ActiveMQ.Commands
{
public delegate void AcknowledgeHandler(ActiveMQMessage message);
-}
-namespace Apache.NMS.ActiveMQ.Commands
-{
public class ActiveMQMessage : Message, IMessage, MarshallAware
{
public const byte ID_ActiveMQMessage = 23;
@@ -259,11 +257,16 @@
public override void BeforeMarshall(OpenWireFormat wireFormat)
{
MarshalledProperties = null;
- if (properties != null)
+ if(properties != null)
{
MarshalledProperties = properties.Marshal();
}
}
+
+ public override Response visit(ICommandVisitor visitor)
+ {
+ return visitor.processMessage(this);
+ }
}
}
Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/ActiveMQQueue.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/ActiveMQQueue.cs?rev=707747&r1=707746&r2=707747&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/ActiveMQQueue.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/ActiveMQQueue.cs Fri Oct 24 14:10:22 2008
@@ -14,52 +14,69 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-using Apache.NMS;
using System;
namespace Apache.NMS.ActiveMQ.Commands
{
-
+
/// <summary>
/// Summary description for ActiveMQQueue.
/// </summary>
public class ActiveMQQueue : ActiveMQDestination, IQueue
- {
- public const byte ID_ActiveMQQueue = 100;
-
- public ActiveMQQueue() : base()
- {
- }
- public ActiveMQQueue(String name) : base(name)
- {
- }
-
+ {
+ public const byte ID_ActiveMQQueue = 100;
+
+ public ActiveMQQueue()
+ : base()
+ {
+ }
+ public ActiveMQQueue(String name)
+ : base(name)
+ {
+ }
+
override public DestinationType DestinationType
{
- get {
+ get
+ {
return DestinationType.Queue;
}
}
-
- public String QueueName
- {
- get { return PhysicalName; }
- }
-
- public override byte GetDataStructureType()
- {
- return ID_ActiveMQQueue;
- }
-
- public override int GetDestinationType()
- {
- return ACTIVEMQ_QUEUE;
- }
-
- public override ActiveMQDestination CreateDestination(String name)
- {
- return new ActiveMQQueue(name);
- }
- }
+
+ public String QueueName
+ {
+ get { return PhysicalName; }
+ }
+
+ public override byte GetDataStructureType()
+ {
+ return ID_ActiveMQQueue;
+ }
+
+ public override int GetDestinationType()
+ {
+ return ACTIVEMQ_QUEUE;
+ }
+
+ public override ActiveMQDestination CreateDestination(String name)
+ {
+ return new ActiveMQQueue(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.
+ ActiveMQQueue o = (ActiveMQQueue) base.Clone();
+
+ // Now do the deep work required
+ // If any new variables are added then this routine will
+ // likely need updating
+
+ return o;
+ }
+ }
}
Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/ActiveMQTempDestination.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/ActiveMQTempDestination.cs?rev=707747&r1=707746&r2=707747&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/ActiveMQTempDestination.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/ActiveMQTempDestination.cs Fri Oct 24 14:10:22 2008
@@ -15,9 +15,7 @@
* limitations under the License.
*/
-using Apache.NMS.ActiveMQ.Commands;
using System;
-using Apache.NMS;
//
@@ -31,8 +29,8 @@
namespace Apache.NMS.ActiveMQ.Commands
{
public abstract class ActiveMQTempDestination : ActiveMQDestination
- {
-
+ {
+
/// <summary>
/// Method GetDestinationType
/// </summary>
@@ -42,7 +40,7 @@
// TODO: Implement this method
return 0;
}
-
+
/// <summary>
/// Method CreateDestination
/// </summary>
@@ -53,26 +51,44 @@
// TODO: Implement this method
return null;
}
-
+
abstract override public DestinationType DestinationType
{
get;
}
-
- public const byte ID_ActiveMQTempDestination = 0;
-
- public ActiveMQTempDestination() : base()
- {
- }
-
- public ActiveMQTempDestination(String name) : base(name)
- {
- }
-
- public override byte GetDataStructureType()
- {
- return ID_ActiveMQTempDestination;
- }
- }
+
+ public const byte ID_ActiveMQTempDestination = 0;
+
+ public ActiveMQTempDestination()
+ : base()
+ {
+ }
+
+ public ActiveMQTempDestination(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.
+ ActiveMQTempDestination o = (ActiveMQTempDestination) base.Clone();
+
+ // Now do the deep work required
+ // If any new variables are added then this routine will
+ // likely need updating
+
+ return o;
+ }
+
+ }
}
Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/ActiveMQTempQueue.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/ActiveMQTempQueue.cs?rev=707747&r1=707746&r2=707747&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/ActiveMQTempQueue.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/ActiveMQTempQueue.cs Fri Oct 24 14:10:22 2008
@@ -14,53 +14,71 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-using Apache.NMS;
using System;
namespace Apache.NMS.ActiveMQ.Commands
{
-
+
/// <summary>
/// A Temporary Queue
/// </summary>
public class ActiveMQTempQueue : ActiveMQTempDestination, ITemporaryQueue
- {
- public const byte ID_ActiveMQTempQueue = 102;
-
- public ActiveMQTempQueue() : base()
- {
- }
-
- public ActiveMQTempQueue(String name) : base(name)
- {
- }
-
+ {
+ public const byte ID_ActiveMQTempQueue = 102;
+
+ public ActiveMQTempQueue()
+ : base()
+ {
+ }
+
+ public ActiveMQTempQueue(String name)
+ : base(name)
+ {
+ }
+
override public DestinationType DestinationType
{
- get {
+ get
+ {
return DestinationType.TemporaryQueue;
}
}
-
- public String GetQueueName()
- {
- return PhysicalName;
- }
-
- public override byte GetDataStructureType()
- {
- return ID_ActiveMQTempQueue;
- }
-
- public override int GetDestinationType()
- {
- return ACTIVEMQ_QUEUE;
- }
-
- public override ActiveMQDestination CreateDestination(String name)
- {
- return new ActiveMQTempQueue(name);
- }
- }
+
+ public String GetQueueName()
+ {
+ return PhysicalName;
+ }
+
+ public override byte GetDataStructureType()
+ {
+ return ID_ActiveMQTempQueue;
+ }
+
+ public override int GetDestinationType()
+ {
+ return ACTIVEMQ_QUEUE;
+ }
+
+ public override ActiveMQDestination CreateDestination(String name)
+ {
+ return new ActiveMQTempQueue(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.
+ ActiveMQTempQueue o = (ActiveMQTempQueue) base.Clone();
+
+ // Now do the deep work required
+ // If any new variables are added then this routine will
+ // likely need updating
+
+ return o;
+ }
+
+ }
}
Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/ActiveMQTempTopic.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/ActiveMQTempTopic.cs?rev=707747&r1=707746&r2=707747&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/ActiveMQTempTopic.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/ActiveMQTempTopic.cs Fri Oct 24 14:10:22 2008
@@ -14,54 +14,72 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-using Apache.NMS;
using System;
namespace Apache.NMS.ActiveMQ.Commands
{
-
+
/// <summary>
/// A Temporary Topic
/// </summary>
public class ActiveMQTempTopic : ActiveMQTempDestination, ITemporaryTopic
- {
- public const byte ID_ActiveMQTempTopic = 103;
-
- public ActiveMQTempTopic() : base()
- {
- }
-
- public ActiveMQTempTopic(String name) : base(name)
- {
- }
-
+ {
+ public const byte ID_ActiveMQTempTopic = 103;
+
+ public ActiveMQTempTopic()
+ : base()
+ {
+ }
+
+ public ActiveMQTempTopic(String name)
+ : base(name)
+ {
+ }
+
override public DestinationType DestinationType
{
- get {
+ get
+ {
return DestinationType.TemporaryTopic;
}
}
-
-
- public String GetTopicName()
- {
- return PhysicalName;
- }
-
- public override byte GetDataStructureType()
- {
- return ID_ActiveMQTempTopic;
- }
-
- public override int GetDestinationType()
- {
- return ACTIVEMQ_TOPIC;
- }
-
- public override ActiveMQDestination CreateDestination(String name)
- {
- return new ActiveMQTempTopic(name);
- }
- }
+
+
+ public String GetTopicName()
+ {
+ return PhysicalName;
+ }
+
+ public override byte GetDataStructureType()
+ {
+ return ID_ActiveMQTempTopic;
+ }
+
+ public override int GetDestinationType()
+ {
+ return ACTIVEMQ_TOPIC;
+ }
+
+ public override ActiveMQDestination CreateDestination(String name)
+ {
+ return new ActiveMQTempTopic(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.
+ ActiveMQTempTopic o = (ActiveMQTempTopic) base.Clone();
+
+ // Now do the deep work required
+ // If any new variables are added then this routine will
+ // likely need updating
+
+ return o;
+ }
+
+ }
}
Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/ActiveMQTopic.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/ActiveMQTopic.cs?rev=707747&r1=707746&r2=707747&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/ActiveMQTopic.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/ActiveMQTopic.cs Fri Oct 24 14:10:22 2008
@@ -14,53 +14,70 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-using Apache.NMS;
using System;
namespace Apache.NMS.ActiveMQ.Commands
{
-
+
/// <summary>
/// Summary description for ActiveMQTopic.
/// </summary>
public class ActiveMQTopic : ActiveMQDestination, ITopic
- {
- public const byte ID_ActiveMQTopic = 101;
-
- public ActiveMQTopic() : base()
- {
- }
- public ActiveMQTopic(String name) : base(name)
- {
- }
-
+ {
+ public const byte ID_ActiveMQTopic = 101;
+
+ public ActiveMQTopic()
+ : base()
+ {
+ }
+ public ActiveMQTopic(String name)
+ : base(name)
+ {
+ }
+
override public DestinationType DestinationType
{
- get {
+ 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 ActiveMQDestination CreateDestination(String name)
- {
- return new ActiveMQTopic(name);
- }
- }
+
+
+ public String TopicName
+ {
+ get { return PhysicalName; }
+ }
+
+ public override byte GetDataStructureType()
+ {
+ return ID_ActiveMQTopic;
+ }
+
+ public override int GetDestinationType()
+ {
+ return ACTIVEMQ_TOPIC;
+ }
+
+ public override ActiveMQDestination CreateDestination(String name)
+ {
+ return new ActiveMQTopic(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.
+ ActiveMQTopic o = (ActiveMQTopic) base.Clone();
+
+ // Now do the deep work required
+ // If any new variables are added then this routine will
+ // likely need updating
+
+ return o;
+ }
+ }
}
Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/BaseCommand.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/BaseCommand.cs?rev=707747&r1=707746&r2=707747&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/BaseCommand.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/BaseCommand.cs Fri Oct 24 14:10:22 2008
@@ -24,115 +24,174 @@
// activemq-openwire module
//
-using Apache.NMS.ActiveMQ.OpenWire;
using System;
-
+using Apache.NMS.ActiveMQ.State;
namespace Apache.NMS.ActiveMQ.Commands
{
- public abstract class BaseCommand : BaseDataStructure, Command
- {
- private int commandId;
-
- public int CommandId
- {
- get { return commandId; }
- set { this.commandId = value; }
- }
-
- public override int GetHashCode()
- {
- return (CommandId * 37) + GetDataStructureType();
- }
-
- public override bool Equals(Object that)
- {
- if (that is BaseCommand)
- {
- BaseCommand thatCommand = (BaseCommand) that;
- return this.GetDataStructureType() == thatCommand.GetDataStructureType()
- && this.CommandId == thatCommand.CommandId;
- }
- return false;
- }
-
- public override String ToString()
- {
- string answer = GetDataStructureTypeAsString(GetDataStructureType());
- if (answer.Length == 0)
- {
- answer = base.ToString();
- }
- return answer + ": id = " + CommandId;
- }
-
- public static String GetDataStructureTypeAsString(int type)
- {
- String packetTypeStr = "";
- switch (type)
- {
- case ActiveMQMessage.ID_ActiveMQMessage :
- packetTypeStr = "ACTIVEMQ_MESSAGE";
- break;
- case ActiveMQTextMessage.ID_ActiveMQTextMessage :
- packetTypeStr = "ACTIVEMQ_TEXT_MESSAGE";
- break;
- case ActiveMQObjectMessage.ID_ActiveMQObjectMessage:
- packetTypeStr = "ACTIVEMQ_OBJECT_MESSAGE";
- break;
- case ActiveMQBytesMessage.ID_ActiveMQBytesMessage :
- packetTypeStr = "ACTIVEMQ_BYTES_MESSAGE";
- break;
- case ActiveMQStreamMessage.ID_ActiveMQStreamMessage :
- packetTypeStr = "ACTIVEMQ_STREAM_MESSAGE";
- break;
- case ActiveMQMapMessage.ID_ActiveMQMapMessage :
- packetTypeStr = "ACTIVEMQ_MAP_MESSAGE";
- break;
- case MessageAck.ID_MessageAck :
- packetTypeStr = "ACTIVEMQ_MSG_ACK";
- break;
- case Response.ID_Response :
- packetTypeStr = "RESPONSE";
- break;
- case ConsumerInfo.ID_ConsumerInfo :
- packetTypeStr = "CONSUMER_INFO";
- break;
- case ProducerInfo.ID_ProducerInfo :
- packetTypeStr = "PRODUCER_INFO";
- break;
- case TransactionInfo.ID_TransactionInfo :
- packetTypeStr = "TRANSACTION_INFO";
- break;
- case BrokerInfo.ID_BrokerInfo :
- packetTypeStr = "BROKER_INFO";
- break;
- case ConnectionInfo.ID_ConnectionInfo :
- packetTypeStr = "CONNECTION_INFO";
- break;
- case SessionInfo.ID_SessionInfo :
- packetTypeStr = "SESSION_INFO";
- break;
- case RemoveSubscriptionInfo.ID_RemoveSubscriptionInfo :
- packetTypeStr = "DURABLE_UNSUBSCRIBE";
- break;
- case IntegerResponse.ID_IntegerResponse :
- packetTypeStr = "INT_RESPONSE_RECEIPT_INFO";
- break;
- case WireFormatInfo.ID_WireFormatInfo :
- packetTypeStr = "WIRE_FORMAT_INFO";
- break;
- case RemoveInfo.ID_RemoveInfo :
- packetTypeStr = "REMOVE_INFO";
- break;
- case KeepAliveInfo.ID_KeepAliveInfo :
- packetTypeStr = "KEEP_ALIVE";
- break;
- }
- return packetTypeStr;
- }
-
- }
+ public abstract class BaseCommand : BaseDataStructure, Command, ICloneable
+ {
+ private int commandId;
+ private bool responseRequired;
+
+ public int CommandId
+ {
+ get { return commandId; }
+ set { this.commandId = value; }
+ }
+
+ public override int GetHashCode()
+ {
+ return (CommandId * 37) + GetDataStructureType();
+ }
+
+ public override bool Equals(Object that)
+ {
+ if(that is BaseCommand)
+ {
+ BaseCommand thatCommand = (BaseCommand) that;
+ return this.GetDataStructureType() == thatCommand.GetDataStructureType()
+ && this.CommandId == thatCommand.CommandId;
+ }
+ return false;
+ }
+
+ public override String ToString()
+ {
+ string answer = GetDataStructureTypeAsString(GetDataStructureType());
+ if(answer.Length == 0)
+ {
+ answer = base.ToString();
+ }
+ return answer + ": id = " + CommandId;
+ }
+
+ public static String GetDataStructureTypeAsString(int type)
+ {
+ String packetTypeStr = "";
+ switch(type)
+ {
+ case ActiveMQMessage.ID_ActiveMQMessage:
+ packetTypeStr = "ACTIVEMQ_MESSAGE";
+ break;
+ case ActiveMQTextMessage.ID_ActiveMQTextMessage:
+ packetTypeStr = "ACTIVEMQ_TEXT_MESSAGE";
+ break;
+ case ActiveMQObjectMessage.ID_ActiveMQObjectMessage:
+ packetTypeStr = "ACTIVEMQ_OBJECT_MESSAGE";
+ break;
+ case ActiveMQBytesMessage.ID_ActiveMQBytesMessage:
+ packetTypeStr = "ACTIVEMQ_BYTES_MESSAGE";
+ break;
+ case ActiveMQStreamMessage.ID_ActiveMQStreamMessage:
+ packetTypeStr = "ACTIVEMQ_STREAM_MESSAGE";
+ break;
+ case ActiveMQMapMessage.ID_ActiveMQMapMessage:
+ packetTypeStr = "ACTIVEMQ_MAP_MESSAGE";
+ break;
+ case MessageAck.ID_MessageAck:
+ packetTypeStr = "ACTIVEMQ_MSG_ACK";
+ break;
+ case Response.ID_Response:
+ packetTypeStr = "RESPONSE";
+ break;
+ case ConsumerInfo.ID_ConsumerInfo:
+ packetTypeStr = "CONSUMER_INFO";
+ break;
+ case ProducerInfo.ID_ProducerInfo:
+ packetTypeStr = "PRODUCER_INFO";
+ break;
+ case TransactionInfo.ID_TransactionInfo:
+ packetTypeStr = "TRANSACTION_INFO";
+ break;
+ case BrokerInfo.ID_BrokerInfo:
+ packetTypeStr = "BROKER_INFO";
+ break;
+ case ConnectionInfo.ID_ConnectionInfo:
+ packetTypeStr = "CONNECTION_INFO";
+ break;
+ case SessionInfo.ID_SessionInfo:
+ packetTypeStr = "SESSION_INFO";
+ break;
+ case RemoveSubscriptionInfo.ID_RemoveSubscriptionInfo:
+ packetTypeStr = "DURABLE_UNSUBSCRIBE";
+ break;
+ case IntegerResponse.ID_IntegerResponse:
+ packetTypeStr = "INT_RESPONSE_RECEIPT_INFO";
+ break;
+ case WireFormatInfo.ID_WireFormatInfo:
+ packetTypeStr = "WIRE_FORMAT_INFO";
+ break;
+ case RemoveInfo.ID_RemoveInfo:
+ packetTypeStr = "REMOVE_INFO";
+ break;
+ case KeepAliveInfo.ID_KeepAliveInfo:
+ packetTypeStr = "KEEP_ALIVE";
+ break;
+ }
+ return packetTypeStr;
+ }
+
+ public virtual Response visit(ICommandVisitor visitor)
+ {
+ throw new ApplicationException("BaseCommand.Visit() not implemented");
+ }
+
+ public virtual bool IsMessage
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public virtual bool IsShutdownInfo
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public virtual bool IsBrokerInfo
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public virtual bool IsResponse
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public virtual bool ResponseRequired
+ {
+ get
+ {
+ return responseRequired;
+ }
+ set
+ {
+ responseRequired = value;
+ }
+ }
+
+ 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.
+ BaseCommand o = (BaseCommand) base.Clone();
+
+ return o;
+ }
+ }
}
Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/BaseDataStructure.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/BaseDataStructure.cs?rev=707747&r1=707746&r2=707747&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/BaseDataStructure.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/BaseDataStructure.cs Fri Oct 24 14:10:22 2008
@@ -14,77 +14,72 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-using Apache.NMS.ActiveMQ.Commands;
using System;
using Apache.NMS.ActiveMQ.OpenWire;
namespace Apache.NMS.ActiveMQ.Commands
{
-
- /// <summary>
- /// Base class for all DataStructure implementations
- /// </summary>
- public abstract class BaseDataStructure : DataStructure
- {
- private bool responseRequired;
-
- public virtual byte GetDataStructureType()
- {
- return 0;
- }
-
- public bool ResponseRequired
- {
- get { return responseRequired; }
- set { this.responseRequired = value; }
- }
-
- public virtual bool IsResponse {
- get { return false; }
- }
-
- public virtual bool IsMarshallAware()
- {
- return false;
- }
-
-
- public virtual void BeforeMarshall(OpenWireFormat wireFormat)
- {
- }
-
- public virtual void AfterMarshall(OpenWireFormat wireFormat)
- {
- }
-
- public virtual void BeforeUnmarshall(OpenWireFormat wireFormat)
- {
- }
-
- public virtual void AfterUnmarshall(OpenWireFormat wireFormat)
- {
- }
-
- public virtual void SetMarshalledForm(OpenWireFormat wireFormat, byte[] data)
- {
- }
-
- public virtual byte[] GetMarshalledForm(OpenWireFormat wireFormat)
- {
- return null;
- }
-
- // Helper methods
- public int HashCode(object value)
- {
- if (value != null)
- {
- return value.GetHashCode();
- }
- else
- {
- return -1;
- }
- }
- }
+
+ /// <summary>
+ /// Base class for all DataStructure implementations
+ /// </summary>
+ public abstract class BaseDataStructure : DataStructure, ICloneable
+ {
+ public virtual byte GetDataStructureType()
+ {
+ return 0;
+ }
+
+ public virtual bool IsMarshallAware()
+ {
+ return false;
+ }
+
+ public virtual void BeforeMarshall(OpenWireFormat wireFormat)
+ {
+ }
+
+ public virtual void AfterMarshall(OpenWireFormat wireFormat)
+ {
+ }
+
+ public virtual void BeforeUnmarshall(OpenWireFormat wireFormat)
+ {
+ }
+
+ public virtual void AfterUnmarshall(OpenWireFormat wireFormat)
+ {
+ }
+
+ public virtual void SetMarshalledForm(OpenWireFormat wireFormat, byte[] data)
+ {
+ }
+
+ public virtual byte[] GetMarshalledForm(OpenWireFormat wireFormat)
+ {
+ return null;
+ }
+
+ // Helper methods
+ public int HashCode(object value)
+ {
+ if(value != null)
+ {
+ return value.GetHashCode();
+ }
+ else
+ {
+ return -1;
+ }
+ }
+
+ public virtual Object Clone()
+ {
+ // Since we are the lowest level base class, do a
+ // shallow copy which will include the derived classes.
+ // From here we would do deep cloning of other objects
+ // if we had any.
+ return this.MemberwiseClone();
+ }
+ }
}
Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/BrokerId.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/BrokerId.cs?rev=707747&r1=707746&r2=707747&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/BrokerId.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/BrokerId.cs Fri Oct 24 14:10:22 2008
@@ -21,61 +21,79 @@
//
using System;
-using System.Collections;
-using Apache.NMS.ActiveMQ.OpenWire;
-using Apache.NMS.ActiveMQ.Commands;
namespace Apache.NMS.ActiveMQ.Commands
{
- /// <summary>
- /// The ActiveMQ BrokerId Command
- /// </summary>
- public class BrokerId : BaseDataStructure, DataStructure
- {
- public const byte ID_BrokerId = 124;
-
- string value;
-
- public override int GetHashCode() {
- int answer = 0;
- answer = (answer * 37) + HashCode(Value);
- return answer;
+ /// <summary>
+ /// The ActiveMQ BrokerId Command
+ /// </summary>
+ public class BrokerId : BaseDataStructure, DataStructure
+ {
+ public const byte ID_BrokerId = 124;
+
+ string value;
+
+ public override int GetHashCode()
+ {
+ int answer = 0;
+ answer = (answer * 37) + HashCode(Value);
+ return answer;
}
- public override bool Equals(object that) {
- if (that is BrokerId) {
- return Equals((BrokerId) that);
+ public override bool Equals(object that)
+ {
+ if(that is BrokerId)
+ {
+ return Equals((BrokerId) that);
}
return false;
- }
+ }
- public virtual bool Equals(BrokerId that) {
- if (! Equals(this.Value, that.Value)) return false;
- return true;
+ public virtual bool Equals(BrokerId that)
+ {
+ if(!Equals(this.Value, that.Value))
+ return false;
+ return true;
}
- public override string ToString() {
- return GetType().Name + "["
- + " Value=" + Value
- + " ]";
+ public override string ToString()
+ {
+ return GetType().Name + "["
+ + " Value=" + Value
+ + " ]";
}
- public override byte GetDataStructureType() {
- return ID_BrokerId;
- }
+ public override byte GetDataStructureType()
+ {
+ return ID_BrokerId;
+ }
- // Properties
+ // Properties
- public string Value
- {
- get { return value; }
- set { this.value = value; }
- }
+ public string Value
+ {
+ get { return value; }
+ set { this.value = value; }
+ }
- }
+ 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.
+ BrokerId o = (BrokerId) base.Clone();
+
+ // Now do the deep work required
+ // If any new variables are added then this routine will
+ // likely need updating
+
+ return o;
+ }
+ }
}
Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/BrokerInfo.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/BrokerInfo.cs?rev=707747&r1=707746&r2=707747&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/BrokerInfo.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/BrokerInfo.cs Fri Oct 24 14:10:22 2008
@@ -20,114 +20,125 @@
// activemq-core module
//
-using System;
-using System.Collections;
-using Apache.NMS.ActiveMQ.OpenWire;
-using Apache.NMS.ActiveMQ.Commands;
+using Apache.NMS.ActiveMQ.State;
namespace Apache.NMS.ActiveMQ.Commands
{
- /// <summary>
- /// The ActiveMQ BrokerInfo Command
- /// </summary>
- public class BrokerInfo : BaseCommand
- {
- public const byte ID_BrokerInfo = 2;
-
- BrokerId brokerId;
- string brokerURL;
- BrokerInfo[] peerBrokerInfos;
- string brokerName;
- bool slaveBroker;
- bool masterBroker;
- bool faultTolerantConfiguration;
- bool duplexConnection;
- bool networkConnection;
- long connectionId;
-
- public override string ToString() {
- return GetType().Name + "["
- + " BrokerId=" + BrokerId
- + " BrokerURL=" + BrokerURL
- + " PeerBrokerInfos=" + PeerBrokerInfos
- + " BrokerName=" + BrokerName
- + " SlaveBroker=" + SlaveBroker
- + " MasterBroker=" + MasterBroker
- + " FaultTolerantConfiguration=" + FaultTolerantConfiguration
- + " DuplexConnection=" + DuplexConnection
- + " NetworkConnection=" + NetworkConnection
- + " ConnectionId=" + ConnectionId
- + " ]";
-
- }
-
- public override byte GetDataStructureType() {
- return ID_BrokerInfo;
- }
-
-
- // Properties
-
- public BrokerId BrokerId
- {
- get { return brokerId; }
- set { this.brokerId = value; }
- }
-
- public string BrokerURL
- {
- get { return brokerURL; }
- set { this.brokerURL = value; }
- }
-
- public BrokerInfo[] PeerBrokerInfos
- {
- get { return peerBrokerInfos; }
- set { this.peerBrokerInfos = value; }
- }
-
- public string BrokerName
- {
- get { return brokerName; }
- set { this.brokerName = value; }
- }
-
- public bool SlaveBroker
- {
- get { return slaveBroker; }
- set { this.slaveBroker = value; }
- }
-
- public bool MasterBroker
- {
- get { return masterBroker; }
- set { this.masterBroker = value; }
- }
-
- public bool FaultTolerantConfiguration
- {
- get { return faultTolerantConfiguration; }
- set { this.faultTolerantConfiguration = value; }
- }
-
- public bool DuplexConnection
- {
- get { return duplexConnection; }
- set { this.duplexConnection = value; }
- }
-
- public bool NetworkConnection
- {
- get { return networkConnection; }
- set { this.networkConnection = value; }
- }
-
- public long ConnectionId
- {
- get { return connectionId; }
- set { this.connectionId = value; }
- }
+ /// <summary>
+ /// The ActiveMQ BrokerInfo Command
+ /// </summary>
+ public class BrokerInfo : BaseCommand
+ {
+ public const byte ID_BrokerInfo = 2;
+
+ BrokerId brokerId;
+ string brokerURL;
+ BrokerInfo[] peerBrokerInfos;
+ string brokerName;
+ bool slaveBroker;
+ bool masterBroker;
+ bool faultTolerantConfiguration;
+ bool duplexConnection;
+ bool networkConnection;
+ long connectionId;
+
+ public override string ToString()
+ {
+ return GetType().Name + "["
+ + " BrokerId=" + BrokerId
+ + " BrokerURL=" + BrokerURL
+ + " PeerBrokerInfos=" + PeerBrokerInfos
+ + " BrokerName=" + BrokerName
+ + " SlaveBroker=" + SlaveBroker
+ + " MasterBroker=" + MasterBroker
+ + " FaultTolerantConfiguration=" + FaultTolerantConfiguration
+ + " DuplexConnection=" + DuplexConnection
+ + " NetworkConnection=" + NetworkConnection
+ + " ConnectionId=" + ConnectionId
+ + " ]";
- }
+ }
+
+ public override byte GetDataStructureType()
+ {
+ return ID_BrokerInfo;
+ }
+
+
+ // Properties
+
+ public BrokerId BrokerId
+ {
+ get { return brokerId; }
+ set { this.brokerId = value; }
+ }
+
+ public string BrokerURL
+ {
+ get { return brokerURL; }
+ set { this.brokerURL = value; }
+ }
+
+ public BrokerInfo[] PeerBrokerInfos
+ {
+ get { return peerBrokerInfos; }
+ set { this.peerBrokerInfos = value; }
+ }
+
+ public string BrokerName
+ {
+ get { return brokerName; }
+ set { this.brokerName = value; }
+ }
+
+ public bool SlaveBroker
+ {
+ get { return slaveBroker; }
+ set { this.slaveBroker = value; }
+ }
+
+ public bool MasterBroker
+ {
+ get { return masterBroker; }
+ set { this.masterBroker = value; }
+ }
+
+ public bool FaultTolerantConfiguration
+ {
+ get { return faultTolerantConfiguration; }
+ set { this.faultTolerantConfiguration = value; }
+ }
+
+ public bool DuplexConnection
+ {
+ get { return duplexConnection; }
+ set { this.duplexConnection = value; }
+ }
+
+ public bool NetworkConnection
+ {
+ get { return networkConnection; }
+ set { this.networkConnection = value; }
+ }
+
+ public long ConnectionId
+ {
+ get { return connectionId; }
+ set { this.connectionId = value; }
+ }
+
+ public override bool IsBrokerInfo
+ {
+ get
+ {
+ return true;
+ }
+ }
+
+ public override Response visit(ICommandVisitor visitor)
+ {
+ return visitor.processBrokerInfo(this);
+ }
+ }
}
Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/Command.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/Command.cs?rev=707747&r1=707746&r2=707747&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/Command.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/Command.cs Fri Oct 24 14:10:22 2008
@@ -14,32 +14,52 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-using Apache.NMS.ActiveMQ.Commands;
+
+using System;
+
+using Apache.NMS.ActiveMQ.State;
namespace Apache.NMS.ActiveMQ.Commands
{
-
- /// <summary>
- /// An OpenWire command
- /// </summary>
- public interface Command : DataStructure
- {
- int CommandId
- {
- get;
- set;
- }
-
- bool ResponseRequired
- {
- get;
- set;
- }
-
- bool IsResponse {
+
+ /// <summary>
+ /// An OpenWire command
+ /// </summary>
+ public interface Command : DataStructure, ICloneable
+ {
+ int CommandId
+ {
+ get;
+ set;
+ }
+
+ bool ResponseRequired
+ {
get;
+ set;
}
-
- }
+
+ bool IsResponse
+ {
+ get;
+ }
+
+ bool IsBrokerInfo
+ {
+ get;
+ }
+
+ bool IsMessage
+ {
+ get;
+ }
+
+ bool IsShutdownInfo
+ {
+ get;
+ }
+
+ Response visit(ICommandVisitor visitor);
+ }
}
Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/ConnectionControl.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/ConnectionControl.cs?rev=707747&r1=707746&r2=707747&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/ConnectionControl.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/ConnectionControl.cs Fri Oct 24 14:10:22 2008
@@ -20,74 +20,77 @@
// activemq-core module
//
-using System;
-using System.Collections;
-using Apache.NMS.ActiveMQ.OpenWire;
-using Apache.NMS.ActiveMQ.Commands;
+using Apache.NMS.ActiveMQ.State;
namespace Apache.NMS.ActiveMQ.Commands
{
- /// <summary>
- /// The ActiveMQ ConnectionControl Command
- /// </summary>
- public class ConnectionControl : BaseCommand
- {
- public const byte ID_ConnectionControl = 18;
-
- bool close;
- bool exit;
- bool faultTolerant;
- bool resume;
- bool suspend;
-
- public override string ToString() {
- return GetType().Name + "["
- + " Close=" + Close
- + " Exit=" + Exit
- + " FaultTolerant=" + FaultTolerant
- + " Resume=" + Resume
- + " Suspend=" + Suspend
- + " ]";
+ /// <summary>
+ /// The ActiveMQ ConnectionControl Command
+ /// </summary>
+ public class ConnectionControl : BaseCommand
+ {
+ public const byte ID_ConnectionControl = 18;
+
+ bool close;
+ bool exit;
+ bool faultTolerant;
+ bool resume;
+ bool suspend;
+
+ public override string ToString()
+ {
+ return GetType().Name + "["
+ + " Close=" + Close
+ + " Exit=" + Exit
+ + " FaultTolerant=" + FaultTolerant
+ + " Resume=" + Resume
+ + " Suspend=" + Suspend
+ + " ]";
}
- public override byte GetDataStructureType() {
- return ID_ConnectionControl;
- }
-
-
- // Properties
-
- public bool Close
- {
- get { return close; }
- set { this.close = value; }
- }
-
- public bool Exit
- {
- get { return exit; }
- set { this.exit = value; }
- }
-
- public bool FaultTolerant
- {
- get { return faultTolerant; }
- set { this.faultTolerant = value; }
- }
-
- public bool Resume
- {
- get { return resume; }
- set { this.resume = value; }
- }
-
- public bool Suspend
- {
- get { return suspend; }
- set { this.suspend = value; }
- }
+ public override byte GetDataStructureType()
+ {
+ return ID_ConnectionControl;
+ }
+
+
+ // Properties
+
+ public bool Close
+ {
+ get { return close; }
+ set { this.close = value; }
+ }
+
+ public bool Exit
+ {
+ get { return exit; }
+ set { this.exit = value; }
+ }
- }
+ public bool FaultTolerant
+ {
+ get { return faultTolerant; }
+ set { this.faultTolerant = value; }
+ }
+
+ public bool Resume
+ {
+ get { return resume; }
+ set { this.resume = value; }
+ }
+
+ public bool Suspend
+ {
+ get { return suspend; }
+ set { this.suspend = value; }
+ }
+
+ public override Response visit(ICommandVisitor visitor)
+ {
+ return visitor.processConnectionControl(this);
+ }
+ }
}
Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/ConnectionError.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/ConnectionError.cs?rev=707747&r1=707746&r2=707747&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/ConnectionError.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/ConnectionError.cs Fri Oct 24 14:10:22 2008
@@ -20,50 +20,53 @@
// activemq-core module
//
-using System;
-using System.Collections;
-using Apache.NMS.ActiveMQ.OpenWire;
-using Apache.NMS.ActiveMQ.Commands;
+using Apache.NMS.ActiveMQ.State;
namespace Apache.NMS.ActiveMQ.Commands
{
- /// <summary>
- /// The ActiveMQ ConnectionError Command
- /// </summary>
- public class ConnectionError : BaseCommand
- {
- public const byte ID_ConnectionError = 16;
-
- BrokerError exception;
- ConnectionId connectionId;
-
- public override string ToString() {
- return GetType().Name + "["
- + " Exception=" + Exception
- + " ConnectionId=" + ConnectionId
- + " ]";
+ /// <summary>
+ /// The ActiveMQ ConnectionError Command
+ /// </summary>
+ public class ConnectionError : BaseCommand
+ {
+ public const byte ID_ConnectionError = 16;
+
+ BrokerError exception;
+ ConnectionId connectionId;
+
+ public override string ToString()
+ {
+ return GetType().Name + "["
+ + " Exception=" + Exception
+ + " ConnectionId=" + ConnectionId
+ + " ]";
}
- public override byte GetDataStructureType() {
- return ID_ConnectionError;
- }
-
-
- // Properties
-
- public BrokerError Exception
- {
- get { return exception; }
- set { this.exception = value; }
- }
-
- public ConnectionId ConnectionId
- {
- get { return connectionId; }
- set { this.connectionId = value; }
- }
+ public override byte GetDataStructureType()
+ {
+ return ID_ConnectionError;
+ }
+
+
+ // Properties
+
+ public BrokerError Exception
+ {
+ get { return exception; }
+ set { this.exception = value; }
+ }
+
+ public ConnectionId ConnectionId
+ {
+ get { return connectionId; }
+ set { this.connectionId = value; }
+ }
- }
+ public override Response visit(ICommandVisitor visitor)
+ {
+ return visitor.processConnectionError(this);
+ }
+ }
}
Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/ConnectionId.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/ConnectionId.cs?rev=707747&r1=707746&r2=707747&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/ConnectionId.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/ConnectionId.cs Fri Oct 24 14:10:22 2008
@@ -20,62 +20,73 @@
// activemq-core module
//
-using System;
-using System.Collections;
-using Apache.NMS.ActiveMQ.OpenWire;
-using Apache.NMS.ActiveMQ.Commands;
namespace Apache.NMS.ActiveMQ.Commands
{
- /// <summary>
- /// The ActiveMQ ConnectionId Command
- /// </summary>
- public class ConnectionId : BaseDataStructure, DataStructure
- {
- public const byte ID_ConnectionId = 120;
-
- string value;
-
- public override int GetHashCode() {
- int answer = 0;
- answer = (answer * 37) + HashCode(Value);
- return answer;
+ /// <summary>
+ /// The ActiveMQ ConnectionId Command
+ /// </summary>
+ public class ConnectionId : BaseDataStructure, DataStructure
+ {
+ public const byte ID_ConnectionId = 120;
+
+ string 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);
+ 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;
+ public virtual bool Equals(ConnectionId that)
+ {
+ if(!Equals(this.Value, that.Value))
+ return false;
+ return true;
}
- public override string ToString() {
- return GetType().Name + "["
- + " Value=" + Value
- + " ]";
+ public override string ToString()
+ {
+ return GetType().Name + "["
+ + " Value=" + Value
+ + " ]";
+
+ }
+ public override byte GetDataStructureType()
+ {
+ return ID_ConnectionId;
}
- public override byte GetDataStructureType() {
- return ID_ConnectionId;
- }
+ // Properties
- // Properties
+ public string Value
+ {
+ get { return value; }
+ set { this.value = value; }
+ }
- public string Value
- {
- get { return value; }
- set { this.value = value; }
- }
+ public ConnectionId(SessionId id)
+ {
+ this.value = id.ConnectionId;
+ }
- }
+ public ConnectionId()
+ {
+ }
+ }
}