public class MapConnectionFactoryLookup extends Object implements ConnectionFactoryLookup
ConnectionFactoryLookup
implementation that relies
on a map for doing lookups.
Useful for testing environments or applications that need to match
arbitrary String
names to target ConnectionFactory
objects.
Constructor and Description |
---|
MapConnectionFactoryLookup()
Create a new instance of the
MapConnectionFactoryLookup class. |
MapConnectionFactoryLookup(Map<String,ConnectionFactory> connectionFactories)
Create a new instance of the
MapConnectionFactoryLookup class. |
MapConnectionFactoryLookup(String connectionFactoryName,
ConnectionFactory connectionFactory)
Create a new instance of the
MapConnectionFactoryLookup class. |
Modifier and Type | Method and Description |
---|---|
void |
addConnectionFactory(String connectionFactoryName,
ConnectionFactory connectionFactory)
Add the supplied
ConnectionFactory to the map of
ConnectionFactory instances maintained by this object. |
Map<String,ConnectionFactory> |
getConnectionFactories()
Get the
Map of ConnectionFactories maintained by this object. |
ConnectionFactory |
getConnectionFactory(String connectionFactoryName)
Retrieve the
ConnectionFactory identified by the given name. |
void |
setConnectionFactories(Map<String,ConnectionFactory> connectionFactories)
Set the
Map of ConnectionFactories . |
public MapConnectionFactoryLookup()
MapConnectionFactoryLookup
class.public MapConnectionFactoryLookup(Map<String,ConnectionFactory> connectionFactories)
MapConnectionFactoryLookup
class.connectionFactories
- the Map
of ConnectionFactory
.
The keys are Strings
, the values are actual ConnectionFactory
instances.public MapConnectionFactoryLookup(String connectionFactoryName, ConnectionFactory connectionFactory)
MapConnectionFactoryLookup
class.connectionFactoryName
- the name under which the supplied ConnectionFactory
is to be addedconnectionFactory
- the ConnectionFactory
to be addedpublic void setConnectionFactories(Map<String,ConnectionFactory> connectionFactories)
Map
of ConnectionFactories
.
The keys are Strings
, the values are actual ConnectionFactory
instances.
If the supplied Map
is null
, then this method call effectively has no effect.
connectionFactories
- said Map
of connectionFactories
public Map<String,ConnectionFactory> getConnectionFactories()
Map
of connectionFactory
(never null
)public void addConnectionFactory(String connectionFactoryName, ConnectionFactory connectionFactory)
ConnectionFactory
to the map of
ConnectionFactory
instances maintained by this object.connectionFactoryName
- the name under which the supplied ConnectionFactory
is to be addedconnectionFactory
- the ConnectionFactory
to be so addedpublic ConnectionFactory getConnectionFactory(String connectionFactoryName) throws ConnectionFactoryLookupFailureException
ConnectionFactoryLookup
ConnectionFactory
identified by the given name.getConnectionFactory
in interface ConnectionFactoryLookup
connectionFactoryName
- the name of the ConnectionFactory
ConnectionFactory
(never null
)ConnectionFactoryLookupFailureException
- if the lookup failed