Skip to content

Commit

Permalink
Merge pull request #4424 from aguibert/jdbc-derby
Browse files Browse the repository at this point in the history
Initial copy of Derby extension
  • Loading branch information
Sanne authored Oct 14, 2019
2 parents 89083cd + c5f91a9 commit 9dcaa18
Show file tree
Hide file tree
Showing 22 changed files with 735 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ out
lib
bin
dependency-reduced-pom.xml
derby.log
hotspot.log
.directory
.java-version
Expand Down
26 changes: 26 additions & 0 deletions bom/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
<mariadb-jdbc.version>2.4.4</mariadb-jdbc.version>
<mysql-jdbc.version>8.0.17</mysql-jdbc.version>
<mssql-jdbc.version>7.2.1.jre8</mssql-jdbc.version>
<derby-jdbc.version>10.14.2.0</derby-jdbc.version>
<shrinkwrap.version>1.2.6</shrinkwrap.version>
<rest-assured.version>4.1.1</rest-assured.version>
<junit.jupiter.version>5.5.2</junit.jupiter.version>
Expand Down Expand Up @@ -408,6 +409,11 @@
<artifactId>quarkus-jdbc-mysql</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-jdbc-derby</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-kafka-client</artifactId>
Expand Down Expand Up @@ -690,6 +696,11 @@
<artifactId>quarkus-test-h2</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-test-derby</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-test-kubernetes-client</artifactId>
Expand Down Expand Up @@ -1822,6 +1833,21 @@
<artifactId>mysql-connector-java</artifactId>
<version>${mysql-jdbc.version}</version>
</dependency>
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derbyclient</artifactId>
<version>${derby-jdbc.version}</version>
</dependency>
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derbynet</artifactId>
<version>${derby-jdbc.version}</version>
</dependency>
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derbytools</artifactId>
<version>${derby-jdbc.version}</version>
</dependency>
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ public final class FeatureBuildItem extends MultiBuildItem {
public static final String INFINISPAN_CLIENT = "infinispan-client";
public static final String INFINISPAN_EMBEDDED = "infinispan-embedded";
public static final String JAEGER = "jaeger";
public static final String JDBC_DERBY = "jdbc-derby";
public static final String JDBC_H2 = "jdbc-h2";
public static final String JDBC_MARIADB = "jdbc-mariadb";
public static final String JDBC_POSTGRESQL = "jdbc-postgresql";
public static final String JDBC_MARIADB = "jdbc-mariadb";
public static final String JDBC_MSSQL = "jdbc-mssql";
public static final String JDBC_MYSQL = "jdbc-mysql";
public static final String JGIT = "jgit";
Expand Down
10 changes: 10 additions & 0 deletions devtools/common/src/main/filtered/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,16 @@
"artifactId": "quarkus-infinispan-client",
"guide": "https://quarkus.io/guides/infinispan-client-guide"
},
{
"name": "JDBC Driver - Derby",
"labels": [
"jdbc-derby",
"jdbc",
"derby"
],
"groupId": "io.quarkus",
"artifactId": "quarkus-jdbc-derby"
},
{
"name": "JDBC Driver - H2",
"labels": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

import org.hibernate.boot.archive.scan.spi.ClassDescriptor;
import org.hibernate.cfg.AvailableSettings;
import org.hibernate.dialect.DerbyTenSevenDialect;
import org.hibernate.dialect.MariaDB103Dialect;
import org.hibernate.dialect.MySQL8Dialect;
import org.hibernate.integrator.spi.Integrator;
Expand Down Expand Up @@ -517,6 +518,9 @@ private Optional<String> guessDialect(Optional<String> driver) {
if (resolvedDriver.contains("com.mysql.cj.jdbc.Driver")) {
return Optional.of(MySQL8Dialect.class.getName());
}
if (resolvedDriver.contains("org.apache.derby.jdbc.ClientDriver")) {
return Optional.of((DerbyTenSevenDialect.class.getName()));
}

String error = driver.isPresent()
? "Hibernate extension could not guess the dialect from the driver '" + resolvedDriver
Expand Down
42 changes: 42 additions & 0 deletions extensions/jdbc/jdbc-derby/jdbc-derby-deployment/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>quarkus-jdbc-derby-parent</artifactId>
<groupId>io.quarkus</groupId>
<version>999-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>quarkus-jdbc-derby-deployment</artifactId>
<name>Quarkus - JDBC - Derby - Deployment</name>

<dependencies>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-core-deployment</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-jdbc-derby</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-extension-processor</artifactId>
<version>${project.version}</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package io.quarkus.jdbc.derby.deployment;

import io.quarkus.deployment.annotations.BuildProducer;
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.builditem.FeatureBuildItem;
import io.quarkus.deployment.builditem.substrate.ReflectiveClassBuildItem;

public class JDBCDerbyProcessor {

@BuildStep
FeatureBuildItem feature() {
return new FeatureBuildItem(FeatureBuildItem.JDBC_DERBY);
}

@BuildStep
void registerDriverForReflection(BuildProducer<ReflectiveClassBuildItem> reflectiveClass) {
//Not strictly necessary when using Agroal, as it also registers
//any JDBC driver being configured explicitly through its configuration.
//We register it for the sake of people not using Agroal.
reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, org.apache.derby.jdbc.ClientDriver.class.getName()));
}

}
51 changes: 51 additions & 0 deletions extensions/jdbc/jdbc-derby/jdbc-derby-runtime/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>quarkus-jdbc-derby-parent</artifactId>
<groupId>io.quarkus</groupId>
<version>999-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>quarkus-jdbc-derby</artifactId>
<name>Quarkus - JDBC - Derby - Runtime</name>

