org.exolab.jms.client
Class JmsXATopicConnection

java.lang.Object
  |
  +--org.exolab.jms.client.JmsConnection
        |
        +--org.exolab.jms.client.JmsTopicConnection
              |
              +--org.exolab.jms.client.JmsXATopicConnection
All Implemented Interfaces:
javax.jms.Connection, javax.jms.TopicConnection, javax.jms.XAConnection, javax.jms.XATopicConnection

public class JmsXATopicConnection
extends org.exolab.jms.client.JmsTopicConnection
implements javax.jms.XATopicConnection

This class extends JmsTopicConnection and is used to gain an XA topic connection. All functionality comes from the base class.

Version:
$Revision: 1.5 $ $Date: 2003/08/07 13:32:51 $
Author:
Jim Alateras
See Also:
XATopicConnection, XATopicSession

Constructor Summary
JmsXATopicConnection(JmsXATopicConnectionFactory factory, java.lang.String id, java.lang.String username, java.lang.String password)
          Instantiate an instance of this connection using the specified client identity.
 
Method Summary
protected  void addSession(org.exolab.jms.client.JmsSession session)
          Add the specified session to the list of managed sessions
 void close()
           
 javax.jms.ConnectionConsumer createConnectionConsumer(javax.jms.Topic topic, java.lang.String selector, javax.jms.ServerSessionPool pool, int maxMessages)
          Create a connection consumer for this connection
 javax.jms.ConnectionConsumer createDurableConnectionConsumer(javax.jms.Topic topic, java.lang.String subscriptionName, java.lang.String selector, javax.jms.ServerSessionPool pool, int maxMessages)
          Create a durable connection consumer for this connection
 javax.jms.TopicSession createTopicSession(boolean transacted, int ack)
          Create a new topic session
 javax.jms.XATopicSession createXATopicSession()
           
 void destroy()
          Release all resources used by this connection, including supporting sessions
protected  void ensureOpen()
          Verifies that the connection is open
 java.lang.String getClientID()
           
 java.lang.String getConnectionId()
          Return the identity of this connection.
 javax.jms.ExceptionListener getExceptionListener()
           
 javax.jms.ConnectionMetaData getMetaData()
           
protected  java.util.Enumeration getSessions()
          Returns an enumeration of all sessions managed by this connection
protected  boolean isManaged(org.exolab.jms.client.JmsSession session)
          Test whether the specified session is managed by this connection
protected  boolean isStopped()
          Return the running state of the connection
 void notifyExceptionListener(javax.jms.JMSException message)
          Notify the exception listener of a JMSException.
protected  void removeSession(org.exolab.jms.client.JmsSession session)
          Remove the specified session from the list of managed sessions.
 void setClientID(java.lang.String id)
           
 void setExceptionListener(javax.jms.ExceptionListener listener)
           
protected  void setModified()
          Flags this connection as being modified.
 void start()
           
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.jms.TopicConnection
createConnectionConsumer, createDurableConnectionConsumer
 
Methods inherited from interface javax.jms.Connection
close, getClientID, getExceptionListener, getMetaData, setClientID, setExceptionListener, start, stop
 

Constructor Detail

JmsXATopicConnection

public JmsXATopicConnection(JmsXATopicConnectionFactory factory,
                            java.lang.String id,
                            java.lang.String username,
                            java.lang.String password)
                     throws javax.jms.JMSException
Instantiate an instance of this connection using the specified client identity. The client identity is immutable and once set cannot be changed. To create a connection with another client identity the user must create another instance of this class. The factory is the creating entity.

If there are any problems during the creation process the JMSException is raised

Parameters:
factory - factory creating this object
id - client identity
username - client username
password - client password
Throws:
javax.jms.JMSException - if there is any problem creating this object
Method Detail

createXATopicSession

public javax.jms.XATopicSession createXATopicSession()
                                              throws javax.jms.JMSException
Specified by:
createXATopicSession in interface javax.jms.XATopicConnection

createTopicSession

public javax.jms.TopicSession createTopicSession(boolean transacted,
                                                 int ack)
                                          throws javax.jms.JMSException
Description copied from class: org.exolab.jms.client.JmsTopicConnection
Create a new topic session
Specified by:
createTopicSession in interface javax.jms.XATopicConnection
Overrides:
createTopicSession in class org.exolab.jms.client.JmsTopicConnection
Following copied from class: org.exolab.jms.client.JmsTopicConnection
Parameters:
transacted - if true, the session is transacted.
ackMode - indicates whether the consumer or the client will acknowledge any messages it receives. This parameter will be ignored if the session is transacted. Legal values are Session.AUTO_ACKNOWLEDGE, Session.CLIENT_ACKNOWLEDGE and Session.DUPS_OK_ACKNOWLEDGE.
Returns:
the new topic session
Throws:
javax.jms.JMSException - if the session cannot be created

