1 10 11 package org.mule.providers.oracle.jms; 12 13 import oracle.jdbc.pool.OracleDataSource; 14 import oracle.jdbc.driver.OracleDriver; 15 import org.mule.umo.lifecycle.InitialisationException; 16 17 import javax.jms.JMSException ; 18 import java.sql.Driver ; 19 import java.sql.DriverManager ; 20 import java.sql.SQLException ; 21 22 32 public class OracleJmsConnector extends AbstractOracleJmsConnector 33 { 34 35 39 private String url; 40 41 45 private OracleDataSource jdbcConnectionPool = null; 46 47 public OracleJmsConnector() 48 { 49 super(); 50 51 } 52 53 public void doInitialise() throws InitialisationException 54 { 55 try 56 { 57 Driver oracleDriver = new OracleDriver(); 59 DriverManager.deregisterDriver(oracleDriver); 61 DriverManager.registerDriver(oracleDriver); 62 63 jdbcConnectionPool = new OracleDataSource(); 64 jdbcConnectionPool.setDataSourceName("Mule Oracle AQ Provider"); 65 jdbcConnectionPool.setUser(username); 66 jdbcConnectionPool.setPassword(password); 67 jdbcConnectionPool.setURL(url); 68 69 } 70 catch (SQLException e) 71 { 72 throw new InitialisationException(e, this); 73 } 74 super.doInitialise(); 75 } 76 77 public java.sql.Connection getJdbcConnection() throws JMSException 78 { 79 try 80 { 81 logger.debug("Getting queue/topic connection from pool, URL = " 82 + getJdbcConnectionPool().getURL() + ", user = " + getJdbcConnectionPool().getUser()); 83 return getJdbcConnectionPool().getConnection(); 84 } 85 catch (SQLException e) 86 { 87 throw new JMSException ("Unable to open JDBC connection: " + e.getMessage()); 88 } 89 } 90 91 public String getUrl() 92 { 93 return url; 94 } 95 96 public void setUrl(String url) 97 { 98 this.url = url; 99 } 100 101 public OracleDataSource getJdbcConnectionPool() 102 { 103 return jdbcConnectionPool; 104 } 105 106 } 107 | Popular Tags |