Class JNDIConnectionFactory
- java.lang.Object
-
- com.levigo.jadice.server.jms.client.JNDIConnectionFactory
-
- All Implemented Interfaces:
javax.jms.ConnectionFactory
,javax.jms.QueueConnectionFactory
,javax.jms.TopicConnectionFactory
public class JNDIConnectionFactory extends Object implements javax.jms.ConnectionFactory, javax.jms.QueueConnectionFactory, javax.jms.TopicConnectionFactory
As some MOM recommend not to create aConnectionFactory
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.
- Since:
- jadice server 4.2.1.6
- See Also:
- JDNI on Sun Developer Network
-
-
Field Summary
Fields Modifier and Type Field Description static String
INITAL_CONTEXT_FACTORY_WEBLOGIC
Default name of the initial context factory for Oracle WebLogic.
-
Constructor Summary
Constructors Constructor Description JNDIConnectionFactory()
Empty default constructor.JNDIConnectionFactory(String providerURL, String initalContextFactoryName, String jndiName)
Constructor that takes all required properties.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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 usevoid
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
-
-
-
Field Detail
-
INITAL_CONTEXT_FACTORY_WEBLOGIC
public static final String INITAL_CONTEXT_FACTORY_WEBLOGIC
Default name of the initial context factory for Oracle WebLogic.
-
-
Constructor Detail
-
JNDIConnectionFactory
public JNDIConnectionFactory()
Empty default constructor. All required properties must be subsequently set.
-
JNDIConnectionFactory
public JNDIConnectionFactory(String providerURL, String initalContextFactoryName, String jndiName)
Constructor that takes all required properties.- Parameters:
providerURL
- the provider URL as described atContext.PROVIDER_URL
initalContextFactoryName
- name of the initial context factory as described atContext.INITIAL_CONTEXT_FACTORY
jndiName
- JNDI name of theQueueConnectionFactory
-
-
Method Detail
-
setJndiEnvironment
public void setJndiEnvironment(Map<?,?> env)
Set additional environment parameters for the JNDI lookup.- Parameters:
env
- the environment for theJNDIConnectionFactory
's context- See Also:
InitialContext.getEnvironment()
-
getJndiEnvironment
public Map<?,?> getJndiEnvironment()
- Returns:
- the additional parameters for the JNDI lookup
-
setJndiName
public void setJndiName(String jndiName)
Set the JDNI name as it is registered in the JDNI repository.- Parameters:
jndiName
- the name where the connection factory is registered.- See Also:
InitialContext.lookup(String)
-
getJndiName
public String getJndiName()
- Returns:
- the name as the connection factory is registered.
-
setProviderURL
public void setProviderURL(String providerURL)
Set the URL for the service provider to use- Parameters:
providerURL
- The JDNI provider's URL- See Also:
Context.PROVIDER_URL
-
getProviderURL
public String getProviderURL()
- Returns:
- the The JDNI provider's URL
-
setInitialContextFactory
public void setInitialContextFactory(String initialContextFactory)
Set the name of the initial context factory to use- Parameters:
initialContextFactory
- name of the initial context factory- See Also:
Context.INITIAL_CONTEXT_FACTORY
-
getInitialContextFactory
public String getInitialContextFactory()
- Returns:
- The name of the initial context factory to use
-
createConnection
public javax.jms.Connection createConnection() throws javax.jms.JMSException
- Specified by:
createConnection
in interfacejavax.jms.ConnectionFactory
- Throws:
javax.jms.JMSException
- See Also:
ConnectionFactory.createConnection()
-
createConnection
public javax.jms.Connection createConnection(String username, String password) throws javax.jms.JMSException
- Specified by:
createConnection
in interfacejavax.jms.ConnectionFactory
- Throws:
javax.jms.JMSException
- See Also:
ConnectionFactory.createConnection(String, String)
-
createQueueConnection
public javax.jms.QueueConnection createQueueConnection() throws javax.jms.JMSException
- Specified by:
createQueueConnection
in interfacejavax.jms.QueueConnectionFactory
- Throws:
javax.jms.JMSException
- See Also:
QueueConnectionFactory.createQueueConnection()
-
createQueueConnection
public javax.jms.QueueConnection createQueueConnection(String userName, String password) throws javax.jms.JMSException
- Specified by:
createQueueConnection
in interfacejavax.jms.QueueConnectionFactory
- Throws:
javax.jms.JMSException
- See Also:
QueueConnectionFactory.createQueueConnection(String, String)
-
createTopicConnection
public javax.jms.TopicConnection createTopicConnection() throws javax.jms.JMSException
- Specified by:
createTopicConnection
in interfacejavax.jms.TopicConnectionFactory
- Throws:
javax.jms.JMSException
- See Also:
TopicConnectionFactory.createTopicConnection()
-
createTopicConnection
public javax.jms.TopicConnection createTopicConnection(String userName, String password) throws javax.jms.JMSException
- Specified by:
createTopicConnection
in interfacejavax.jms.TopicConnectionFactory
- Throws:
javax.jms.JMSException
- See Also:
TopicConnectionFactory.createTopicConnection(String, String)
-
-