org.jboss.messaging.ra
Class JBMSessionFactoryImpl

java.lang.Object
  extended by org.jboss.messaging.ra.JBMSessionFactoryImpl
All Implemented Interfaces:
javax.jms.Connection, javax.jms.QueueConnection, javax.jms.TopicConnection, javax.jms.XAConnection, javax.jms.XAQueueConnection, javax.jms.XATopicConnection, javax.naming.Referenceable, JBMSessionFactory

public class JBMSessionFactoryImpl
extends java.lang.Object
implements JBMSessionFactory, javax.resource.Referenceable

Implements the JMS Connection API and produces JBMSession objects.

Version:
$Revision: $
Author:
Adrian Brock, Jesper Pedersen

Field Summary
 
Fields inherited from interface org.jboss.messaging.ra.JBMSessionFactory
ISE
 
Constructor Summary
JBMSessionFactoryImpl(JBMManagedConnectionFactory mcf, javax.resource.spi.ConnectionManager cm, int type)
          Constructor
 
Method Summary
 void addTemporaryQueue(javax.jms.TemporaryQueue temp)
          Add temporary queue
 void addTemporaryTopic(javax.jms.TemporaryTopic temp)
          Add temporary topic
protected  JBMSession allocateConnection(boolean transacted, int acknowledgeMode, int sessionType)
          Allocation a connection
protected  JBMSession allocateConnection(int sessionType)
          Allocation a connection
protected  void checkClosed()
          Check if we are closed
 void close()
          Close
 void closeSession(JBMSession session)
          Close session
 javax.jms.ConnectionConsumer createConnectionConsumer(javax.jms.Destination destination, javax.jms.ServerSessionPool pool, int maxMessages)
          Create a connection consumer -- throws IllegalStateException
 javax.jms.ConnectionConsumer createConnectionConsumer(javax.jms.Destination destination, java.lang.String name, javax.jms.ServerSessionPool pool, int maxMessages)
          Create a connection consumer -- throws IllegalStateException
 javax.jms.ConnectionConsumer createConnectionConsumer(javax.jms.Queue queue, java.lang.String messageSelector, javax.jms.ServerSessionPool sessionPool, int maxMessages)
          Create a connection consumer -- throws IllegalStateException
 javax.jms.ConnectionConsumer createConnectionConsumer(javax.jms.Topic topic, java.lang.String messageSelector, javax.jms.ServerSessionPool sessionPool, int maxMessages)
          Create a connection consumer -- throws IllegalStateException
 javax.jms.ConnectionConsumer createDurableConnectionConsumer(javax.jms.Topic topic, java.lang.String subscriptionName, java.lang.String messageSelector, javax.jms.ServerSessionPool sessionPool, int maxMessages)
          Create a durable connection consumer -- throws IllegalStateException
 javax.jms.QueueSession createQueueSession(boolean transacted, int acknowledgeMode)
          Create a queue session
 javax.jms.Session createSession(boolean transacted, int acknowledgeMode)
          Create a session
 javax.jms.TopicSession createTopicSession(boolean transacted, int acknowledgeMode)
          Create a topic session
 javax.jms.XAQueueSession createXAQueueSession()
          Create a XA queue session
 javax.jms.XASession createXASession()
          Create a XA session
 javax.jms.XATopicSession createXATopicSession()
          Create a XA topic session
 java.lang.String getClientID()
          Get the client ID
 javax.jms.ExceptionListener getExceptionListener()
          Get the exception listener -- throws IllegalStateException
 javax.jms.ConnectionMetaData getMetaData()
          Get the connection metadata
 javax.naming.Reference getReference()
          Get the naming reference
 void setClientID(java.lang.String cID)
          Set the client ID -- throws IllegalStateException
 void setExceptionListener(javax.jms.ExceptionListener listener)
          Set the exception listener -- throws IllegalStateException
 void setPassword(java.lang.String password)
          Set the password
 void setReference(javax.naming.Reference reference)
          Set the naming reference
 void setUserName(java.lang.String name)
          Set the user name
 void start()
          Start
 void stop()
          Stop -- throws IllegalStateException
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JBMSessionFactoryImpl

public JBMSessionFactoryImpl(JBMManagedConnectionFactory mcf,
                             javax.resource.spi.ConnectionManager cm,
                             int type)
Constructor

Parameters:
mcf - The managed connection factory
cm - The connection manager
type - The connection type
Method Detail

setReference

public void setReference(javax.naming.Reference reference)
Set the naming reference

Parameters:
reference - The reference

getReference

public javax.naming.Reference getReference()
Get the naming reference

Specified by:
getReference in interface javax.naming.Referenceable
Returns:
The reference

setUserName

