From 788bfbef25d634a8295d3b52d6b692dc76a5f738 Mon Sep 17 00:00:00 2001 From: James Strachan Date: Tue, 10 Jan 2006 10:56:34 +0000 Subject: [PATCH] latest generated OpenWire.Net code together with an early plugin for the transport git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@367566 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/OpenWire.Core/AbstractCommand.cs | 225 ++--- .../AbstractCommandMarshaller.cs | 192 ++-- .../src/OpenWire.Core/ActiveMQDestination.cs | 838 +++++++++--------- .../src/OpenWire.Core/ActiveMQQueue.cs | 51 +- .../src/OpenWire.Core/ActiveMQTempQueue.cs | 48 +- .../src/OpenWire.Core/ActiveMQTempTopic.cs | 46 +- .../src/OpenWire.Core/ActiveMQTopic.cs | 50 +- openwire-dotnet/src/OpenWire.Core/Command.cs | 15 +- .../src/OpenWire.Core/CommandConstants.cs | 157 ---- .../src/OpenWire.Core/Commands/BaseCommand.cs | 81 +- .../src/OpenWire.Core/Commands/BrokerId.cs | 10 +- .../src/OpenWire.Core/Commands/BrokerInfo.cs | 40 +- .../OpenWire.Core/Commands/ConnectionError.cs | 20 +- .../OpenWire.Core/Commands/ConnectionId.cs | 10 +- .../OpenWire.Core/Commands/ConnectionInfo.cs | 50 +- .../src/OpenWire.Core/Commands/ConsumerId.cs | 30 +- .../OpenWire.Core/Commands/ConsumerInfo.cs | 130 +-- .../OpenWire.Core/Commands/ControlCommand.cs | 10 +- .../Commands/DataArrayResponse.cs | 10 +- .../OpenWire.Core/Commands/DataResponse.cs | 10 +- .../OpenWire.Core/Commands/DestinationInfo.cs | 50 +- .../OpenWire.Core/Commands/DiscoveryEvent.cs | 20 +- .../Commands/ExceptionResponse.cs | 10 +- .../OpenWire.Core/Commands/IntegerResponse.cs | 10 +- .../OpenWire.Core/Commands/JournalQueueAck.cs | 20 +- .../OpenWire.Core/Commands/JournalTopicAck.cs | 60 +- .../OpenWire.Core/Commands/JournalTrace.cs | 10 +- .../Commands/JournalTransaction.cs | 30 +- .../Commands/LocalTransactionId.cs | 20 +- .../src/OpenWire.Core/Commands/Message.cs | 250 ++---- .../src/OpenWire.Core/Commands/MessageAck.cs | 70 +- .../OpenWire.Core/Commands/MessageDispatch.cs | 40 +- .../src/OpenWire.Core/Commands/MessageId.cs | 30 +- .../src/OpenWire.Core/Commands/ProducerId.cs | 34 +- .../OpenWire.Core/Commands/ProducerInfo.cs | 30 +- .../src/OpenWire.Core/Commands/RemoveInfo.cs | 10 +- .../Commands/RemoveSubscriptionInfo.cs | 30 +- .../src/OpenWire.Core/Commands/Response.cs | 10 +- .../src/OpenWire.Core/Commands/SessionId.cs | 20 +- .../src/OpenWire.Core/Commands/SessionInfo.cs | 10 +- .../Commands/SubscriptionInfo.cs | 40 +- .../OpenWire.Core/Commands/TransactionInfo.cs | 30 +- .../OpenWire.Core/Commands/WireFormatInfo.cs | 30 +- .../OpenWire.Core/Commands/XATransactionId.cs | 30 +- .../src/OpenWire.Core/DataStructure.cs | 19 +- .../src/OpenWire.Core/Destination.cs | 14 +- .../src/OpenWire.Core/DestinationFilter.cs | 30 +- .../OpenWire.Core/IO/ProducerIdMarshaller.cs | 4 +- openwire-dotnet/src/OpenWire.Core/Queue.cs | 22 +- .../src/OpenWire.Core/TemporaryQueue.cs | 14 +- .../src/OpenWire.Core/TemporaryTopic.cs | 14 +- openwire-dotnet/src/OpenWire.Core/Topic.cs | 21 +- .../src/OpenWire.Core/TransactionConstants.cs | 128 ++- .../OpenWire.Core/Transport/FutureResponse.cs | 44 + .../src/OpenWire.Core/Transport/Transport.cs | 24 + 55 files changed, 1145 insertions(+), 2106 deletions(-) delete mode 100755 openwire-dotnet/src/OpenWire.Core/CommandConstants.cs create mode 100755 openwire-dotnet/src/OpenWire.Core/Transport/FutureResponse.cs create mode 100755 openwire-dotnet/src/OpenWire.Core/Transport/Transport.cs diff --git a/openwire-dotnet/src/OpenWire.Core/AbstractCommand.cs b/openwire-dotnet/src/OpenWire.Core/AbstractCommand.cs index 6e3eaf90b5..856866b952 100755 --- a/openwire-dotnet/src/OpenWire.Core/AbstractCommand.cs +++ b/openwire-dotnet/src/OpenWire.Core/AbstractCommand.cs @@ -1,155 +1,82 @@ using System; +using OpenWire.Core; +using OpenWire.Core.Commands; -namespace OpenWire.Core -{ - /// - /// Summary description for AbstractCommand. - /// - public abstract class AbstractCommand : Command { - - //public const int NON_PERSISTENT = 1; - //public const int PERSISTENT = 2; - - /** - * Message flag indexes (used for writing/reading to/from a Stream - */ - public const int RECEIPT_REQUIRED_INDEX = 0; - public const int BROKERS_VISITED_INDEX =1; - private short id = 0; - private bool receiptRequired; +namespace OpenWire.Core { + /// + /// Summary description for AbstractCommand. + /// + public abstract class AbstractCommand : Command { - protected AbstractCommand() - { - - } - - public virtual byte GetCommandType() - { - return 0; - } + protected AbstractCommand() { + } - public short GetId() - { - return this.id; - } + public virtual byte GetCommandType() { + return 0; + } - public virtual void SetId(short newId) - { - this.id = newId; - } - - public virtual bool IsReceiptRequired() - { - return this.receiptRequired; - } - - - public virtual bool IsReceipt() - { - return false; - } - - public void SetReceiptRequired(bool value) - { - this.receiptRequired = value; - } - - public virtual bool IsJMSMessage() - { - return false; - } - - public override int GetHashCode() - { - return this.id; - } - - public override String ToString() - { - return GetCommandTypeAsString(GetCommandType()) + ": id = " + GetId(); - } - - - public static String GetCommandTypeAsString(int type) - { - String packetTypeStr = ""; - switch (type) - { - case CommandConstants.ACTIVEMQ_MESSAGE: - packetTypeStr = "ACTIVEMQ_MESSAGE"; - break; - case CommandConstants.ACTIVEMQ_TEXT_MESSAGE: - packetTypeStr = "ACTIVEMQ_TEXT_MESSAGE"; - break; - case CommandConstants.ACTIVEMQ_OBJECT_MESSAGE: - packetTypeStr = "ACTIVEMQ_OBJECT_MESSAGE"; - break; - case CommandConstants.ACTIVEMQ_BYTES_MESSAGE: - packetTypeStr = "ACTIVEMQ_BYTES_MESSAGE"; - break; - case CommandConstants.ACTIVEMQ_STREAM_MESSAGE: - packetTypeStr = "ACTIVEMQ_STREAM_MESSAGE"; - break; - case CommandConstants.ACTIVEMQ_MAP_MESSAGE: - packetTypeStr = "ACTIVEMQ_MAP_MESSAGE"; - break; - case CommandConstants.ACTIVEMQ_MSG_ACK: - packetTypeStr = "ACTIVEMQ_MSG_ACK"; - break; - case CommandConstants.RECEIPT_INFO: - packetTypeStr = "RECEIPT_INFO"; - break; - case CommandConstants.CONSUMER_INFO: - packetTypeStr = "CONSUMER_INFO"; - break; - case CommandConstants.PRODUCER_INFO: - packetTypeStr = "PRODUCER_INFO"; - break; - case CommandConstants.TRANSACTION_INFO: - packetTypeStr = "TRANSACTION_INFO"; - break; - case CommandConstants.XA_TRANSACTION_INFO: - packetTypeStr = "XA_TRANSACTION_INFO"; - break; - case CommandConstants.ACTIVEMQ_BROKER_INFO: - packetTypeStr = "ACTIVEMQ_BROKER_INFO"; - break; - case CommandConstants.ACTIVEMQ_CONNECTION_INFO: - packetTypeStr = "ACTIVEMQ_CONNECTION_INFO"; - break; - case CommandConstants.SESSION_INFO: - packetTypeStr = "SESSION_INFO"; - break; - case CommandConstants.DURABLE_UNSUBSCRIBE: - packetTypeStr = "DURABLE_UNSUBSCRIBE"; - break; - case CommandConstants.RESPONSE_RECEIPT_INFO: - packetTypeStr = "RESPONSE_RECEIPT_INFO"; - break; - case CommandConstants.INT_RESPONSE_RECEIPT_INFO: - packetTypeStr = "INT_RESPONSE_RECEIPT_INFO"; - break; - case CommandConstants.CAPACITY_INFO: - packetTypeStr = "CAPACITY_INFO"; - break; - case CommandConstants.CAPACITY_INFO_REQUEST: - packetTypeStr = "CAPACITY_INFO_REQUEST"; - break; - case CommandConstants.WIRE_FORMAT_INFO: - packetTypeStr = "WIRE_FORMAT_INFO"; - break; - case CommandConstants.KEEP_ALIVE: - packetTypeStr = "KEEP_ALIVE"; - break; - case CommandConstants.CACHED_VALUE_COMMAND: - packetTypeStr = "CachedValue"; - break; - default : - packetTypeStr = "UNKNOWN PACKET TYPE: " + type; - break; - } - return packetTypeStr; - } - } + public static String GetCommandTypeAsString(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; + } + } } - diff --git a/openwire-dotnet/src/OpenWire.Core/AbstractCommandMarshaller.cs b/openwire-dotnet/src/OpenWire.Core/AbstractCommandMarshaller.cs index 50f127af9d..077d279202 100755 --- a/openwire-dotnet/src/OpenWire.Core/AbstractCommandMarshaller.cs +++ b/openwire-dotnet/src/OpenWire.Core/AbstractCommandMarshaller.cs @@ -4,115 +4,101 @@ using System.IO; using OpenWire.Core.Commands; using OpenWire.Core.IO; -namespace OpenWire.Core -{ - /// - /// A base class with useful implementation inheritence methods - /// for creating marshallers of the OpenWire protocol - /// - public abstract class AbstractCommandMarshaller { +namespace OpenWire.Core { + /// + /// A base class with useful implementation inheritence methods + /// for creating marshallers of the OpenWire protocol + /// + public abstract class AbstractCommandMarshaller { - public abstract Command CreateCommand(); + public abstract Command CreateCommand(); - public virtual Command ReadCommand(BinaryReader dataIn) - { - Command command = CreateCommand(); - BuildCommand(command, dataIn); - return command; - } - - public virtual void BuildCommand(Command command, BinaryReader dataIn) - { - // empty body to allow generated code to call base method - } - - public virtual void WriteCommand(Command command, BinaryWriter dataOut) - { - // empty body to allow generated code to call base method - } - - protected virtual ActiveMQDestination ReadDestination(BinaryReader dataIn) - { - return (ActiveMQDestination) CommandMarshallerRegistry.ReadCommand(dataIn); - } - - protected virtual void WriteDestination(ActiveMQDestination command, BinaryWriter dataOut) - { - CommandMarshallerRegistry.WriteCommand(command, dataOut); - } - - protected virtual BrokerId[] ReadBrokerIds(BinaryReader dataIn) - { - int size = dataIn.ReadInt32(); - BrokerId[] answer = new BrokerId[size]; - for (int i = 0; i < size; i++) { - answer[i] = (BrokerId) CommandMarshallerRegistry.BrokerIdMarshaller.ReadCommand(dataIn); - } - return answer; - } + public virtual Command ReadCommand(BinaryReader dataIn) { + Command command = CreateCommand(); + BuildCommand(command, dataIn); + return command; + } - protected virtual void WriteBrokerIds(BrokerId[] commands, BinaryWriter dataOut) - { - int size = commands.Length; - dataOut.Write(size); - for (int i = 0; i < size; i++) { - CommandMarshallerRegistry.BrokerIdMarshaller.WriteCommand(commands[i], dataOut); - } - } + public virtual void BuildCommand(Command command, BinaryReader dataIn) { + // empty body to allow generated code to call base method + } - - protected virtual BrokerInfo[] ReadBrokerInfos(BinaryReader dataIn) - { - int size = dataIn.ReadInt32(); - BrokerInfo[] answer = new BrokerInfo[size]; - for (int i = 0; i < size; i++) { - answer[i] = (BrokerInfo) CommandMarshallerRegistry.BrokerInfoMarshaller.ReadCommand(dataIn); - } - return answer; - } + public virtual void WriteCommand(Command command, BinaryWriter dataOut) { + // empty body to allow generated code to call base method + } - protected virtual void WriteBrokerInfos(BrokerInfo[] commands, BinaryWriter dataOut) - { - int size = commands.Length; - dataOut.Write(size); - for (int i = 0; i < size; i++) { - CommandMarshallerRegistry.BrokerInfoMarshaller.WriteCommand(commands[i], dataOut); - } - } + protected virtual ActiveMQDestination ReadDestination(BinaryReader dataIn) { + return (ActiveMQDestination) CommandMarshallerRegistry.ReadCommand(dataIn); + } - - protected virtual DataStructure[] ReadDataStructures(BinaryReader dataIn) - { - int size = dataIn.ReadInt32(); - DataStructure[] answer = new DataStructure[size]; - for (int i = 0; i < size; i++) { - answer[i] = (DataStructure) CommandMarshallerRegistry.ReadCommand(dataIn); - } - return answer; - } + protected virtual void WriteDestination(ActiveMQDestination command, BinaryWriter dataOut) { + CommandMarshallerRegistry.WriteCommand(command, dataOut); + } - protected virtual void WriteDataStructures(DataStructure[] commands, BinaryWriter dataOut) - { - int size = commands.Length; - dataOut.Write(size); - for (int i = 0; i < size; i++) { - CommandMarshallerRegistry.WriteCommand((Command) commands[i], dataOut); - } - } + protected virtual BrokerId[] ReadBrokerIds(BinaryReader dataIn) { + int size = dataIn.ReadInt32(); + BrokerId[] answer = new BrokerId[size]; + for (int i = 0; i < size; i++) { + answer[i] = (BrokerId) CommandMarshallerRegistry.BrokerIdMarshaller.ReadCommand(dataIn); + } + return answer; + } - - protected virtual byte[] ReadBytes(BinaryReader dataIn) - { - int size = dataIn.ReadInt32(); - return dataIn.ReadBytes(size); - } - - protected virtual void WriteBytes(byte[] command, BinaryWriter dataOut) - { - dataOut.Write(command.Length); - dataOut.Write(command); - } - - } + protected virtual void WriteBrokerIds(BrokerId[] commands, BinaryWriter dataOut) { + int size = commands.Length; + dataOut.Write(size); + for (int i = 0; i < size; i++) { + CommandMarshallerRegistry.BrokerIdMarshaller.WriteCommand(commands[i], dataOut); + } + } + + + protected virtual BrokerInfo[] ReadBrokerInfos(BinaryReader dataIn) { + int size = dataIn.ReadInt32(); + BrokerInfo[] answer = new BrokerInfo[size]; + for (int i = 0; i < size; i++) { + answer[i] = (BrokerInfo) CommandMarshallerRegistry + .BrokerInfoMarshaller + .ReadCommand(dataIn); + } + return answer; + } + + protected virtual void WriteBrokerInfos(BrokerInfo[] commands, BinaryWriter dataOut) { + int size = commands.Length; + dataOut.Write(size); + for (int i = 0; i < size; i++) { + CommandMarshallerRegistry.BrokerInfoMarshaller.WriteCommand(commands[i], dataOut); + } + } + + + protected virtual DataStructure[] ReadDataStructures(BinaryReader dataIn) { + int size = dataIn.ReadInt32(); + DataStructure[] answer = new DataStructure[size]; + for (int i = 0; i < size; i++) { + answer[i] = (DataStructure) CommandMarshallerRegistry.ReadCommand(dataIn); + } + return answer; + } + + protected virtual void WriteDataStructures(DataStructure[] commands, BinaryWriter dataOut) { + int size = commands.Length; + dataOut.Write(size); + for (int i = 0; i < size; i++) { + CommandMarshallerRegistry.WriteCommand((Command) commands[i], dataOut); + } + } + + + protected virtual byte[] ReadBytes(BinaryReader dataIn) { + int size = dataIn.ReadInt32(); + return dataIn.ReadBytes(size); + } + + protected virtual void WriteBytes(byte[] command, BinaryWriter dataOut) { + dataOut.Write(command.Length); + dataOut.Write(command); + } + } } - diff --git a/openwire-dotnet/src/OpenWire.Core/ActiveMQDestination.cs b/openwire-dotnet/src/OpenWire.Core/ActiveMQDestination.cs index 79e9a03e88..5a143ad813 100755 --- a/openwire-dotnet/src/OpenWire.Core/ActiveMQDestination.cs +++ b/openwire-dotnet/src/OpenWire.Core/ActiveMQDestination.cs @@ -1,463 +1,443 @@ using System; using OpenWire.Core.Commands; -namespace OpenWire.Core -{ - /// - /// Summary description for ActiveMQDestination. - /// - public abstract class ActiveMQDestination : AbstractCommand, Destination { +namespace OpenWire.Core { + + /// + /// Summary description for ActiveMQDestination. + /// + public abstract class ActiveMQDestination : AbstractCommand, Destination { - /** - * Topic Destination object - */ - public const int ACTIVEMQ_TOPIC = 1; - /** - * Temporary Topic Destination object - */ - public const int ACTIVEMQ_TEMPORARY_TOPIC = 2; + /** + * 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"; + /** + * Queue Destination object + */ + public const int ACTIVEMQ_QUEUE = 3; + /** + * Temporary Queue Destination object + */ + public const int ACTIVEMQ_TEMPORARY_QUEUE = 4; - private const int NULL_DESTINATION = 10; + /** + * prefix for Advisory message destinations + */ + public const String ADVISORY_PREFIX = "ActiveMQ.Advisory."; - private const String TEMP_PREFIX = "{TD{"; - private const String TEMP_POSTFIX = "}TD}"; - private const String COMPOSITE_SEPARATOR = ","; - private const String QUEUE_PREFIX = "queue://"; - private const String TOPIC_PREFIX = "topic://"; - + /** + * prefix for consumer advisory destinations + */ + public const String CONSUMER_ADVISORY_PREFIX = ADVISORY_PREFIX + "Consumers."; - private String physicalName = ""; + /** + * prefix for producer advisory destinations + */ + public const String PRODUCER_ADVISORY_PREFIX = ADVISORY_PREFIX + "Producers."; - // Cached transient data - private bool exclusive; - private bool ordered; - private bool advisory; - private String orderedTarget = DEFAULT_ORDERED_TARGET; - - - /** - * The Default Constructor - */ - protected ActiveMQDestination() { - } + /** + * prefix for connection advisory destinations + */ + public const String CONNECTION_ADVISORY_PREFIX = ADVISORY_PREFIX + "Connections."; - /** - * Construct the Destination with a defined physical name; - * - * @param name - */ - protected ActiveMQDestination(String name) { - this.physicalName = name; - this.advisory = name != null && name.StartsWith(ADVISORY_PREFIX); - } + /** + * The default target for ordered destinations + */ + public const String DEFAULT_ORDERED_TARGET = "coordinator"; + + private const int NULL_DESTINATION = 10; + + private const String TEMP_PREFIX = "{TD{"; + private const String TEMP_POSTFIX = "}TD}"; + private const String COMPOSITE_SEPARATOR = ","; + private const String QUEUE_PREFIX = "queue://"; + private const String TOPIC_PREFIX = "topic://"; - - /** - * @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 Topic) { - return "Topic(" + destination.ToString() + ")"; - } - else { - return "Queue(" + destination.ToString() + ")"; - } - } + private String physicalName = ""; - /** - * @param destination - * @return @throws JMSException - * @throws javax.jms.JMSException - */ - public static ActiveMQDestination transformDestination(Destination destination) { - ActiveMQDestination result = null; - if (destination != null) { - if (destination is ActiveMQDestination) { - result = (ActiveMQDestination) destination; - } - else { - if (destination is TemporaryQueue) { - result = new ActiveMQTempQueue(((Queue) destination).QueueName); + // Cached transient data + private bool exclusive; + private bool ordered; + private bool advisory; + private String orderedTarget = DEFAULT_ORDERED_TARGET; + + + /** + * The Default Constructor + */ + protected ActiveMQDestination() { } - else if (destination is TemporaryTopic) { - result = new ActiveMQTempTopic(((Topic) destination).TopicName); + + /** + * Construct the Destination with a defined physical name; + * + * @param name + */ + protected ActiveMQDestination(String name) { + this.physicalName = name; + this.advisory = name != null && name.StartsWith(ADVISORY_PREFIX); } - else if (destination is Queue) { - result = new ActiveMQQueue(((Queue) destination).QueueName); + + + + /** + * @return Returns the advisory. + */ + public bool IsAdvisory() { + return advisory; } - else if (destination is Topic) { - result = new ActiveMQTopic(((Topic) destination).TopicName); + /** + * @param advisory The advisory to set. + */ + public void SetAdvisory(bool advisory) { + this.advisory = advisory; } - } - } - return result; - } - /** - * Create a Destination - * @param type - * @param pyhsicalName - * @return - */ - public static ActiveMQDestination CreateDestination(int type,String pyhsicalName){ - ActiveMQDestination result = null; - 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 true if this is a destination for Consumer advisories + */ + public bool IsConsumerAdvisory() { + return IsAdvisory() && physicalName.StartsWith(CONSUMER_ADVISORY_PREFIX); } - } - } - 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; + /** + * @return true if this is a destination for Producer advisories + */ + public bool IsProducerAdvisory() { + return IsAdvisory() && physicalName.StartsWith(PRODUCER_ADVISORY_PREFIX); } - } - else { - if (that.IsTopic()) { - return -1; + + /** + * @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 Topic) { + return "Topic(" + destination.ToString() + ")"; + } else { + return "Queue(" + destination.ToString() + ")"; + } + } + + /** + * @param destination + * @return @throws JMSException + * @throws javax.jms.JMSException + */ + public static ActiveMQDestination transformDestination(Destination destination) { + ActiveMQDestination result = null; + if (destination != null) { + if (destination is ActiveMQDestination) { + result = (ActiveMQDestination) destination; + } else { + if (destination is TemporaryQueue) { + result = new ActiveMQTempQueue(((Queue) destination).QueueName); + } else if (destination is TemporaryTopic) { + result = new ActiveMQTempTopic(((Topic) destination).TopicName); + } else if (destination is Queue) { + result = new ActiveMQQueue(((Queue) destination).QueueName); + } else if (destination is Topic) { + result = new ActiveMQTopic(((Topic) destination).TopicName); + } + } + } + return result; + } + + /** + * Create a Destination + * @param type + * @param pyhsicalName + * @return + */ + public static ActiveMQDestination CreateDestination(int type, String pyhsicalName) { + ActiveMQDestination result = null; + 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; } - } - } - return answer; - } - /** - * @return Returns the Destination type - */ + /** + * @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; + } - public abstract int GetDestinationType(); + /** + * 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; + } - public String PhysicalName - { - get - { - return this.physicalName; - } - set - { - this.physicalName = value; - } - } + /** + * @return Returns the Destination type + */ - /** - * Returns true if a temporary Destination - * - * @return true/false - */ - - public bool IsTemporary() { - return GetDestinationType() == ACTIVEMQ_TEMPORARY_TOPIC || - GetDestinationType() == ACTIVEMQ_TEMPORARY_QUEUE; - } - - /** - * Returns true if a Topic Destination - * - * @return true/false - */ - - public bool IsTopic() { - return GetDestinationType() == ACTIVEMQ_TOPIC || - GetDestinationType() == ACTIVEMQ_TEMPORARY_TOPIC; - } - - /** - * Returns true if a Queue Destination - * - * @return true/false - */ - public bool IsQueue() { - return !IsTopic(); - } - - /** - * Returns true if this destination represents a collection of - * destinations; allowing a set of destinations to be published to or subscribed - * from in one JMS operation. - *

- * 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() { - return physicalName.IndexOf(COMPOSITE_SEPARATOR) > 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() { - return this.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; - } + public abstract int GetDestinationType(); - /** - * @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; - } + public String PhysicalName { + get { return this.physicalName; } + set { this.physicalName = value; } + } + + /** + * Returns true if a temporary Destination + * + * @return true/false + */ + + public bool IsTemporary() { + return GetDestinationType() == ACTIVEMQ_TEMPORARY_TOPIC + || GetDestinationType() == ACTIVEMQ_TEMPORARY_QUEUE; + } + + /** + * Returns true if a Topic Destination + * + * @return true/false + */ + + public bool IsTopic() { + return GetDestinationType() == ACTIVEMQ_TOPIC + || GetDestinationType() == ACTIVEMQ_TEMPORARY_TOPIC; + } + + /** + * Returns true if a Queue Destination + * + * @return true/false + */ + public bool IsQueue() { + return !IsTopic(); + } + + /** + * Returns true if this destination represents a collection of + * destinations; allowing a set of destinations to be published to or subscribed + * from in one JMS operation. + *

+ * 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() { + return physicalName.IndexOf(COMPOSITE_SEPARATOR) > 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() { + return this.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; + } - /** - * 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 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); + } } diff --git a/openwire-dotnet/src/OpenWire.Core/ActiveMQQueue.cs b/openwire-dotnet/src/OpenWire.Core/ActiveMQQueue.cs index f920dc817a..b710b896d9 100755 --- a/openwire-dotnet/src/OpenWire.Core/ActiveMQQueue.cs +++ b/openwire-dotnet/src/OpenWire.Core/ActiveMQQueue.cs @@ -2,31 +2,28 @@ using System; using OpenWire.Core; using OpenWire.Core.Commands; -namespace OpenWire.Core -{ - ///

- /// Summary description for ActiveMQQueue. - /// - public class ActiveMQQueue : ActiveMQDestination, Queue - { - public const byte ID_ActiveMQQueue = 100; - - public ActiveMQQueue() : base(){} - public ActiveMQQueue(String name) : base(name){} - - public String QueueName - { - get { - return PhysicalName; - } - } - - public override int GetDestinationType() { - return ACTIVEMQ_QUEUE; - } +namespace OpenWire.Core { + /// + /// Summary description for ActiveMQQueue. + /// + public class ActiveMQQueue : ActiveMQDestination, Queue { + public const byte ID_ActiveMQQueue = 100; - public override ActiveMQDestination CreateDestination(String name) { - return new ActiveMQQueue(name); - } - } -} \ No newline at end of file + public ActiveMQQueue() : base() { + } + public ActiveMQQueue(String name) : base(name) { + } + + public String QueueName { + get { return PhysicalName; } + } + + public override int GetDestinationType() { + return ACTIVEMQ_QUEUE; + } + + public override ActiveMQDestination CreateDestination(String name) { + return new ActiveMQQueue(name); + } + } +} diff --git a/openwire-dotnet/src/OpenWire.Core/ActiveMQTempQueue.cs b/openwire-dotnet/src/OpenWire.Core/ActiveMQTempQueue.cs index 8d36de1921..5b58d59a82 100755 --- a/openwire-dotnet/src/OpenWire.Core/ActiveMQTempQueue.cs +++ b/openwire-dotnet/src/OpenWire.Core/ActiveMQTempQueue.cs @@ -2,28 +2,28 @@ using System; using OpenWire.Core; using OpenWire.Core.Commands; -namespace OpenWire.Core -{ - /// - /// Summary description for ActiveMQTempQueue. - /// - public class ActiveMQTempQueue : ActiveMQDestination, TemporaryQueue - { - public const byte ID_ActiveMQTempQueue = 102; - - public ActiveMQTempQueue() : base(){} - public ActiveMQTempQueue(String name) : base(name){} - - public String GetQueueName() { - return PhysicalName; - } - - public override int GetDestinationType() { - return ACTIVEMQ_QUEUE; - } +namespace OpenWire.Core { + /// + /// Summary description for ActiveMQTempQueue. + /// + public class ActiveMQTempQueue : ActiveMQDestination, TemporaryQueue { + public const byte ID_ActiveMQTempQueue = 102; - public override ActiveMQDestination CreateDestination(String name) { - return new ActiveMQTempQueue(name); - } - } -} \ No newline at end of file + public ActiveMQTempQueue() : base() { + } + public ActiveMQTempQueue(String name) : base(name) { + } + + public String GetQueueName() { + return PhysicalName; + } + + public override int GetDestinationType() { + return ACTIVEMQ_QUEUE; + } + + public override ActiveMQDestination CreateDestination(String name) { + return new ActiveMQTempQueue(name); + } + } +} diff --git a/openwire-dotnet/src/OpenWire.Core/ActiveMQTempTopic.cs b/openwire-dotnet/src/OpenWire.Core/ActiveMQTempTopic.cs index a36d3f50f8..1388a41616 100755 --- a/openwire-dotnet/src/OpenWire.Core/ActiveMQTempTopic.cs +++ b/openwire-dotnet/src/OpenWire.Core/ActiveMQTempTopic.cs @@ -2,31 +2,27 @@ using System; using OpenWire.Core; using OpenWire.Core.Commands; -namespace OpenWire.Core -{ - /// - /// Summary description for ActiveMQTempTopic. - /// - public class ActiveMQTempTopic : ActiveMQDestination, TemporaryTopic - { - public const byte ID_ActiveMQTempTopic = 103; - - public ActiveMQTempTopic(): base() {} - public ActiveMQTempTopic(String name):base(name){} - - public String GetTopicName() - { - return PhysicalName; - } - public override int GetDestinationType() - { - return ACTIVEMQ_TOPIC; - } +namespace OpenWire.Core { + /// + /// Summary description for ActiveMQTempTopic. + /// + public class ActiveMQTempTopic : ActiveMQDestination, TemporaryTopic { + public const byte ID_ActiveMQTempTopic = 103; - public override ActiveMQDestination CreateDestination(String name) - { - return new ActiveMQTempTopic(name); - } + public ActiveMQTempTopic() : base() { + } + public ActiveMQTempTopic(String name) : base(name) { + } - } + public String GetTopicName() { + return PhysicalName; + } + public override int GetDestinationType() { + return ACTIVEMQ_TOPIC; + } + + public override ActiveMQDestination CreateDestination(String name) { + return new ActiveMQTempTopic(name); + } + } } diff --git a/openwire-dotnet/src/OpenWire.Core/ActiveMQTopic.cs b/openwire-dotnet/src/OpenWire.Core/ActiveMQTopic.cs index e2f530ba26..336405ad01 100755 --- a/openwire-dotnet/src/OpenWire.Core/ActiveMQTopic.cs +++ b/openwire-dotnet/src/OpenWire.Core/ActiveMQTopic.cs @@ -2,34 +2,28 @@ using System; using OpenWire.Core; using OpenWire.Core.Commands; -namespace OpenWire.Core -{ - /// - /// Summary description for ActiveMQTopic. - /// - public class ActiveMQTopic : ActiveMQDestination, Topic - { - public const byte ID_ActiveMQTopic = 101; - - public ActiveMQTopic(): base() {} - public ActiveMQTopic(String name):base(name){} - - public String TopicName - { - get { - return PhysicalName; - } - } - - public override int GetDestinationType() - { - return ACTIVEMQ_TOPIC; - } +namespace OpenWire.Core { + /// + /// Summary description for ActiveMQTopic. + /// + public class ActiveMQTopic : ActiveMQDestination, Topic { + public const byte ID_ActiveMQTopic = 101; - public override ActiveMQDestination CreateDestination(String name) - { - return new ActiveMQTopic(name); - } + public ActiveMQTopic() : base() { + } + public ActiveMQTopic(String name) : base(name) { + } - } + public String TopicName { + get { return PhysicalName; } + } + + public override int GetDestinationType() { + return ACTIVEMQ_TOPIC; + } + + public override ActiveMQDestination CreateDestination(String name) { + return new ActiveMQTopic(name); + } + } } diff --git a/openwire-dotnet/src/OpenWire.Core/Command.cs b/openwire-dotnet/src/OpenWire.Core/Command.cs index 706df69398..6f19df7b66 100755 --- a/openwire-dotnet/src/OpenWire.Core/Command.cs +++ b/openwire-dotnet/src/OpenWire.Core/Command.cs @@ -1,12 +1,9 @@ using System; -namespace OpenWire.Core -{ - /// - /// An OpenWire command - /// - public interface Command : DataStructure { - - } +namespace OpenWire.Core { + /// + /// An OpenWire command + /// + public interface Command : DataStructure { + } } - diff --git a/openwire-dotnet/src/OpenWire.Core/CommandConstants.cs b/openwire-dotnet/src/OpenWire.Core/CommandConstants.cs deleted file mode 100755 index 209d7e79c9..0000000000 --- a/openwire-dotnet/src/OpenWire.Core/CommandConstants.cs +++ /dev/null @@ -1,157 +0,0 @@ -using System; - -namespace OpenWire.Core -{ - /// - /// TODO autogenerate this file! - /// - class CommandConstants - { - CommandConstants() - {} - - public const int NOT_SET = 0; - - /** - * ActiveMQMessage object - */ - public const int ACTIVEMQ_MESSAGE = 6; - - /** - * ActiveMQTextMessage object - */ - - public const int ACTIVEMQ_TEXT_MESSAGE = 7; - - /** - * ActiveMQObjectMessage object - */ - - public const int ACTIVEMQ_OBJECT_MESSAGE = 8; - - /** - * ActiveMQBytesMessage - */ - - public const int ACTIVEMQ_BYTES_MESSAGE = 9; - - /** - * ActiveMQStreamMessage object - */ - - public const int ACTIVEMQ_STREAM_MESSAGE = 10; - - /** - * ActiveMQMapMessage object - */ - - public const int ACTIVEMQ_MAP_MESSAGE = 11; - - /** - * Message acknowledge - */ - public const int ACTIVEMQ_MSG_ACK = 15; - - /** - * Recipt message - */ - - public const int RECEIPT_INFO = 16; - - /** - * Consumer Infomation - */ - - public const int CONSUMER_INFO = 17; - - /** - * Producer Info - */ - - public const int PRODUCER_INFO = 18; - - /** - * Transaction info - */ - - public const int TRANSACTION_INFO = 19; - - /** - * XA Transaction info - */ - - public const int XA_TRANSACTION_INFO = 20; - - /** - * Broker infomation message - */ - - public const int ACTIVEMQ_BROKER_INFO = 21; - - /** - * Connection info message - */ - - public const int ACTIVEMQ_CONNECTION_INFO = 22; - - - /** - * Session Info message - */ - public const int SESSION_INFO = 23; - - /** - * Durable Unsubscribe message - */ - - public const int DURABLE_UNSUBSCRIBE = 24; - - - /** - * A receipt with an Object reponse. - */ - public const int RESPONSE_RECEIPT_INFO = 25; - - - /** - * A receipt with an Integer reponse. - */ - public const int INT_RESPONSE_RECEIPT_INFO = 26; - - /** - * Infomation about the Capacity for more Messages for either Connection/Broker - */ - public const int CAPACITY_INFO = 27; - - /** - * Request infomation about the current capacity - */ - public const int CAPACITY_INFO_REQUEST = 28; - - /** - * Infomation about the wire format expected - */ - public const int WIRE_FORMAT_INFO = 29; - - /** - * Keep-alive message - */ - public const int KEEP_ALIVE = 30; - - /** - * A command to the Broker Admin - */ - public const int BROKER_ADMIN_COMMAND = 31; - - /** - * transmit cached values for the wire format - */ - public const int CACHED_VALUE_COMMAND = 32; - - /** - * transmit cached values for the wire format - */ - public const int CLEANUP_CONNECTION_INFO = 33; - } - } - diff --git a/openwire-dotnet/src/OpenWire.Core/Commands/BaseCommand.cs b/openwire-dotnet/src/OpenWire.Core/Commands/BaseCommand.cs index c0a4117cbc..8bbea3b06c 100644 --- a/openwire-dotnet/src/OpenWire.Core/Commands/BaseCommand.cs +++ b/openwire-dotnet/src/OpenWire.Core/Commands/BaseCommand.cs @@ -12,52 +12,51 @@ using System.Collections; using OpenWire.Core; -namespace OpenWire.Core.Commands -{ - public class BaseCommand : AbstractCommand - { - public const byte ID_BaseCommand = 0; - - short commandId; - bool responseRequired; +namespace OpenWire.Core.Commands { + + public class BaseCommand : AbstractCommand { + public const byte ID_BaseCommand = 0; + + short commandId; + bool responseRequired; + public override int GetHashCode() { + return commandId; + } - // TODO generate Equals method - // TODO generate GetHashCode method - // TODO generate ToString method + public override bool Equals(Object that) { + if (that is BaseCommand) { + BaseCommand thatCommand = (BaseCommand) that; + return this.GetCommandType() == thatCommand.GetCommandType() + && this.CommandId == thatCommand.CommandId; + } + return false; + } + + public override String ToString() { + string answer = GetCommandTypeAsString(GetCommandType()); + if (answer.Length == 0) { + answer = base.ToString(); + } + return answer + ": id = " + CommandId; + } + + public override byte GetCommandType() { + return ID_BaseCommand; + } - public override byte GetCommandType() { - return ID_BaseCommand; - } + // Properties + public short CommandId { + get { return commandId; } + set { this.commandId = value; } + } - // Properties - - public short CommandId - { - get - { - return commandId; - } - set - { - commandId = value; - } - } - - public bool ResponseRequired - { - get - { - return responseRequired; - } - set - { - responseRequired = value; - } - } - - } + public bool ResponseRequired { + get { return responseRequired; } + set { this.responseRequired = value; } + } + } } diff --git a/openwire-dotnet/src/OpenWire.Core/Commands/BrokerId.cs b/openwire-dotnet/src/OpenWire.Core/Commands/BrokerId.cs index 29955c198f..cfb5f20e3b 100644 --- a/openwire-dotnet/src/OpenWire.Core/Commands/BrokerId.cs +++ b/openwire-dotnet/src/OpenWire.Core/Commands/BrokerId.cs @@ -36,14 +36,8 @@ namespace OpenWire.Core.Commands public string Value { - get - { - return value; - } - set - { - value = value; - } + get { return value; } + set { this.value = value; } } } diff --git a/openwire-dotnet/src/OpenWire.Core/Commands/BrokerInfo.cs b/openwire-dotnet/src/OpenWire.Core/Commands/BrokerInfo.cs index 62482c9ae4..a4452febab 100644 --- a/openwire-dotnet/src/OpenWire.Core/Commands/BrokerInfo.cs +++ b/openwire-dotnet/src/OpenWire.Core/Commands/BrokerInfo.cs @@ -39,50 +39,26 @@ namespace OpenWire.Core.Commands public BrokerId BrokerId { - get - { - return brokerId; - } - set - { - brokerId = value; - } + get { return brokerId; } + set { this.brokerId = value; } } public string BrokerURL { - get - { - return brokerURL; - } - set - { - brokerURL = value; - } + get { return brokerURL; } + set { this.brokerURL = value; } } public BrokerInfo[] PeerBrokerInfos { - get - { - return peerBrokerInfos; - } - set - { - peerBrokerInfos = value; - } + get { return peerBrokerInfos; } + set { this.peerBrokerInfos = value; } } public string BrokerName { - get - { - return brokerName; - } - set - { - brokerName = value; - } + get { return brokerName; } + set { this.brokerName = value; } } } diff --git a/openwire-dotnet/src/OpenWire.Core/Commands/ConnectionError.cs b/openwire-dotnet/src/OpenWire.Core/Commands/ConnectionError.cs index 7152037efe..d557b94add 100644 --- a/openwire-dotnet/src/OpenWire.Core/Commands/ConnectionError.cs +++ b/openwire-dotnet/src/OpenWire.Core/Commands/ConnectionError.cs @@ -37,26 +37,14 @@ namespace OpenWire.Core.Commands public byte[] Exception { - get - { - return exception; - } - set - { - exception = value; - } + get { return exception; } + set { this.exception = value; } } public ConnectionId ConnectionId { - get - { - return connectionId; - } - set - { - connectionId = value; - } + get { return connectionId; } + set { this.connectionId = value; } } } diff --git a/openwire-dotnet/src/OpenWire.Core/Commands/ConnectionId.cs b/openwire-dotnet/src/OpenWire.Core/Commands/ConnectionId.cs index ba30d201b0..c1c76b5980 100644 --- a/openwire-dotnet/src/OpenWire.Core/Commands/ConnectionId.cs +++ b/openwire-dotnet/src/OpenWire.Core/Commands/ConnectionId.cs @@ -36,14 +36,8 @@ namespace OpenWire.Core.Commands public string Value { - get - { - return value; - } - set - { - value = value; - } + get { return value; } + set { this.value = value; } } } diff --git a/openwire-dotnet/src/OpenWire.Core/Commands/ConnectionInfo.cs b/openwire-dotnet/src/OpenWire.Core/Commands/ConnectionInfo.cs index f66ed80c3e..7d9cede183 100644 --- a/openwire-dotnet/src/OpenWire.Core/Commands/ConnectionInfo.cs +++ b/openwire-dotnet/src/OpenWire.Core/Commands/ConnectionInfo.cs @@ -40,62 +40,32 @@ namespace OpenWire.Core.Commands public ConnectionId ConnectionId { - get - { - return connectionId; - } - set - { - connectionId = value; - } + get { return connectionId; } + set { this.connectionId = value; } } public string ClientId { - get - { - return clientId; - } - set - { - clientId = value; - } + get { return clientId; } + set { this.clientId = value; } } public string Password { - get - { - return password; - } - set - { - password = value; - } + get { return password; } + set { this.password = value; } } public string UserName { - get - { - return userName; - } - set - { - userName = value; - } + get { return userName; } + set { this.userName = value; } } public BrokerId[] BrokerPath { - get - { - return brokerPath; - } - set - { - brokerPath = value; - } + get { return brokerPath; } + set { this.brokerPath = value; } } } diff --git a/openwire-dotnet/src/OpenWire.Core/Commands/ConsumerId.cs b/openwire-dotnet/src/OpenWire.Core/Commands/ConsumerId.cs index 680b51e7d2..92e796fdfe 100644 --- a/openwire-dotnet/src/OpenWire.Core/Commands/ConsumerId.cs +++ b/openwire-dotnet/src/OpenWire.Core/Commands/ConsumerId.cs @@ -38,38 +38,20 @@ namespace OpenWire.Core.Commands public string ConnectionId { - get - { - return connectionId; - } - set - { - connectionId = value; - } + get { return connectionId; } + set { this.connectionId = value; } } public long SessionId { - get - { - return sessionId; - } - set - { - sessionId = value; - } + get { return sessionId; } + set { this.sessionId = value; } } public long Value { - get - { - return value; - } - set - { - value = value; - } + get { return value; } + set { this.value = value; } } } diff --git a/openwire-dotnet/src/OpenWire.Core/Commands/ConsumerInfo.cs b/openwire-dotnet/src/OpenWire.Core/Commands/ConsumerInfo.cs index eed56cbd9d..4b83440b4e 100644 --- a/openwire-dotnet/src/OpenWire.Core/Commands/ConsumerInfo.cs +++ b/openwire-dotnet/src/OpenWire.Core/Commands/ConsumerInfo.cs @@ -48,158 +48,80 @@ namespace OpenWire.Core.Commands public ConsumerId ConsumerId { - get - { - return consumerId; - } - set - { - consumerId = value; - } + get { return consumerId; } + set { this.consumerId = value; } } public bool Browser { - get - { - return browser; - } - set - { - browser = value; - } + get { return browser; } + set { this.browser = value; } } public ActiveMQDestination Destination { - get - { - return destination; - } - set - { - destination = value; - } + get { return destination; } + set { this.destination = value; } } public int PrefetchSize { - get - { - return prefetchSize; - } - set - { - prefetchSize = value; - } + get { return prefetchSize; } + set { this.prefetchSize = value; } } public bool DispatchAsync { - get - { - return dispatchAsync; - } - set - { - dispatchAsync = value; - } + get { return dispatchAsync; } + set { this.dispatchAsync = value; } } public string Selector { - get - { - return selector; - } - set - { - selector = value; - } + get { return selector; } + set { this.selector = value; } } public string SubcriptionName { - get - { - return subcriptionName; - } - set - { - subcriptionName = value; - } + get { return subcriptionName; } + set { this.subcriptionName = value; } } public bool NoLocal { - get - { - return noLocal; - } - set - { - noLocal = value; - } + get { return noLocal; } + set { this.noLocal = value; } } public bool Exclusive { - get - { - return exclusive; - } - set - { - exclusive = value; - } + get { return exclusive; } + set { this.exclusive = value; } } public bool Retroactive { - get - { - return retroactive; - } - set - { - retroactive = value; - } + get { return retroactive; } + set { this.retroactive = value; } } public byte Priority { - get - { - return priority; - } - set - { - priority = value; - } + get { return priority; } + set { this.priority = value; } } public BrokerId[] BrokerPath { - get - { - return brokerPath; - } - set - { - brokerPath = value; - } + get { return brokerPath; } + set { this.brokerPath = value; } } public bool NetworkSubscription { - get - { - return networkSubscription; - } - set - { - networkSubscription = value; - } + get { return networkSubscription; } + set { this.networkSubscription = value; } } } diff --git a/openwire-dotnet/src/OpenWire.Core/Commands/ControlCommand.cs b/openwire-dotnet/src/OpenWire.Core/Commands/ControlCommand.cs index 0fa2b1e0a8..a1f7c11252 100644 --- a/openwire-dotnet/src/OpenWire.Core/Commands/ControlCommand.cs +++ b/openwire-dotnet/src/OpenWire.Core/Commands/ControlCommand.cs @@ -36,14 +36,8 @@ namespace OpenWire.Core.Commands public string Command { - get - { - return command; - } - set - { - command = value; - } + get { return command; } + set { this.command = value; } } } diff --git a/openwire-dotnet/src/OpenWire.Core/Commands/DataArrayResponse.cs b/openwire-dotnet/src/OpenWire.Core/Commands/DataArrayResponse.cs index 874a29ed8e..3ab0448de2 100644 --- a/openwire-dotnet/src/OpenWire.Core/Commands/DataArrayResponse.cs +++ b/openwire-dotnet/src/OpenWire.Core/Commands/DataArrayResponse.cs @@ -36,14 +36,8 @@ namespace OpenWire.Core.Commands public DataStructure[] Data { - get - { - return data; - } - set - { - data = value; - } + get { return data; } + set { this.data = value; } } } diff --git a/openwire-dotnet/src/OpenWire.Core/Commands/DataResponse.cs b/openwire-dotnet/src/OpenWire.Core/Commands/DataResponse.cs index 16ea6ad9b3..3d489cdf8e 100644 --- a/openwire-dotnet/src/OpenWire.Core/Commands/DataResponse.cs +++ b/openwire-dotnet/src/OpenWire.Core/Commands/DataResponse.cs @@ -36,14 +36,8 @@ namespace OpenWire.Core.Commands public DataStructure Data { - get - { - return data; - } - set - { - data = value; - } + get { return data; } + set { this.data = value; } } } diff --git a/openwire-dotnet/src/OpenWire.Core/Commands/DestinationInfo.cs b/openwire-dotnet/src/OpenWire.Core/Commands/DestinationInfo.cs index f9f3610f8c..d4d1386f5b 100644 --- a/openwire-dotnet/src/OpenWire.Core/Commands/DestinationInfo.cs +++ b/openwire-dotnet/src/OpenWire.Core/Commands/DestinationInfo.cs @@ -40,62 +40,32 @@ namespace OpenWire.Core.Commands public ConnectionId ConnectionId { - get - { - return connectionId; - } - set - { - connectionId = value; - } + get { return connectionId; } + set { this.connectionId = value; } } public ActiveMQDestination Destination { - get - { - return destination; - } - set - { - destination = value; - } + get { return destination; } + set { this.destination = value; } } public byte OperationType { - get - { - return operationType; - } - set - { - operationType = value; - } + get { return operationType; } + set { this.operationType = value; } } public long Timeout { - get - { - return timeout; - } - set - { - timeout = value; - } + get { return timeout; } + set { this.timeout = value; } } public BrokerId[] BrokerPath { - get - { - return brokerPath; - } - set - { - brokerPath = value; - } + get { return brokerPath; } + set { this.brokerPath = value; } } } diff --git a/openwire-dotnet/src/OpenWire.Core/Commands/DiscoveryEvent.cs b/openwire-dotnet/src/OpenWire.Core/Commands/DiscoveryEvent.cs index 0c2f0f6a13..00350cd0ae 100644 --- a/openwire-dotnet/src/OpenWire.Core/Commands/DiscoveryEvent.cs +++ b/openwire-dotnet/src/OpenWire.Core/Commands/DiscoveryEvent.cs @@ -37,26 +37,14 @@ namespace OpenWire.Core.Commands public string ServiceName { - get - { - return serviceName; - } - set - { - serviceName = value; - } + get { return serviceName; } + set { this.serviceName = value; } } public string BrokerName { - get - { - return brokerName; - } - set - { - brokerName = value; - } + get { return brokerName; } + set { this.brokerName = value; } } } diff --git a/openwire-dotnet/src/OpenWire.Core/Commands/ExceptionResponse.cs b/openwire-dotnet/src/OpenWire.Core/Commands/ExceptionResponse.cs index 1972a3d302..f409679ba9 100644 --- a/openwire-dotnet/src/OpenWire.Core/Commands/ExceptionResponse.cs +++ b/openwire-dotnet/src/OpenWire.Core/Commands/ExceptionResponse.cs @@ -36,14 +36,8 @@ namespace OpenWire.Core.Commands public byte[] Exception { - get - { - return exception; - } - set - { - exception = value; - } + get { return exception; } + set { this.exception = value; } } } diff --git a/openwire-dotnet/src/OpenWire.Core/Commands/IntegerResponse.cs b/openwire-dotnet/src/OpenWire.Core/Commands/IntegerResponse.cs index e6d9d36428..6c3b971268 100644 --- a/openwire-dotnet/src/OpenWire.Core/Commands/IntegerResponse.cs +++ b/openwire-dotnet/src/OpenWire.Core/Commands/IntegerResponse.cs @@ -36,14 +36,8 @@ namespace OpenWire.Core.Commands public int Result { - get - { - return result; - } - set - { - result = value; - } + get { return result; } + set { this.result = value; } } } diff --git a/openwire-dotnet/src/OpenWire.Core/Commands/JournalQueueAck.cs b/openwire-dotnet/src/OpenWire.Core/Commands/JournalQueueAck.cs index 0684fdf5ff..6b6fc13e7e 100644 --- a/openwire-dotnet/src/OpenWire.Core/Commands/JournalQueueAck.cs +++ b/openwire-dotnet/src/OpenWire.Core/Commands/JournalQueueAck.cs @@ -37,26 +37,14 @@ namespace OpenWire.Core.Commands public ActiveMQDestination Destination { - get - { - return destination; - } - set - { - destination = value; - } + get { return destination; } + set { this.destination = value; } } public MessageAck MessageAck { - get - { - return messageAck; - } - set - { - messageAck = value; - } + get { return messageAck; } + set { this.messageAck = value; } } } diff --git a/openwire-dotnet/src/OpenWire.Core/Commands/JournalTopicAck.cs b/openwire-dotnet/src/OpenWire.Core/Commands/JournalTopicAck.cs index 8002f5dcd8..fa9f8aa759 100644 --- a/openwire-dotnet/src/OpenWire.Core/Commands/JournalTopicAck.cs +++ b/openwire-dotnet/src/OpenWire.Core/Commands/JournalTopicAck.cs @@ -41,74 +41,38 @@ namespace OpenWire.Core.Commands public ActiveMQDestination Destination { - get - { - return destination; - } - set - { - destination = value; - } + get { return destination; } + set { this.destination = value; } } public MessageId MessageId { - get - { - return messageId; - } - set - { - messageId = value; - } + get { return messageId; } + set { this.messageId = value; } } public long MessageSequenceId { - get - { - return messageSequenceId; - } - set - { - messageSequenceId = value; - } + get { return messageSequenceId; } + set { this.messageSequenceId = value; } } public string SubscritionName { - get - { - return subscritionName; - } - set - { - subscritionName = value; - } + get { return subscritionName; } + set { this.subscritionName = value; } } public string ClientId { - get - { - return clientId; - } - set - { - clientId = value; - } + get { return clientId; } + set { this.clientId = value; } } public TransactionId TransactionId { - get - { - return transactionId; - } - set - { - transactionId = value; - } + get { return transactionId; } + set { this.transactionId = value; } } } diff --git a/openwire-dotnet/src/OpenWire.Core/Commands/JournalTrace.cs b/openwire-dotnet/src/OpenWire.Core/Commands/JournalTrace.cs index d2f501e0f9..288e948e65 100644 --- a/openwire-dotnet/src/OpenWire.Core/Commands/JournalTrace.cs +++ b/openwire-dotnet/src/OpenWire.Core/Commands/JournalTrace.cs @@ -36,14 +36,8 @@ namespace OpenWire.Core.Commands public string Message { - get - { - return message; - } - set - { - message = value; - } + get { return message; } + set { this.message = value; } } } diff --git a/openwire-dotnet/src/OpenWire.Core/Commands/JournalTransaction.cs b/openwire-dotnet/src/OpenWire.Core/Commands/JournalTransaction.cs index a73e08efb6..cced33bd10 100644 --- a/openwire-dotnet/src/OpenWire.Core/Commands/JournalTransaction.cs +++ b/openwire-dotnet/src/OpenWire.Core/Commands/JournalTransaction.cs @@ -38,38 +38,20 @@ namespace OpenWire.Core.Commands public TransactionId TransactionId { - get - { - return transactionId; - } - set - { - transactionId = value; - } + get { return transactionId; } + set { this.transactionId = value; } } public byte Type { - get - { - return type; - } - set - { - type = value; - } + get { return type; } + set { this.type = value; } } public bool WasPrepared { - get - { - return wasPrepared; - } - set - { - wasPrepared = value; - } + get { return wasPrepared; } + set { this.wasPrepared = value; } } } diff --git a/openwire-dotnet/src/OpenWire.Core/Commands/LocalTransactionId.cs b/openwire-dotnet/src/OpenWire.Core/Commands/LocalTransactionId.cs index 461d38c4bd..74d6af0ae1 100644 --- a/openwire-dotnet/src/OpenWire.Core/Commands/LocalTransactionId.cs +++ b/openwire-dotnet/src/OpenWire.Core/Commands/LocalTransactionId.cs @@ -37,26 +37,14 @@ namespace OpenWire.Core.Commands public long Value { - get - { - return value; - } - set - { - value = value; - } + get { return value; } + set { this.value = value; } } public ConnectionId ConnectionId { - get - { - return connectionId; - } - set - { - connectionId = value; - } + get { return connectionId; } + set { this.connectionId = value; } } } diff --git a/openwire-dotnet/src/OpenWire.Core/Commands/Message.cs b/openwire-dotnet/src/OpenWire.Core/Commands/Message.cs index 84957db2e8..88830fee92 100644 --- a/openwire-dotnet/src/OpenWire.Core/Commands/Message.cs +++ b/openwire-dotnet/src/OpenWire.Core/Commands/Message.cs @@ -60,302 +60,152 @@ namespace OpenWire.Core.Commands public ProducerId ProducerId { - get - { - return producerId; - } - set - { - producerId = value; - } + get { return producerId; } + set { this.producerId = value; } } public ActiveMQDestination Destination { - get - { - return destination; - } - set - { - destination = value; - } + get { return destination; } + set { this.destination = value; } } public TransactionId TransactionId { - get - { - return transactionId; - } - set - { - transactionId = value; - } + get { return transactionId; } + set { this.transactionId = value; } } public ActiveMQDestination OriginalDestination { - get - { - return originalDestination; - } - set - { - originalDestination = value; - } + get { return originalDestination; } + set { this.originalDestination = value; } } public MessageId MessageId { - get - { - return messageId; - } - set - { - messageId = value; - } + get { return messageId; } + set { this.messageId = value; } } public TransactionId OriginalTransactionId { - get - { - return originalTransactionId; - } - set - { - originalTransactionId = value; - } + get { return originalTransactionId; } + set { this.originalTransactionId = value; } } public string GroupID { - get - { - return groupID; - } - set - { - groupID = value; - } + get { return groupID; } + set { this.groupID = value; } } public int GroupSequence { - get - { - return groupSequence; - } - set - { - groupSequence = value; - } + get { return groupSequence; } + set { this.groupSequence = value; } } public string CorrelationId { - get - { - return correlationId; - } - set - { - correlationId = value; - } + get { return correlationId; } + set { this.correlationId = value; } } public bool Persistent { - get - { - return persistent; - } - set - { - persistent = value; - } + get { return persistent; } + set { this.persistent = value; } } public long Expiration { - get - { - return expiration; - } - set - { - expiration = value; - } + get { return expiration; } + set { this.expiration = value; } } public byte Priority { - get - { - return priority; - } - set - { - priority = value; - } + get { return priority; } + set { this.priority = value; } } public ActiveMQDestination ReplyTo { - get - { - return replyTo; - } - set - { - replyTo = value; - } + get { return replyTo; } + set { this.replyTo = value; } } public long Timestamp { - get - { - return timestamp; - } - set - { - timestamp = value; - } + get { return timestamp; } + set { this.timestamp = value; } } public string Type { - get - { - return type; - } - set - { - type = value; - } + get { return type; } + set { this.type = value; } } public byte[] Content { - get - { - return content; - } - set - { - content = value; - } + get { return content; } + set { this.content = value; } } public byte[] MarshalledProperties { - get - { - return marshalledProperties; - } - set - { - marshalledProperties = value; - } + get { return marshalledProperties; } + set { this.marshalledProperties = value; } } public DataStructure DataStructure { - get - { - return dataStructure; - } - set - { - dataStructure = value; - } + get { return dataStructure; } + set { this.dataStructure = value; } } public ConsumerId TargetConsumerId { - get - { - return targetConsumerId; - } - set - { - targetConsumerId = value; - } + get { return targetConsumerId; } + set { this.targetConsumerId = value; } } public bool Compressed { - get - { - return compressed; - } - set - { - compressed = value; - } + get { return compressed; } + set { this.compressed = value; } } public int RedeliveryCounter { - get - { - return redeliveryCounter; - } - set - { - redeliveryCounter = value; - } + get { return redeliveryCounter; } + set { this.redeliveryCounter = value; } } public BrokerId[] BrokerPath { - get - { - return brokerPath; - } - set - { - brokerPath = value; - } + get { return brokerPath; } + set { this.brokerPath = value; } } public long Arrival { - get - { - return arrival; - } - set - { - arrival = value; - } + get { return arrival; } + set { this.arrival = value; } } public string UserID { - get - { - return userID; - } - set - { - userID = value; - } + get { return userID; } + set { this.userID = value; } } public bool RecievedByDFBridge { - get - { - return recievedByDFBridge; - } - set - { - recievedByDFBridge = value; - } + get { return recievedByDFBridge; } + set { this.recievedByDFBridge = value; } } } diff --git a/openwire-dotnet/src/OpenWire.Core/Commands/MessageAck.cs b/openwire-dotnet/src/OpenWire.Core/Commands/MessageAck.cs index 24760e5d17..ae23e5b843 100644 --- a/openwire-dotnet/src/OpenWire.Core/Commands/MessageAck.cs +++ b/openwire-dotnet/src/OpenWire.Core/Commands/MessageAck.cs @@ -42,86 +42,44 @@ namespace OpenWire.Core.Commands public ActiveMQDestination Destination { - get - { - return destination; - } - set - { - destination = value; - } + get { return destination; } + set { this.destination = value; } } public TransactionId TransactionId { - get - { - return transactionId; - } - set - { - transactionId = value; - } + get { return transactionId; } + set { this.transactionId = value; } } public ConsumerId ConsumerId { - get - { - return consumerId; - } - set - { - consumerId = value; - } + get { return consumerId; } + set { this.consumerId = value; } } public byte AckType { - get - { - return ackType; - } - set - { - ackType = value; - } + get { return ackType; } + set { this.ackType = value; } } public MessageId FirstMessageId { - get - { - return firstMessageId; - } - set - { - firstMessageId = value; - } + get { return firstMessageId; } + set { this.firstMessageId = value; } } public MessageId LastMessageId { - get - { - return lastMessageId; - } - set - { - lastMessageId = value; - } + get { return lastMessageId; } + set { this.lastMessageId = value; } } public int MessageCount { - get - { - return messageCount; - } - set - { - messageCount = value; - } + get { return messageCount; } + set { this.messageCount = value; } } } diff --git a/openwire-dotnet/src/OpenWire.Core/Commands/MessageDispatch.cs b/openwire-dotnet/src/OpenWire.Core/Commands/MessageDispatch.cs index 23f6862018..b47e27cd57 100644 --- a/openwire-dotnet/src/OpenWire.Core/Commands/MessageDispatch.cs +++ b/openwire-dotnet/src/OpenWire.Core/Commands/MessageDispatch.cs @@ -39,50 +39,26 @@ namespace OpenWire.Core.Commands public ConsumerId ConsumerId { - get - { - return consumerId; - } - set - { - consumerId = value; - } + get { return consumerId; } + set { this.consumerId = value; } } public ActiveMQDestination Destination { - get - { - return destination; - } - set - { - destination = value; - } + get { return destination; } + set { this.destination = value; } } public Message Message { - get - { - return message; - } - set - { - message = value; - } + get { return message; } + set { this.message = value; } } public int RedeliveryCounter { - get - { - return redeliveryCounter; - } - set - { - redeliveryCounter = value; - } + get { return redeliveryCounter; } + set { this.redeliveryCounter = value; } } } diff --git a/openwire-dotnet/src/OpenWire.Core/Commands/MessageId.cs b/openwire-dotnet/src/OpenWire.Core/Commands/MessageId.cs index 0c4ad804c1..d09b90705d 100644 --- a/openwire-dotnet/src/OpenWire.Core/Commands/MessageId.cs +++ b/openwire-dotnet/src/OpenWire.Core/Commands/MessageId.cs @@ -38,38 +38,20 @@ namespace OpenWire.Core.Commands public ProducerId ProducerId { - get - { - return producerId; - } - set - { - producerId = value; - } + get { return producerId; } + set { this.producerId = value; } } public long ProducerSequenceId { - get - { - return producerSequenceId; - } - set - { - producerSequenceId = value; - } + get { return producerSequenceId; } + set { this.producerSequenceId = value; } } public long BrokerSequenceId { - get - { - return brokerSequenceId; - } - set - { - brokerSequenceId = value; - } + get { return brokerSequenceId; } + set { this.brokerSequenceId = value; } } } diff --git a/openwire-dotnet/src/OpenWire.Core/Commands/ProducerId.cs b/openwire-dotnet/src/OpenWire.Core/Commands/ProducerId.cs index 8abc71ec81..ee5d642dfc 100644 --- a/openwire-dotnet/src/OpenWire.Core/Commands/ProducerId.cs +++ b/openwire-dotnet/src/OpenWire.Core/Commands/ProducerId.cs @@ -19,7 +19,7 @@ namespace OpenWire.Core.Commands public const byte ID_ProducerId = 123; string connectionId; - long producerId; + long value; long sessionId; @@ -38,38 +38,20 @@ namespace OpenWire.Core.Commands public string ConnectionId { - get - { - return connectionId; - } - set - { - connectionId = value; - } + get { return connectionId; } + set { this.connectionId = value; } } - public long ProducerIdValue + public long Value { - get - { - return producerId; - } - set - { - producerId = value; - } + get { return value; } + set { this.value = value; } } public long SessionId { - get - { - return sessionId; - } - set - { - sessionId = value; - } + get { return sessionId; } + set { this.sessionId = value; } } } diff --git a/openwire-dotnet/src/OpenWire.Core/Commands/ProducerInfo.cs b/openwire-dotnet/src/OpenWire.Core/Commands/ProducerInfo.cs index 8d886508ff..8f4a667bba 100644 --- a/openwire-dotnet/src/OpenWire.Core/Commands/ProducerInfo.cs +++ b/openwire-dotnet/src/OpenWire.Core/Commands/ProducerInfo.cs @@ -38,38 +38,20 @@ namespace OpenWire.Core.Commands public ProducerId ProducerId { - get - { - return producerId; - } - set - { - producerId = value; - } + get { return producerId; } + set { this.producerId = value; } } public ActiveMQDestination Destination { - get - { - return destination; - } - set - { - destination = value; - } + get { return destination; } + set { this.destination = value; } } public BrokerId[] BrokerPath { - get - { - return brokerPath; - } - set - { - brokerPath = value; - } + get { return brokerPath; } + set { this.brokerPath = value; } } } diff --git a/openwire-dotnet/src/OpenWire.Core/Commands/RemoveInfo.cs b/openwire-dotnet/src/OpenWire.Core/Commands/RemoveInfo.cs index 98494415d3..f273defdd5 100644 --- a/openwire-dotnet/src/OpenWire.Core/Commands/RemoveInfo.cs +++ b/openwire-dotnet/src/OpenWire.Core/Commands/RemoveInfo.cs @@ -36,14 +36,8 @@ namespace OpenWire.Core.Commands public DataStructure ObjectId { - get - { - return objectId; - } - set - { - objectId = value; - } + get { return objectId; } + set { this.objectId = value; } } } diff --git a/openwire-dotnet/src/OpenWire.Core/Commands/RemoveSubscriptionInfo.cs b/openwire-dotnet/src/OpenWire.Core/Commands/RemoveSubscriptionInfo.cs index 94f1f63c5a..9f69d9c68b 100644 --- a/openwire-dotnet/src/OpenWire.Core/Commands/RemoveSubscriptionInfo.cs +++ b/openwire-dotnet/src/OpenWire.Core/Commands/RemoveSubscriptionInfo.cs @@ -38,38 +38,20 @@ namespace OpenWire.Core.Commands public ConnectionId ConnectionId { - get - { - return connectionId; - } - set - { - connectionId = value; - } + get { return connectionId; } + set { this.connectionId = value; } } public string SubcriptionName { - get - { - return subcriptionName; - } - set - { - subcriptionName = value; - } + get { return subcriptionName; } + set { this.subcriptionName = value; } } public string ClientId { - get - { - return clientId; - } - set - { - clientId = value; - } + get { return clientId; } + set { this.clientId = value; } } } diff --git a/openwire-dotnet/src/OpenWire.Core/Commands/Response.cs b/openwire-dotnet/src/OpenWire.Core/Commands/Response.cs index d50082f0ed..d04f691cd2 100644 --- a/openwire-dotnet/src/OpenWire.Core/Commands/Response.cs +++ b/openwire-dotnet/src/OpenWire.Core/Commands/Response.cs @@ -36,14 +36,8 @@ namespace OpenWire.Core.Commands public short CorrelationId { - get - { - return correlationId; - } - set - { - correlationId = value; - } + get { return correlationId; } + set { this.correlationId = value; } } } diff --git a/openwire-dotnet/src/OpenWire.Core/Commands/SessionId.cs b/openwire-dotnet/src/OpenWire.Core/Commands/SessionId.cs index e6dff29cb4..442e56293a 100644 --- a/openwire-dotnet/src/OpenWire.Core/Commands/SessionId.cs +++ b/openwire-dotnet/src/OpenWire.Core/Commands/SessionId.cs @@ -37,26 +37,14 @@ namespace OpenWire.Core.Commands public string ConnectionId { - get - { - return connectionId; - } - set - { - connectionId = value; - } + get { return connectionId; } + set { this.connectionId = value; } } public long Value { - get - { - return value; - } - set - { - value = value; - } + get { return value; } + set { this.value = value; } } } diff --git a/openwire-dotnet/src/OpenWire.Core/Commands/SessionInfo.cs b/openwire-dotnet/src/OpenWire.Core/Commands/SessionInfo.cs index a624a2652b..2c8bd801e4 100644 --- a/openwire-dotnet/src/OpenWire.Core/Commands/SessionInfo.cs +++ b/openwire-dotnet/src/OpenWire.Core/Commands/SessionInfo.cs @@ -36,14 +36,8 @@ namespace OpenWire.Core.Commands public SessionId SessionId { - get - { - return sessionId; - } - set - { - sessionId = value; - } + get { return sessionId; } + set { this.sessionId = value; } } } diff --git a/openwire-dotnet/src/OpenWire.Core/Commands/SubscriptionInfo.cs b/openwire-dotnet/src/OpenWire.Core/Commands/SubscriptionInfo.cs index 573daf97bf..beb7ec7632 100644 --- a/openwire-dotnet/src/OpenWire.Core/Commands/SubscriptionInfo.cs +++ b/openwire-dotnet/src/OpenWire.Core/Commands/SubscriptionInfo.cs @@ -39,50 +39,26 @@ namespace OpenWire.Core.Commands public string ClientId { - get - { - return clientId; - } - set - { - clientId = value; - } + get { return clientId; } + set { this.clientId = value; } } public ActiveMQDestination Destination { - get - { - return destination; - } - set - { - destination = value; - } + get { return destination; } + set { this.destination = value; } } public string Selector { - get - { - return selector; - } - set - { - selector = value; - } + get { return selector; } + set { this.selector = value; } } public string SubcriptionName { - get - { - return subcriptionName; - } - set - { - subcriptionName = value; - } + get { return subcriptionName; } + set { this.subcriptionName = value; } } } diff --git a/openwire-dotnet/src/OpenWire.Core/Commands/TransactionInfo.cs b/openwire-dotnet/src/OpenWire.Core/Commands/TransactionInfo.cs index eb2f09b041..ca6cc7179f 100644 --- a/openwire-dotnet/src/OpenWire.Core/Commands/TransactionInfo.cs +++ b/openwire-dotnet/src/OpenWire.Core/Commands/TransactionInfo.cs @@ -38,38 +38,20 @@ namespace OpenWire.Core.Commands public ConnectionId ConnectionId { - get - { - return connectionId; - } - set - { - connectionId = value; - } + get { return connectionId; } + set { this.connectionId = value; } } public TransactionId TransactionId { - get - { - return transactionId; - } - set - { - transactionId = value; - } + get { return transactionId; } + set { this.transactionId = value; } } public byte Type { - get - { - return type; - } - set - { - type = value; - } + get { return type; } + set { this.type = value; } } } diff --git a/openwire-dotnet/src/OpenWire.Core/Commands/WireFormatInfo.cs b/openwire-dotnet/src/OpenWire.Core/Commands/WireFormatInfo.cs index 467f03bafc..e17d54d2d4 100644 --- a/openwire-dotnet/src/OpenWire.Core/Commands/WireFormatInfo.cs +++ b/openwire-dotnet/src/OpenWire.Core/Commands/WireFormatInfo.cs @@ -38,38 +38,20 @@ namespace OpenWire.Core.Commands public byte[] Magic { - get - { - return magic; - } - set - { - magic = value; - } + get { return magic; } + set { this.magic = value; } } public int Version { - get - { - return version; - } - set - { - version = value; - } + get { return version; } + set { this.version = value; } } public int Options { - get - { - return options; - } - set - { - options = value; - } + get { return options; } + set { this.options = value; } } } diff --git a/openwire-dotnet/src/OpenWire.Core/Commands/XATransactionId.cs b/openwire-dotnet/src/OpenWire.Core/Commands/XATransactionId.cs index 266a257f62..60469c3761 100644 --- a/openwire-dotnet/src/OpenWire.Core/Commands/XATransactionId.cs +++ b/openwire-dotnet/src/OpenWire.Core/Commands/XATransactionId.cs @@ -38,38 +38,20 @@ namespace OpenWire.Core.Commands public int FormatId { - get - { - return formatId; - } - set - { - formatId = value; - } + get { return formatId; } + set { this.formatId = value; } } public byte[] GlobalTransactionId { - get - { - return globalTransactionId; - } - set - { - globalTransactionId = value; - } + get { return globalTransactionId; } + set { this.globalTransactionId = value; } } public byte[] BranchQualifier { - get - { - return branchQualifier; - } - set - { - branchQualifier = value; - } + get { return branchQualifier; } + set { this.branchQualifier = value; } } } diff --git a/openwire-dotnet/src/OpenWire.Core/DataStructure.cs b/openwire-dotnet/src/OpenWire.Core/DataStructure.cs index 4f0742c441..91e5065348 100755 --- a/openwire-dotnet/src/OpenWire.Core/DataStructure.cs +++ b/openwire-dotnet/src/OpenWire.Core/DataStructure.cs @@ -1,14 +1,11 @@ using System; -namespace OpenWire.Core -{ - /// - /// An OpenWire command - /// - public interface DataStructure { - - byte GetCommandType(); - - } -} +namespace OpenWire.Core { + /// + /// An OpenWire command + /// + public interface DataStructure { + byte GetCommandType(); + } +} diff --git a/openwire-dotnet/src/OpenWire.Core/Destination.cs b/openwire-dotnet/src/OpenWire.Core/Destination.cs index 960c93d54d..594fb8a1e0 100755 --- a/openwire-dotnet/src/OpenWire.Core/Destination.cs +++ b/openwire-dotnet/src/OpenWire.Core/Destination.cs @@ -1,12 +1,10 @@ using System; using OpenWire.Core.Commands; -namespace OpenWire.Core -{ - /// - /// Summary description for Destination. - /// - public interface Destination - { - } +namespace OpenWire.Core { + /// + /// Summary description for Destination. + /// + public interface Destination { + } } diff --git a/openwire-dotnet/src/OpenWire.Core/DestinationFilter.cs b/openwire-dotnet/src/OpenWire.Core/DestinationFilter.cs index 5fb90ca18b..29d374ba52 100755 --- a/openwire-dotnet/src/OpenWire.Core/DestinationFilter.cs +++ b/openwire-dotnet/src/OpenWire.Core/DestinationFilter.cs @@ -1,24 +1,18 @@ using System; using OpenWire.Core.Commands; -namespace OpenWire.Core -{ - /// - /// Summary description for DestinationFilter. - /// - public abstract class DestinationFilter - { - public const String ANY_DESCENDENT = ">"; - public const String ANY_CHILD = "*"; +namespace OpenWire.Core { + /// + /// Summary description for DestinationFilter. + /// + public abstract class DestinationFilter { + public const String ANY_DESCENDENT = ">"; + public const String ANY_CHILD = "*"; - public bool matches(ActiveMQMessage message) - { - return matches(message.Destination); - } - - public abstract bool matches(ActiveMQDestination destination); - - - } + public bool matches(ActiveMQMessage message) { + return matches(message.Destination); + } + public abstract bool matches(ActiveMQDestination destination); + } } diff --git a/openwire-dotnet/src/OpenWire.Core/IO/ProducerIdMarshaller.cs b/openwire-dotnet/src/OpenWire.Core/IO/ProducerIdMarshaller.cs index b8cd61bff7..714b0ac377 100644 --- a/openwire-dotnet/src/OpenWire.Core/IO/ProducerIdMarshaller.cs +++ b/openwire-dotnet/src/OpenWire.Core/IO/ProducerIdMarshaller.cs @@ -30,7 +30,7 @@ namespace OpenWire.Core.IO ProducerId info = (ProducerId) command; info.ConnectionId = dataIn.ReadString(); - info.ProducerIdValue = dataIn.ReadInt64(); + info.Value = dataIn.ReadInt64(); info.SessionId = dataIn.ReadInt64(); } @@ -40,7 +40,7 @@ namespace OpenWire.Core.IO ProducerId info = (ProducerId) command; dataOut.Write(info.ConnectionId); - dataOut.Write(info.ProducerIdValue); + dataOut.Write(info.Value); dataOut.Write(info.SessionId); } diff --git a/openwire-dotnet/src/OpenWire.Core/Queue.cs b/openwire-dotnet/src/OpenWire.Core/Queue.cs index 27db567e17..31b85bc0b7 100755 --- a/openwire-dotnet/src/OpenWire.Core/Queue.cs +++ b/openwire-dotnet/src/OpenWire.Core/Queue.cs @@ -1,16 +1,14 @@ using System; using OpenWire.Core.Commands; -namespace OpenWire.Core -{ - /// - /// Summary description for Queue. - /// - public interface Queue : Destination { +namespace OpenWire.Core { + /// + /// Summary description for Queue. + /// + public interface Queue : Destination { - String QueueName - { - get; - } - } -} \ No newline at end of file + String QueueName { + get; + } + } +} diff --git a/openwire-dotnet/src/OpenWire.Core/TemporaryQueue.cs b/openwire-dotnet/src/OpenWire.Core/TemporaryQueue.cs index 94a1914b55..ebed1d0379 100755 --- a/openwire-dotnet/src/OpenWire.Core/TemporaryQueue.cs +++ b/openwire-dotnet/src/OpenWire.Core/TemporaryQueue.cs @@ -1,12 +1,10 @@ using System; using OpenWire.Core.Commands; -namespace OpenWire.Core -{ - /// - /// Summary description for TemporaryQueue. - /// - public interface TemporaryQueue : Destination - { - } +namespace OpenWire.Core { + /// + /// Summary description for TemporaryQueue. + /// + public interface TemporaryQueue : Destination { + } } diff --git a/openwire-dotnet/src/OpenWire.Core/TemporaryTopic.cs b/openwire-dotnet/src/OpenWire.Core/TemporaryTopic.cs index 68e13c3084..95d8708f2e 100755 --- a/openwire-dotnet/src/OpenWire.Core/TemporaryTopic.cs +++ b/openwire-dotnet/src/OpenWire.Core/TemporaryTopic.cs @@ -1,12 +1,10 @@ using System; using OpenWire.Core.Commands; -namespace OpenWire.Core -{ - /// - /// Summary description for TemporaryTopic. - /// - public interface TemporaryTopic : Destination - { - } +namespace OpenWire.Core { + /// + /// Summary description for TemporaryTopic. + /// + public interface TemporaryTopic : Destination { + } } diff --git a/openwire-dotnet/src/OpenWire.Core/Topic.cs b/openwire-dotnet/src/OpenWire.Core/Topic.cs index ada479d90a..613719c059 100755 --- a/openwire-dotnet/src/OpenWire.Core/Topic.cs +++ b/openwire-dotnet/src/OpenWire.Core/Topic.cs @@ -1,17 +1,14 @@ using System; using OpenWire.Core.Commands; -namespace OpenWire.Core -{ - /// - /// Summary description for Topic. - /// - public interface Topic : Destination - { +namespace OpenWire.Core { + /// + /// Summary description for Topic. + /// + public interface Topic : Destination { - String TopicName - { - get; - } - } + String TopicName { + get; + } + } } diff --git a/openwire-dotnet/src/OpenWire.Core/TransactionConstants.cs b/openwire-dotnet/src/OpenWire.Core/TransactionConstants.cs index ab2f7da2db..91534fb1df 100755 --- a/openwire-dotnet/src/OpenWire.Core/TransactionConstants.cs +++ b/openwire-dotnet/src/OpenWire.Core/TransactionConstants.cs @@ -1,68 +1,66 @@ using System; -namespace OpenWire.Core -{ - /// - /// Summary description for TransactionConstants. - /// - public class TransactionType - { - - /** - * Transaction state not set - */ - const int NOT_SET = 0; - /** - * Start a transaction - */ - const int START = 101; - /** - * Pre-commit a transaction - */ - const int PRE_COMMIT = 102; - /** - * Commit a transaction - */ - const int COMMIT = 103; - /** - * Recover a transaction - */ - const int RECOVER = 104; - /** - * Rollback a transaction - */ - const int ROLLBACK = 105; - /** - * End a transaction - */ - const int END = 106; - /** - * Forget a transaction - */ - const int FORGET = 107; - /** - * Join a transaction - */ - const int JOIN = 108; - /** - * Do a one phase commit... No PRE COMMIT has been done. - */ - const int COMMIT_ONE_PHASE = 109; - /** - * Get a list of all the XIDs that are currently prepared. - */ - const int XA_RECOVER = 110; - /** - * Get a the transaction timeout for the RM - */ - const int GET_TX_TIMEOUT = 111; - /** - * Set a the transaction timeout for the RM - */ - const int SET_TX_TIMEOUT = 112; - /** - * Gets the unique id of the resource manager. - */ - const int GET_RM_ID = 113; - } +namespace OpenWire.Core { + /// + /// Summary description for TransactionConstants. + /// + public class TransactionType { + + /** + * Transaction state not set + */ + const int NOT_SET = 0; + /** + * Start a transaction + */ + const int START = 101; + /** + * Pre-commit a transaction + */ + const int PRE_COMMIT = 102; + /** + * Commit a transaction + */ + const int COMMIT = 103; + /** + * Recover a transaction + */ + const int RECOVER = 104; + /** + * Rollback a transaction + */ + const int ROLLBACK = 105; + /** + * End a transaction + */ + const int END = 106; + /** + * Forget a transaction + */ + const int FORGET = 107; + /** + * Join a transaction + */ + const int JOIN = 108; + /** + * Do a one phase commit... No PRE COMMIT has been done. + */ + const int COMMIT_ONE_PHASE = 109; + /** + * Get a list of all the XIDs that are currently prepared. + */ + const int XA_RECOVER = 110; + /** + * Get a the transaction timeout for the RM + */ + const int GET_TX_TIMEOUT = 111; + /** + * Set a the transaction timeout for the RM + */ + const int SET_TX_TIMEOUT = 112; + /** + * Gets the unique id of the resource manager. + */ + const int GET_RM_ID = 113; + } } diff --git a/openwire-dotnet/src/OpenWire.Core/Transport/FutureResponse.cs b/openwire-dotnet/src/OpenWire.Core/Transport/FutureResponse.cs new file mode 100755 index 0000000000..5dc5c36f3b --- /dev/null +++ b/openwire-dotnet/src/OpenWire.Core/Transport/FutureResponse.cs @@ -0,0 +1,44 @@ +using System; +using System.Threading; + +using OpenWire.Core; +using OpenWire.Core.Commands; + +namespace OpenWire.Core.Transport { + /// + /// Handles asynchronous responses + /// + public class FutureResponse : IAsyncResult { + + private Response response; + private Mutex asyncWaitHandle = new Mutex(); + private bool isCompleted; + + public WaitHandle AsyncWaitHandle { + get { return asyncWaitHandle; } + } + + public object AsyncState { + get { return response; } + set { response = (Response) value; } + } + + public bool IsCompleted { + get { return isCompleted; } + } + + public bool CompletedSynchronously { + get { return false; } + } + + public Response Response { + get { return response; } + set { + asyncWaitHandle.WaitOne(); + response = value; + isCompleted = true; + asyncWaitHandle.ReleaseMutex(); + } + } + } +} diff --git a/openwire-dotnet/src/OpenWire.Core/Transport/Transport.cs b/openwire-dotnet/src/OpenWire.Core/Transport/Transport.cs new file mode 100755 index 0000000000..34b024b0d7 --- /dev/null +++ b/openwire-dotnet/src/OpenWire.Core/Transport/Transport.cs @@ -0,0 +1,24 @@ +using System; + +using OpenWire.Core; +using OpenWire.Core.Commands; + +namespace OpenWire.Core.Transport { + + public delegate void CommandHandler(Transport sender, Command command); + public delegate void ExceptionHandler(Transport sender, Exception command); + + /// + /// Represents the logical networking transport layer. + /// + public interface Transport { + void Oneway(Command command); + + FutureResponse AsyncRequest(Command command); + + Response Request(Command command); + + event CommandHandler Command; + event ExceptionHandler Exception; + } +}