Class 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 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.

    Since:
    jadice server 4.2.1.6
    See Also:
    JDNI on Sun Developer Network
    • Method Detail

      • 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 interface javax.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 interface javax.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 interface javax.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 interface javax.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 interface javax.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 interface javax.jms.TopicConnectionFactory
        Throws:
        javax.jms.JMSException
        See Also:
        TopicConnectionFactory.createTopicConnection(String, String)