public void setUserName(java.lang.String name)
Set the user name

Parameters:
name - The user name

setPassword

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

Parameters:
password - The password

getClientID

public java.lang.String getClientID()
                             throws javax.jms.JMSException
Get the client ID

Specified by:
getClientID in interface javax.jms.Connection
Returns:
The client ID
Throws:
javax.jms.JMSException - Thrown if an error occurs

setClientID

public void setClientID(java.lang.String cID)
                 throws javax.jms.JMSException
Set the client ID -- throws IllegalStateException

Specified by:
setClientID in interface javax.jms.Connection
Parameters:
cID - The client ID
Throws:
javax.jms.JMSException - Thrown if an error occurs

createQueueSession

public javax.jms.QueueSession createQueueSession(boolean transacted,
                                                 int acknowledgeMode)
                                          throws javax.jms.JMSException
Create a queue session

Specified by:
createQueueSession in interface javax.jms.QueueConnection
Specified by:
createQueueSession in interface javax.jms.XAQueueConnection
Parameters:
transacted - Use transactions
acknowledgeMode - The acknowledge mode
Returns:
The queue session
Throws:
javax.jms.JMSException - Thrown if an error occurs

createXAQueueSession

public javax.jms.XAQueueSession createXAQueueSession()
                                              throws javax.jms.JMSException
Create a XA queue session

Specified by:
createXAQueueSession in interface javax.jms.XAQueueConnection
Returns:
The XA queue session
Throws:
javax.jms.JMSException - Thrown if an error occurs

createConnectionConsumer

public javax.jms.ConnectionConsumer createConnectionConsumer(javax.jms.Queue queue,
                                                             java.lang.String messageSelector,
                                                             javax.jms.ServerSessionPool sessionPool,
                                                             int maxMessages)
                                                      throws javax.jms.JMSException
Create a connection consumer -- throws IllegalStateException

Specified by:
createConnectionConsumer in interface javax.jms.QueueConnection
Parameters:
queue - The queue
messageSelector - The message selector
sessionPool - The session pool
maxMessages - The number of max messages
Returns:
The connection consumer
Throws:
javax.jms.JMSException - Thrown if an error occurs

createTopicSession

public javax.jms.TopicSession createTopicSession(boolean transacted,
                                                 int acknowledgeMode)
                                          throws javax.jms.JMSException
Create a topic session

Specified by:
createTopicSession in interface javax.jms.TopicConnection
Specified by:
createTopicSession in interface javax.jms.XATopicConnection
Parameters:
transacted - Use transactions
acknowledgeMode - The acknowledge mode
Returns:
The topic session
Throws:
javax.jms.JMSException - Thrown if an error occurs

createXATopicSession

public javax.jms.XATopicSession createXATopicSession()
                                              throws javax.jms.JMSException
Create a XA topic session

Specified by:
createXATopicSession in interface javax.jms.XATopicConnection
Returns:
The XA topic session
Throws:
javax.jms.JMSException - Thrown if an error occurs

createConnectionConsumer

public javax.jms.ConnectionConsumer createConnectionConsumer(javax.jms.Topic topic,
                                                             java.lang.String messageSelector,
                                                             javax.jms.ServerSessionPool sessionPool,
                                                             int maxMessages)
                                                      throws javax.jms.JMSException
Create a connection consumer -- throws IllegalStateException

Specified by:
createConnectionConsumer in interface javax.jms.TopicConnection
Parameters:
topic - The topic
messageSelector - The message selector
sessionPool - The session pool
maxMessages - The number of max messages
Returns:
The connection consumer
Throws:
javax.jms.JMSException - Thrown if an error occurs

createDurableConnectionConsumer

public javax.jms.ConnectionConsumer createDurableConnectionConsumer(javax.jms.Topic topic,
                                                                    java.lang.String subscriptionName,
                                                                    java.lang.String messageSelector,
                                                                    javax.jms.ServerSessionPool sessionPool,
                                                                    int maxMessages)
                                                             throws javax.jms.JMSException
Create a durable connection consumer -- throws IllegalStateException

Specified by:
createDurableConnectionConsumer in interface javax.jms.Connection
Specified by:
createDurableConnectionConsumer in interface javax.jms.TopicConnection
Parameters:
topic - The topic
subscriptionName - The subscription name
messageSelector - The message selector
sessionPool - The session pool
maxMessages - The number of max messages
Returns:
The connection consumer
Throws:
javax.jms.JMSException - Thrown if an error occurs

createConnectionConsumer

public javax.jms.ConnectionConsumer createConnectionConsumer(javax.jms.Destination destination,
                                                             javax.jms.ServerSessionPool pool,
                                                             int maxMessages)
                                                      throws javax.jms.JMSException
