@ -1,5 +1,5 @@
@@ -1,5 +1,5 @@
/ *
* Copyright 2002 - 2012 the original author or authors .
* Copyright 2002 - 2013 the original author or authors .
*
* Licensed under the Apache License , Version 2 . 0 ( the "License" ) ;
* you may not use this file except in compliance with the License .
@ -24,7 +24,7 @@ import org.springframework.util.ReflectionUtils;
@@ -24,7 +24,7 @@ import org.springframework.util.ReflectionUtils;
/ * *
* Implementation of the { @link NativeJdbcExtractor } interface for WebSphere ,
* supporting WebSphere Application Server 5 . 1 and higher .
* supporting WebSphere Application Server 6 . 1 and higher .
*
* < p > Returns the underlying native Connection to application code instead
* of WebSphere ' s wrapper implementation ; unwraps the Connection for
@ -40,14 +40,14 @@ import org.springframework.util.ReflectionUtils;
@@ -40,14 +40,14 @@ import org.springframework.util.ReflectionUtils;
* /
public class WebSphereNativeJdbcExtractor extends NativeJdbcExtractorAdapter {
private static final String JDBC_ADAPTER_CONNECTION_NAME_5 = "com.ibm.ws.rsadapter.jdbc.WSJdbcConnection" ;
private static final String JDBC_ADAPTER_CONNECTION_NAME = "com.ibm.ws.rsadapter.jdbc.WSJdbcConnection" ;
private static final String JDBC_ADAPTER_UTIL_NAME_5 = "com.ibm.ws.rsadapter.jdbc.WSJdbcUtil" ;
private static final String JDBC_ADAPTER_UTIL_NAME = "com.ibm.ws.rsadapter.jdbc.WSJdbcUtil" ;
private Class webSphere5 ConnectionClass ;
private Class webSphereConnectionClass ;
private Method webSphere5 NativeConnectionMethod ;
private Method webSphereNativeConnectionMethod ;
/ * *
@ -56,10 +56,10 @@ public class WebSphereNativeJdbcExtractor extends NativeJdbcExtractorAdapter {
@@ -56,10 +56,10 @@ public class WebSphereNativeJdbcExtractor extends NativeJdbcExtractorAdapter {
* /
public WebSphereNativeJdbcExtractor ( ) {
try {
this . webSphere5 ConnectionClass = getClass ( ) . getClassLoader ( ) . loadClass ( JDBC_ADAPTER_CONNECTION_NAME_5 ) ;
Class jdbcAdapterUtilClass = getClass ( ) . getClassLoader ( ) . loadClass ( JDBC_ADAPTER_UTIL_NAME_5 ) ;
this . webSphere5 NativeConnectionMethod =
jdbcAdapterUtilClass . getMethod ( "getNativeConnection" , new Class [ ] { this . webSphere5 ConnectionClass } ) ;
this . webSphereConnectionClass = getClass ( ) . getClassLoader ( ) . loadClass ( JDBC_ADAPTER_CONNECTION_NAME ) ;
Class jdbcAdapterUtilClass = getClass ( ) . getClassLoader ( ) . loadClass ( JDBC_ADAPTER_UTIL_NAME ) ;
this . webSphereNativeConnectionMethod =
jdbcAdapterUtilClass . getMethod ( "getNativeConnection" , new Class [ ] { this . webSphereConnectionClass } ) ;
}
catch ( Exception ex ) {
throw new IllegalStateException (
@ -97,9 +97,8 @@ public class WebSphereNativeJdbcExtractor extends NativeJdbcExtractorAdapter {
@@ -97,9 +97,8 @@ public class WebSphereNativeJdbcExtractor extends NativeJdbcExtractorAdapter {
* /
@Override
protected Connection doGetNativeConnection ( Connection con ) throws SQLException {
if ( this . webSphere5ConnectionClass . isAssignableFrom ( con . getClass ( ) ) ) {
return ( Connection ) ReflectionUtils . invokeJdbcMethod (
this . webSphere5NativeConnectionMethod , null , new Object [ ] { con } ) ;
if ( this . webSphereConnectionClass . isAssignableFrom ( con . getClass ( ) ) ) {
return ( Connection ) ReflectionUtils . invokeJdbcMethod ( this . webSphereNativeConnectionMethod , null , con ) ;
}
return con ;
}