diff options
author | Simon Brandhof <simon.brandhof@gmail.com> | 2012-01-16 17:11:08 +0100 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@gmail.com> | 2012-01-16 17:11:08 +0100 |
commit | d30b0e381a451abaf2ff5aef3978d595c521bde5 (patch) | |
tree | 125526e85bb3e5b446d9515ab2242be9ff1f19d7 | |
parent | e7b0c960d3a38f5f8e8ac6bd3b7464783a4cf9c1 (diff) | |
download | sonarqube-d30b0e381a451abaf2ff5aef3978d595c521bde5.tar.gz sonarqube-d30b0e381a451abaf2ff5aef3978d595c521bde5.zip |
Remove unused Ruby code : JNDI support in activerecord adapters
2 files changed, 7 insertions, 32 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/vendor/gems/activerecord-jdbc-adapter-1.1.3/lib/arjdbc/jdbc/connection.rb b/sonar-server/src/main/webapp/WEB-INF/vendor/gems/activerecord-jdbc-adapter-1.1.3/lib/arjdbc/jdbc/connection.rb index fec934983a6..0d37eace4fe 100644 --- a/sonar-server/src/main/webapp/WEB-INF/vendor/gems/activerecord-jdbc-adapter-1.1.3/lib/arjdbc/jdbc/connection.rb +++ b/sonar-server/src/main/webapp/WEB-INF/vendor/gems/activerecord-jdbc-adapter-1.1.3/lib/arjdbc/jdbc/connection.rb @@ -13,34 +13,11 @@ module ActiveRecord config[:connection_alive_sql] ||= "select 1" # sonar - # ActiveRecord must transfer the responsibility of connection pool to the Sonar, - # even if JNDI datasource is not used. + # The connection pool is managed by Sonar (commons-dbcp) but not by ActiveRecord @jndi_connection = true - # /sonar @connection = nil - if config[:jndi] - begin - configure_jndi - rescue => e - warn "JNDI data source unavailable: #{e.message}; trying straight JDBC" - configure_jdbc - end - else - configure_jdbc - end - end - - def configure_jndi - jndi = config[:jndi].to_s - ctx = javax.naming.InitialContext.new - ds = ctx.lookup(jndi) - @connection_factory = JdbcConnectionFactory.impl do - ds.connection - end - unless config[:driver] - config[:driver] = connection.meta_data.connection.java_class.name - end - @jndi_connection = true + configure_jdbc + # /sonar end def configure_url diff --git a/sonar-server/src/main/webapp/WEB-INF/vendor/gems/activerecord-oracle_enhanced-adapter-1.4.0/lib/active_record/connection_adapters/oracle_enhanced_jdbc_connection.rb b/sonar-server/src/main/webapp/WEB-INF/vendor/gems/activerecord-oracle_enhanced-adapter-1.4.0/lib/active_record/connection_adapters/oracle_enhanced_jdbc_connection.rb index 6a6694c1e2d..7f709da824f 100644 --- a/sonar-server/src/main/webapp/WEB-INF/vendor/gems/activerecord-oracle_enhanced-adapter-1.4.0/lib/active_record/connection_adapters/oracle_enhanced_jdbc_connection.rb +++ b/sonar-server/src/main/webapp/WEB-INF/vendor/gems/activerecord-oracle_enhanced-adapter-1.4.0/lib/active_record/connection_adapters/oracle_enhanced_jdbc_connection.rb @@ -56,17 +56,15 @@ module ActiveRecord end #sonar - # modified method to support JNDI connections + # Commons DBCP is used to manage pool of JDBC connections. def new_connection(config) @raw_connection = ::Java::OrgSonarServerUi::JRubyFacade.getInstance().getConnection() + if @raw_connection.respond_to?(:getInnermostDelegate) @pooled_connection = @raw_connection - @raw_connection = @raw_connection.innermost_delegate - elsif @raw_connection.respond_to?(:getUnderlyingConnection) - @pooled_connection = @raw_connection - @raw_connection = @raw_connection.underlying_connection + @raw_connection = @raw_connection.getInnermostDelegate() else - raise ArgumentError, "JDBC Datasource not supported. Please use Commons DBCP or Tomcat Connection Pool" + raise ArgumentError, "This JDBC connection is not managed by Commons DBCP" end username = @raw_connection.meta_data.user_name |