public class JNDIConnectionFactory extends Object implements javax.jms.ConnectionFactory, javax.jms.QueueConnectionFactory, javax.jms.TopicConnectionFactory
As some MOM recommend not to create a ConnectionFactory
directly but to retrieve one via
Java Naming and Directory Interface (JNDI), this class wraps all the lookup handling.
Furthermore all properties of this class can be changed via setters and getters so that dependency injection is no obstacle.
Modifier and Type | Field and Description |
---|---|
static String |
INITAL_CONTEXT_FACTORY_WEBLOGIC
Default name of the initial context factory for Oracle WebLogic.
|
Constructor and Description |
---|
JNDIConnectionFactory()
Empty default constructor.
|
JNDIConnectionFactory(String providerURL,
String initalContextFactoryName,
String jndiName)
Constructor that takes all required properties.
|
Modifier and Type | Method and Description |
---|---|
javax.jms.Connection |
createConnection() |
javax.jms.Connection |
createConnection(String username,
String password) |
javax.jms.QueueConnection |
createQueueConnection() |
javax.jms.QueueConnection |
createQueueConnection(String userName,
String password) |
javax.jms.TopicConnection |
createTopicConnection() |
javax.jms.TopicConnection |
createTopicConnection(String userName,
String password) |
String |
getInitialContextFactory() |
Map<?,?> |
getJndiEnvironment() |
String |
getJndiName() |
String |
getProviderURL() |
void |
setInitialContextFactory(String initialContextFactory)
Set the name of the initial context factory to use
|
void |
setJndiEnvironment(Map<?,?> env)
Set additional environment parameters for the JNDI lookup.
|
void |
setJndiName(String jndiName)
Set the JDNI name as it is registered in the JDNI repository.
|
void |
setProviderURL(String providerURL)
Set the URL for the service provider to use
|
public static final String INITAL_CONTEXT_FACTORY_WEBLOGIC
public JNDIConnectionFactory()
public void setJndiEnvironment(Map<?,?> env)
env
- the environment for the JNDIConnectionFactory
's contextInitialContext.getEnvironment()
public Map<?,?> getJndiEnvironment()
public void setJndiName(String jndiName)
jndiName
- the name where the connection factory is registered.InitialContext.lookup(String)
public String getJndiName()
public void setProviderURL(String providerURL)
providerURL
- The JDNI provider's URLContext.PROVIDER_URL
public String getProviderURL()
public void setInitialContextFactory(String initialContextFactory)
initialContextFactory
- name of the initial context factoryContext.INITIAL_CONTEXT_FACTORY
public String getInitialContextFactory()
public javax.jms.Connection createConnection() throws javax.jms.JMSException
createConnection
in interface javax.jms.ConnectionFactory
javax.jms.JMSException
ConnectionFactory.createConnection()
public javax.jms.Connection createConnection(String username, String password) throws javax.jms.JMSException
createConnection
in interface javax.jms.ConnectionFactory
javax.jms.JMSException
ConnectionFactory.createConnection(String, String)
public javax.jms.QueueConnection createQueueConnection() throws javax.jms.JMSException
createQueueConnection
in interface javax.jms.QueueConnectionFactory
javax.jms.JMSException
QueueConnectionFactory.createQueueConnection()
public javax.jms.QueueConnection createQueueConnection(String userName, String password) throws javax.jms.JMSException
createQueueConnection
in interface javax.jms.QueueConnectionFactory
javax.jms.JMSException
QueueConnectionFactory.createQueueConnection(String, String)
public javax.jms.TopicConnection createTopicConnection() throws javax.jms.JMSException
createTopicConnection
in interface javax.jms.TopicConnectionFactory
javax.jms.JMSException
TopicConnectionFactory.createTopicConnection()
public javax.jms.TopicConnection createTopicConnection(String userName, String password) throws javax.jms.JMSException
createTopicConnection
in interface javax.jms.TopicConnectionFactory
javax.jms.JMSException
TopicConnectionFactory.createTopicConnection(String, String)
Copyright © 2017 levigo holding gmbh. All rights reserved.