FileDocCategorySizeDatePackage
JmsConnectionFactoryImpl.javaAPI DocJBoss 4.2.14987Fri Jul 13 21:01:16 BST 2007org.jboss.resource.adapter.jms

JmsConnectionFactoryImpl

public class JmsConnectionFactoryImpl extends Object implements javax.resource.Referenceable, JmsConnectionFactory
The the connection factory implementation for the JMS RA.

This object will be the QueueConnectionFactory or TopicConnectionFactory which clients will use to create connections.

author
Peter Antman.
author
Jason Dillon
author
Adrian Brock
version
$Revision: 57189 $

Fields Summary
private static final long
serialVersionUID
private static final Logger
log
private javax.resource.spi.ManagedConnectionFactory
mcf
private javax.resource.spi.ConnectionManager
cm
private Reference
reference
Constructors Summary
public JmsConnectionFactoryImpl(javax.resource.spi.ManagedConnectionFactory mcf, javax.resource.spi.ConnectionManager cm)


      
                                      
   
      this.mcf = mcf;

      boolean trace = log.isTraceEnabled();
      if (cm == null)
      {
         // This is standalone usage, no appserver
         this.cm = new JmsConnectionManager();
         if (trace)
            log.trace("Created new connection manager");
      }
      else
         this.cm = cm;

      if (trace)
         log.trace("Using ManagedConnectionFactory=" + mcf + ", ConnectionManager=" + cm);
   
Methods Summary
public javax.jms.ConnectioncreateConnection()

      Connection c = new JmsSessionFactoryImpl(mcf, cm, BOTH);

      if (log.isTraceEnabled())
         log.trace("Created connection: " + c);

      return c;
   
public javax.jms.ConnectioncreateConnection(java.lang.String userName, java.lang.String password)

      JmsSessionFactoryImpl s = new JmsSessionFactoryImpl(mcf, cm, BOTH);
      s.setUserName(userName);
      s.setPassword(password);
      
      if (log.isTraceEnabled())
         log.trace("Created connection: " + s);

      return s;
   
public javax.jms.QueueConnectioncreateQueueConnection()

      QueueConnection qc = new JmsSessionFactoryImpl(mcf, cm, QUEUE);

      if (log.isTraceEnabled())
         log.trace("Created queue connection: " + qc);
      
      return qc;
   
public javax.jms.QueueConnectioncreateQueueConnection(java.lang.String userName, java.lang.String password)

      JmsSessionFactoryImpl s = new JmsSessionFactoryImpl(mcf, cm, QUEUE);
      s.setUserName(userName);
      s.setPassword(password);

      if (log.isTraceEnabled())
         log.trace("Created queue connection: " + s);
      
      return s;
   
public javax.jms.TopicConnectioncreateTopicConnection()

      TopicConnection tc = new JmsSessionFactoryImpl(mcf, cm, TOPIC);

      if (log.isTraceEnabled())
         log.trace("Created topic connection: " + tc);

      return tc;
   
public javax.jms.TopicConnectioncreateTopicConnection(java.lang.String userName, java.lang.String password)

      JmsSessionFactoryImpl s = new JmsSessionFactoryImpl(mcf, cm, TOPIC);
      s.setUserName(userName);
      s.setPassword(password);
      
      if (log.isTraceEnabled())
         log.trace("Created topic connection: " + s);

      return s;
   
public javax.naming.ReferencegetReference()

      return reference;
   
public voidsetReference(javax.naming.Reference reference)

      this.reference = reference;

      if (log.isTraceEnabled())
         log.trace("Using Reference=" + reference);