diff --git a/blocks/cocoon-databases/cocoon-databases-bridge/src/main/java/org/apache/cocoon/databases/bridge/spring/avalon/SpringToAvalonDataSourceWrapper.java b/blocks/cocoon-databases/cocoon-databases-bridge/src/main/java/org/apache/cocoon/databases/bridge/spring/avalon/SpringToAvalonDataSourceWrapper.java index b88ce571836..9aad4004e7a 100644 --- a/blocks/cocoon-databases/cocoon-databases-bridge/src/main/java/org/apache/cocoon/databases/bridge/spring/avalon/SpringToAvalonDataSourceWrapper.java +++ b/blocks/cocoon-databases/cocoon-databases-bridge/src/main/java/org/apache/cocoon/databases/bridge/spring/avalon/SpringToAvalonDataSourceWrapper.java @@ -21,6 +21,8 @@ import java.io.PrintWriter; import java.sql.Connection; import java.sql.SQLException; +import java.sql.SQLFeatureNotSupportedException; +import java.util.logging.Logger; import javax.sql.DataSource; @@ -34,7 +36,7 @@ * */ public class SpringToAvalonDataSourceWrapper implements DataSource, DataSourceComponent { - + private DataSource wrappedBean; /** @@ -80,6 +82,13 @@ public int getLoginTimeout() throws SQLException { return wrappedBean.getLoginTimeout(); } + /** + * Required by JDK1.7. + */ + public Logger getParentLogger() throws SQLFeatureNotSupportedException { + throw new SQLFeatureNotSupportedException(); + } + /** * @return * @throws SQLException @@ -106,7 +115,7 @@ public void setLoginTimeout(int seconds) throws SQLException { public void setLogWriter(PrintWriter out) throws SQLException { wrappedBean.setLogWriter(out); } - + /** * @param iface * @return @@ -114,8 +123,7 @@ public void setLogWriter(PrintWriter out) throws SQLException { * @see java.sql.Wrapper#isWrapperFor(java.lang.Class) */ public boolean isWrapperFor(Class iface) throws SQLException { - throw new UnsupportedOperationException("This operation is not supported because we need to stay compatible " + - "with Java 1.4 where isWrapperFor() is not defined"); + return wrappedBean.isWrapperFor(iface); } /** @@ -125,9 +133,7 @@ public boolean isWrapperFor(Class iface) throws SQLException { * @see java.sql.Wrapper#unwrap(java.lang.Class) */ public Object unwrap(Class iface) throws SQLException { - //I hope that nothing will call this method (GK) - throw new UnsupportedOperationException("This operation is not supported because we need to stay compatible " + - "with Java 1.4 where unwrap() is not defined"); + return wrappedBean.unwrap(iface); } public void configure(Configuration arg0) throws ConfigurationException { diff --git a/blocks/cocoon-databases/cocoon-databases-impl/src/main/java/org/apache/cocoon/databases/ibatis/ExcaliburDataSourceFactory.java b/blocks/cocoon-databases/cocoon-databases-impl/src/main/java/org/apache/cocoon/databases/ibatis/ExcaliburDataSourceFactory.java index 737f129ec78..2ed8a1d2670 100644 --- a/blocks/cocoon-databases/cocoon-databases-impl/src/main/java/org/apache/cocoon/databases/ibatis/ExcaliburDataSourceFactory.java +++ b/blocks/cocoon-databases/cocoon-databases-impl/src/main/java/org/apache/cocoon/databases/ibatis/ExcaliburDataSourceFactory.java @@ -19,7 +19,9 @@ import java.io.PrintWriter; import java.sql.Connection; import java.sql.SQLException; +import java.sql.SQLFeatureNotSupportedException; import java.util.Map; +import java.util.logging.Logger; import javax.sql.DataSource; @@ -63,13 +65,13 @@ public void initialize(Map values) { final ServiceManager manager = EnvironmentHelper.getSitemapServiceManager(); if ( manager == null ) { throw new RuntimeException("Cocoon sitemap service manager is not available for " + this.getClass().getName() + "." + - " Make sure that you're initializing iBatis during an active request and not on startup."); + " Make sure that you're initializing iBatis during an active request and not on startup."); } try { this.datasource = (DataSourceComponent)manager.lookup(DataSourceComponent.ROLE + '/' + connection); } catch (ServiceException e) { throw new CascadingRuntimeException("Unable to lookup data source with name " + connection + "." + - " Check the cocoon.xconf and the iBatis sqlMapConfig.", e); + " Check the cocoon.xconf and the iBatis sqlMapConfig.", e); } } @@ -95,6 +97,13 @@ public int getLoginTimeout() throws SQLException { return this.timeout; } + /** + * Required by JDK1.7. + */ + public Logger getParentLogger() throws SQLFeatureNotSupportedException { + throw new SQLFeatureNotSupportedException(); + } + public PrintWriter getLogWriter() throws SQLException { return this.writer; } @@ -105,7 +114,7 @@ public void setLoginTimeout(int seconds) throws SQLException { public void setLogWriter(PrintWriter out) throws SQLException { this.writer = out; - } + } /** * Required by JDK1.6.