Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/java-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
fail-fast: false
matrix:
javaver: [21]
javaver: [21, 22, 23]
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/javadoc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Javadoc
run: mvn javadoc:javadoc
- name: Publish Documentation on GitHub Pages
uses: peaceiris/actions-gh-pages@v3
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./target/site/apidocs
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
packages: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v3
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 21
Expand Down
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,3 @@ test-results-native/
# OS generating files
.DS_Store
Thumbs.db

# GraalVM native build configuration files
src/main/resources/META-INF/native-image
177 changes: 139 additions & 38 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,39 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.github.sttk</groupId>
<groupId>io.github.sttk</groupId>
<artifactId>sabi</artifactId>
<version>0.4.0</version>
<packaging>jar</packaging>

<name>sabi</name>
<description>A small framework to separate logics and data accesses for Java application.</description>
<url>https://github.com/sttk/sabi-java</url>

<licenses>
<license>
<name>The MIT License</name>
<url>https://opensource.org/license/mit/</url>
<distribution>repo</distribution>
</license>
</licenses>

<developers>
<developer>
<id>sttk</id>
<name>Takayuki Sato</name>
<url>https://github.com/sttk</url>
</developer>
</developers>

<scm>
<url>https://github.com/sttk/sabi-java</url>
<connection>scm:git:git://github.com/sttk/sabi-java.git</connection>
<developerConnection>scm:git:git//github.com/sttk/sabi-java.git</developerConnection>
</scm>

<properties>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<maven.compiler.release>21</maven.compiler.release>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!--
For changing environment variables in unit tests.
Expand All @@ -23,51 +48,79 @@

<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.10.1</version>
<scope>test</scope>
<groupId>io.github.sttk</groupId>
<artifactId>errs</artifactId>
<version>0.1.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.10.1</version>
<artifactId>junit-jupiter</artifactId>
<version>5.11.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-launcher</artifactId>
<version>1.10.1</version>
<version>1.11.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.25.1</version>
<version>3.27.2</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.4.1</version>
<version>3.11.2</version>
<configuration>
<author>true</author>
<source>21</source>
<show>protected</show>
<encoding>UTF-8</encoding>
<charset>UTF-8</charset>
<docencoding>UTF-8</docencoding>
<bottom><![CDATA[Copyright 2022-2023 Takayuki Sato. All Rights Reserved.]]></bottom>
<bottom><![CDATA[Copyright 2022-2025 Takayuki Sato. All Rights Reserved.]]></bottom>
<outputDirectory>${project.build.directory}/site</outputDirectory>
</configuration>
<executions>
<execution>
<goals>
<goal>aggregate</goal>
</goals>
<phase>site</phase>
</execution>
<execution>
<id>attach-javadoc</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.10</version>
<version>0.8.12</version>
<executions>
<execution>
<id>default-prepare-agent</id>
Expand All @@ -87,7 +140,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.10.1</version>
<version>3.13.0</version>
<configuration>
<compilerArgs>
<arg>-g</arg>
Expand All @@ -98,7 +151,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M7</version>
<version>3.5.2</version>
</plugin>
</plugins>
</build>
Expand All @@ -111,7 +164,7 @@
<plugin>
<groupId>org.graalvm.buildtools</groupId>
<artifactId>native-maven-plugin</artifactId>
<version>0.9.19</version>
<version>0.10.4</version>
<extensions>true</extensions>
<executions>
<execution>
Expand All @@ -120,25 +173,13 @@
<goal>test</goal>
</goals>
<phase>test</phase>
<configuration>
<dependencies>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-launcher</artifactId>
<version>1.9.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</configuration>
</execution>
</executions>
<configuration>
<fallback>false</fallback>
<!-- For changing environment variables in unit tests. -->
<buildArgs>
<buildArg>-J--add-opens=java.base/java.lang=ALL-UNNAMED</buildArg>
<buildArg>--initialize-at-build-time=org.junit.platform.launcher.core.LauncherConfig</buildArg>
<buildArg>--initialize-at-build-time=org.junit.jupiter.engine.config.InstantiatingConfigurationParameterConverter</buildArg>
</buildArgs>
</configuration>
</plugin>
Expand All @@ -148,17 +189,77 @@
<profile>
<id>trace</id>
<properties>
<argLine>-agentlib:native-image-agent=config-output-dir=src/main/resources/META-INF/native-image</argLine>
<argLine>-agentlib:native-image-agent=config-output-dir=target/native-trace/</argLine>
</properties>
</profile>
<profile>
<id>release-gh</id>
<distributionManagement>
<repository>
<id>github</id>
<name>GitHub Packages</name>
<url>https://maven.pkg.github.com/sttk/cliargs-java</url>
</repository>
</distributionManagement>
</profile>
<profile>
<id>release-ossrh</id>
<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<name>Central Repository OSSRH (Snapshot)</name>
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>ossrh</id>
<name>Central Repository OSSRH</name>
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>
<build>
<plugins>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.7.0</version>
<extensions>true</extensions>
<executions>
<execution>
<phase>deploy</phase>
<goals>
<goal>deploy</goal>
</goals>
</execution>
</executions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://s01.oss.sonatype.org</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>3.2.7</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
<configuration>
<gpgArguments>
<arg>--pinentry-mode</arg>
<arg>loopback</arg>
</gpgArguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

