From 4179ae42ea34c2f611c83e839d232a82c689ae48 Mon Sep 17 00:00:00 2001 From: jruaux Date: Wed, 27 Nov 2024 09:47:23 -0800 Subject: [PATCH] fix: Added Google Storage write scope to WriteOptions Solves #163 --- .../java/com/redis/riot/file/xml/XmlResourceItemWriter.java | 2 +- .../com/redis/riot/file/xml/XmlResourceItemWriterBuilder.java | 3 ++- plugins/riot/src/main/java/com/redis/riot/FileWriterArgs.java | 2 ++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/core/riot-file/src/main/java/com/redis/riot/file/xml/XmlResourceItemWriter.java b/core/riot-file/src/main/java/com/redis/riot/file/xml/XmlResourceItemWriter.java index 3ce7aa2c8..7aac180f2 100644 --- a/core/riot-file/src/main/java/com/redis/riot/file/xml/XmlResourceItemWriter.java +++ b/core/riot-file/src/main/java/com/redis/riot/file/xml/XmlResourceItemWriter.java @@ -20,13 +20,13 @@ import org.springframework.batch.item.Chunk; import org.springframework.batch.item.json.JsonObjectMarshaller; -import org.springframework.batch.item.support.AbstractFileItemWriter; import org.springframework.core.io.Resource; import org.springframework.core.io.WritableResource; import org.springframework.util.Assert; import org.springframework.util.ClassUtils; import com.fasterxml.jackson.dataformat.xml.XmlMapper; +import com.redis.riot.resource.AbstractFileItemWriter; /** * Item writer that writes data in XML format to an output file. The location of diff --git a/core/riot-file/src/main/java/com/redis/riot/file/xml/XmlResourceItemWriterBuilder.java b/core/riot-file/src/main/java/com/redis/riot/file/xml/XmlResourceItemWriterBuilder.java index ca33aa056..1e2924376 100644 --- a/core/riot-file/src/main/java/com/redis/riot/file/xml/XmlResourceItemWriterBuilder.java +++ b/core/riot-file/src/main/java/com/redis/riot/file/xml/XmlResourceItemWriterBuilder.java @@ -19,11 +19,12 @@ import org.springframework.batch.item.file.FlatFileFooterCallback; import org.springframework.batch.item.file.FlatFileHeaderCallback; import org.springframework.batch.item.json.JsonObjectMarshaller; -import org.springframework.batch.item.support.AbstractFileItemWriter; import org.springframework.core.io.Resource; import org.springframework.core.io.WritableResource; import org.springframework.util.Assert; +import com.redis.riot.resource.AbstractFileItemWriter; + /** * Builder for {@link XmlResourceItemWriter}. * diff --git a/plugins/riot/src/main/java/com/redis/riot/FileWriterArgs.java b/plugins/riot/src/main/java/com/redis/riot/FileWriterArgs.java index 2114619c9..7f1867bc8 100644 --- a/plugins/riot/src/main/java/com/redis/riot/FileWriterArgs.java +++ b/plugins/riot/src/main/java/com/redis/riot/FileWriterArgs.java @@ -1,5 +1,6 @@ package com.redis.riot; +import com.google.cloud.spring.core.GcpScope; import com.redis.riot.file.WriteOptions; import lombok.ToString; @@ -38,6 +39,7 @@ public class FileWriterArgs extends FileArgs { public WriteOptions fileWriterOptions() { WriteOptions options = new WriteOptions(); apply(options); + options.getGoogleStorageOptions().setScope(GcpScope.STORAGE_READ_WRITE); options.setAppend(append); options.setElementName(elementName); options.setForceSync(forceSync);