Skip to content

Commit

Permalink
Only require JDK 17.
Browse files Browse the repository at this point in the history
  • Loading branch information
io7m committed Sep 1, 2024
1 parent f2d96d9 commit f78a637
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 67 deletions.
2 changes: 1 addition & 1 deletion README.in
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ The `darco` package provides a minimalist, opinionated API for database access.
* Instrumented with [OpenTelemetry](https://www.opentelemetry.io).
* [PostgreSQL](https://www.postgresql.org) support.
* [SQLite](https://www.sqlite.org) support.
* Written in pure Java 21.
* Written in pure Java 17.
* [OSGi](https://www.osgi.org/) ready
* [JPMS](https://en.wikipedia.org/wiki/Java_Platform_Module_System) ready
* ISC license
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ darco
[![Maven Central](https://img.shields.io/maven-central/v/com.io7m.darco/com.io7m.darco.svg?style=flat-square)](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22com.io7m.darco%22)
[![Maven Central (snapshot)](https://img.shields.io/nexus/s/com.io7m.darco/com.io7m.darco?server=https%3A%2F%2Fs01.oss.sonatype.org&style=flat-square)](https://s01.oss.sonatype.org/content/repositories/snapshots/com/io7m/darco/)
[![Codecov](https://img.shields.io/codecov/c/github/io7m-com/darco.svg?style=flat-square)](https://codecov.io/gh/io7m-com/darco)
![Java Version](https://img.shields.io/badge/21-java?label=java&color=e6c35c)
![Java Version](https://img.shields.io/badge/17-java?label=java&color=e65cc3)

![com.io7m.darco](./src/site/resources/darco.jpg?raw=true)

Expand All @@ -27,7 +27,7 @@ The `darco` package provides a minimalist, opinionated API for database access.
* Instrumented with [OpenTelemetry](https://www.opentelemetry.io).
* [PostgreSQL](https://www.postgresql.org) support.
* [SQLite](https://www.sqlite.org) support.
* Written in pure Java 21.
* Written in pure Java 17.
* [OSGi](https://www.osgi.org/) ready
* [JPMS](https://en.wikipedia.org/wiki/Java_Platform_Module_System) ready
* ISC license
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,32 +122,28 @@ public Optional<Throwable> exception()
public static DDatabaseException ofException(
final Throwable ex)
{
return switch (ex) {
case final DDatabaseException e -> {
yield e;
}

case final SStructuredErrorExceptionType<?> e -> {
yield new DDatabaseException(
e.getMessage(),
ex,
e.errorCode().toString(),
e.attributes(),
e.remediatingAction()
);
}

default -> {
yield new DDatabaseException(
Objects.requireNonNullElse(
ex.getMessage(),
ex.getClass().getSimpleName()),
ex,
"error-io",
Map.of(),
Optional.empty()
);
}
};
if (ex instanceof DDatabaseException e) {
return e;
}

if (ex instanceof SStructuredErrorExceptionType<?> e) {
return new DDatabaseException(
e.getMessage(),
ex,
e.errorCode().toString(),
e.attributes(),
e.remediatingAction()
);
}

return new DDatabaseException(
Objects.requireNonNullElse(
ex.getMessage(),
ex.getClass().getSimpleName()),
ex,
"error-io",
Map.of(),
Optional.empty()
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -435,24 +435,23 @@ private void publishTrEvent(
final Consumer<String> startupMessages,
final TrEventType event)
{
switch (event) {
case final TrEventExecutingSQL sql -> {
this.publishEvent(
startupMessages,
String.format("Executing SQL: %s", sql.statement())
);
return;
}
case final TrEventUpgrading upgrading -> {
this.publishEvent(
startupMessages,
String.format(
"Upgrading database from version %s -> %s",
upgrading.fromVersion(),
upgrading.toVersion())
);
return;
}
if (event instanceof final TrEventExecutingSQL sql) {
this.publishEvent(
startupMessages,
String.format("Executing SQL: %s", sql.statement())
);
return;
}

if (event instanceof final TrEventUpgrading upgrading) {
this.publishEvent(
startupMessages,
String.format(
"Upgrading database from version %s -> %s",
upgrading.fromVersion(),
upgrading.toVersion())
);
return;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -353,24 +353,23 @@ private void publishTrEvent(
final Consumer<String> startupMessages,
final TrEventType event)
{
switch (event) {
case final TrEventExecutingSQL sql -> {
this.publishEvent(
startupMessages,
String.format("Executing SQL: %s", sql.statement())
);
return;
}
case final TrEventUpgrading upgrading -> {
this.publishEvent(
startupMessages,
String.format(
"Upgrading database from version %s -> %s",
upgrading.fromVersion(),
upgrading.toVersion())
);
return;
}
if (event instanceof final TrEventExecutingSQL sql) {
this.publishEvent(
startupMessages,
String.format("Executing SQL: %s", sql.statement())
);
return;
}

if (event instanceof final TrEventUpgrading upgrading) {
this.publishEvent(
startupMessages,
String.format(
"Upgrading database from version %s -> %s",
upgrading.fromVersion(),
upgrading.toVersion())
);
return;
}
}

Expand Down
1 change: 1 addition & 0 deletions com.io7m.darco.tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<properties>
<checkstyle.skip>true</checkstyle.skip>
<mdep.analyze.skip>true</mdep.analyze.skip>
<enforcer.skip>true</enforcer.skip>
</properties>

<dependencies>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<properties>
<!-- Configuration -->
<io7m.api.previousVersion>0.0.1-SNAPSHOT</io7m.api.previousVersion>
<io7m.java.targetJavaVersion>21</io7m.java.targetJavaVersion>
<io7m.java.targetJavaVersion>17</io7m.java.targetJavaVersion>

<!-- io7m dependencies. -->
<com.io7m.trasco.version>2.0.1</com.io7m.trasco.version>
Expand Down

0 comments on commit f78a637

Please sign in to comment.