org.objectweb.jonas_jms
Class JConnectionFactory

java.lang.Object
  extended by org.objectweb.jonas_jms.JConnectionFactory
All Implemented Interfaces:
java.io.Serializable, javax.jms.ConnectionFactory, javax.naming.Referenceable
Direct Known Subclasses:
JQueueConnectionFactory, JTopicConnectionFactory

public class JConnectionFactory
extends java.lang.Object
implements javax.jms.ConnectionFactory, javax.naming.Referenceable, java.io.Serializable

Author:
Laurent Chauvirey, Frederic Maistre, Nicolas Tachker Contributor(s): Philippe Durieux Jeff Mesnil connection anonymous Philippe Coq
See Also:
Serialized Form

Field Summary
protected  JmsManager jms
           
protected  java.lang.String name
           
protected  javax.jms.XAConnectionFactory xacf
           
 
Constructor Summary
protected JConnectionFactory()
          Empty Constructor called by subclasses.
  JConnectionFactory(java.lang.String name)
          Constructor.
 
Method Summary
 javax.jms.Connection createConnection()
          Create a connection for an anonymous user.
 javax.jms.Connection createConnection(java.lang.String userName, java.lang.String password)
          Create a connection with specified user identity.
 void freeJConnection(JConnection con)
          Free a Connection and return it to the pool
 JConnection getJConnection()
          Get a Connection from the pool for an anonymous user
 JConnection getJConnection(java.lang.String user)
          Get a Connection from the pool for the specified user
 javax.naming.Reference getReference()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

jms

protected JmsManager jms

name

protected java.lang.String name

xacf

protected javax.jms.XAConnectionFactory xacf
Constructor Detail

JConnectionFactory

public JConnectionFactory(java.lang.String name)
Constructor.

Parameters:
name - - ConnectionFactory name

JConnectionFactory

protected JConnectionFactory()
Empty Constructor called by subclasses.

Method Detail

createConnection

public javax.jms.Connection createConnection()
                                      throws javax.jms.JMSException
Create a connection for an anonymous user.

Specified by:
createConnection in interface javax.jms.ConnectionFactory
Returns:
a newly created connection.
Throws:
javax.jms.JMSException - - if JMS Provider fails to create Connection due to some internal error. required resources for a Connection.
JMSSecurityException - - if client authentication fails due to invalid user name or password.

createConnection

public javax.jms.Connection createConnection(java.lang.String userName,
                                             java.lang.String password)
                                      throws javax.jms.JMSException
Create a connection with specified user identity. The connection is created in stopped mode. No messages will be delivered until Connection.start method is explicitly called.

Specified by:
createConnection in interface javax.jms.ConnectionFactory
Parameters:
userName - - the caller's user name
password - - the caller's password
Throws:
javax.jms.JMSException - - if JMS Provider fails to create Connection due to some internal error. required resources for a Connection.
JMSSecurityException - - if client authentication fails due to invalid user name or password.

freeJConnection

public void freeJConnection(JConnection con)
Free a Connection and return it to the pool

Parameters:
con - - Connection to be freed

getJConnection

public JConnection getJConnection()
Get a Connection from the pool for an anonymous user

Returns:
a Connection for an anonymous user

getJConnection

public JConnection getJConnection(java.lang.String user)
Get a Connection from the pool for the specified user

Parameters:
user - User wanting a connection
Returns:
Connection from the pool for the specified user

getReference

public javax.naming.Reference getReference()
                                    throws javax.naming.NamingException
Specified by:
getReference in interface javax.naming.Referenceable
Throws:
javax.naming.NamingException