com.caucho.jms.connection
Class ConnectionFactoryImpl

java.lang.Object
  extended by com.caucho.jms.connection.ConnectionFactoryImpl
All Implemented Interfaces:
HandleAware, java.io.Serializable, ConnectionFactory, QueueConnectionFactory, TopicConnectionFactory, XAConnectionFactory, XAQueueConnectionFactory, XATopicConnectionFactory
Direct Known Subclasses:
JmsConnectionFactory, JVMQueueConnectionFactory, JVMTopicConnectionFactory, XAConnectionFactoryImpl

public class ConnectionFactoryImpl
extends java.lang.Object
implements XAQueueConnectionFactory, XATopicConnectionFactory, java.io.Serializable, HandleAware

A sample connection factory.

See Also:
Serialized Form

Constructor Summary
ConnectionFactoryImpl()
           
 
Method Summary
protected  void addConnection(ConnectionImpl conn)
           
protected  void authenticate(java.lang.String username, java.lang.String password)
           
 Connection createConnection()
          Creates a new queue connection
 Connection createConnection(java.lang.String username, java.lang.String password)
          Creates a new connection
 Queue createQueue(java.lang.String name)
          Creates queue.
 QueueConnection createQueueConnection()
          Creates a new queue connection
 QueueConnection createQueueConnection(java.lang.String username, java.lang.String password)
          Creates a new queue connection
 Topic createTopic(java.lang.String name)
          Creates topics.
 TopicConnection createTopicConnection()
          Creates a new queue connection
 TopicConnection createTopicConnection(java.lang.String username, java.lang.String password)
          Creates a new queue connection
 XAConnection createXAConnection()
           
 XAConnection createXAConnection(java.lang.String username, java.lang.String password)
           
 XAQueueConnection createXAQueueConnection()
           
 XAQueueConnection createXAQueueConnection(java.lang.String username, java.lang.String password)
           
 XATopicConnection createXATopicConnection()
           
 XATopicConnection createXATopicConnection(java.lang.String username, java.lang.String password)
           
 ConnectionImpl findByClientID(java.lang.String id)
          Returns the connection named by the specified client id.
 java.lang.String getName()
          Returns the name of the connection factory.
 void init()
          Initialize the connection factory.
 void removeConnection(ConnectionImpl conn)
          Removes a connection once closed.
 void setClientID(java.lang.String id)
          Sets the client id.
 void setDataSource(javax.sql.DataSource dataSource)
          Sets the JDBC manager.
 void setName(java.lang.String name)
          Sets the name of the connection factory.
 void setPassword(java.lang.String password)
          Sets the password.
 void setSerializationHandle(java.lang.Object handle)
          Sets the serialization handle
 void setUser(java.lang.String user)
          Sets the user.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ConnectionFactoryImpl

public ConnectionFactoryImpl()
Method Detail

setUser

public void setUser(java.lang.String user)
Sets the user.


setPassword

public void setPassword(java.lang.String password)
Sets the password.


setName

public void setName(java.lang.String name)
Sets the name of the connection factory.


getName

public java.lang.String getName()
Returns the name of the connection factory.


setClientID

public void setClientID(java.lang.String id)
Sets the client id.


setDataSource

public void setDataSource(javax.sql.DataSource dataSource)
Sets the JDBC manager.


setSerializationHandle

public void setSerializationHandle(java.lang.Object handle)
Sets the serialization handle

Specified by:
setSerializationHandle in interface HandleAware

init

public void init()
          throws ConfigException,
                 java.sql.SQLException
Initialize the connection factory.

Throws:
ConfigException
java.sql.SQLException

createConnection

public Connection createConnection()
                            throws JMSException
Creates a new queue connection

Specified by:
createConnection in interface ConnectionFactory
Throws:
JMSException

createConnection

public Connection createConnection(java.lang.String username,
                                   java.lang.String password)
                            throws JMSException
Creates a new connection

Specified by:
createConnection in interface ConnectionFactory
Parameters:
username - the username to authenticate with the server.
password - the password to authenticate with the server.
Returns:
the created connection
Throws:
JMSException

addConnection

protected void addConnection(ConnectionImpl conn)

findByClientID

public ConnectionImpl findByClientID(java.lang.String id)
Returns the connection named by the specified client id.


removeConnection

public void removeConnection(ConnectionImpl conn)
Removes a connection once closed.


createQueue

public Queue createQueue(java.lang.String name)
                  throws JMSException
Creates queue.

Throws:
JMSException

createTopic

public Topic createTopic(java.lang.String name)
                  throws JMSException
Creates topics.

Throws:
JMSException

authenticate

protected void authenticate(java.lang.String username,
                            java.lang.String password)
                     throws JMSException
Throws:
JMSException

createQueueConnection

public QueueConnection createQueueConnection()
                                      throws JMSException
Creates a new queue connection

Specified by:
createQueueConnection in interface QueueConnectionFactory
Throws:
JMSException

createQueueConnection

public QueueConnection createQueueConnection(java.lang.String username,
                                             java.lang.String password)
                                      throws JMSException
Creates a new queue connection

Specified by:
createQueueConnection in interface QueueConnectionFactory
Parameters:
username - the username to authenticate with the server.
password - the password to authenticate with the server.
Returns:
the created connection
Throws:
JMSException

createTopicConnection

public TopicConnection createTopicConnection()
                                      throws JMSException
Creates a new queue connection

Specified by:
createTopicConnection in interface TopicConnectionFactory
Throws:
JMSException

createTopicConnection

public TopicConnection createTopicConnection(java.lang.String username,
                                             java.lang.String password)
                                      throws JMSException
Creates a new queue connection

Specified by:
createTopicConnection in interface TopicConnectionFactory
Parameters:
username - the username to authenticate with the server.
password - the password to authenticate with the server.
Returns:
the created connection
Throws:
JMSException

createXAConnection

public XAConnection createXAConnection()
                                throws JMSException
Specified by:
createXAConnection in interface XAConnectionFactory
Throws:
JMSException

createXAConnection

public XAConnection createXAConnection(java.lang.String username,
                                       java.lang.String password)
                                throws JMSException
Specified by:
createXAConnection in interface XAConnectionFactory
Throws:
JMSException

createXAQueueConnection

public XAQueueConnection createXAQueueConnection()
                                          throws JMSException
Specified by:
createXAQueueConnection in interface XAQueueConnectionFactory
Throws:
JMSException

createXAQueueConnection

public XAQueueConnection createXAQueueConnection(java.lang.String username,
                                                 java.lang.String password)
                                          throws JMSException
Specified by:
createXAQueueConnection in interface XAQueueConnectionFactory
Throws:
JMSException

createXATopicConnection

public XATopicConnection createXATopicConnection()
                                          throws JMSException
Specified by:
createXATopicConnection in interface XATopicConnectionFactory
Throws:
JMSException

createXATopicConnection

public XATopicConnection createXATopicConnection(java.lang.String username,
                                                 java.lang.String password)
                                          throws JMSException
Specified by:
createXATopicConnection in interface XATopicConnectionFactory
Throws:
JMSException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object