Skip to content

Commit

Permalink
Update Entur Helper (#607)
Browse files Browse the repository at this point in the history
  • Loading branch information
vpaturet authored Dec 3, 2024
1 parent d47608a commit fbd1eb8
Show file tree
Hide file tree
Showing 14 changed files with 72 additions and 395 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<java.version>17</java.version>
<entur.google.pubsub.emulator.download.skip>false</entur.google.pubsub.emulator.download.skip>
<camel.version>4.4.4</camel.version>
<entur.helpers.version>3.0</entur.helpers.version>
<entur.helpers.version>4.4</entur.helpers.version>
<netex-validator-java.version>8.0.0</netex-validator-java.version>
<netex-parser-java.version>3.1.29</netex-parser-java.version>
<jts-core.version>1.20.0</jts-core.version>
Expand Down Expand Up @@ -79,7 +79,7 @@
</dependency>
<dependency>
<groupId>org.entur.ror.helpers</groupId>
<artifactId>gcp-storage</artifactId>
<artifactId>storage-gcp-gcs</artifactId>
<version>${entur.helpers.version}</version>
<exclusions>
<exclusion>
Expand Down
12 changes: 12 additions & 0 deletions src/main/java/no/entur/antu/config/GcsStorageConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,13 @@

import com.google.cloud.storage.Storage;
import org.rutebanken.helper.gcp.BlobStoreHelper;
import org.rutebanken.helper.gcp.repository.GcsBlobStoreRepository;
import org.rutebanken.helper.storage.repository.BlobStoreRepository;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import org.springframework.context.annotation.Scope;

@Configuration
@Profile("gcs-blobstore")
Expand All @@ -43,4 +46,13 @@ public Storage storage() {
return BlobStoreHelper.getStorage(credentialPath, projectId);
}
}

@Bean
@Scope("prototype")
BlobStoreRepository blobStoreRepository(
@Value("${blobstore.gcs.project.id}") String projectId,
@Value("${blobstore.gcs.credential.path:#{null}}") String credentialPath
) {
return new GcsBlobStoreRepository(projectId, credentialPath);
}
}
56 changes: 0 additions & 56 deletions src/main/java/no/entur/antu/config/GcsStorageStubConfig.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,12 @@
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import org.rutebanken.helper.storage.repository.BlobStoreRepository;
import org.rutebanken.helper.storage.repository.InMemoryBlobStoreRepository;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import org.springframework.context.annotation.Scope;

/**
* Common in-memory map of blobs that simulate different buckets in GCS.
Expand All @@ -36,4 +39,12 @@ public class InMemoryBlobStoreRepositoryConfig {
public Map<String, Map<String, byte[]>> blobsInContainers() {
return Collections.synchronizedMap(new HashMap<>());
}

@Bean
@Scope("prototype")
BlobStoreRepository blobStoreRepository(
Map<String, Map<String, byte[]>> blobsInContainers
) {
return new InMemoryBlobStoreRepository(blobsInContainers);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Licensed under the EUPL, Version 1.2 or – as soon they will be approved by
* the European Commission - subsequent versions of the EUPL (the "Licence");
* You may not use this work except in compliance with the Licence.
* You may obtain a copy of the Licence at:
*
* https://joinup.ec.europa.eu/software/page/eupl
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the Licence is distributed on an "AS IS" basis,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the Licence for the specific language governing permissions and
* limitations under the Licence.
*
*/

package no.entur.antu.config;

import org.rutebanken.helper.storage.repository.BlobStoreRepository;
import org.rutebanken.helper.storage.repository.LocalDiskBlobStoreRepository;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import org.springframework.context.annotation.Scope;

@Configuration
@Profile("local-disk-blobstore")
public class LocalDiskBlobStoreRepositoryConfig {

@Bean
@Scope("prototype")
BlobStoreRepository blobStoreRepository(
@Value("${blobstore.local.folder:files/blob}") String baseFolder
) {
return new LocalDiskBlobStoreRepository(baseFolder);
}
}
41 changes: 0 additions & 41 deletions src/main/java/no/entur/antu/repository/BlobStoreRepository.java

This file was deleted.

62 changes: 0 additions & 62 deletions src/main/java/no/entur/antu/repository/GcsBlobStoreRepository.java

This file was deleted.

This file was deleted.

Loading

0 comments on commit fbd1eb8

Please sign in to comment.