Create a connection consumer -- throws IllegalStateException

Parameters:
destination - The destination
pool - The session pool
maxMessages - The number of max messages
Returns:
The connection consumer
Throws:
javax.jms.JMSException - Thrown if an error occurs

createConnectionConsumer

public javax.jms.ConnectionConsumer createConnectionConsumer(javax.jms.Destination destination,
                                                             java.lang.String name,
                                                             javax.jms.ServerSessionPool pool,
                                                             int maxMessages)
                                                      throws javax.jms.JMSException
Create a connection consumer -- throws IllegalStateException

Specified by:
createConnectionConsumer in interface javax.jms.Connection
Parameters:
destination - The destination
name - The name
pool - The session pool
maxMessages - The number of max messages
Returns:
The connection consumer
Throws:
javax.jms.JMSException - Thrown if an error occurs

createSession

public javax.jms.Session createSession(boolean transacted,
                                       int acknowledgeMode)
                                throws javax.jms.JMSException
Create a session

Specified by:
createSession in interface javax.jms.Connection
Specified by:
createSession in interface javax.jms.XAConnection
Parameters:
transacted - Use transactions
acknowledgeMode - The acknowledge mode
Returns:
The session
Throws:
javax.jms.JMSException - Thrown if an error occurs

createXASession

public javax.jms.XASession createXASession()
                                    throws javax.jms.JMSException
Create a XA session

Specified by:
createXASession in interface javax.jms.XAConnection
Returns:
The XA session
Throws:
javax.jms.JMSException - Thrown if an error occurs

getMetaData

public javax.jms.ConnectionMetaData getMetaData()
                                         throws javax.jms.JMSException
Get the connection metadata

Specified by:
getMetaData in interface javax.jms.Connection
Returns:
The connection metadata
Throws:
javax.jms.JMSException - Thrown if an error occurs

getExceptionListener

public javax.jms.ExceptionListener getExceptionListener()
                                                 throws javax.jms.JMSException
Get the exception listener -- throws IllegalStateException

Specified by:
getExceptionListener in interface javax.jms.Connection
Returns:
The exception listener
Throws:
javax.jms.JMSException - Thrown if an error occurs

setExceptionListener

public void setExceptionListener(javax.jms.ExceptionListener listener)
                          throws javax.jms.JMSException
Set the exception listener -- throws IllegalStateException

Specified by:
setExceptionListener in interface javax.jms.Connection
Parameters:
listener - The exception listener
Throws:
javax.jms.JMSException - Thrown if an error occurs

start

public void start()
           throws javax.jms.JMSException
Start

Specified by:
start in interface javax.jms.Connection
Throws:
javax.jms.JMSException - Thrown if an error occurs

stop

public void stop()
          throws javax.jms.JMSException
Stop -- throws IllegalStateException

Specified by:
stop in interface javax.jms.Connection
Throws:
javax.jms.JMSException - Thrown if an error occurs

close

public void close()
           throws javax.jms.JMSException
Close

Specified by:
close in interface javax.jms.Connection
Throws:
javax.jms.JMSException - Thrown if an error occurs

closeSession

public void closeSession(JBMSession session)
                  throws javax.jms.JMSException
Close session

Specified by:
closeSession in interface JBMSessionFactory
Parameters:
session - The session
Throws:
javax.jms.JMSException - Thrown if an error occurs

addTemporaryQueue

public void addTemporaryQueue(javax.jms.TemporaryQueue temp)
Add temporary queue

Specified by:
addTemporaryQueue in interface JBMSessionFactory
Parameters:
temp - The temporary queue

addTemporaryTopic

public void addTemporaryTopic(javax.jms.TemporaryTopic temp)
Add temporary topic

Specified by:
addTemporaryTopic in interface JBMSessionFactory
Parameters:
temp - The temporary topic

allocateConnection

protected JBMSession allocateConnection(int sessionType)
                                 throws javax.jms.JMSException
Allocation a connection

Parameters:
sessionType - The session type
Returns:
The session
Throws:
javax.jms.JMSException - Thrown if an error occurs

allocateConnection

protected JBMSession allocateConnection(boolean transacted,
                                        int acknowledgeMode,
                                        int sessionType)
                                 throws javax.jms.JMSException
Allocation a connection

Parameters:
transacted - Use transactions
acknowledgeMode - The acknowledge mode
sessionType - The session type
Returns:
The session
Throws:
javax.jms.JMSException - Thrown if an error occurs

checkClosed

protected void checkClosed()
                    throws javax.jms.IllegalStateException
Check if we are closed

Throws:
javax.jms.IllegalStateException - Thrown if closed


Copyright © 2006 JBoss Inc. All Rights Reserved.