diff --git a/pom.xml b/pom.xml
index b6195f4..c1920d3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -7,6 +7,18 @@
1.0.0-SNAPSHOT
Storagehub Scripts
+
+
+
+ org.gcube.distribution
+ gcube-bom
+ 3.0.0-SNAPSHOT
+ pom
+ import
+
+
+
+
maven-parent
org.gcube.tools
@@ -24,7 +36,6 @@
org.gcube.common
storagehub-model
- [1.0.0,2.0.0-SNAPSHOT)
provided
diff --git a/src/main/java/CleanTrash.java b/src/main/java/CleanTrash.java
new file mode 100644
index 0000000..bb5c37b
--- /dev/null
+++ b/src/main/java/CleanTrash.java
@@ -0,0 +1,63 @@
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.Collections;
+import java.util.List;
+
+import javax.jcr.Node;
+import javax.jcr.NodeIterator;
+
+import org.apache.jackrabbit.api.JackrabbitSession;
+import org.gcube.common.storagehub.model.Path;
+import org.gcube.common.storagehub.model.Paths;
+import org.gcube.common.storagehub.model.items.Item;
+import org.gcube.common.storagehub.model.items.TrashItem;
+import org.gcube.data.access.storagehub.scripting.AbstractScript;
+import org.gcube.data.access.storagehub.scripting.ScriptParameter;
+import org.gcube.data.access.storagehub.scripting.ScriptUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class CleanTrash implements AbstractScript{
+
+ private static Logger log = LoggerFactory.getLogger(CleanTrash.class);
+
+ @Override
+ public String run(JackrabbitSession session, ScriptParameter prameters, ScriptUtil scriptUtil) {
+ StringBuilder stringBuilder = new StringBuilder();
+ try {
+ Node node = session.getNode("/Home");
+
+ NodeIterator it = node.getNodes();
+
+ while (it.hasNext()) {
+ Node home = it.nextNode();
+
+ long start = System.currentTimeMillis();
+ Path workspacePath = Paths.append(Paths.getPath(home.getPath()),"Workspace");
+
+ if (!session.nodeExists(workspacePath.toPath())) continue;
+
+
+ Node trashNode = session.getNode(Paths.append(workspacePath, "Trash").toPath());
+
+ List- items = scriptUtil.getChildren(null, trashNode, null, true, TrashItem.class);
+
+ for (Item item: items) {
+ TrashItem trashItem = (TrashItem) item;
+ if (System.currentTimeMillis() - trashItem.getDeletedTime().getTimeInMillis() > 2629800000l ) {
+ scriptUtil.removeNodes(session, Collections.singletonList(trashItem));
+
+ }
+ }
+
+ }
+ }catch (Exception e) {
+ StringWriter writer = new StringWriter();
+ PrintWriter sw = new PrintWriter(writer, true);
+ e.printStackTrace(sw);
+ return writer.toString();
+ }
+ return stringBuilder.toString();
+ }
+
+}
diff --git a/src/main/java/MongoToMinioPorting.java b/src/main/java/MongoToMinioPorting.java
new file mode 100644
index 0000000..5384f14
--- /dev/null
+++ b/src/main/java/MongoToMinioPorting.java
@@ -0,0 +1,4 @@
+
+public class MongoToMinioPorting {
+
+}