From 32aa99ff87c21854d338aa0b8f6187c2417908d5 Mon Sep 17 00:00:00 2001 From: markpollack Date: Tue, 16 Nov 2010 16:41:52 +0000 Subject: [PATCH] SPRNET-1390 - Allow for dependency injection on object returned from TIBCO EMS's JndiLookupFactoryObject --- doc/reference/src/messaging-ems.xml | 25 +++++++++++-------- .../Ems/Jndi/JndiLookupFactoryObject.cs | 15 ++++++++++- .../Messaging/Ems/Jndi/JndiObjectLocator.cs | 2 +- 3 files changed, 30 insertions(+), 12 deletions(-) diff --git a/doc/reference/src/messaging-ems.xml b/doc/reference/src/messaging-ems.xml index fee8bbec..b84166b7 100644 --- a/doc/reference/src/messaging-ems.xml +++ b/doc/reference/src/messaging-ems.xml @@ -224,7 +224,7 @@ application context the class JndiFactoryObject is used. This allows you look configure the location of the JNDI registry and to retrieve objects by name. The objects are retrieved from - JNDI at application startup. + JNDI at application startup. These retrieved objetcts from JNDI in turn can be dependency injected into other collaborating objects such as Spring's @@ -237,11 +237,16 @@ <property name="JndiProperties[LookupContext.PROVIDER_URL]" value="tibjmsnaming://localhost:7222"/> </object> - JndiLookupFactory object implements the IFactoryObject interface, - so the type that is associated with the name 'jndiConnectionFactory' is - not JndiLookupFactoryObject, but the type returned from this factory's - 'GetType' method, in this case the type of what was retrieved from - JNDI. + JndiLookupFactory object implements the + IConfigurableFactoryObject interface, so + the type that is associated with the name 'jndiConnectionFactory' is not + JndiLookupFactoryObject, but the type returned from this factory's + 'GetType' method, in this case the type of what was retrieved from JNDI. + The IConfigurableFactoryObject interface + also allows for the object that was returned to be dependency injected. + Please refer to the documentation on + IConfigurableFactoryObject for more + information. The dictionary JndiProperties is set using Spring Expression @@ -253,7 +258,7 @@ The use of this object retrieved from JNDI to configure Spring's CachingConnectionFactory set the property TargetConnectionFactory as - shown below + shown below <object id="cachingJndiConnectionFactory" type="Spring.Messaging.Ems.Connections.CachingConnectionFactory, Spring.Messaging.Ems"> <property name="SessionCacheSize" value="10" /> @@ -329,7 +334,7 @@ Spring's MessageListenerContainer's are used to process messages asynchronously and concurrently. MessageListenerContainers are described more in this - section. + section.
@@ -352,7 +357,7 @@ linkend="activemq-sending-messages">section aside from the use of type destination type TIBCO.EMS.Destination instead of Apache.NMS.IDestination and switching of the namespace from Apache.NMS - to Spring.Messaging.Ems.Common. + to Spring.Messaging.Ems.Common. Shown below is the code example for a SimplePublisher using Spring's TIBCO EMS classes. This does now show the 'one-liner' send @@ -482,7 +487,7 @@ namespace Spring.Messaging.Ems.Core
- Asynchronous Reception + Asynchronous Reception Please refer to this section for an diff --git a/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Jndi/JndiLookupFactoryObject.cs b/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Jndi/JndiLookupFactoryObject.cs index 1c1f9b1c..a326e351 100644 --- a/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Jndi/JndiLookupFactoryObject.cs +++ b/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Jndi/JndiLookupFactoryObject.cs @@ -21,13 +21,14 @@ using System; using Spring.Core.TypeResolution; using Spring.Objects.Factory; +using Spring.Objects.Factory.Config; using Spring.Util; using TIBCO.EMS; using Common.Logging; namespace Spring.Messaging.Ems.Jndi { - public class JndiLookupFactoryObject : JndiObjectLocator, IFactoryObject + public class JndiLookupFactoryObject : JndiObjectLocator, IConfigurableFactoryObject { static JndiLookupFactoryObject() { @@ -37,6 +38,7 @@ namespace Spring.Messaging.Ems.Jndi private object defaultObject; private Object jndiObject; + private IObjectDefinition productTemplate; public JndiLookupFactoryObject() { @@ -143,5 +145,16 @@ namespace Spring.Messaging.Ems.Jndi throw; } } + + /// + /// Gets the template object definition that should be used + /// to configure the instance of the object managed by this factory. + /// + /// + public IObjectDefinition ProductTemplate + { + get { return productTemplate; } + set { productTemplate = value; } + } } } \ No newline at end of file diff --git a/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Jndi/JndiObjectLocator.cs b/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Jndi/JndiObjectLocator.cs index debc5e90..21d5e9e4 100644 --- a/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Jndi/JndiObjectLocator.cs +++ b/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Jndi/JndiObjectLocator.cs @@ -40,7 +40,7 @@ namespace Spring.Messaging.Ems.Jndi /// /// Juergen Hoeller /// Mark Pollack (.NET) - public abstract class JndiObjectLocator : JndiLocatorSupport, IInitializingObject + public abstract class JndiObjectLocator : JndiLocatorSupport { private string jndiName;