From 04ac4aec80c5723e85b44c25d632adc72de61aa8 Mon Sep 17 00:00:00 2001 From: markpollack Date: Thu, 18 Jun 2009 06:49:31 +0000 Subject: [PATCH] TIBCO EMS QuickStart Add additional constructors to ConnectionFactory Remove comments referring to 'NMS' --- .../Ems/Common/EmsConnectionFactory.cs | 37 ++++++++++++++----- .../Ems/Config/EmsNamespaceParser.cs | 2 +- .../Ems/Connections/CachedMessageConsumer .cs | 2 +- .../Ems/Connections/CachedSession.cs | 2 +- .../Connections/CachingConnectionFactory.cs | 6 +-- .../Connections/SingleConnectionFactory.cs | 12 +++--- .../Messaging/Ems/Core/EmsTemplate.cs | 4 +- .../SimpleMessageListenerContainer.cs | 4 +- .../Support/Converter/XmlMessageConverter.cs | 10 ++--- .../Spring.Messaging.Ems.2005.csproj | 4 ++ 10 files changed, 53 insertions(+), 30 deletions(-) diff --git a/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Common/EmsConnectionFactory.cs b/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Common/EmsConnectionFactory.cs index 9a21d5d2..e2b0af7e 100644 --- a/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Common/EmsConnectionFactory.cs +++ b/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Common/EmsConnectionFactory.cs @@ -19,6 +19,7 @@ #endregion using System; +using System.Collections; using System.IO; using System.Runtime.Serialization; using Spring.Objects.Factory; @@ -35,7 +36,23 @@ namespace Spring.Messaging.Ems.Common private string sslProxyHost; private int sslProxyPort; + public EmsConnectionFactory() + { + this.nativeConnectionFactory = new ConnectionFactory(); + } + public EmsConnectionFactory(string serverUrl) : this(serverUrl, null, null) + { + } + + public EmsConnectionFactory(string serverUrl, string clientId) : this(serverUrl, clientId, null) + { + } + + public EmsConnectionFactory(string serverUrl, string clientId, Hashtable properties) + { + this.nativeConnectionFactory = new ConnectionFactory(serverUrl, clientId, properties); + } public EmsConnectionFactory(ConnectionFactory nativeConnectionFactory) { @@ -196,11 +213,6 @@ namespace Spring.Messaging.Ems.Common set { nativeConnectionFactory.SetSSLAuthOnly(value); } } - public void SetSSLProxy(string host, int port) - { - nativeConnectionFactory.SetSSLProxy(host, port); - } - public string SSLProxyAuthUsername { set { this.sslProxyAuthUsername = value; } @@ -248,10 +260,17 @@ namespace Spring.Messaging.Ems.Common #region Implementation of IInitializingObject - public void AfterPropertiesSet() - { - nativeConnectionFactory.SetSSLProxyAuth(this.sslProxyAuthUsername, this.sslProxyAuthPassword); - nativeConnectionFactory.SetSSLProxy(this.sslProxyHost, this.sslProxyPort); + public void AfterPropertiesSet() { + + if (this.sslProxyAuthUsername != null && sslProxyAuthPassword != null) + { + nativeConnectionFactory.SetSSLProxyAuth(this.sslProxyAuthUsername, this.sslProxyAuthPassword); + } + if (sslProxyHost != null && sslProxyPort != null) + { + nativeConnectionFactory.SetSSLProxy(this.sslProxyHost, this.sslProxyPort); + } + } #endregion diff --git a/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Config/EmsNamespaceParser.cs b/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Config/EmsNamespaceParser.cs index 36a264ea..972c64a1 100644 --- a/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Config/EmsNamespaceParser.cs +++ b/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Config/EmsNamespaceParser.cs @@ -24,7 +24,7 @@ using Spring.Objects.Factory.Xml; namespace Spring.Messaging.Ems.Config { /// - /// Namespace parser for the nms namespace. + /// Namespace parser for the EMS namespace. /// /// Mark Fisher /// Juergen Hoeller diff --git a/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Connections/CachedMessageConsumer .cs b/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Connections/CachedMessageConsumer .cs index 0aca247b..57653342 100644 --- a/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Connections/CachedMessageConsumer .cs +++ b/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Connections/CachedMessageConsumer .cs @@ -25,7 +25,7 @@ using TIBCO.EMS; namespace Spring.Messaging.Ems.Connections { /// - /// NMS MessageConsumer decorator that adapts all calls + /// EMS MessageConsumer decorator that adapts all calls /// to a shared MessageConsumer instance underneath. /// /// Juergen Hoeller diff --git a/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Connections/CachedSession.cs b/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Connections/CachedSession.cs index 3d4ec8bc..5e8a0f66 100644 --- a/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Connections/CachedSession.cs +++ b/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Connections/CachedSession.cs @@ -351,7 +351,7 @@ namespace Spring.Messaging.Ems.Connections } if (LOG.IsDebugEnabled) { - LOG.Debug("Creating cached NMS MessageConsumer for destination [" + destination + "]: " + consumer); + LOG.Debug("Creating cached EMS MessageConsumer for destination [" + destination + "]: " + consumer); } cachedConsumers[cacheKey] = consumer; } diff --git a/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Connections/CachingConnectionFactory.cs b/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Connections/CachingConnectionFactory.cs index 9ba643df..bc01eff7 100644 --- a/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Connections/CachingConnectionFactory.cs +++ b/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Connections/CachingConnectionFactory.cs @@ -42,7 +42,7 @@ namespace Spring.Messaging.Ems.Connections /// /// NOTE: This ConnectionFactory requires explicit closing of all Sessions /// obtained from its shared Connection. This is the usual recommendation for - /// native NMS access code anyway. However, with this ConnectionFactory, its use + /// native EMS access code anyway. However, with this ConnectionFactory, its use /// is mandatory in order to actually allow for Session reuse. /// /// @@ -143,7 +143,7 @@ namespace Spring.Messaging.Ems.Connections /// /// Gets or sets a value indicating whether o cache JMS MessageConsumers per - /// NMS Session instance. + /// EMS Session instance. /// /// /// Mmore specifically: one MessageConsumer per Destination, selector String @@ -192,7 +192,7 @@ namespace Spring.Messaging.Ems.Connections } catch (Exception ex) { - LOG.Trace("Could not close cached NMS Session", ex); + LOG.Trace("Could not close cached EMS Session", ex); } } } diff --git a/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Connections/SingleConnectionFactory.cs b/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Connections/SingleConnectionFactory.cs index d15b080b..d605f361 100644 --- a/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Connections/SingleConnectionFactory.cs +++ b/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Connections/SingleConnectionFactory.cs @@ -164,7 +164,7 @@ namespace Spring.Messaging.Ems.Connections /// /// Gets or sets a value indicating whether the single Connection - /// should be reset (to be subsequently renewed) when a NMSException + /// should be reset (to be subsequently renewed) when a EMSException /// is reported by the underlying Connection. /// /// @@ -441,7 +441,7 @@ namespace Spring.Messaging.Ems.Connections PrepareConnection(this.target); if (LOG.IsDebugEnabled) { - LOG.Info("Established shared NMS Connection: " + this.target); + LOG.Info("Established shared EMS Connection: " + this.target); } this.connection = GetSharedConnection(target); } @@ -462,7 +462,7 @@ namespace Spring.Messaging.Ems.Connections /// Can be overridden in subclasses. /// /// The Connection to prepare. - /// if thrown by any NMS API methods. + /// if thrown by any EMS API methods. protected virtual void PrepareConnection(IConnection con) { if (ClientId != null) @@ -511,7 +511,7 @@ namespace Spring.Messaging.Ems.Connections { if (LOG.IsDebugEnabled) { - LOG.Debug("Closing shared NMS Connection: " + this.target); + LOG.Debug("Closing shared EMS Connection: " + this.target); } try { @@ -528,7 +528,7 @@ namespace Spring.Messaging.Ems.Connections } } catch (Exception ex) { - LOG.Warn("Could not close shared NMS connection.", ex); + LOG.Warn("Could not close shared EMS connection.", ex); } } @@ -630,7 +630,7 @@ namespace Spring.Messaging.Ems.Connections } /// - /// Add information to show this is a shared NMS connection + /// Add information to show this is a shared EMS connection /// /// Description of connection wrapper public override string ToString() diff --git a/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Core/EmsTemplate.cs b/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Core/EmsTemplate.cs index 7c839da0..6c813607 100644 --- a/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Core/EmsTemplate.cs +++ b/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Core/EmsTemplate.cs @@ -1450,7 +1450,7 @@ namespace Spring.Messaging.Ems.Core Destination destination = DefaultDestination; if (!(destination is Queue)) { - throw new InvalidOperationException("defaultDestination does not correspond to a Queue. Check configuration of NmsTemplate."); + throw new InvalidOperationException("defaultDestination does not correspond to a Queue. Check configuration of EmsTemplate."); } return BrowseWithDelegate((Queue)destination, action); } @@ -1499,7 +1499,7 @@ namespace Spring.Messaging.Ems.Core Destination destination = DefaultDestination; if (!(destination is Queue)) { - throw new InvalidOperationException("defaultDestination does not correspond to a Queue. Check configuration of NmsTemplate."); + throw new InvalidOperationException("defaultDestination does not correspond to a Queue. Check configuration of EmsTemplate."); } return BrowseSelectedWithDelegate((Queue)destination, messageSelector, action); } diff --git a/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Listener/SimpleMessageListenerContainer.cs b/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Listener/SimpleMessageListenerContainer.cs index f27a7745..65611f2b 100644 --- a/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Listener/SimpleMessageListenerContainer.cs +++ b/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Listener/SimpleMessageListenerContainer.cs @@ -325,7 +325,7 @@ namespace Spring.Messaging.Ems.Listener { if (consumers != null) { - logger.Debug("Closing NMS MessageConsumers"); + logger.Debug("Closing EMS MessageConsumers"); foreach (IMessageConsumer messageConsumer in consumers) { EmsUtils.CloseMessageConsumer(messageConsumer); @@ -333,7 +333,7 @@ namespace Spring.Messaging.Ems.Listener } if (sessions != null) { - logger.Debug("Closing NMS Sessions"); + logger.Debug("Closing EMS Sessions"); foreach (ISession session in sessions) { EmsUtils.CloseSession(session); diff --git a/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Support/Converter/XmlMessageConverter.cs b/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Support/Converter/XmlMessageConverter.cs index 9ec7cb3d..9f7cfdb1 100644 --- a/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Support/Converter/XmlMessageConverter.cs +++ b/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Support/Converter/XmlMessageConverter.cs @@ -31,13 +31,13 @@ namespace Spring.Messaging.Ems.Support.Converter } /// - /// Convert a .NET object to a NMS Message using the supplied session + /// Convert a .NET object to a EMS Message using the supplied session /// to create the message object. /// /// the object to convert - /// the Session to use for creating a NMS Message - /// the NMS Message - /// NMSException if thrown by NMS API methods + /// the Session to use for creating a EMS Message + /// the EMS Message + /// EMSException if thrown by EMS API methods /// MessageConversionException in case of conversion failure public Message ToMessage(object objectToConvert, ISession session) { @@ -97,7 +97,7 @@ namespace Spring.Messaging.Ems.Support.Converter } /// - /// Convert from a NMS Message to a .NET object. + /// Convert from a EMS Message to a .NET object. /// /// the message to convert /// the converted .NET object diff --git a/src/Spring/Spring.Messaging.Ems/Spring.Messaging.Ems.2005.csproj b/src/Spring/Spring.Messaging.Ems/Spring.Messaging.Ems.2005.csproj index cc41cb7e..327b93a2 100644 --- a/src/Spring/Spring.Messaging.Ems/Spring.Messaging.Ems.2005.csproj +++ b/src/Spring/Spring.Messaging.Ems/Spring.Messaging.Ems.2005.csproj @@ -60,14 +60,18 @@ + + + +