JTopicConnectionFactory.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: JTopicConnectionFactory.java,v 1.8 2004/03/19 14:31:48 sauthieg Exp $
00022  * --------------------------------------------------------------------------
00023  */
00024 
00025 package org.objectweb.jonas_jms;
00026 
00027 import javax.jms.JMSException;
00028 import javax.jms.TopicConnection;
00029 import javax.jms.TopicConnectionFactory;
00030 import javax.jms.XATopicConnectionFactory;
00031 
00032 import org.objectweb.util.monolog.api.BasicLevel;
00033 
00043 public class JTopicConnectionFactory extends JConnectionFactory implements TopicConnectionFactory {
00044     
00045     private XATopicConnectionFactory xatcf;
00046 
00051     public JTopicConnectionFactory(String name) {
00052         this.name = name;
00053         jms = JmsManagerImpl.getJmsManager();
00054         xacf = jms.getXATopicConnectionFactory();
00055         xatcf = (XATopicConnectionFactory) xacf;
00056     }
00057 
00058     // -----------------------------------------------------------------------
00059     // TopicConnectionFactory implementation
00060     // -----------------------------------------------------------------------
00061 
00071     public TopicConnection createTopicConnection() throws JMSException {
00072         // Try to reuse a connection from the pool.
00073         // Create a new one if no connection available.
00074         TraceJms.logger.log(BasicLevel.DEBUG,"");
00075         JTopicConnection tc = (JTopicConnection) getJConnection();
00076         if (tc == null) {
00077             tc = new JTopicConnection(this, xatcf);
00078         }
00079         return (TopicConnection) tc;
00080     }
00081 
00095     public TopicConnection createTopicConnection(String userName, String password) 
00096         throws JMSException {
00097         TraceJms.logger.log(BasicLevel.DEBUG,"");
00098         // Try to reuse a connection from the pool.
00099         // Create a new one if no connection available.
00100         JTopicConnection tc = (JTopicConnection) getJConnection(userName);
00101         if (tc == null) {
00102             tc = new JTopicConnection(this, xatcf, userName, password);
00103         }
00104         return (TopicConnection) tc;
00105     }
00106 
00107 } 

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