createConnectionConsumer

public javax.jms.ConnectionConsumer createConnectionConsumer(javax.jms.Topic topic,
                                                             java.lang.String selector,
                                                             javax.jms.ServerSessionPool pool,
                                                             int maxMessages)
                                                      throws javax.jms.JMSException
Create a connection consumer for this connection
Specified by:
createConnectionConsumer in interface javax.jms.TopicConnection
Parameters:
topic - the topic to access
selector - the message selector. May be null
pool - the server session pool to associate with the consumer
maxMessages - the maximum number of messages that can be assigned to a server session at one time
Returns:
the new connection consumer
Throws:
InvalidSelectorException - if the message selector is invalid
javax.jms.JMSException - if the connection consumer cannot be created

createDurableConnectionConsumer

public javax.jms.ConnectionConsumer createDurableConnectionConsumer(javax.jms.Topic topic,
                                                                    java.lang.String subscriptionName,
                                                                    java.lang.String selector,
                                                                    javax.jms.ServerSessionPool pool,
                                                                    int maxMessages)
                                                             throws javax.jms.JMSException
Create a durable connection consumer for this connection
Specified by:
createDurableConnectionConsumer in interface javax.jms.TopicConnection
Parameters:
topic - the topic to access
subscriptionName - the durable subscription name
selector - the message selector. May be null
pool - the server session pool to associate with the consumer
maxMessages - the maximum number of messages that can be assigned to a server session at one time
Returns:
the new connection consumer
Throws:
InvalidSelectorException - if the message selector is invalid
javax.jms.JMSException - if the connection consumer cannot be created

getClientID

public java.lang.String getClientID()
                             throws javax.jms.JMSException
Specified by:
getClientID in interface javax.jms.Connection

setClientID

public void setClientID(java.lang.String id)
                 throws javax.jms.JMSException
Specified by:
setClientID in interface javax.jms.Connection

getMetaData

public javax.jms.ConnectionMetaData getMetaData()
                                         throws javax.jms.JMSException
Specified by:
getMetaData in interface javax.jms.Connection

getExceptionListener

public javax.jms.ExceptionListener getExceptionListener()
                                                 throws javax.jms.JMSException
Specified by:
getExceptionListener in interface javax.jms.Connection

setExceptionListener

public void setExceptionListener(javax.jms.ExceptionListener listener)
                          throws javax.jms.JMSException
Specified by:
setExceptionListener in interface javax.jms.Connection

notifyExceptionListener

public void notifyExceptionListener(javax.jms.JMSException message)
Notify the exception listener of a JMSException. If the exception listener is not set then ignore it
Parameters:
message - message to deliver

start

public void start()
           throws javax.jms.JMSException
Specified by:
start in interface javax.jms.Connection

stop

public void stop()
          throws javax.jms.JMSException
Specified by:
stop in interface javax.jms.Connection

close

public void close()
           throws javax.jms.JMSException
Specified by:
close in interface javax.jms.Connection

destroy

public void destroy()
             throws javax.jms.JMSException
Release all resources used by this connection, including supporting sessions
Throws:
javax.jms.JMSException - - error completing this request

getConnectionId

public java.lang.String getConnectionId()
Return the identity of this connection. An identity is created by the server and is unique within that servers environment
Returns:
String

addSession

protected void addSession(org.exolab.jms.client.JmsSession session)
Add the specified session to the list of managed sessions
Parameters:
session - session to register

removeSession

protected void removeSession(org.exolab.jms.client.JmsSession session)
Remove the specified session from the list of managed sessions. If it doesn't exist then fail silently
Parameters:
session - session to remove

isManaged

protected boolean isManaged(org.exolab.jms.client.JmsSession session)
Test whether the specified session is managed by this connection
Parameters:
session - session to test against
Returns:
boolean true if managed

getSessions

protected java.util.Enumeration getSessions()
Returns an enumeration of all sessions managed by this connection
Returns:
an enumeration of all sessions managed by this connection

isStopped

protected boolean isStopped()
Return the running state of the connection
Returns:
true if stopped

setModified

protected void setModified()
Flags this connection as being modified. Subsequent attempts to invoke JmsConnection.setClientID(java.lang.String) will result in an IllegalStateException being thrown

ensureOpen

protected void ensureOpen()
                   throws javax.jms.IllegalStateException
Verifies that the connection is open
Throws:
javax.jms.IllegalStateException - if the connection is closed


Copyright © 1999-2004 The OpenJMS Group. All Rights Reserved.