OCI object storage api fehler behoben

This commit is contained in:
2026-04-22 15:25:24 +02:00
parent aa0ed5d763
commit 1c303f1376
6 changed files with 36 additions and 31 deletions

View File

@@ -1,5 +1,6 @@
package de.galabau.dateieingang.oci;
import com.oracle.bmc.Region;
import com.oracle.bmc.auth.SimpleAuthenticationDetailsProvider;
import com.oracle.bmc.objectstorage.ObjectStorage;
import com.oracle.bmc.objectstorage.ObjectStorageClient;
@@ -9,6 +10,7 @@ import de.galabau.dateieingang.exception.OciException;
import de.galabau.dateieingang.model.FileEntry;
import de.galabau.dateieingang.model.ProcessingContext;
import io.quarkus.logging.Log;
import io.quarkus.runtime.Startup;
import jakarta.annotation.PostConstruct;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
@@ -23,6 +25,7 @@ import java.util.List;
* Lädt die entpackten Dateien und den Marker in OCI Object Storage hoch.
* Authentifizierung via OCI HTTP Signature V1 (entspricht APEX Web Credential vom Typ OCI).
*/
//@Startup
@ApplicationScoped
public class OciUploadService {
@@ -34,24 +37,29 @@ public class OciUploadService {
@PostConstruct
void init() {
Log.info("Initialisiere OCI ObjectStorage-Client...");
SimpleAuthenticationDetailsProvider auth = SimpleAuthenticationDetailsProvider.builder()
.tenantId(config.tenancyId())
.userId(config.userId())
.fingerprint(config.fingerprint())
.privateKeySupplier(() -> {
try {
return Files.newInputStream(Path.of(config.privateKeyPath()));
} catch (IOException e) {
throw new RuntimeException("OCI Private Key nicht lesbar: "
+ config.privateKeyPath(), e);
}
})
.build();
Log.info("Auhtentifizierung...");
client = ObjectStorageClient.builder()
.endpoint("https://objectstorage." + config.region() + ".oraclecloud.com")
.build(auth);
Log.infof("OCI ObjectStorage-Client initialisiert (Region: %s, Bucket: %s)", config.region(), config.bucket());
try {
SimpleAuthenticationDetailsProvider auth = SimpleAuthenticationDetailsProvider.builder()
.tenantId(config.tenancyId())
.userId(config.userId())
.fingerprint(config.fingerprint())
.region(Region.fromRegionId(config.region()))
.privateKeySupplier(() -> {
try {
return Files.newInputStream(Path.of(config.privateKeyPath()));
} catch (IOException e) {
throw new RuntimeException("OCI Private Key nicht lesbar: "
+ config.privateKeyPath(), e);
}
})
.build();
Log.info("Authentifizierung...");
client = ObjectStorageClient.builder()
.build(auth);
Log.infof("OCI ObjectStorage-Client initialisiert (Region: %s, Bucket: %s)", config.region(), config.bucket());
} catch (Throwable e) {
Log.errorf(e, "OCI ObjectStorage-Client Initialisierung fehlgeschlagen");
throw new RuntimeException("OCI-Client konnte nicht initialisiert werden", e);
}
}
/**