protected DataSource wrapAsDataSource ( JdbcConnectionDescriptor jcd , ObjectPool connectionPool ) { final boolean allowConnectionUnwrap ; if ( jcd == null ) { allowConnectionUnwrap = false ; } else { final Properties properties = jcd . getConnectionPoolDescriptor ( ) . getDbcpProperties ( ) ; final String allowConnectionUnwrapParam ; allowConnectionUnwrapParam = properties . getProperty ( PARAM_NAME_UNWRAP_ALLOWED ) ; allowConnectionUnwrap = allowConnectionUnwrapParam != null && Boolean . valueOf ( allowConnectionUnwrapParam ) . booleanValue ( ) ; } final PoolingDataSource dataSource ; dataSource = new PoolingDataSource ( connectionPool ) ; dataSource . setAccessToUnderlyingConnectionAllowed ( allowConnectionUnwrap ) ; if ( jcd != null ) { final AbandonedConfig ac = jcd . getConnectionPoolDescriptor ( ) . getAbandonedConfig ( ) ; if ( ac . getRemoveAbandoned ( ) && ac . getLogAbandoned ( ) ) { final LoggerWrapperPrintWriter loggerPiggyBack ; loggerPiggyBack = new LoggerWrapperPrintWriter ( log , Logger . ERROR ) ; dataSource . setLogWriter ( loggerPiggyBack ) ; } } return dataSource ; }
Wraps the specified object pool for connections as a DataSource .