From eb0c810a0ddc5950711d5239ce1b6899e40e0d95 Mon Sep 17 00:00:00 2001 From: tsande16 Date: Fri, 3 Jan 2025 10:17:49 -0500 Subject: [PATCH] Add javadoc to file service --- .../service/storage/FileStorageService.java | 4 ++ .../service/storage/StorageConfiguration.java | 41 +++++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/pass-core-file-service/src/main/java/org/eclipse/pass/file/service/storage/FileStorageService.java b/pass-core-file-service/src/main/java/org/eclipse/pass/file/service/storage/FileStorageService.java index de032e8..ffe56a5 100644 --- a/pass-core-file-service/src/main/java/org/eclipse/pass/file/service/storage/FileStorageService.java +++ b/pass-core-file-service/src/main/java/org/eclipse/pass/file/service/storage/FileStorageService.java @@ -82,6 +82,10 @@ public class FileStorageService { /** * FileStorageService Class constructor. + * + * @param ocflRepository ocfl object that is a layer to handle the io of the files + * @param storageProperties properties indicating where and what type of storage is used for persistence. + * @param rootLoc path of the root location used to set up temp working directory for the File Service */ public FileStorageService(OcflRepository ocflRepository, StorageProperties storageProperties, diff --git a/pass-core-file-service/src/main/java/org/eclipse/pass/file/service/storage/StorageConfiguration.java b/pass-core-file-service/src/main/java/org/eclipse/pass/file/service/storage/StorageConfiguration.java index 630be7f..476ca01 100644 --- a/pass-core-file-service/src/main/java/org/eclipse/pass/file/service/storage/StorageConfiguration.java +++ b/pass-core-file-service/src/main/java/org/eclipse/pass/file/service/storage/StorageConfiguration.java @@ -59,6 +59,11 @@ public class StorageConfiguration { @Value("${aws.region}") private String awsRegion; + /** + * Creates and configures an S3TransferManager for managing file transfers to Amazon S3. + * + * @return a configured S3TransferManager instance. + */ @Bean @ConditionalOnProperty(name = "pass.file-service.storage-type", havingValue = "S3") public S3TransferManager s3TransferManager() { @@ -72,6 +77,13 @@ public S3TransferManager s3TransferManager() { .build(); } + /** + * Creates and configures an S3AsyncClient for interacting with Amazon S3 or an S3-compatible storage service. + * + * @param storageProperties the StorageProperties containing the configuration. + * @return a configured S3AsyncClient instance. + * @throws IOException if the S3 bucket name is not set in StorageProperties. + */ @Bean @ConditionalOnProperty(name = "pass.file-service.storage-type", havingValue = "S3") public S3AsyncClient s3Client(StorageProperties storageProperties) throws IOException { @@ -93,6 +105,17 @@ public S3AsyncClient s3Client(StorageProperties storageProperties) throws IOExce return s3Client; } + /** + * Creates and configures an OcflRepository instance for use with Amazon S3 as the storage backend. + * + * @param s3Client the S3AsyncClient for interacting with Amazon S3. + * @param s3TransferManager the S3TransferManager to manage file transfers to S3. + * @param storageProperties the StorageProperties containing the configuration. + * @param rootLoc the root Path for the file service. + * @return a OcflRepository instance, using S3 as the storage layer. + * @throws IOException if the S3 bucket name is not set in the StorageProperties, or if there are + * issues creating or accessing the working directory. + */ @Bean @ConditionalOnProperty(name = "pass.file-service.storage-type", havingValue = "S3") public OcflRepository ocflS3Repository(S3AsyncClient s3Client, S3TransferManager s3TransferManager, @@ -121,6 +144,17 @@ public OcflRepository ocflS3Repository(S3AsyncClient s3Client, S3TransferManager return ocflRepository; } + /** + * Creates and configures an {@link OcflRepository} instance when the file service storage type + * is set to "FILE_SYSTEM". This method ensures that the OCFL directory exists, is accessible, + * and is properly set up with the required permissions. + * + * @param storageProperties the StorageProperties object containing storage configurations. + * @param rootLoc the root Path where the OCFL directory will be created or accessed. + * @return a fully configured OcflRepository instance backed by a file system storage type. + * @throws IOException if the OCFL directory cannot be created, or if there are insufficient + * read/write permissions. + */ @Bean @ConditionalOnProperty(name = "pass.file-service.storage-type", havingValue = "FILE_SYSTEM") public OcflRepository ocflFileRepository(StorageProperties storageProperties, @@ -142,6 +176,13 @@ public OcflRepository ocflFileRepository(StorageProperties storageProperties, return ocflRepository; } + /** + * Configures and provides the root Path for the file service storage. + * + * @param storageProperties the StorageProperties object containing storage configuration details. + * @return the root Path for the storage system. + * @throws IOException if an error occurs while creating the temporary directory. + */ @Bean @Qualifier("rootPath") public Path rootPath(StorageProperties storageProperties) throws IOException {