<dependencies>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-core</artifactId>
</dependency>
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derbyclient</artifactId>
</dependency>
<dependency>
<groupId>com.oracle.substratevm</groupId>
<artifactId>svm</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-bootstrap-maven-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-extension-processor</artifactId>
<version>${project.version}</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
</plugins>
</build>

</project>
20 changes: 20 additions & 0 deletions extensions/jdbc/jdbc-derby/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>quarkus-jdbc-parent</artifactId>
<groupId>io.quarkus</groupId>
<version>999-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>quarkus-jdbc-derby-parent</artifactId>
<name>Quarkus - JDBC - Derby</name>
<packaging>pom</packaging>
<modules>
<module>jdbc-derby-deployment</module>
<module>jdbc-derby-runtime</module>
</modules>

</project>
1 change: 1 addition & 0 deletions extensions/jdbc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<packaging>pom</packaging>
<modules>
<module>jdbc-postgresql</module>
<module>jdbc-derby</module>
<module>jdbc-h2</module>
<module>jdbc-mariadb</module>
<module>jdbc-mssql</module>
Expand Down
126 changes: 126 additions & 0 deletions integration-tests/jpa-derby/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>quarkus-integration-tests-parent</artifactId>
<groupId>io.quarkus</groupId>
<version>999-SNAPSHOT</version>
<relativePath>../</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>quarkus-integration-test-jpa-derby</artifactId>
<name>Quarkus - Integration Tests - JPA - Derby</name>
<description>Module that contains JPA related tests running with the Derby database</description>
<dependencies>
<!-- Enables the JPA capabilities -->
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-hibernate-orm</artifactId>
</dependency>
<!-- We'll be using the Derby database -->
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-jdbc-derby</artifactId>
</dependency>
<!-- .. and some REST endpoints -->
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-undertow</artifactId>
</dependency>

<!-- test dependencies -->
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-junit5</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-test-derby</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>build</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>native-image</id>
<activation>
<property>
<name>native</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
<configuration>
<systemProperties>
<native.image.path>${project.build.directory}/${project.build.finalName}-runner</native.image.path>
</systemProperties>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-maven-plugin</artifactId>
<executions>
<execution>
<id>native-image</id>
<goals>
<goal>native-image</goal>
</goals>
<configuration>
<reportErrorsAtRuntime>false</reportErrorsAtRuntime>
<cleanupServer>true</cleanupServer>
<enableHttpUrlHandler>true</enableHttpUrlHandler>
<graalvmHome>${graalvmHome}</graalvmHome>
<enableJni>false</enableJni>
<debugBuildProcess>false</debugBuildProcess>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>

</profiles>

</project>
Loading

0 comments on commit 9dcaa18

Please sign in to comment.