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
This commit is contained in:
James Strachan 2006-01-10 10:56:34 +00:00
parent c3a767b21e
commit 788bfbef25
55 changed files with 1145 additions and 2106 deletions

View File

@ -1,155 +1,82 @@
using System;
using OpenWire.Core;
using OpenWire.Core.Commands;
namespace OpenWire.Core
{
/// <summary>
/// Summary description for AbstractCommand.
/// </summary>
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>
/// Summary description for AbstractCommand.
/// </summary>
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;
}
}
}

View File

@ -4,115 +4,101 @@ using System.IO;
using OpenWire.Core.Commands;
using OpenWire.Core.IO;
namespace OpenWire.Core
{
/// <summary>
/// A base class with useful implementation inheritence methods
/// for creating marshallers of the OpenWire protocol
/// </summary>
public abstract class AbstractCommandMarshaller {
namespace OpenWire.Core {
/// <summary>
/// A base class with useful implementation inheritence methods
/// for creating marshallers of the OpenWire protocol
/// </summary>
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);
}
}
}

View File

@ -1,463 +1,443 @@
using System;
using OpenWire.Core.Commands;
namespace OpenWire.Core
{
/// <summary>
/// Summary description for ActiveMQDestination.
/// </summary>
public abstract class ActiveMQDestination : AbstractCommand, Destination {
namespace OpenWire.Core {
/// <summary>
/// Summary description for ActiveMQDestination.
/// </summary>
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.
* <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() {
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.
* <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() {
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);
}
}

View File

@ -2,31 +2,28 @@ using System;
using OpenWire.Core;
using OpenWire.Core.Commands;
namespace OpenWire.Core
{
/// <summary>
/// Summary description for ActiveMQQueue.
/// </summary>
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>
/// Summary description for ActiveMQQueue.
/// </summary>
public class ActiveMQQueue : ActiveMQDestination, Queue {
public const byte ID_ActiveMQQueue = 100;
public override ActiveMQDestination CreateDestination(String name) {
return new ActiveMQQueue(name);
}
}
}
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);
}
}
}

View File

@ -2,28 +2,28 @@ using System;
using OpenWire.Core;
using OpenWire.Core.Commands;
namespace OpenWire.Core
{
/// <summary>
/// Summary description for ActiveMQTempQueue.
/// </summary>
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>
/// Summary description for ActiveMQTempQueue.
/// </summary>
public class ActiveMQTempQueue : ActiveMQDestination, TemporaryQueue {
public const byte ID_ActiveMQTempQueue = 102;
public override ActiveMQDestination CreateDestination(String name) {
return new ActiveMQTempQueue(name);
}
}
}
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);
}
}
}

View File

@ -2,31 +2,27 @@ using System;
using OpenWire.Core;
using OpenWire.Core.Commands;
namespace OpenWire.Core
{
/// <summary>
/// Summary description for ActiveMQTempTopic.
/// </summary>
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>
/// Summary description for ActiveMQTempTopic.
/// </summary>
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);
}
}
}

View File

@ -2,34 +2,28 @@ using System;
using OpenWire.Core;
using OpenWire.Core.Commands;
namespace OpenWire.Core
{
/// <summary>
/// Summary description for ActiveMQTopic.
/// </summary>
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>
/// Summary description for ActiveMQTopic.
/// </summary>
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);
}
}
}

View File

@ -1,12 +1,9 @@
using System;
namespace OpenWire.Core
{
/// <summary>
/// An OpenWire command
/// </summary>
public interface Command : DataStructure {
}
namespace OpenWire.Core {
/// <summary>
/// An OpenWire command
/// </summary>
public interface Command : DataStructure {
}
}

View File

@ -1,157 +0,0 @@
using System;
namespace OpenWire.Core
{
/// <summary>
/// TODO autogenerate this file!
/// </summary>
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;
}
}

View File

@ -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; }
}
}
}

View File

@ -36,14 +36,8 @@ namespace OpenWire.Core.Commands
public string Value
{
get
{
return value;
}
set
{
value = value;
}
get { return value; }
set { this.value = value; }
}
}

View File

@ -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; }
}
}

View File

@ -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; }
}
}

View File

@ -36,14 +36,8 @@ namespace OpenWire.Core.Commands
public string Value
{
get
{
return value;
}
set
{
value = value;
}
get { return value; }
set { this.value = value; }
}
}

View File

@ -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; }
}
}

View File

@ -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; }
}
}

View File

@ -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; }
}
}

View File

@ -36,14 +36,8 @@ namespace OpenWire.Core.Commands
public string Command
{
get
{
return command;
}
set
{
command = value;
}
get { return command; }
set { this.command = value; }
}
}

View File

@ -36,14 +36,8 @@ namespace OpenWire.Core.Commands
public DataStructure[] Data
{
get
{
return data;
}
set
{
data = value;
}
get { return data; }
set { this.data = value; }
}
}

View File

@ -36,14 +36,8 @@ namespace OpenWire.Core.Commands
public DataStructure Data
{
get
{
return data;
}
set
{
data = value;
}
get { return data; }
set { this.data = value; }
}
}

View File

@ -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; }
}
}

View File

@ -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; }
}
}

View File

@ -36,14 +36,8 @@ namespace OpenWire.Core.Commands
public byte[] Exception
{
get
{
return exception;
}
set
{
exception = value;
}
get { return exception; }
set { this.exception = value; }
}
}

View File

