org.ow2.jotm.jms
Class JConnectionFactory

java.lang.Object
  extended by org.ow2.jotm.jms.JConnectionFactory
All Implemented Interfaces:
Serializable, ConnectionFactory, Referenceable
Direct Known Subclasses:
JQueueConnectionFactory, JTopicConnectionFactory

public class JConnectionFactory
extends Object
implements ConnectionFactory, Referenceable, Serializable

See Also:
Serialized Form

Field Summary
protected  JmsManager jms
           
protected  org.objectweb.util.monolog.api.Logger logger
           
protected  String name
           
protected  XAConnectionFactory xacf
           
 
Constructor Summary
JConnectionFactory(String name, XAConnectionFactory xacf, org.objectweb.util.monolog.api.Logger logger)
          Constructor.
 
Method Summary
 void cleanPool()
          Close all Connections of the pool.
 Connection createConnection()
          Create a connection for an anonymous user.
 Connection createConnection(String userName, String password)
          Create a connection with specified user identity.
 void freeJConnection(JConnection con)
          Free a Connection and return it to the pool
 JConnection getJConnection(String user)
          Get a Connection from the pool for the specified user
 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 String name

xacf

protected XAConnectionFactory xacf

logger

protected org.objectweb.util.monolog.api.Logger logger
Constructor Detail

JConnectionFactory

public JConnectionFactory(String name,
                          XAConnectionFactory xacf,
                          org.objectweb.util.monolog.api.Logger logger)
Constructor.

Parameters:
name - - ConnectionFactory name
xacf - - underlaying XAConnectionFactory
Method Detail

createConnection

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

Specified by:
createConnection in interface ConnectionFactory
Returns:
a newly created connection.
Throws:
JMSException - - if JMS Provider fails to create Connection due to some internal error. required resources for a Connection.

createConnection

public Connection createConnection(String userName,
                                   String password)
                            throws 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 ConnectionFactory
Parameters:
userName - - the caller's user name
password - - the caller's password
Throws:
JMSException - - if JMS Provider fails to create Connection due to some internal error. required resources for a Connection.

freeJConnection

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

Parameters:
con - - Connection to be freed

cleanPool

public void cleanPool()
Close all Connections of the pool.


getJConnection

public JConnection getJConnection(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 Reference getReference()
                       throws NamingException
Specified by:
getReference in interface Referenceable
Throws:
NamingException


Copyright ? 2005-2010 OW2 Consortium. All Rights Reserved.