Skip to content

Commit

Permalink
Merge branch 'main' into feature/init-mail-integration
Browse files Browse the repository at this point in the history
  • Loading branch information
simonhir authored Aug 14, 2024
2 parents e5e3f3e + 4d5d148 commit 54e47a3
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public DocumentStorageFileRepository documentStorageFileRepository(
}

@Bean
@ConditionalOnBean
@ConditionalOnMissingBean
public DocumentStorageFolderRepository documentStorageFolderRepository(
final FolderOperationsInPort folderOperationsInPort) {
return new DocumentStorageFolderJavaRepository(folderOperationsInPort);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-oauth2-client</artifactId>
Expand All @@ -43,10 +47,6 @@
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>

<dependency>
<groupId>org.apache.httpcomponents.client5</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@
import de.muenchen.refarch.integration.s3.client.domain.model.SupportedFileExtensions;
import de.muenchen.refarch.integration.s3.client.factory.YamlPropertySourceFactory;
import de.muenchen.refarch.integration.s3.client.properties.S3IntegrationClientProperties;
import de.muenchen.refarch.integration.s3.client.repository.DocumentStorageFileRepository;
import de.muenchen.refarch.integration.s3.client.repository.DocumentStorageFileRestRepository;
import de.muenchen.refarch.integration.s3.client.repository.DocumentStorageFolderRepository;
import de.muenchen.refarch.integration.s3.client.repository.DocumentStorageFolderRestRepository;
import de.muenchen.refarch.integration.s3.client.repository.presignedurl.PresignedUrlRepository;
import de.muenchen.refarch.integration.s3.client.repository.presignedurl.PresignedUrlRestRepository;
import de.muenchen.refarch.integration.s3.client.repository.transfer.S3FileTransferRepository;
import de.muenchen.refarch.integration.s3.client.service.FileValidationService;
import jakarta.annotation.PostConstruct;
import lombok.RequiredArgsConstructor;
Expand Down Expand Up @@ -33,15 +40,15 @@
)
@RequiredArgsConstructor
@EnableConfigurationProperties(S3IntegrationClientProperties.class)
@PropertySource(value = ResourceUtils.CLASSPATH_URL_PREFIX + "application.yml", factory = YamlPropertySourceFactory.class)
@PropertySource(value = "classpath:application-s3-client.yml", factory = YamlPropertySourceFactory.class)
@Slf4j
public class S3IntegrationClientAutoConfiguration {

public final S3IntegrationClientProperties s3IntegrationClientProperties;

@PostConstruct
public void init() {
log.info("[REFARCH-S3-INTEGRATION-CLIENT]: Staring integration client, security is {}.",
log.info("s3 rest client security is {}.",
s3IntegrationClientProperties.isEnableSecurity() ? "enabled" : "disabled");
}

Expand Down Expand Up @@ -110,4 +117,28 @@ public FileApiApi fileApiApi(final ApiClient apiClient) {
public FolderApiApi folderApiApi(final ApiClient apiClient) {
return new FolderApiApi(apiClient);
}

@Bean
@ConditionalOnMissingBean
public PresignedUrlRepository presignedUrlRepository(
final FileApiApi fileApi) {
return new PresignedUrlRestRepository(fileApi);
}

@Bean
@ConditionalOnMissingBean
public DocumentStorageFileRepository documentStorageFileRepository(
final PresignedUrlRepository presignedUrlRepository,
final S3FileTransferRepository s3FileTransferRepository,
final FileApiApi fileApi) {
return new DocumentStorageFileRestRepository(presignedUrlRepository,
s3FileTransferRepository, fileApi);
}

@Bean
@ConditionalOnMissingBean
public DocumentStorageFolderRepository documentStorageFolderRepository(
final FolderApiApi folderApi) {
return new DocumentStorageFolderRestRepository(folderApi);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,11 @@
import de.muenchen.refarch.integration.s3.client.repository.presignedurl.PresignedUrlRepository;
import de.muenchen.refarch.integration.s3.client.repository.transfer.S3FileTransferRepository;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Repository;
import org.springframework.web.client.HttpClientErrorException;
import org.springframework.web.client.HttpServerErrorException;
import org.springframework.web.client.RestClientException;

@Slf4j
@Repository
public class DocumentStorageFileRestRepository extends DocumentStorageFileRepository {
private final FileApiApi fileApi;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,12 @@
import java.util.Set;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Repository;
import org.springframework.web.client.HttpClientErrorException;
import org.springframework.web.client.HttpServerErrorException;
import org.springframework.web.client.RestClientException;
import reactor.core.publisher.Mono;

@Slf4j
@Repository
@RequiredArgsConstructor
public class DocumentStorageFolderRestRepository implements DocumentStorageFolderRepository {
private final FolderApiApi folderApi;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,12 @@
import de.muenchen.refarch.integration.s3.client.model.PresignedUrlDto;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Repository;
import org.springframework.web.client.HttpClientErrorException;
import org.springframework.web.client.HttpServerErrorException;
import org.springframework.web.client.RestClientException;
import reactor.core.publisher.Mono;

@Slf4j
@Repository
@RequiredArgsConstructor
public class PresignedUrlRestRepository implements PresignedUrlRepository {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@
import de.muenchen.refarch.integration.s3.adapter.out.s3.S3Adapter;
import de.muenchen.refarch.integration.s3.application.port.in.CreatePresignedUrlsInPort;
import de.muenchen.refarch.integration.s3.application.port.in.FileOperationsInPort;
import de.muenchen.refarch.integration.s3.application.port.in.FolderOperationsInPort;
import de.muenchen.refarch.integration.s3.application.port.out.S3OutPort;
import de.muenchen.refarch.integration.s3.application.usecase.CreatePresignedUrlsUseCase;
import de.muenchen.refarch.integration.s3.application.usecase.FileOperationsPresignedUrlUseCase;
import de.muenchen.refarch.integration.s3.application.usecase.FileOperationsUseCase;
import de.muenchen.refarch.integration.s3.application.usecase.FolderOperationsUseCase;
import de.muenchen.refarch.integration.s3.domain.exception.FileSystemAccessException;
import de.muenchen.refarch.integration.s3.properties.S3IntegrationProperties;
import io.minio.MinioClient;
Expand Down Expand Up @@ -55,4 +58,10 @@ public FileOperationsInPort fileOperationsInPort(S3Adapter s3Adapter) {
public FileOperationsPresignedUrlUseCase fileOperationsPresignedUrlUseCase(S3Adapter s3Adapter) {
return new FileOperationsPresignedUrlUseCase(s3Adapter);
}

@ConditionalOnMissingBean
@Bean
public FolderOperationsInPort folderOperationsInPort(final S3OutPort s3OutPort) {
return new FolderOperationsUseCase(s3OutPort);
}
}

0 comments on commit 54e47a3

Please sign in to comment.