add temp storage in zenodo repository

This commit is contained in:
Bernaldo Mihasi 2022-12-08 13:06:52 +02:00
parent ad00695d4e
commit 8c95b16164
2 changed files with 6 additions and 2 deletions

View File

@ -10,6 +10,7 @@ import eu.eudat.depositinterface.zenodorepository.mapper.DMPToZenodoMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.core.io.FileSystemResource;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
@ -34,10 +35,12 @@ public class ZenodoDeposit implements RepositoryDeposit {
private static final ObjectMapper objectMapper = new ObjectMapper();
private ConfigLoader configLoader;
private Environment environment;
@Autowired
public ZenodoDeposit(ConfigLoader configLoader){
public ZenodoDeposit(ConfigLoader configLoader, Environment environment){
this.configLoader = configLoader;
this.environment = environment;
}
@Override
@ -127,7 +130,7 @@ public class ZenodoDeposit implements RepositoryDeposit {
ResponseEntity<byte[]> jsonFile = dmpDepositModel.getRdaJson();
UUID jsonFileUUID = UUID.randomUUID();
File tempJsonFile = new File(jsonFileUUID + ".json"); // temp storage??
File tempJsonFile = new File(this.environment.getProperty("storage.temp") + jsonFileUUID + ".json");
try (FileOutputStream jsonFos = new FileOutputStream(tempJsonFile)) {
jsonFos.write(jsonFile.getBody());
jsonFos.flush();

View File

@ -1,2 +1,3 @@
configuration.doi_funder=DOI_Funder.json
storage.temp=${ZENODO_TMP}
configuration.zenodo=${ZENODO_CONF}