add temp storage in zenodo repository
This commit is contained in:
parent
ad00695d4e
commit
8c95b16164
|
@ -10,6 +10,7 @@ import eu.eudat.depositinterface.zenodorepository.mapper.DMPToZenodoMapper;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.core.env.Environment;
|
||||||
import org.springframework.core.io.FileSystemResource;
|
import org.springframework.core.io.FileSystemResource;
|
||||||
import org.springframework.http.HttpEntity;
|
import org.springframework.http.HttpEntity;
|
||||||
import org.springframework.http.HttpHeaders;
|
import org.springframework.http.HttpHeaders;
|
||||||
|
@ -34,10 +35,12 @@ public class ZenodoDeposit implements RepositoryDeposit {
|
||||||
private static final ObjectMapper objectMapper = new ObjectMapper();
|
private static final ObjectMapper objectMapper = new ObjectMapper();
|
||||||
|
|
||||||
private ConfigLoader configLoader;
|
private ConfigLoader configLoader;
|
||||||
|
private Environment environment;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public ZenodoDeposit(ConfigLoader configLoader){
|
public ZenodoDeposit(ConfigLoader configLoader, Environment environment){
|
||||||
this.configLoader = configLoader;
|
this.configLoader = configLoader;
|
||||||
|
this.environment = environment;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -127,7 +130,7 @@ public class ZenodoDeposit implements RepositoryDeposit {
|
||||||
|
|
||||||
ResponseEntity<byte[]> jsonFile = dmpDepositModel.getRdaJson();
|
ResponseEntity<byte[]> jsonFile = dmpDepositModel.getRdaJson();
|
||||||
UUID jsonFileUUID = UUID.randomUUID();
|
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)) {
|
try (FileOutputStream jsonFos = new FileOutputStream(tempJsonFile)) {
|
||||||
jsonFos.write(jsonFile.getBody());
|
jsonFos.write(jsonFile.getBody());
|
||||||
jsonFos.flush();
|
jsonFos.flush();
|
||||||
|
|
|
@ -1,2 +1,3 @@
|
||||||
configuration.doi_funder=DOI_Funder.json
|
configuration.doi_funder=DOI_Funder.json
|
||||||
|
storage.temp=${ZENODO_TMP}
|
||||||
configuration.zenodo=${ZENODO_CONF}
|
configuration.zenodo=${ZENODO_CONF}
|
||||||
|
|
Loading…
Reference in New Issue