Implementing Zenodo deposition
This commit is contained in:
parent
7c91747281
commit
2fca8b6e3b
|
@ -1,6 +1,7 @@
|
|||
package org.gcube.common.deposition;
|
||||
|
||||
import org.gcube.com.fasterxml.jackson.databind.JsonNode;
|
||||
import org.gcube.common.deposition.executor.DepositionVersionExecutor;
|
||||
import org.gcube.common.deposition.model.DepositionVersion;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -34,14 +35,13 @@ public class ElaborateDepositionVersion {
|
|||
name , depositionVersion.getVersion(),
|
||||
depositionVersion.getPrevious()!=null ? depositionVersion.getPrevious().getVersion(): null);
|
||||
|
||||
DepositionVersionExecutor dve = DepositionVersionExecutor.getDefaultExecutor();
|
||||
dve.setMetadata(getMetadata());
|
||||
|
||||
|
||||
if(depositionVersion.getPrevious()==null) {
|
||||
// TODO New deposit on Zenodo
|
||||
if(depositionVersion.getConceptDOIURL()==null) {
|
||||
dve.create();
|
||||
}else {
|
||||
// TODO New version on Zenodo from previous using the id in the DOI
|
||||
// TODO Remove previous files
|
||||
|
||||
dve.newVersion();
|
||||
}
|
||||
|
||||
// TODO Add files
|
||||
|
|
|
@ -3,15 +3,15 @@ package org.gcube.common.deposition.executor;
|
|||
import java.net.URL;
|
||||
|
||||
import org.gcube.com.fasterxml.jackson.databind.JsonNode;
|
||||
import org.gcube.common.deposition.executor.zenodo.ZenodoDepositionExecutor;
|
||||
import org.gcube.common.deposition.executor.zenodo.ZenodoDepositionVersionExecutor;
|
||||
|
||||
/**
|
||||
* @author Luca Frosini (ISTI - CNR)
|
||||
*/
|
||||
public abstract class DepositionExecutor {
|
||||
public abstract class DepositionVersionExecutor {
|
||||
|
||||
public static DepositionExecutor getDefaultExecutor() {
|
||||
return new ZenodoDepositionExecutor();
|
||||
public static DepositionVersionExecutor getDefaultExecutor() {
|
||||
return new ZenodoDepositionVersionExecutor();
|
||||
}
|
||||
|
||||
protected JsonNode metadata;
|
||||
|
@ -37,4 +37,6 @@ public abstract class DepositionExecutor {
|
|||
|
||||
public abstract void update();
|
||||
|
||||
public abstract void newVersion();
|
||||
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
package org.gcube.common.deposition.executor.zenodo;
|
||||
|
||||
import org.gcube.common.deposition.executor.DepositionExecutor;
|
||||
|
||||
/**
|
||||
* @author Luca Frosini (ISTI - CNR)
|
||||
*/
|
||||
public class ZenodoDepositionExecutor extends DepositionExecutor {
|
||||
|
||||
public ZenodoDepositionExecutor() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void create() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
package org.gcube.common.deposition.executor.zenodo;
|
||||
|
||||
import org.gcube.common.deposition.executor.DepositionVersionExecutor;
|
||||
|
||||
/**
|
||||
* @author Luca Frosini (ISTI - CNR)
|
||||
*/
|
||||
public class ZenodoDepositionVersionExecutor extends DepositionVersionExecutor {
|
||||
|
||||
public ZenodoDepositionVersionExecutor() {
|
||||
|
||||
}
|
||||
|
||||
protected void finalize() {
|
||||
// TODO Add files
|
||||
// TODO Update deposit metadata
|
||||
|
||||
// TODO Publish the version
|
||||
}
|
||||
|
||||
@Override
|
||||
public void create() {
|
||||
// TODO New deposit on Zenodo
|
||||
finalize();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
// TODO edit a published version
|
||||
}
|
||||
|
||||
@Override
|
||||
public void newVersion() {
|
||||
// TODO New version on Zenodo from previous using the id in the DOI
|
||||
// TODO Remove previous files
|
||||
finalize();
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue