JQueueConnection.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: JQueueConnection.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.Queue;
00030 import javax.jms.QueueConnection;
00031 import javax.jms.QueueSession;
00032 import javax.jms.ServerSessionPool;
00033 import javax.jms.XAConnection;
00034 import javax.jms.XAQueueConnection;
00035 import javax.jms.XAQueueConnectionFactory;
00036 
00037 import org.objectweb.util.monolog.api.BasicLevel;
00038 
00048 public class JQueueConnection extends JConnection implements QueueConnection {
00049 
00050     // The XAQueueConnection used in the MOM
00051     protected XAQueueConnection xaqc = null;
00052 
00053 
00060     public JQueueConnection(JConnectionFactory jcf, 
00061                             XAQueueConnectionFactory xaqcf, 
00062                             String user, String passwd) throws JMSException {
00063         super(jcf, user);
00064 
00065         // Create the underlaying XAQueueConnection
00066         xaqc = xaqcf.createXAQueueConnection(user, passwd);
00067         this.xac = (XAConnection) xaqc;
00068     }
00069 
00073     public JQueueConnection(JConnectionFactory jcf, XAQueueConnectionFactory xaqcf) 
00074         throws JMSException {
00075 
00076         super(jcf, INTERNAL_USER_NAME);
00077         xaqc = xaqcf.createXAQueueConnection();
00078         this.xac = (XAConnection) xaqc;
00079     }
00080 
00081     // -----------------------------------------------------------------------
00082     // QueueConnection implementation
00083     // -----------------------------------------------------------------------
00084 
00098     public ConnectionConsumer createConnectionConsumer(Queue queue, 
00099                                                        String selector, 
00100                                                        ServerSessionPool pool, 
00101                                                        int maxmessages) throws JMSException {
00102         TraceJms.logger.log(BasicLevel.DEBUG,  "");
00103         return xaqc.createConnectionConsumer(queue, selector, pool, maxmessages);
00104     }
00105 
00115     public QueueSession createQueueSession(boolean transacted, int acknowledgeMode) throws JMSException {
00116         TraceJms.logger.log(BasicLevel.DEBUG, "");
00117         return new JQueueSession(this, xaqc);
00118     }
00119 }

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