org.apache.commons.messenger
Class JNDISessionFactory

java.lang.Object
  extended by org.apache.commons.messenger.SessionFactory
      extended by org.apache.commons.messenger.JNDISessionFactory

public class JNDISessionFactory
extends SessionFactory

JNDISessionFactory is a Factory of JMS Session objects which looks up the ConnectionFactory object from JNDI.

Version:
$Revision: 1.7 $
Author:
James Strachan

Field Summary
 javax.naming.Context context
          the initial JNDI context used to lookup ConnectionFactory objects
private static org.apache.commons.logging.Log log
          Logger
private  java.lang.String lookupName
          the name used to lookup the ConnectionFactory
 
Fields inherited from class org.apache.commons.messenger.SessionFactory
properties
 
Constructor Summary
JNDISessionFactory()
           
 
Method Summary
 javax.jms.Connection createConnection()
          Re-implemented from SessionFactory.
protected  javax.jms.ConnectionFactory createConnectionFactory()
          Factory method used to create a connection factory.
protected  javax.naming.Context createContext()
          Factory method used to create a connection factory.
 javax.jms.Session createSession(javax.jms.Connection connection)
          Re-implemented from SessionFactory.
 javax.naming.Context getContext()
          Returns the JNDI Context used to lookup JMS ConnectionFactory objects
 java.lang.String getLookupName()
          The JNDI Name of the ConnectionFactory
 void setContext(javax.naming.Context context)
           
 void setLookupName(java.lang.String lookupName)
          Sets the JNDI Name of the ConnectionFactory
 
Methods inherited from class org.apache.commons.messenger.SessionFactory
addProperty, close, createProperties, createQueueConnection, createServerSessionPool, createSession, createTopicConnection, getAcknowledgeMode, getClientID, getConnection, getConnectionFactory, getPassword, getProperties, getUsername, isTopic, isTransacted, setAcknowledge, setAcknowledgeMode, setClientID, setConnection, setConnectionFactory, setPassword, setProperties, setTopic, setTransacted, setUsername
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static final org.apache.commons.logging.Log log
Logger


context

public javax.naming.Context context
the initial JNDI context used to lookup ConnectionFactory objects


lookupName

private java.lang.String lookupName
the name used to lookup the ConnectionFactory

Constructor Detail

JNDISessionFactory

public JNDISessionFactory()
Method Detail

getLookupName

public java.lang.String getLookupName()
The JNDI Name of the ConnectionFactory


setLookupName

public void setLookupName(java.lang.String lookupName)
Sets the JNDI Name of the ConnectionFactory


getContext

public javax.naming.Context getContext()
                                throws javax.naming.NamingException
Returns the JNDI Context used to lookup JMS ConnectionFactory objects

Throws:
javax.naming.NamingException

setContext

public void setContext(javax.naming.Context context)

createConnectionFactory

protected javax.jms.ConnectionFactory createConnectionFactory()
                                                       throws javax.jms.JMSException
Factory method used to create a connection factory. Lookup the ConnectionFactory in JNDI

Overrides:
createConnectionFactory in class SessionFactory
Throws:
javax.jms.JMSException

createConnection

public javax.jms.Connection createConnection()
                                      throws javax.jms.JMSException
Re-implemented from SessionFactory. Method used to create a connection

Overrides:
createConnection in class SessionFactory
Throws:
javax.jms.JMSException

createSession

public javax.jms.Session createSession(javax.jms.Connection connection)
                                throws javax.jms.JMSException
Re-implemented from SessionFactory. Creates a new Session instance

Overrides:
createSession in class SessionFactory
Throws:
javax.jms.JMSException

createContext

protected javax.naming.Context createContext()
                                      throws javax.naming.NamingException
Factory method used to create a connection factory. Derived classes may wish to use JNDI to load the ConnectionFactory

Throws:
javax.naming.NamingException