Author: jgomes
Date: Wed Oct 7 18:09:03 2009
New Revision: 822815
URL: http://svn.apache.org/viewvc?rev=822815&view=rev
Log:
Added ConnectionMetaData support to the EMS and MSMQ provider implementations.
Fixes [AMQNET-96]. (See https://issues.apache.org/activemq/browse/AMQNET-96)
Added:
activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/ConnectionMetaData.cs
activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/ConnectionMetaData.cs
Modified:
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Connection.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/ConnectionMetaData.cs
activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/Connection.cs
activemq/activemq-dotnet/Apache.NMS.EMS/trunk/vs2008-ems.csproj
activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Connection.cs
activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/vs2008-msmq.csproj
activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/IConnection.cs
Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Connection.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Connection.cs?rev=822815&r1=822814&r2=822815&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Connection.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Connection.cs Wed Oct
7 18:09:03 2009
@@ -37,13 +37,13 @@
private BrokerInfo brokerInfo; // from broker
private WireFormatInfo brokerWireFormatInfo; // from broker
private readonly IList sessions = ArrayList.Synchronized(new ArrayList());
- private readonly IDictionary producers = Hashtable.Synchronized(new Hashtable());
+ private readonly IDictionary producers = Hashtable.Synchronized(new Hashtable());
private readonly object myLock = new object();
private bool asyncSend = false;
- private bool alwaysSyncSend = false;
+ private bool alwaysSyncSend = false;
private bool asyncClose = true;
- private bool copyMessageOnSend = true;
- private int producerWindowSize = 0;
+ private bool copyMessageOnSend = true;
+ private int producerWindowSize = 0;
private bool connected = false;
private bool closed = false;
private bool closing = false;
@@ -51,7 +51,7 @@
private int temporaryDestinationCounter = 0;
private int localTransactionCounter;
private readonly Atomic<bool> started = new Atomic<bool>(false);
- private ConnectionMetaData metaData = null;
+ private ConnectionMetaData metaData = null;
private bool disposed = false;
public Connection(Uri connectionUri, ITransport transport, ConnectionInfo info)
@@ -74,24 +74,24 @@
public event ExceptionListener ExceptionListener;
#region Properties
-
- /// <summary>
- /// This property indicates what version of the Protocol we are using to
- /// communicate with the Broker, if not set we return the lowest version
- /// number to indicate we support only the basic command set.
- /// </summary>
- public int ProtocolVersion
- {
- get
- {
- if(brokerWireFormatInfo != null)
- {
- return brokerWireFormatInfo.Version;
- }
-
- return 1;
- }
- }
+
+ /// <summary>
+ /// This property indicates what version of the Protocol we are using to
+ /// communicate with the Broker, if not set we return the lowest version
+ /// number to indicate we support only the basic command set.
+ /// </summary>
+ public int ProtocolVersion
+ {
+ get
+ {
+ if(brokerWireFormatInfo != null)
+ {
+ return brokerWireFormatInfo.Version;
+ }
+
+ return 1;
+ }
+ }
/// <summary>
/// This property indicates whether or not async send is enabled.
@@ -123,59 +123,51 @@
{
set { this.acknowledgementMode = NMSConvert.ToAcknowledgementMode(value); }
}
-
- /// <summary>
- /// This property is the maximum number of bytes in memory that a producer will transmit
- /// to a broker before waiting for acknowledgement messages from the broker that
it has
- /// accepted the previously sent messages. In other words, this how you configure
the
- /// producer flow control window that is used for async sends where the client is
responsible
- /// for managing memory usage. The default value of 0 means no flow control at the
client
- /// </summary>
- public int ProducerWindowSize
- {
- get { return producerWindowSize; }
- set { producerWindowSize = value; }
- }
-
- /// <summary>
- /// This property forces all messages that are sent to be sent synchronously overriding
- /// any usage of the AsyncSend flag. This can reduce performance in some cases since
the
- /// only messages we normally send synchronously are Persistent messages not sent
in a
- /// transaction. This options guarantees that no send will return until the broker
has
- /// acknowledge receipt of the message
- /// </summary>
- public bool AlwaysSyncSend
- {
- get { return alwaysSyncSend; }
- set { alwaysSyncSend = value; }
- }
-
- /// <summary>
- /// This property indicates whether Message's should be copied before being sent
via
- /// one of the Connection's send methods. Copying the Message object allows the
user
- /// to resuse the Object over for another send. If the message isn't copied performance
- /// can improve but the user must not reuse the Object as it may not have been sent
- /// before they reset its payload.
- /// </summary>
- public bool CopyMessageOnSend
- {
- get { return copyMessageOnSend; }
- set { copyMessageOnSend = value; }
- }
-
- public IConnectionMetaData MetaData
- {
- get
- {
- if(this.metaData == null)
- {
- this.metaData = new ConnectionMetaData();
- }
-
- return this.metaData;
- }
- }
-
+
+ /// <summary>
+ /// This property is the maximum number of bytes in memory that a producer will transmit
+ /// to a broker before waiting for acknowledgement messages from the broker that it has
+ /// accepted the previously sent messages. In other words, this how you configure the
+ /// producer flow control window that is used for async sends where the client is responsible
+ /// for managing memory usage. The default value of 0 means no flow control at the client
+ /// </summary>
+ public int ProducerWindowSize
+ {
+ get { return producerWindowSize; }
+ set { producerWindowSize = value; }
+ }
+
+ /// <summary>
+ /// This property forces all messages that are sent to be sent synchronously overriding
+ /// any usage of the AsyncSend flag. This can reduce performance in some cases since the
+ /// only messages we normally send synchronously are Persistent messages not sent in a
+ /// transaction. This options guarantees that no send will return until the broker has
+ /// acknowledge receipt of the message
+ /// </summary>
+ public bool AlwaysSyncSend
+ {
+ get { return alwaysSyncSend; }
+ set { alwaysSyncSend = value; }
+ }
+
+ /// <summary>
+ /// This property indicates whether Message's should be copied before being sent via
+ /// one of the Connection's send methods. Copying the Message object allows the user
+ /// to resuse the Object over for another send. If the message isn't copied performance
+ /// can improve but the user must not reuse the Object as it may not have been sent
+ /// before they reset its payload.
+ /// </summary>
+ public bool CopyMessageOnSend
+ {
+ get { return copyMessageOnSend; }
+ set { copyMessageOnSend = value; }
+ }
+
+ public IConnectionMetaData MetaData
+ {
+ get { return this.metaData ?? (this.metaData = new ConnectionMetaData()); }
+ }
+
#endregion
/// <summary>
@@ -264,16 +256,16 @@
sessions.Remove(session);
}
}
-
- public void addProducer( ProducerId id, MessageProducer producer )
- {
- this.producers.Add( id, producer );
- }
-
- public void removeProducer( ProducerId id )
- {
- this.producers.Remove( id );
- }
+
+ public void addProducer( ProducerId id, MessageProducer producer )
+ {
+ this.producers.Add( id, producer );
+ }
+
+ public void removeProducer( ProducerId id )
+ {
+ this.producers.Remove( id );
+ }
public void Close()
{
@@ -513,8 +505,8 @@
/// <param name="commandTransport">An ITransport</param>
/// <param name="command">A Command</param>
protected void OnCommand(ITransport commandTransport, Command command)
- {
- if(command is MessageDispatch)
+ {
+ if(command is MessageDispatch)
{
DispatchMessage((MessageDispatch) command);
}
@@ -539,13 +531,13 @@
}
else if(command is ProducerAck)
{
- ProducerAck ack = (ProducerAck) command;
- if(ack != null && ack.ProducerId != null) {
- MessageProducer producer = (MessageProducer) producers[ack.ProducerId];
- if( producer != null ) {
- producer.OnProducerAck(ack);
- }
- }
+ ProducerAck ack = (ProducerAck) command;
+ if(ack != null && ack.ProducerId != null) {
+ MessageProducer producer = (MessageProducer) producers[ack.ProducerId];
+ if( producer != null ) {
+ producer.OnProducerAck(ack);
+ }
+ }
}
else if(command is ConnectionError)
{
@@ -583,9 +575,9 @@
// This is a bit of a hack since we should really be sending the entire dispatch to
// the Consumer.
dispatch.Message.Destination = dispatch.Destination;
- dispatch.Message.ReadOnlyBody = true;
- dispatch.Message.ReadOnlyProperties = true;
- dispatch.Message.RedeliveryCounter = dispatch.RedeliveryCounter;
+ dispatch.Message.ReadOnlyBody = true;
+ dispatch.Message.ReadOnlyProperties = true;
+ dispatch.Message.RedeliveryCounter = dispatch.RedeliveryCounter;
lock(sessions.SyncRoot)
{
@@ -645,12 +637,12 @@
protected void OnTransportInterrupted(ITransport sender)
{
- Tracer.Debug("Transport has been Interrupted.");
+ Tracer.Debug("Transport has been Interrupted.");
}
protected void OnTransportResumed(ITransport sender)
{
- Tracer.Debug("Transport has resumed normal operation.");
+ Tracer.Debug("Transport has resumed normal operation.");
}
internal void OnSessionException(Session sender, Exception exception)
Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/ConnectionMetaData.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/ConnectionMetaData.cs?rev=822815&r1=822814&r2=822815&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/ConnectionMetaData.cs
(original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/ConnectionMetaData.cs
Wed Oct 7 18:09:03 2009
@@ -21,90 +21,90 @@
namespace Apache.NMS.ActiveMQ
{
- /// <summary>
- /// Implements the Connection Meta-Data feature for Apache.NMS.ActiveMQ
- /// </summary>
- public class ConnectionMetaData : IConnectionMetaData
- {
- private int nmsMajorVersion;
- private int nmsMinorVersion;
-
- private string nmsProviderName;
- private string nmsVersion;
-
- private int providerMajorVersion;
- private int providerMinorVersion;
- private string providerVersion;
-
- private string[] nmsxProperties;
-
- public ConnectionMetaData()
- {
- Assembly self = Assembly.GetExecutingAssembly();
- AssemblyName asmName = self.GetName();
-
- this.nmsProviderName = asmName.Name;
- this.providerMajorVersion = asmName.Version.Major;
- this.providerMinorVersion = asmName.Version.Minor;
- this.providerVersion = asmName.Version.ToString();
-
- this.nmsxProperties =
- new String[]{ "NMSXGroupID", "NMSXGroupSeq", "NMSXDeliveryCount", "NMSXProducerTXID"
};
-
- foreach( AssemblyName name in self.GetReferencedAssemblies() )
- {
- if( name.Name == "Apache.NMS" )
- {
- this.nmsMajorVersion = name.Version.Major;
- this.nmsMinorVersion = name.Version.Minor;
- this.nmsVersion = name.Version.ToString();
-
- return;
- }
- }
-
- throw new NMSException("Could not find a reference to the Apache.NMS Assembly.");
- }
-
- public int NMSMajorVersion
- {
- get{ return this.nmsMajorVersion; }
- }
-
- public int NMSMinorVersion
- {
- get{ return this.nmsMinorVersion; }
- }
-
- public string NMSProviderName
- {
- get{ return this.nmsProviderName; }
- }
-
- public string NMSVersion
- {
- get{ return this.nmsVersion; }
- }
-
- public string[] NMSXPropertyNames
- {
- get{ return this.nmsxProperties; }
- }
-
- public int ProviderMajorVersion
- {
- get{ return this.providerMajorVersion; }
- }
-
- public int ProviderMinorVersion
- {
- get{ return this.providerMinorVersion; }
- }
-
- public string ProviderVersion
- {
- get{ return this.providerVersion; }
- }
-
- }
+ /// <summary>
+ /// Implements the Connection Meta-Data feature for Apache.NMS.ActiveMQ
+ /// </summary>
+ public class ConnectionMetaData : IConnectionMetaData
+ {
+ private int nmsMajorVersion;
+ private int nmsMinorVersion;
+
+ private string nmsProviderName;
+ private string nmsVersion;
+
+ private int providerMajorVersion;
+ private int providerMinorVersion;
+ private string providerVersion;
+
+ private string[] nmsxProperties;
+
+ public ConnectionMetaData()
+ {
+ Assembly self = Assembly.GetExecutingAssembly();
+ AssemblyName asmName = self.GetName();
+
+ this.nmsProviderName = asmName.Name;
+ this.providerMajorVersion = asmName.Version.Major;
+ this.providerMinorVersion = asmName.Version.Minor;
+ this.providerVersion = asmName.Version.ToString();
+
+ this.nmsxProperties =
+ new String[]{ "NMSXGroupID", "NMSXGroupSeq", "NMSXDeliveryCount", "NMSXProducerTXID"
};
+
+ foreach(AssemblyName name in self.GetReferencedAssemblies())
+ {
+ if(0 == string.Compare(name.Name, "Apache.NMS", true))
+ {
+ this.nmsMajorVersion = name.Version.Major;
+ this.nmsMinorVersion = name.Version.Minor;
+ this.nmsVersion = name.Version.ToString();
+
+ return;
+ }
+ }
+
+ throw new NMSException("Could not find a reference to the Apache.NMS Assembly.");
+ }
+
+ public int NMSMajorVersion
+ {
+ get{ return this.nmsMajorVersion; }
+ }
+
+ public int NMSMinorVersion
+ {
+ get{ return this.nmsMinorVersion; }
+ }
+
+ public string NMSProviderName
+ {
+ get{ return this.nmsProviderName; }
+ }
+
+ public string NMSVersion
+ {
+ get{ return this.nmsVersion; }
+ }
+
+ public string[] NMSXPropertyNames
+ {
+ get{ return this.nmsxProperties; }
+ }
+
+ public int ProviderMajorVersion
+ {
+ get{ return this.providerMajorVersion; }
+ }
+
+ public int ProviderMinorVersion
+ {
+ get{ return this.providerMinorVersion; }
+ }
+
+ public string ProviderVersion
+ {
+ get{ return this.providerVersion; }
+ }
+
+ }
}
Modified: activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/Connection.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/Connection.cs?rev=822815&r1=822814&r2=822815&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/Connection.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/Connection.cs Wed Oct 7
18:09:03 2009
@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
using System;
using Apache.NMS.Util;
@@ -27,6 +28,7 @@
{
private Apache.NMS.AcknowledgementMode acknowledgementMode;
public readonly TIBCO.EMS.Connection tibcoConnection;
+ private ConnectionMetaData metaData = null;
private readonly Atomic<bool> started = new Atomic<bool>(false);
private bool closed = false;
private bool disposed = false;
@@ -172,6 +174,11 @@
set { this.tibcoConnection.ClientID = value; }
}
+ public IConnectionMetaData MetaData
+ {
+ get { return this.metaData ?? (this.metaData = new ConnectionMetaData()); }
+ }
+
#endregion
public event Apache.NMS.ExceptionListener ExceptionListener;
Added: activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/ConnectionMetaData.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/ConnectionMetaData.cs?rev=822815&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/ConnectionMetaData.cs (added)
+++ activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/ConnectionMetaData.cs Wed
Oct 7 18:09:03 2009
@@ -0,0 +1,107 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Reflection;
+
+namespace Apache.NMS.EMS
+{
+ /// <summary>
+ /// Implements the Connection Meta-Data feature for Apache.NMS.EMS
+ /// </summary>
+ public class ConnectionMetaData : IConnectionMetaData
+ {
+ private int nmsMajorVersion;
+ private int nmsMinorVersion;
+
+ private string nmsProviderName;
+ private string nmsVersion;
+
+ private int providerMajorVersion;
+ private int providerMinorVersion;
+ private string providerVersion;
+
+ private string[] nmsxProperties;
+
+ public ConnectionMetaData()
+ {
+ Assembly self = Assembly.GetExecutingAssembly();
+ AssemblyName asmName = self.GetName();
+
+ this.nmsProviderName = asmName.Name;
+ this.providerMajorVersion = asmName.Version.Major;
+ this.providerMinorVersion = asmName.Version.Minor;
+ this.providerVersion = asmName.Version.ToString();
+
+ this.nmsxProperties = new String[] { };
+
+ foreach(AssemblyName name in self.GetReferencedAssemblies())
+ {
+ if(0 == string.Compare(name.Name, "Apache.NMS", true))
+ {
+ this.nmsMajorVersion = name.Version.Major;
+ this.nmsMinorVersion = name.Version.Minor;
+ this.nmsVersion = name.Version.ToString();
+
+ return;
+ }
+ }
+
+ throw new NMSException("Could not find a reference to the Apache.NMS Assembly.");
+ }
+
+ public int NMSMajorVersion
+ {
+ get { return this.nmsMajorVersion; }
+ }
+
+ public int NMSMinorVersion
+ {
+ get { return this.nmsMinorVersion; }
+ }
+
+ public string NMSProviderName
+ {
+ get { return this.nmsProviderName; }
+ }
+
+ public string NMSVersion
+ {
+ get { return this.nmsVersion; }
+ }
+
+ public string[] NMSXPropertyNames
+ {
+ get { return this.nmsxProperties; }
+ }
+
+ public int ProviderMajorVersion
+ {
+ get { return this.providerMajorVersion; }
+ }
+
+ public int ProviderMinorVersion
+ {
+ get { return this.providerMinorVersion; }
+ }
+
+ public string ProviderVersion
+ {
+ get { return this.providerVersion; }
+ }
+ }
+}
Modified: activemq/activemq-dotnet/Apache.NMS.EMS/trunk/vs2008-ems.csproj
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.EMS/trunk/vs2008-ems.csproj?rev=822815&r1=822814&r2=822815&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.EMS/trunk/vs2008-ems.csproj (original)
+++ activemq/activemq-dotnet/Apache.NMS.EMS/trunk/vs2008-ems.csproj Wed Oct 7 18:09:03 2009
@@ -60,6 +60,7 @@
<HintPath>lib\Apache.NMS\net-2.0\Apache.NMS.dll</HintPath>
</Reference>
<Reference Include="System" />
+ <Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="TIBCO.EMS, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5b83db8ff05c64ba">
<SpecificVersion>False</SpecificVersion>
@@ -71,6 +72,7 @@
<Compile Include="src\main\csharp\CommonAssemblyInfo.cs" />
<Compile Include="src\main\csharp\Connection.cs" />
<Compile Include="src\main\csharp\ConnectionFactory.cs" />
+ <Compile Include="src\main\csharp\ConnectionMetaData.cs" />
<Compile Include="src\main\csharp\StreamMessage.cs" />
<Compile Include="src\main\csharp\QueueBrowser.cs" />
<Compile Include="src\main\csharp\Destination.cs" />
Modified: activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Connection.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Connection.cs?rev=822815&r1=822814&r2=822815&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Connection.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Connection.cs Wed Oct
7 18:09:03 2009
@@ -29,6 +29,7 @@
private AcknowledgementMode acknowledgementMode = AcknowledgementMode.AutoAcknowledge;
private IMessageConverter messageConverter = new DefaultMessageConverter();
+ private ConnectionMetaData metaData = null;
private bool connected;
private bool closed;
private string clientId;
@@ -114,6 +115,11 @@
}
}
+ public IConnectionMetaData MetaData
+ {
+ get { return this.metaData ?? (this.metaData = new ConnectionMetaData()); }
+ }
+
public event ExceptionListener ExceptionListener;
protected void CheckConnected()
Added: activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/ConnectionMetaData.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/ConnectionMetaData.cs?rev=822815&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/ConnectionMetaData.cs (added)
+++ activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/ConnectionMetaData.cs Wed
Oct 7 18:09:03 2009
@@ -0,0 +1,107 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Reflection;
+
+namespace Apache.NMS.MSMQ
+{
+ /// <summary>
+ /// Implements the Connection Meta-Data feature for Apache.NMS.MSMQ
+ /// </summary>
+ public class ConnectionMetaData : IConnectionMetaData
+ {
+ private int nmsMajorVersion;
+ private int nmsMinorVersion;
+
+ private string nmsProviderName;
+ private string nmsVersion;
+
+ private int providerMajorVersion;
+ private int providerMinorVersion;
+ private string providerVersion;
+
+ private string[] nmsxProperties;
+
+ public ConnectionMetaData()
+ {
+ Assembly self = Assembly.GetExecutingAssembly();
+ AssemblyName asmName = self.GetName();
+
+ this.nmsProviderName = asmName.Name;
+ this.providerMajorVersion = asmName.Version.Major;
+ this.providerMinorVersion = asmName.Version.Minor;
+ this.providerVersion = asmName.Version.ToString();
+
+ this.nmsxProperties = new String[] { };
+
+ foreach(AssemblyName name in self.GetReferencedAssemblies())
+ {
+ if(0 == string.Compare(name.Name, "Apache.NMS", true))
+ {
+ this.nmsMajorVersion = name.Version.Major;
+ this.nmsMinorVersion = name.Version.Minor;
+ this.nmsVersion = name.Version.ToString();
+
+ return;
+ }
+ }
+
+ throw new NMSException("Could not find a reference to the Apache.NMS Assembly.");
+ }
+
+ public int NMSMajorVersion
+ {
+ get { return this.nmsMajorVersion; }
+ }
+
+ public int NMSMinorVersion
+ {
+ get { return this.nmsMinorVersion; }
+ }
+
+ public string NMSProviderName
+ {
+ get { return this.nmsProviderName; }
+ }
+
+ public string NMSVersion
+ {
+ get { return this.nmsVersion; }
+ }
+
+ public string[] NMSXPropertyNames
+ {
+ get { return this.nmsxProperties; }
+ }
+
+ public int ProviderMajorVersion
+ {
+ get { return this.providerMajorVersion; }
+ }
+
+ public int ProviderMinorVersion
+ {
+ get { return this.providerMinorVersion; }
+ }
+
+ public string ProviderVersion
+ {
+ get { return this.providerVersion; }
+ }
+ }
+}
Modified: activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/vs2008-msmq.csproj
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/vs2008-msmq.csproj?rev=822815&r1=822814&r2=822815&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/vs2008-msmq.csproj (original)
+++ activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/vs2008-msmq.csproj Wed Oct 7 18:09:03
2009
@@ -61,6 +61,7 @@
<HintPath>lib\Apache.NMS\net-2.0\Apache.NMS.dll</HintPath>
</Reference>
<Reference Include="System" />
+ <Reference Include="System.Data" />
<Reference Include="System.Messaging" />
<Reference Include="System.Xml" />
</ItemGroup>
@@ -70,6 +71,7 @@
<Compile Include="src\main\csharp\CommonAssemblyInfo.cs" />
<Compile Include="src\main\csharp\Connection.cs" />
<Compile Include="src\main\csharp\ConnectionFactory.cs" />
+ <Compile Include="src\main\csharp\ConnectionMetaData.cs" />
<Compile Include="src\main\csharp\DefaultMessageConverter.cs" />
<Compile Include="src\main\csharp\Destination.cs" />
<Compile Include="src\main\csharp\IMessageConverter.cs" />
Modified: activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/IConnection.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/IConnection.cs?rev=822815&r1=822814&r2=822815&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/IConnection.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/IConnection.cs Wed Oct 7 18:09:03
2009
@@ -103,11 +103,11 @@
/// </summary>
string ClientId { get; set; }
- /// <summary>
- /// Gets the Meta Data for the NMS Connection instance.
- /// </summary>
- IConnectionMetaData MetaData{ get; }
-
+ /// <summary>
+ /// Gets the Meta Data for the NMS Connection instance.
+ /// </summary>
+ IConnectionMetaData MetaData{ get; }
+
#endregion
}
}
|