<distributionManagement>
<repository>
<id>github</id>
<name>GitHub Packages</name>
<url>https://maven.pkg.github.com/sttk/sabi-java</url>
</repository>
</distributionManagement>

</project>
29 changes: 3 additions & 26 deletions src/main/java/com/github/sttk/sabi/AsyncGroup.java
Original file line number Diff line number Diff line change
@@ -1,40 +1,17 @@
/*
* AsyncGroup class.
* Copyright (C) 2023 Takayuki Sato. All Rights Reserved.
* Copyright (C) 2023-2025 Takayuki Sato. All Rights Reserved.
*/
package com.github.sttk.sabi;

import com.github.sttk.sabi.errs.Err;
import com.github.sttk.errs.Exc;

import java.util.Map;
import java.util.HashMap;

/**
* {@code AsyncGroup} is the inferface to execute added {@link Runner}(s)
* asynchronously.
* <p>
* The method Add is to add target {@link Runner}(s).
* This interface is used as an argument of {@link DaxSrc#setup}, {@link
* DaxConn#commit}, and {@link DaxConn#rollback}.
*/
public interface AsyncGroup {

/**
* {@code RunnerFailed} is an error reason which indicates that a {@link
* Runner} failed.
*/
record RunnerFailed() {}

/**
* {@code RunnerInterrupted} is an error reason which indicates that a {@link
* Runner}'s thread is interrupted.
*/
record RunnerInterrupted() {}

/**
* Adds a runner to be run asynchronously.
*
* @param runner A {@link Runner} object.
*/
void add(Runner runner);
void add(final Runner runner);
}
11 changes: 11 additions & 0 deletions src/main/java/com/github/sttk/sabi/DataAcc.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*
* DataAcc class.
* Copyright (C) 2023-2025 Takayuki Sato. All Rights Reserved.
*/
package com.github.sttk.sabi;

import com.github.sttk.errs.Exc;

public interface DataAcc {
<C extends DataConn> C getDataConn(String name, Class<C> cls) throws Exc;
}
17 changes: 17 additions & 0 deletions src/main/java/com/github/sttk/sabi/DataConn.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
* DataConn class.
* Copyright (C) 2022-2025 Takayuki Sato. All Rights Reserved.
*/
package com.github.sttk.sabi;

import com.github.sttk.errs.Exc;

public interface DataConn {
void commit(AsyncGroup ag) throws Exc;
default void preCommit(AsyncGroup ag) throws Exc {}
default void postCommit(AsyncGroup ag) {}
default boolean shouldForceBack() { return false; }
void rollback(AsyncGroup ag);
default void forceBack(AsyncGroup ag) {}
void close();
}
Loading
Loading