]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.utils/src/org/simantics/utils/FileService.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.utils / src / org / simantics / utils / FileService.java
diff --git a/bundles/org.simantics.utils/src/org/simantics/utils/FileService.java b/bundles/org.simantics.utils/src/org/simantics/utils/FileService.java
new file mode 100644 (file)
index 0000000..f272437
--- /dev/null
@@ -0,0 +1,36 @@
+package org.simantics.utils;\r
+\r
+import java.io.File;\r
+import java.io.IOException;\r
+\r
+/**\r
+ * @author Tuukka Lehtonen\r
+ */\r
+public interface FileService {\r
+\r
+       public static interface DeleteOption {}\r
+\r
+       public static class EffortOption implements DeleteOption {\r
+               public final int maxTries;\r
+\r
+               private EffortOption(int maxTries) {\r
+                       this.maxTries = maxTries;\r
+               }\r
+\r
+               public static EffortOption maxTries(int maxTries) {\r
+                       return new EffortOption(maxTries);\r
+               }\r
+       }\r
+\r
+       /**\r
+        * Schedules a file to be deleted at some point in the future when the\r
+        * system allows it to be deleted if ever.\r
+        * \r
+        * @param file\r
+        * @return an operation handle for tracking the progress of the deletion or\r
+        *         <code>null</code> if there's a deletion operation scheduled for\r
+        *         the provided file in the queue or the file does not exist.\r
+        */\r
+       IOperation<Boolean, IOException> scheduleDeleteIfExists(File file, DeleteOption... options);\r
+\r
+}\r