|
1 | 1 | package software.xdev.spring.data.eclipse.store.demo.complex; |
2 | 2 |
|
3 | 3 | import java.nio.file.Path; |
| 4 | +import java.util.Map; |
| 5 | +import java.util.stream.Collectors; |
4 | 6 |
|
5 | 7 | import org.eclipse.store.integrations.spring.boot.types.configuration.EclipseStoreProperties; |
6 | 8 | import org.eclipse.store.integrations.spring.boot.types.factories.EmbeddedStorageFoundationFactory; |
7 | 9 | import org.eclipse.store.storage.embedded.types.EmbeddedStorage; |
8 | 10 | import org.eclipse.store.storage.embedded.types.EmbeddedStorageFoundation; |
| 11 | +import org.eclipse.store.storage.embedded.types.EmbeddedStorageManager; |
| 12 | +import org.eclipse.store.storage.restadapter.types.StorageRestAdapter; |
| 13 | +import org.eclipse.store.storage.restservice.spring.boot.types.configuration.StoreDataRestServiceProperties; |
| 14 | +import org.eclipse.store.storage.restservice.spring.boot.types.rest.StoreDataRestController; |
9 | 15 | import org.eclipse.store.storage.types.Storage; |
| 16 | +import org.eclipse.store.storage.types.StorageManager; |
10 | 17 | import org.springframework.beans.factory.ObjectProvider; |
11 | 18 | import org.springframework.beans.factory.annotation.Autowired; |
12 | 19 | import org.springframework.boot.autoconfigure.transaction.TransactionManagerCustomizers; |
13 | 20 | import org.springframework.context.annotation.Bean; |
14 | 21 | import org.springframework.context.annotation.Configuration; |
| 22 | +import org.springframework.context.annotation.DependsOn; |
15 | 23 | import org.springframework.transaction.PlatformTransactionManager; |
16 | 24 |
|
17 | 25 | import software.xdev.spring.data.eclipse.store.repository.config.EclipseStoreClientConfiguration; |
@@ -48,6 +56,24 @@ public EmbeddedStorageFoundation<?> createEmbeddedStorageFoundation() |
48 | 56 | return EmbeddedStorage.Foundation(Storage.Configuration(Storage.FileProvider(Path.of(STORAGE_PATH)))); |
49 | 57 | } |
50 | 58 |
|
| 59 | + @Bean |
| 60 | + @DependsOn({"embeddedStorageFoundationFactory"}) |
| 61 | + public Map<String, StorageRestAdapter> storageRestAdapters(final Map<String, EmbeddedStorageManager> storages) |
| 62 | + { |
| 63 | + return Map.of( |
| 64 | + "default", StorageRestAdapter.New(this.createEmbeddedStorageFoundation()) |
| 65 | + ); |
| 66 | + } |
| 67 | + |
| 68 | + @Bean |
| 69 | + @DependsOn({"embeddedStorageFoundationFactory"}) |
| 70 | + public StoreDataRestController storageDataRestController( |
| 71 | + final Map<String, StorageRestAdapter> storageRestAdapters, |
| 72 | + final StoreDataRestServiceProperties properties) |
| 73 | + { |
| 74 | + return new StoreDataRestController(storageRestAdapters, properties); |
| 75 | + } |
| 76 | + |
51 | 77 | /** |
52 | 78 | * Overriding {@link #transactionManager(ObjectProvider)} only to add the {@link Bean}-Annotation. |
53 | 79 | */ |
|
0 commit comments