@ -36,14 +36,8 @@ namespace OpenWire.Core.Commands
public int Result
{
get
{
return result;
}
set
{
result = value;
}
get { return result; }
set { this.result = value; }
}
}

View File

@ -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; }
}
}

View File

@ -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; }
}
}

View File

@ -36,14 +36,8 @@ namespace OpenWire.Core.Commands
public string Message
{
get
{
return message;
}
set
{
message = value;
}
get { return message; }
set { this.message = value; }
}
}

View File

@ -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; }
}
}

View File

@ -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; }
}
}

View File

@ -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; }
}
}

View File

@ -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; }
}
}

View File

@ -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; }
}
}

View File

@ -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; }
}
}

View File

@ -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; }
}
}

View File

@ -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; }
}
}

View File

@ -36,14 +36,8 @@ namespace OpenWire.Core.Commands
public DataStructure ObjectId
{
get
{
return objectId;
}
set
{
objectId = value;
}
get { return objectId; }
set { this.objectId = value; }
}
}

View File

@ -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; }
}
}

View File

@ -36,14 +36,8 @@ namespace OpenWire.Core.Commands
public short CorrelationId
{
get
{
return correlationId;
}
set
{
correlationId = value;
}
get { return correlationId; }
set { this.correlationId = value; }
}
}

View File

@ -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; }
}
}

View File

@ -36,14 +36,8 @@ namespace OpenWire.Core.Commands
public SessionId SessionId
{
get
{
return sessionId;
}
set
{
sessionId = value;
}
get { return sessionId; }
set { this.sessionId = value; }
}
}

View File

@ -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; }
}
}

View File

@ -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; }
}
}

View File

@ -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; }
}
}

View File

@ -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; }
}
}

View File

@ -1,14 +1,11 @@
using System;
namespace OpenWire.Core
{
/// <summary>
/// An OpenWire command
/// </summary>
public interface DataStructure {
byte GetCommandType();
}
}
namespace OpenWire.Core {
/// <summary>
/// An OpenWire command
/// </summary>
public interface DataStructure {
byte GetCommandType();
}
}

View File

@ -1,12 +1,10 @@
using System;
using OpenWire.Core.Commands;
namespace OpenWire.Core
{
/// <summary>
/// Summary description for Destination.
/// </summary>
public interface Destination
{
}
namespace OpenWire.Core {
/// <summary>
/// Summary description for Destination.
/// </summary>
public interface Destination {
}
}

View File

@ -1,24 +1,18 @@
using System;
using OpenWire.Core.Commands;
namespace OpenWire.Core
{
/// <summary>
/// Summary description for DestinationFilter.
/// </summary>
public abstract class DestinationFilter
{
public const String ANY_DESCENDENT = ">";
public const String ANY_CHILD = "*";
namespace OpenWire.Core {
/// <summary>
/// Summary description for DestinationFilter.
/// </summary>
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);
}
}

View File

@ -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);
}

View File

@ -1,16 +1,14 @@
using System;
using OpenWire.Core.Commands;
namespace OpenWire.Core
{
/// <summary>
/// Summary description for Queue.
/// </summary>
public interface Queue : Destination {
namespace OpenWire.Core {
/// <summary>
/// Summary description for Queue.
/// </summary>
public interface Queue : Destination {
String QueueName
{
get;
}
}
}
String QueueName {
get;
}
}
}

View File

@ -1,12 +1,10 @@
using System;
using OpenWire.Core.Commands;
namespace OpenWire.Core
{
/// <summary>
/// Summary description for TemporaryQueue.
/// </summary>
public interface TemporaryQueue : Destination
{
}
namespace OpenWire.Core {
/// <summary>
/// Summary description for TemporaryQueue.
/// </summary>
public interface TemporaryQueue : Destination {
}
}

View File

@ -1,12 +1,10 @@
using System;
using OpenWire.Core.Commands;
namespace OpenWire.Core
{
/// <summary>
/// Summary description for TemporaryTopic.
/// </summary>
public interface TemporaryTopic : Destination
{
}
namespace OpenWire.Core {
/// <summary>
/// Summary description for TemporaryTopic.
/// </summary>
public interface TemporaryTopic : Destination {
}
}

View File

@ -1,17 +1,14 @@
using System;
using OpenWire.Core.Commands;
namespace OpenWire.Core
{
/// <summary>
/// Summary description for Topic.
/// </summary>
public interface Topic : Destination
{
namespace OpenWire.Core {
/// <summary>
/// Summary description for Topic.
/// </summary>
public interface Topic : Destination {
String TopicName
{
get;
}
}
String TopicName {
get;
}
}
}

View File

@ -1,68 +1,66 @@
using System;
namespace OpenWire.Core
{
/// <summary>
/// Summary description for TransactionConstants.
/// </summary>
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>
/// Summary description for TransactionConstants.
/// </summary>
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;
}
}

View File

@ -0,0 +1,44 @@
using System;
using System.Threading;
using OpenWire.Core;
using OpenWire.Core.Commands;
namespace OpenWire.Core.Transport {
/// <summary>
/// Handles asynchronous responses
/// </summary>
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();
}
}
}
}

View File

@ -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);
/// <summary>
/// Represents the logical networking transport layer.
/// </summary>
public interface Transport {
void Oneway(Command command);
FutureResponse AsyncRequest(Command command);
Response Request(Command command);
event CommandHandler Command;
event ExceptionHandler Exception;
}
}