diff --git a/refarch-gateway/Dockerfile b/refarch-gateway/Dockerfile
index d7540e49..fa43a00a 100644
--- a/refarch-gateway/Dockerfile
+++ b/refarch-gateway/Dockerfile
@@ -1,3 +1,3 @@
-FROM registry.access.redhat.com/ubi9/openjdk-21:latest
+FROM registry.access.redhat.com/ubi9/openjdk-21-runtime:latest
COPY target/*.jar /deployments/spring-boot-application.jar
diff --git a/refarch-gateway/pom.xml b/refarch-gateway/pom.xml
index 8553660f..189de292 100644
--- a/refarch-gateway/pom.xml
+++ b/refarch-gateway/pom.xml
@@ -17,21 +17,30 @@
refarch-gateway
+
21
${java.version}
${java.version}
${java.version}
- 0.8.12
- 3.3.1
+
+ 2023.0.3
+
+
+ 8.0
+
+
2.34.0
1.0.10
- 3.4.0
- 2023.0.3
- 8.0
- 5.5.0
+
+ 0.8.12
+
+
3.16.0
+
+
+ 5.5.0
@@ -83,7 +92,7 @@
org.projectlombok
lombok
- true
+ provided
org.apache.commons
@@ -133,7 +142,9 @@
org.apache.maven.plugins
maven-surefire-plugin
- ${maven-surefire-plugin.version}
+
+ -Dfile.encoding=${project.build.sourceEncoding}
+
org.apache.maven.plugins
diff --git a/refarch-integrations/refarch-s3-integration/refarch-s3-integration-client-starter/src/main/java/de/muenchen/refarch/integration/s3/client/configuration/S3IntegrationClientAutoConfiguration.java b/refarch-integrations/refarch-s3-integration/refarch-s3-integration-client-starter/src/main/java/de/muenchen/refarch/integration/s3/client/configuration/S3IntegrationClientAutoConfiguration.java
index 5d7509b8..645abe6c 100644
--- a/refarch-integrations/refarch-s3-integration/refarch-s3-integration-client-starter/src/main/java/de/muenchen/refarch/integration/s3/client/configuration/S3IntegrationClientAutoConfiguration.java
+++ b/refarch-integrations/refarch-s3-integration/refarch-s3-integration-client-starter/src/main/java/de/muenchen/refarch/integration/s3/client/configuration/S3IntegrationClientAutoConfiguration.java
@@ -5,10 +5,7 @@
import de.muenchen.refarch.integration.s3.client.api.FolderApiApi;
import de.muenchen.refarch.integration.s3.client.domain.model.SupportedFileExtensions;
import de.muenchen.refarch.integration.s3.client.properties.S3IntegrationClientProperties;
-import de.muenchen.refarch.integration.s3.client.service.ApiClientFactory;
import de.muenchen.refarch.integration.s3.client.service.FileService;
-import de.muenchen.refarch.integration.s3.client.service.S3DomainProvider;
-import de.muenchen.refarch.integration.s3.client.service.S3StorageUrlProvider;
import jakarta.annotation.PostConstruct;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@@ -19,7 +16,6 @@
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.FilterType;
import org.springframework.security.oauth2.client.AuthorizedClientServiceOAuth2AuthorizedClientManager;
import org.springframework.security.oauth2.client.OAuth2AuthorizedClientService;
import org.springframework.security.oauth2.client.registration.ClientRegistrationRepository;
@@ -30,21 +26,6 @@
@ComponentScan(
basePackages = {
"de.muenchen.refarch.integration.s3.client"
- },
- excludeFilters = {
- @ComponentScan.Filter(
- type = FilterType.ASSIGNABLE_TYPE,
- classes = {
- /*
- * Exclude to avoid multiple instantiation of multiple beans with same name.
- * This class is instantiated in {@link S3IntegrationClientAutoConfiguration}
- * to give the bean another name.
- */
- ApiClient.class,
- FileApiApi.class,
- FolderApiApi.class
- }
- )
}
)
@RequiredArgsConstructor
@@ -62,20 +43,20 @@ public void init() {
@Bean
@ConditionalOnProperty(prefix = "refarch.s3.client", name = "enable-security", havingValue = "true")
- public ApiClientFactory securedApiClientFactory(final ClientRegistrationRepository clientRegistrationRepository,
+ public ApiClient securedApiClient(final ClientRegistrationRepository clientRegistrationRepository,
final OAuth2AuthorizedClientService authorizedClientService) {
- return new ApiClientFactory(
- this.webClient(clientRegistrationRepository, authorizedClientService));
+ return new ApiClient(
+ this.authenticatedWebClient(clientRegistrationRepository, authorizedClientService));
}
@Bean
@ConditionalOnProperty(prefix = "refarch.s3.client", name = "enable-security", havingValue = "false", matchIfMissing = true)
- public ApiClientFactory apiClientFactory() {
- return new ApiClientFactory(
+ public ApiClient apiClient() {
+ return new ApiClient(
WebClient.builder().build());
}
- private WebClient webClient(
+ private WebClient authenticatedWebClient(
final ClientRegistrationRepository clientRegistrationRepository,
final OAuth2AuthorizedClientService authorizedClientService) {
final var oauth = new ServletOAuth2AuthorizedClientExchangeFilterFunction(
@@ -102,7 +83,7 @@ public FileService fileService(final SupportedFileExtensions supportedFileExtens
/**
* Instance of a {@link FileService} containing supported file extensions configured within in the
- * 'de.muenchen.oss.digiwf.s3' scope.
+ * 'de.muenchen.refarch.s3' scope.
*
* @return {@link FileService} for managing file extensions.
*/
@@ -113,30 +94,15 @@ public FileService fileServiceFromS3IntegrationClientProperties() {
this.s3IntegrationClientProperties.getMaxBatchSize());
}
- /**
- * Instance of an {@link S3StorageUrlProvider} containing an externally created
- * {@link S3DomainProvider} for retrieving the S3 storage URL.
- *
- * @param s3DomainProvider Provider of domain specific S3 storages configured in process
- * configurations.
- * @return Provider of the S3 storage URL.
- */
@Bean
- @ConditionalOnBean(S3DomainProvider.class)
- public S3StorageUrlProvider s3StorageUrlProvider(final S3DomainProvider s3DomainProvider) {
- return new S3StorageUrlProvider(s3DomainProvider, this.s3IntegrationClientProperties.getDocumentStorageUrl());
+ @ConditionalOnMissingBean
+ public FileApiApi fileApiApi(final ApiClient apiClient) {
+ return new FileApiApi(apiClient);
}
- /**
- * Instance of an {@link S3StorageUrlProvider} containing a default {@link S3DomainProvider}. The
- * instance will only return the default S3 URL.
- *
- * @return Provider of the S3 storage URL.
- */
@Bean
- @ConditionalOnMissingBean(S3DomainProvider.class)
- public S3StorageUrlProvider s3StorageUrlProviderWithoutDomainProvider() {
- return new S3StorageUrlProvider(this.s3IntegrationClientProperties.getDocumentStorageUrl());
+ @ConditionalOnMissingBean
+ public FolderApiApi folderApiApi(final ApiClient apiClient) {
+ return new FolderApiApi(apiClient);
}
-
}
diff --git a/refarch-integrations/refarch-s3-integration/refarch-s3-integration-client/src/main/java/de/muenchen/refarch/integration/s3/client/repository/DocumentStorageFileRepository.java b/refarch-integrations/refarch-s3-integration/refarch-s3-integration-client/src/main/java/de/muenchen/refarch/integration/s3/client/repository/DocumentStorageFileRepository.java
index b104e844..e7030920 100644
--- a/refarch-integrations/refarch-s3-integration/refarch-s3-integration-client/src/main/java/de/muenchen/refarch/integration/s3/client/repository/DocumentStorageFileRepository.java
+++ b/refarch-integrations/refarch-s3-integration/refarch-s3-integration-client/src/main/java/de/muenchen/refarch/integration/s3/client/repository/DocumentStorageFileRepository.java
@@ -7,7 +7,6 @@
import de.muenchen.refarch.integration.s3.client.model.FileSizeDto;
import de.muenchen.refarch.integration.s3.client.repository.presignedurl.PresignedUrlRepository;
import de.muenchen.refarch.integration.s3.client.repository.transfer.S3FileTransferRepository;
-import de.muenchen.refarch.integration.s3.client.service.ApiClientFactory;
import java.io.InputStream;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@@ -26,14 +25,13 @@ public class DocumentStorageFileRepository {
private final S3FileTransferRepository s3FileTransferRepository;
- private final ApiClientFactory apiClientFactory;
+ private final FileApiApi fileApi;
/**
* Gets the file specified in the parameter from the document storage.
*
* @param pathToFile defines the path to the file.
* @param expireInMinutes the expiration time of the presignedURL in minutes.
- * @param documentStorageUrl to define to which document storage the request goes.
* @return the file.
* @throws DocumentStorageClientErrorException if the problem is with the client.
* @throws DocumentStorageServerErrorException if the problem is with the S3 storage or document
@@ -41,9 +39,9 @@ public class DocumentStorageFileRepository {
* @throws DocumentStorageException if the problem cannot be assigned to either the client or the S3
* storage or the document storage.
*/
- public byte[] getFile(final String pathToFile, final int expireInMinutes, final String documentStorageUrl)
+ public byte[] getFile(final String pathToFile, final int expireInMinutes)
throws DocumentStorageException, DocumentStorageClientErrorException, DocumentStorageServerErrorException {
- final Mono presignedUrl = this.presignedUrlRepository.getPresignedUrlGetFile(pathToFile, expireInMinutes, documentStorageUrl);
+ final Mono presignedUrl = this.presignedUrlRepository.getPresignedUrlGetFile(pathToFile, expireInMinutes);
return this.s3FileTransferRepository.getFile(presignedUrl.block());
}
@@ -51,7 +49,6 @@ public byte[] getFile(final String pathToFile, final int expireInMinutes, final
* Retrieves the file size of a file specified in the parameter from the document storage.
*
* @param pathToFile defines the path to the file.
- * @param documentStorageUrl defines to which document storage the request goes.
* @return the file size.
* @throws DocumentStorageClientErrorException if the problem is with the client.
* @throws DocumentStorageServerErrorException if the problem is with the S3 storage or document
@@ -59,10 +56,9 @@ public byte[] getFile(final String pathToFile, final int expireInMinutes, final
* @throws DocumentStorageException if the problem cannot be assigned to either the client or the S3
* storage or the document storage.
*/
- public Mono getFileSize(final String pathToFile, final String documentStorageUrl)
+ public Mono getFileSize(final String pathToFile)
throws DocumentStorageClientErrorException, DocumentStorageServerErrorException, DocumentStorageException {
try {
- final FileApiApi fileApi = this.apiClientFactory.getFileApiForDocumentStorageUrl(documentStorageUrl);
return fileApi.getFileSize(pathToFile).mapNotNull(FileSizeDto::getFileSize);
} catch (final HttpClientErrorException exception) {
final String message = String.format("The request to get file size failed %s.", exception.getStatusCode());
@@ -84,7 +80,6 @@ public Mono getFileSize(final String pathToFile, final String documentStor
*
* @param pathToFile defines the path to the file.
* @param expireInMinutes the expiration time of the presignedURL in minutes.
- * @param documentStorageUrl to define to which document storage the request goes.
* @return the InputStream for the file.
* @throws DocumentStorageClientErrorException if the problem is with the client.
* @throws DocumentStorageServerErrorException if the problem is with the S3 storage or document
@@ -92,9 +87,9 @@ public Mono getFileSize(final String pathToFile, final String documentStor
* @throws DocumentStorageException if the problem cannot be assigned to either the client or the S3
* storage or the document storage.
*/
- public InputStream getFileInputStream(final String pathToFile, final int expireInMinutes, final String documentStorageUrl)
+ public InputStream getFileInputStream(final String pathToFile, final int expireInMinutes)
throws DocumentStorageException, DocumentStorageClientErrorException, DocumentStorageServerErrorException {
- final Mono presignedUrl = this.presignedUrlRepository.getPresignedUrlGetFile(pathToFile, expireInMinutes, documentStorageUrl);
+ final Mono presignedUrl = this.presignedUrlRepository.getPresignedUrlGetFile(pathToFile, expireInMinutes);
return this.s3FileTransferRepository.getFileInputStream(presignedUrl.block());
}
@@ -104,16 +99,15 @@ public InputStream getFileInputStream(final String pathToFile, final int expireI
* @param pathToFile defines the path to the file.
* @param file to save.
* @param expireInMinutes the expiration time of the presignedURL in minutes.
- * @param documentStorageUrl to define to which document storage the request goes.
* @throws DocumentStorageClientErrorException if the problem is with the client.
* @throws DocumentStorageServerErrorException if the problem is with the S3 storage or document
* storage.
* @throws DocumentStorageException if the problem cannot be assigned to either the client or the S3
* storage or the document storage.
*/
- public void saveFile(final String pathToFile, final byte[] file, final int expireInMinutes,
- final String documentStorageUrl) throws DocumentStorageException, DocumentStorageClientErrorException, DocumentStorageServerErrorException {
- final String presignedUrl = this.presignedUrlRepository.getPresignedUrlSaveFile(pathToFile, expireInMinutes, documentStorageUrl);
+ public void saveFile(final String pathToFile, final byte[] file, final int expireInMinutes)
+ throws DocumentStorageException, DocumentStorageClientErrorException, DocumentStorageServerErrorException {
+ final String presignedUrl = this.presignedUrlRepository.getPresignedUrlSaveFile(pathToFile, expireInMinutes);
this.s3FileTransferRepository.saveFile(presignedUrl, file);
}
@@ -123,16 +117,15 @@ public void saveFile(final String pathToFile, final byte[] file, final int expir
* @param pathToFile defines the path to the file.
* @param file to save.
* @param expireInMinutes the expiration time of the presignedURL in minutes.
- * @param documentStorageUrl to define to which document storage the request goes.
* @throws DocumentStorageClientErrorException if the problem is with the client.
* @throws DocumentStorageServerErrorException if the problem is with the S3 storage or document
* storage.
* @throws DocumentStorageException if the problem cannot be assigned to either the client or the S3
* storage or the document storage.
*/
- public void saveFileInputStream(final String pathToFile, final InputStream file, final int expireInMinutes,
- final String documentStorageUrl) throws DocumentStorageException, DocumentStorageClientErrorException, DocumentStorageServerErrorException {
- final String presignedUrl = this.presignedUrlRepository.getPresignedUrlSaveFile(pathToFile, expireInMinutes, documentStorageUrl);
+ public void saveFileInputStream(final String pathToFile, final InputStream file, final int expireInMinutes)
+ throws DocumentStorageException, DocumentStorageClientErrorException, DocumentStorageServerErrorException {
+ final String presignedUrl = this.presignedUrlRepository.getPresignedUrlSaveFile(pathToFile, expireInMinutes);
this.s3FileTransferRepository.saveFileInputStream(presignedUrl, file);
}
@@ -142,16 +135,15 @@ public void saveFileInputStream(final String pathToFile, final InputStream file,
* @param pathToFile defines the path to the file.
* @param file which overwrites the file in the document storage.
* @param expireInMinutes the expiration time of the presignedURL in minutes.
- * @param documentStorageUrl to define to which document storage the request goes.
* @throws DocumentStorageClientErrorException if the problem is with the client.
* @throws DocumentStorageServerErrorException if the problem is with the S3 storage or document
* storage.
* @throws DocumentStorageException if the problem cannot be assigned to either the client or the S3
* storage or the document storage.
*/
- public void updateFile(final String pathToFile, final byte[] file, final int expireInMinutes,
- final String documentStorageUrl) throws DocumentStorageException, DocumentStorageClientErrorException, DocumentStorageServerErrorException {
- final String presignedUrl = this.presignedUrlRepository.getPresignedUrlUpdateFile(pathToFile, expireInMinutes, documentStorageUrl);
+ public void updateFile(final String pathToFile, final byte[] file, final int expireInMinutes)
+ throws DocumentStorageException, DocumentStorageClientErrorException, DocumentStorageServerErrorException {
+ final String presignedUrl = this.presignedUrlRepository.getPresignedUrlUpdateFile(pathToFile, expireInMinutes);
this.s3FileTransferRepository.updateFile(presignedUrl, file);
}
@@ -161,16 +153,15 @@ public void updateFile(final String pathToFile, final byte[] file, final int exp
* @param pathToFile defines the path to the file.
* @param file which overwrites the file in the document storage.
* @param expireInMinutes the expiration time of the presignedURL in minutes.
- * @param documentStorageUrl to define to which document storage the request goes.
* @throws DocumentStorageClientErrorException if the problem is with the client.
* @throws DocumentStorageServerErrorException if the problem is with the S3 storage or document
* storage.
* @throws DocumentStorageException if the problem cannot be assigned to either the client or the S3
* storage or the document storage.
*/
- public void updateFileInputStream(final String pathToFile, final InputStream file, final int expireInMinutes,
- final String documentStorageUrl) throws DocumentStorageException, DocumentStorageClientErrorException, DocumentStorageServerErrorException {
- final String presignedUrl = this.presignedUrlRepository.getPresignedUrlUpdateFile(pathToFile, expireInMinutes, documentStorageUrl);
+ public void updateFileInputStream(final String pathToFile, final InputStream file, final int expireInMinutes)
+ throws DocumentStorageException, DocumentStorageClientErrorException, DocumentStorageServerErrorException {
+ final String presignedUrl = this.presignedUrlRepository.getPresignedUrlUpdateFile(pathToFile, expireInMinutes);
this.s3FileTransferRepository.updateFileInputStream(presignedUrl, file);
}
@@ -179,16 +170,15 @@ public void updateFileInputStream(final String pathToFile, final InputStream fil
*
* @param pathToFile defines the path to the file.
* @param expireInMinutes the expiration time of the presignedURL in minutes.
- * @param documentStorageUrl to define to which document storage the request goes.
* @throws DocumentStorageClientErrorException if the problem is with the client.
* @throws DocumentStorageServerErrorException if the problem is with the S3 storage or document
* storage.
* @throws DocumentStorageException if the problem cannot be assigned to either the client or the S3
* storage or the document storage.
*/
- public void deleteFile(final String pathToFile, final int expireInMinutes, final String documentStorageUrl)
+ public void deleteFile(final String pathToFile, final int expireInMinutes)
throws DocumentStorageException, DocumentStorageClientErrorException, DocumentStorageServerErrorException {
- final String presignedUrl = this.presignedUrlRepository.getPresignedUrlDeleteFile(pathToFile, expireInMinutes, documentStorageUrl);
+ final String presignedUrl = this.presignedUrlRepository.getPresignedUrlDeleteFile(pathToFile, expireInMinutes);
this.s3FileTransferRepository.deleteFile(presignedUrl);
}
diff --git a/refarch-integrations/refarch-s3-integration/refarch-s3-integration-client/src/main/java/de/muenchen/refarch/integration/s3/client/repository/DocumentStorageFolderRepository.java b/refarch-integrations/refarch-s3-integration/refarch-s3-integration-client/src/main/java/de/muenchen/refarch/integration/s3/client/repository/DocumentStorageFolderRepository.java
index 4df00db2..64b8e0ce 100644
--- a/refarch-integrations/refarch-s3-integration/refarch-s3-integration-client/src/main/java/de/muenchen/refarch/integration/s3/client/repository/DocumentStorageFolderRepository.java
+++ b/refarch-integrations/refarch-s3-integration/refarch-s3-integration-client/src/main/java/de/muenchen/refarch/integration/s3/client/repository/DocumentStorageFolderRepository.java
@@ -6,7 +6,6 @@
import de.muenchen.refarch.integration.s3.client.exception.DocumentStorageServerErrorException;
import de.muenchen.refarch.integration.s3.client.model.FileSizesInFolderDto;
import de.muenchen.refarch.integration.s3.client.model.FilesInFolderDto;
-import de.muenchen.refarch.integration.s3.client.service.ApiClientFactory;
import java.util.Map;
import java.util.Set;
import lombok.RequiredArgsConstructor;
@@ -21,23 +20,20 @@
@Repository
@RequiredArgsConstructor
public class DocumentStorageFolderRepository {
-
- private final ApiClientFactory apiClientFactory;
+ private final FolderApiApi folderApi;
/**
* Deletes the folder with all containing files on document storage.
*
* @param pathToFolder which defines the folder in the document storage.
- * @param documentStorageUrl to define to which document storage the request goes.
* @throws DocumentStorageClientErrorException if the problem is with the client.
* @throws DocumentStorageServerErrorException if the problem is with the document storage.
* @throws DocumentStorageException if the problem cannot be assigned directly to the document
* storage.
*/
- public void deleteFolder(final String pathToFolder, final String documentStorageUrl)
+ public void deleteFolder(final String pathToFolder)
throws DocumentStorageClientErrorException, DocumentStorageServerErrorException, DocumentStorageException {
try {
- final FolderApiApi folderApi = this.apiClientFactory.getFolderApiForDocumentStorageUrl(documentStorageUrl);
folderApi.delete(pathToFolder);
} catch (final HttpClientErrorException exception) {
final String message = String.format("The request to delete a folder failed %s.", exception.getStatusCode());
@@ -58,16 +54,14 @@ public void deleteFolder(final String pathToFolder, final String documentStorage
* Returns all files within a folder given in the parameter from document storage.
*
* @param pathToFolder which defines the folder in the document storage.
- * @param documentStorageUrl to define to which document storage the request goes.
* @throws DocumentStorageClientErrorException if the problem is with the client.
* @throws DocumentStorageServerErrorException if the problem is with the document storage.
* @throws DocumentStorageException if the problem cannot be assigned directly to the document
* storage.
*/
- public Mono> getAllFilesInFolderRecursively(final String pathToFolder, final String documentStorageUrl)
+ public Mono> getAllFilesInFolderRecursively(final String pathToFolder)
throws DocumentStorageClientErrorException, DocumentStorageServerErrorException, DocumentStorageException {
try {
- final FolderApiApi folderApi = this.apiClientFactory.getFolderApiForDocumentStorageUrl(documentStorageUrl);
final Mono filesInFolderDto = folderApi.getAllFilesInFolderRecursively(pathToFolder);
return filesInFolderDto.mapNotNull(FilesInFolderDto::getPathToFiles);
} catch (final HttpClientErrorException exception) {
@@ -89,17 +83,15 @@ public Mono> getAllFilesInFolderRecursively(final String pathToFolde
* Returns all file sizes of files within a folder given in the parameter from document storage.
*
* @param pathToFolder defines the folder in the document storage.
- * @param documentStorageUrl defines to which document storage the request goes.
* @return file paths with their file sizes.
* @throws DocumentStorageClientErrorException if the problem is with the client.
* @throws DocumentStorageServerErrorException if the problem is with the document storage.
* @throws DocumentStorageException if the problem cannot be assigned directly to the document
* storage.
*/
- public Mono