JTopicConnection.java

00001 /*
00002  * JOnAS: Java(TM) Open Application Server
00003  * Copyright (C) 1999 Bull S.A.
00004  * Contact: jonas-team@objectweb.org
00005  * 
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Lesser General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2.1 of the License, or any later version.
00010  * 
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Lesser General Public License for more details.
00015  * 
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with this library; if not, write to the Free Software
00018  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
00019  * USA
00020  * --------------------------------------------------------------------------
00021  * $Id: JTopicConnection.java,v 1.7 2004/03/19 14:31:48 sauthieg Exp $
00022  * --------------------------------------------------------------------------
00023  */
00024 
00025 package org.objectweb.jonas_jms;
00026 
00027 import javax.jms.ConnectionConsumer;
00028 import javax.jms.JMSException;
00029 import javax.jms.ServerSessionPool;
00030 import javax.jms.Topic;
00031 import javax.jms.TopicConnection;
00032 import javax.jms.TopicSession;
00033 import javax.jms.XAConnection;
00034 import javax.jms.XATopicConnection;
00035 import javax.jms.XATopicConnectionFactory;
00036 
00037 import org.objectweb.util.monolog.api.BasicLevel;
00038 
00039 /*
00040  *
00041  * @author Laurent Chauvirey, Frederic Maistre, Nicolas Tachker
00042  * Contributor(s): 
00043  * Philippe Durieux
00044  * Jeff Mesnil connection anonymous
00045  *
00046  */
00047 
00048 public class JTopicConnection extends JConnection implements TopicConnection {
00049 
00050     // The XATopicConnection used in the MOM
00051     protected XATopicConnection xatc = null;
00052 
00053 
00060     public JTopicConnection(JConnectionFactory jcf, XATopicConnectionFactory xatcf, String user, String passwd) throws JMSException {
00061         super(jcf, user);
00062         // Create the underlaying XATopicConnection
00063         xatc = xatcf.createXATopicConnection(user, passwd);
00064         this.xac = (XAConnection) xatc;
00065     }
00066 
00070     public JTopicConnection(JConnectionFactory jcf, XATopicConnectionFactory xatcf) throws JMSException {
00071         super(jcf, INTERNAL_USER_NAME);
00072         // Create the underlying XATopicConnection
00073         xatc = xatcf.createXATopicConnection();
00074         this.xac = (XAConnection) xatc;
00075     }
00076 
00077     // -----------------------------------------------------------------------
00078     // TopicConnection implementation
00079     // -----------------------------------------------------------------------
00080 
00090     public TopicSession createTopicSession(boolean transacted, int acknowledgeMode) throws JMSException {
00091         TraceJms.logger.log(BasicLevel.DEBUG,  "");
00092         return new JTopicSession(this, xatc);
00093     }
00094 
00098     public ConnectionConsumer createConnectionConsumer(Topic topic,
00099                                                        String messageSelector, 
00100                                                        ServerSessionPool sessionPool, 
00101                                                        int maxMessages) throws JMSException  {
00102         TraceJms.logger.log(BasicLevel.DEBUG,  "");
00103         return xatc.createConnectionConsumer(topic, messageSelector, sessionPool, maxMessages);
00104     }
00105 }

Generated on Tue Feb 15 15:05:50 2005 for JOnAS by  doxygen 1.3.9.1