Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds new method DataSource.getParentLogger() introduced in Java 1.7. #33

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -34,7 +36,7 @@
*
*/
public class SpringToAvalonDataSourceWrapper implements DataSource, DataSourceComponent {

private DataSource wrappedBean;

/**
Expand Down Expand Up @@ -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
Expand All @@ -106,16 +115,15 @@ public void setLoginTimeout(int seconds) throws SQLException {
public void setLogWriter(PrintWriter out) throws SQLException {
wrappedBean.setLogWriter(out);
}

/**
* @param iface
* @return
* @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);
}

/**
Expand All @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);
}
}

Expand All @@ -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;
}
Expand All @@ -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.
Expand Down