Skip to content

Commit fbd1eb8

Browse files
authored
Update Entur Helper (#607)
1 parent d47608a commit fbd1eb8

14 files changed

+72
-395
lines changed

pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<java.version>17</java.version>
2727
<entur.google.pubsub.emulator.download.skip>false</entur.google.pubsub.emulator.download.skip>
2828
<camel.version>4.4.4</camel.version>
29-
<entur.helpers.version>3.0</entur.helpers.version>
29+
<entur.helpers.version>4.4</entur.helpers.version>
3030
<netex-validator-java.version>8.0.0</netex-validator-java.version>
3131
<netex-parser-java.version>3.1.29</netex-parser-java.version>
3232
<jts-core.version>1.20.0</jts-core.version>
@@ -79,7 +79,7 @@
7979
</dependency>
8080
<dependency>
8181
<groupId>org.entur.ror.helpers</groupId>
82-
<artifactId>gcp-storage</artifactId>
82+
<artifactId>storage-gcp-gcs</artifactId>
8383
<version>${entur.helpers.version}</version>
8484
<exclusions>
8585
<exclusion>

src/main/java/no/entur/antu/config/GcsStorageConfig.java

+12
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,13 @@
2020

2121
import com.google.cloud.storage.Storage;
2222
import org.rutebanken.helper.gcp.BlobStoreHelper;
23+
import org.rutebanken.helper.gcp.repository.GcsBlobStoreRepository;
24+
import org.rutebanken.helper.storage.repository.BlobStoreRepository;
2325
import org.springframework.beans.factory.annotation.Value;
2426
import org.springframework.context.annotation.Bean;
2527
import org.springframework.context.annotation.Configuration;
2628
import org.springframework.context.annotation.Profile;
29+
import org.springframework.context.annotation.Scope;
2730

2831
@Configuration
2932
@Profile("gcs-blobstore")
@@ -43,4 +46,13 @@ public Storage storage() {
4346
return BlobStoreHelper.getStorage(credentialPath, projectId);
4447
}
4548
}
49+
50+
@Bean
51+
@Scope("prototype")
52+
BlobStoreRepository blobStoreRepository(
53+
@Value("${blobstore.gcs.project.id}") String projectId,
54+
@Value("${blobstore.gcs.credential.path:#{null}}") String credentialPath
55+
) {
56+
return new GcsBlobStoreRepository(projectId, credentialPath);
57+
}
4658
}

src/main/java/no/entur/antu/config/GcsStorageStubConfig.java

-56
This file was deleted.

src/main/java/no/entur/antu/config/InMemoryBlobStoreRepositoryConfig.java

+11
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,12 @@
2121
import java.util.Collections;
2222
import java.util.HashMap;
2323
import java.util.Map;
24+
import org.rutebanken.helper.storage.repository.BlobStoreRepository;
25+
import org.rutebanken.helper.storage.repository.InMemoryBlobStoreRepository;
2426
import org.springframework.context.annotation.Bean;
2527
import org.springframework.context.annotation.Configuration;
2628
import org.springframework.context.annotation.Profile;
29+
import org.springframework.context.annotation.Scope;
2730

2831
/**
2932
* Common in-memory map of blobs that simulate different buckets in GCS.
@@ -36,4 +39,12 @@ public class InMemoryBlobStoreRepositoryConfig {
3639
public Map<String, Map<String, byte[]>> blobsInContainers() {
3740
return Collections.synchronizedMap(new HashMap<>());
3841
}
42+
43+
@Bean
44+
@Scope("prototype")
45+
BlobStoreRepository blobStoreRepository(
46+
Map<String, Map<String, byte[]>> blobsInContainers
47+
) {
48+
return new InMemoryBlobStoreRepository(blobsInContainers);
49+
}
3950
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* Licensed under the EUPL, Version 1.2 or – as soon they will be approved by
3+
* the European Commission - subsequent versions of the EUPL (the "Licence");
4+
* You may not use this work except in compliance with the Licence.
5+
* You may obtain a copy of the Licence at:
6+
*
7+
* https://joinup.ec.europa.eu/software/page/eupl
8+
*
9+
* Unless required by applicable law or agreed to in writing, software
10+
* distributed under the Licence is distributed on an "AS IS" basis,
11+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
* See the Licence for the specific language governing permissions and
13+
* limitations under the Licence.
14+
*
15+
*/
16+
17+
package no.entur.antu.config;
18+
19+
import org.rutebanken.helper.storage.repository.BlobStoreRepository;
20+
import org.rutebanken.helper.storage.repository.LocalDiskBlobStoreRepository;
21+
import org.springframework.beans.factory.annotation.Value;
22+
import org.springframework.context.annotation.Bean;
23+
import org.springframework.context.annotation.Configuration;
24+
import org.springframework.context.annotation.Profile;
25+
import org.springframework.context.annotation.Scope;
26+
27+
@Configuration
28+
@Profile("local-disk-blobstore")
29+
public class LocalDiskBlobStoreRepositoryConfig {
30+
31+
@Bean
32+
@Scope("prototype")
33+
BlobStoreRepository blobStoreRepository(
34+
@Value("${blobstore.local.folder:files/blob}") String baseFolder
35+
) {
36+
return new LocalDiskBlobStoreRepository(baseFolder);
37+
}
38+
}

src/main/java/no/entur/antu/repository/BlobStoreRepository.java

-41
This file was deleted.

src/main/java/no/entur/antu/repository/GcsBlobStoreRepository.java

-62
This file was deleted.

src/main/java/no/entur/antu/repository/InMemoryBlobStoreRepository.java

-111
This file was deleted.

0 commit comments

Comments
 (0)