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 OutboundTopicConnectionFactory 38 extends OutboundConnectionFactory 39 implements javax.jms.TopicConnectionFactory , 40 java.io.Serializable , 41 javax.resource.Referenceable 42 { 43 49 OutboundTopicConnectionFactory(ManagedConnectionFactoryImpl mcf, 50 ConnectionManager cxManager) { 51 super(mcf, cxManager); 52 53 if (AdapterTracing.dbgAdapter.isLoggable(BasicLevel.DEBUG)) 54 AdapterTracing.dbgAdapter.log(BasicLevel.DEBUG, 55 "OutboundTopicConnectionFactory(" + mcf + 56 ", " + cxManager + ")"); 57 } 58 59 60 69 public javax.jms.TopicConnection createTopicConnection() 70 throws JMSException { 71 if (AdapterTracing.dbgAdapter.isLoggable(BasicLevel.DEBUG)) 72 AdapterTracing.dbgAdapter.log(BasicLevel.DEBUG, this + " createTopicConnection()"); 73 74 return createTopicConnection(mcf.userName, mcf.password); 75 } 76 77 86 public javax.jms.TopicConnection 87 createTopicConnection(String userName, String password) 88 throws JMSException { 89 90 if (AdapterTracing.dbgAdapter.isLoggable(BasicLevel.DEBUG)) 91 AdapterTracing.dbgAdapter.log(BasicLevel.DEBUG, 92 this + " createTopicConnection(" + userName + 93 ", " + password + ")"); 94 95 try { 96 TopicConnectionRequest cxRequest = 97 new TopicConnectionRequest(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 + " createTopicConnection TopicConnection = " + o); 104 105 return (javax.jms.TopicConnection ) 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 |