You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by ja...@apache.org on 2022/12/18 21:52:30 UTC
svn commit: r1906073 - in /cocoon/branches/cocoon-2.2.1/blocks/cocoon-databases: cocoon-databases-bridge/src/main/java/org/apache/cocoon/databases/bridge/spring/avalon/ cocoon-databases-impl/src/main/java/org/apache/cocoon/databases/ibatis/
Author: javier
Date: Sun Dec 18 21:52:30 2022
New Revision: 1906073
URL: http://svn.apache.org/viewvc?rev=1906073&view=rev
Log:
COCOON-2372: Adds new method DataSource.getParentLogger() introduced in Java 1.7.
Modified:
cocoon/branches/cocoon-2.2.1/blocks/cocoon-databases/cocoon-databases-bridge/src/main/java/org/apache/cocoon/databases/bridge/spring/avalon/SpringToAvalonDataSourceWrapper.java
cocoon/branches/cocoon-2.2.1/blocks/cocoon-databases/cocoon-databases-impl/src/main/java/org/apache/cocoon/databases/ibatis/ExcaliburDataSourceFactory.java
Modified: cocoon/branches/cocoon-2.2.1/blocks/cocoon-databases/cocoon-databases-bridge/src/main/java/org/apache/cocoon/databases/bridge/spring/avalon/SpringToAvalonDataSourceWrapper.java
URL: http://svn.apache.org/viewvc/cocoon/branches/cocoon-2.2.1/blocks/cocoon-databases/cocoon-databases-bridge/src/main/java/org/apache/cocoon/databases/bridge/spring/avalon/SpringToAvalonDataSourceWrapper.java?rev=1906073&r1=1906072&r2=1906073&view=diff
==============================================================================
--- cocoon/branches/cocoon-2.2.1/blocks/cocoon-databases/cocoon-databases-bridge/src/main/java/org/apache/cocoon/databases/bridge/spring/avalon/SpringToAvalonDataSourceWrapper.java (original)
+++ cocoon/branches/cocoon-2.2.1/blocks/cocoon-databases/cocoon-databases-bridge/src/main/java/org/apache/cocoon/databases/bridge/spring/avalon/SpringToAvalonDataSourceWrapper.java Sun Dec 18 21:52:30 2022
@@ -21,6 +21,8 @@ package org.apache.cocoon.databases.brid
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 @@ import org.apache.avalon.framework.confi
*
*/
public class SpringToAvalonDataSourceWrapper implements DataSource, DataSourceComponent {
-
+
private DataSource wrappedBean;
/**
@@ -81,6 +83,13 @@ public class SpringToAvalonDataSourceWra
}
/**
+ * Required by JDK1.7.
+ */
+ public Logger getParentLogger() throws SQLFeatureNotSupportedException {
+ throw new SQLFeatureNotSupportedException();
+ }
+
+ /**
* @return
* @throws SQLException
* @see javax.sql.CommonDataSource#getLogWriter()
@@ -106,7 +115,7 @@ public class SpringToAvalonDataSourceWra
public void setLogWriter(PrintWriter out) throws SQLException {
wrappedBean.setLogWriter(out);
}
-
+
/**
* @param iface
* @return
@@ -114,8 +123,7 @@ public class SpringToAvalonDataSourceWra
* @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 class SpringToAvalonDataSourceWra
* @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 {
Modified: cocoon/branches/cocoon-2.2.1/blocks/cocoon-databases/cocoon-databases-impl/src/main/java/org/apache/cocoon/databases/ibatis/ExcaliburDataSourceFactory.java
URL: http://svn.apache.org/viewvc/cocoon/branches/cocoon-2.2.1/blocks/cocoon-databases/cocoon-databases-impl/src/main/java/org/apache/cocoon/databases/ibatis/ExcaliburDataSourceFactory.java?rev=1906073&r1=1906072&r2=1906073&view=diff
==============================================================================
--- cocoon/branches/cocoon-2.2.1/blocks/cocoon-databases/cocoon-databases-impl/src/main/java/org/apache/cocoon/databases/ibatis/ExcaliburDataSourceFactory.java (original)
+++ cocoon/branches/cocoon-2.2.1/blocks/cocoon-databases/cocoon-databases-impl/src/main/java/org/apache/cocoon/databases/ibatis/ExcaliburDataSourceFactory.java Sun Dec 18 21:52:30 2022
@@ -19,7 +19,9 @@ package org.apache.cocoon.databases.ibat
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 class ExcaliburDataSourceFactory
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 class ExcaliburDataSourceFactory
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 class ExcaliburDataSourceFactory
public void setLogWriter(PrintWriter out) throws SQLException {
this.writer = out;
- }
+ }
/**
* Required by JDK1.6.