Skip to content

Commit

Permalink
refactor: migrate to Java ServiceLoader for plugin registration
Browse files Browse the repository at this point in the history
  • Loading branch information
fhussonnois committed Apr 23, 2024
1 parent 4dc540b commit b037487
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
4 changes: 4 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ dependencies {
compileOnly "io.micronaut.validation:micronaut-validation"

// kestra
annotationProcessor group: "io.kestra", name: "processor", version: kestraVersion
compileOnly group: "io.kestra", name: "core", version: kestraVersion

// AWS libs: versions are managed by the Micronaut BOM
Expand Down Expand Up @@ -104,6 +105,9 @@ dependencies {
testImplementation "org.testcontainers:testcontainers:1.19.1"
testImplementation "org.testcontainers:localstack:1.19.6"
testImplementation "com.amazonaws:aws-java-sdk-s3"

// test
testAnnotationProcessor group: "io.kestra", name: "processor", version: kestraVersion
}

/**********************************************************************************************************************\
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version=0.17.0-SNAPSHOT
kestraVersion=[0.16,)
kestraVersion=[0.17,)
micronautVersion=4.3.7
lombokVersion=1.18.32
11 changes: 11 additions & 0 deletions src/main/java/io/kestra/storage/s3/S3Storage.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.kestra.storage.s3;

import io.kestra.core.models.annotations.Plugin;
import io.kestra.core.storages.FileAttributes;
import io.kestra.core.storages.StorageInterface;
import io.micronaut.core.annotation.Introspected;
Expand Down Expand Up @@ -36,13 +37,23 @@
@Singleton
@Introspected
@S3StorageEnabled
@Plugin
public class S3Storage implements StorageInterface {
private final S3Client s3Client;

private final S3AsyncClient s3AsyncClient;

private final S3Config s3Config;

/**
* No-arg constructor - required for Kestra plugin.
*/
public S3Storage() {
this.s3Config = null;
this.s3AsyncClient = null;
this.s3Client = null;
}

public S3Storage(final S3Config s3Config) {
this.s3Config = s3Config;
this.s3Client = S3ClientFactory.getS3Client(s3Config);
Expand Down

0 comments on commit b037487

Please sign in to comment.