1 23 package org.objectweb.joram.client.connector; 24 25 import javax.jms.IllegalStateException ; 26 import javax.jms.JMSException ; 27 import javax.jms.JMSSecurityException ; 28 import javax.resource.spi.ConnectionManager ; 29 import javax.resource.spi.ConnectionRequestInfo ; 30 31 import org.objectweb.util.monolog.api.BasicLevel; 32 33 37 public class OutboundQueueConnectionFactory 38 extends OutboundConnectionFactory 39 implements javax.jms.QueueConnectionFactory , 40 java.io.Serializable , 41 javax.resource.Referenceable 42 { 43 49 OutboundQueueConnectionFactory(ManagedConnectionFactoryImpl mcf, 50 ConnectionManager cxManager) 51 { 52 super(mcf, cxManager); 53 54 if (AdapterTracing.dbgAdapter.isLoggable(BasicLevel.DEBUG)) 55 AdapterTracing.dbgAdapter.log(BasicLevel.DEBUG, 56 "OutboundQueueConnectionFactory(" + mcf + 57 ", " + cxManager + ")"); 58 } 59 60 61 70 public javax.jms.QueueConnection createQueueConnection() 71 throws JMSException { 72 if (AdapterTracing.dbgAdapter.isLoggable(BasicLevel.DEBUG)) 73 AdapterTracing.dbgAdapter.log(BasicLevel.DEBUG, this + " createQueueConnection()"); 74 75 return createQueueConnection(mcf.userName, mcf.password); 76 } 77 78 87 public javax.jms.QueueConnection 88 createQueueConnection(String userName, String password) 89 throws JMSException { 90 if (AdapterTracing.dbgAdapter.isLoggable(BasicLevel.DEBUG)) 91 AdapterTracing.dbgAdapter.log(BasicLevel.DEBUG, 92 this + " createQueueConnection(" + userName + 93 ", " + password + ")"); 94 95 try { 96 QueueConnectionRequest cxRequest = 97 new QueueConnectionRequest(userName, password); 98 99 Object o = cxManager.allocateConnection(mcf, cxRequest); 100 101 if (AdapterTracing.dbgAdapter.isLoggable(BasicLevel.DEBUG)) 102 AdapterTracing.dbgAdapter.log(BasicLevel.DEBUG, 103 this + " createQueueConnection connection = " + o); 104 105 return (javax.jms.QueueConnection ) o; 106 } catch (javax.resource.spi.SecurityException exc) { 107 throw new JMSSecurityException ("Invalid user identification: " + exc); 108 } catch (javax.resource.spi.CommException exc) { 109 throw new IllegalStateException ("Could not connect to the JORAM server: " 110 + exc); 111 } catch (javax.resource.ResourceException exc) { 112 throw new JMSException ("Could not create connection: " + exc); 113 } 114 } 115 } 116 | Popular Tags |