View Javadoc

1   /*
2    * $Id: OracleInContainerJmsConnector.java 7976 2007-08-21 14:26:13Z dirk.olmes $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.providers.oracle.jms;
12  
13  import java.sql.Connection;
14  import java.sql.SQLException;
15  
16  import javax.jms.JMSException;
17  import javax.sql.DataSource;
18  
19  /**
20   * JMS Connector for Oracle AQ that uses a user provided data source for database connectivity
21   */
22  public class OracleInContainerJmsConnector extends AbstractOracleJmsConnector
23  {
24  
25      private DataSource dataSource;
26  
27      public DataSource getDataSource()
28      {
29          return dataSource;
30      }
31  
32      public void setDataSource(DataSource dataSource)
33      {
34          this.dataSource = dataSource;
35      }
36  
37      public Connection getJdbcConnection() throws JMSException
38      {
39          try
40          {
41              return dataSource.getConnection();
42          }
43          catch (SQLException e)
44          {
45              throw new JMSException("Unable to open JDBC connection: " + e.getMessage());
46          }
47      }
48  
49  }