Skip to content

Commit

Permalink
Improves integrations/jdbc/jdbc to better support future JPA improvem…
Browse files Browse the repository at this point in the history
…ents; initial work (#5654)

Signed-off-by: Laird Nelson <laird.nelson@oracle.com>
  • Loading branch information
ljnelson authored Dec 15, 2022
1 parent 9881679 commit ea0abfd
Show file tree
Hide file tree
Showing 16 changed files with 5,366 additions and 190 deletions.
10 changes: 5 additions & 5 deletions integrations/jdbc/jdbc/etc/spotbugs/exclude.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2021 Oracle and/or its affiliates.
Copyright (c) 2021, 2022 Oracle and/or its affiliates.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand All @@ -13,19 +13,19 @@
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
-->
<FindBugsFilter
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://github.com/spotbugs/filter/3.1.0"
xsi:schemaLocation="https://github.com/spotbugs/filter/3.1.0
https://raw.githubusercontent.com/spotbugs/spotbugs/3.1.0/spotbugs/etc/findbugsfilter.xsd">
<!-- These are delegating classes. User input validation would need to occur upstream -->
<!-- These are delegating classes. User input validation would need to occur upstream. -->
<Match>
<Class name="io.helidon.integrations.jdbc.DelegatingConnection"/>
<Package name="io.helidon.integrations.jdbc"/>
<Bug pattern="EXTERNAL_CONFIG_CONTROL"/>
</Match>
<Match>
<Class name="io.helidon.integrations.jdbc.DelegatingConnection"/>
<Package name="io.helidon.integrations.jdbc"/>
<Bug pattern="SQL_INJECTION_JDBC"/>
</Match>
</FindBugsFilter>
26 changes: 25 additions & 1 deletion integrations/jdbc/jdbc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,29 @@
<properties>
<spotbugs.exclude>etc/spotbugs/exclude.xml</spotbugs.exclude>
</properties>


<dependencies>

<!-- Test-scoped dependencies. -->

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>test</scope>
</dependency>

</dependencies>

</project>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Oracle and/or its affiliates.
* Copyright (c) 2021, 2022 Oracle and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -23,15 +23,18 @@
import javax.sql.CommonDataSource;

/**
* A skeletal implementation of the {@link CommonDataSource}
* interface.
* A <a href="https://download.oracle.com/otn-pub/jcp/jdbc-4_3-mrel3-spec/jdbc4.3-fr-spec.pdf" target="_parent">JDBC
* 4.3</a>-compliant skeletal implementation of the {@link CommonDataSource} interface.
*/
public abstract class AbstractCommonDataSource implements CommonDataSource {

private int loginTimeout;

private PrintWriter logWriter;

/**
* Creates a new {@link AbstractCommonDataSource}.
*/
protected AbstractCommonDataSource() {
super();
}
Expand All @@ -42,7 +45,7 @@ public PrintWriter getLogWriter() throws SQLException {
}

@Override
public void setLogWriter(final PrintWriter logWriter) throws SQLException {
public void setLogWriter(PrintWriter logWriter) throws SQLException {
this.logWriter = logWriter;
}

Expand All @@ -52,7 +55,7 @@ public int getLoginTimeout() throws SQLException {
}

@Override
public void setLoginTimeout(final int loginTimeout) throws SQLException {
public void setLoginTimeout(int loginTimeout) throws SQLException {
this.loginTimeout = loginTimeout;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Oracle and/or its affiliates.
* Copyright (c) 2021, 2022 Oracle and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -20,21 +20,25 @@
import javax.sql.DataSource;

/**
* A skeletal implementation of the {@link DataSource} interface.
* A <a href="https://download.oracle.com/otn-pub/jcp/jdbc-4_3-mrel3-spec/jdbc4.3-fr-spec.pdf" target="_parent">JDBC
* 4.3</a>-compliant, skeletal implementation of the {@link DataSource} interface.
*/
public abstract class AbstractDataSource extends AbstractCommonDataSource implements DataSource {

/**
* Creates a new {@link AbstractDataSource}.
*/
protected AbstractDataSource() {
super();
}

@Override
public boolean isWrapperFor(final Class<?> iface) throws SQLException {
public boolean isWrapperFor(Class<?> iface) throws SQLException {
return iface != null && iface.isInstance(this);
}

@Override
public <T> T unwrap(final Class<T> iface) throws SQLException {
public <T> T unwrap(Class<T> iface) throws SQLException {
return iface.cast(this);
}

Expand Down
Loading

0 comments on commit ea0abfd

Please sign in to comment.