]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.utils/src/org/simantics/utils/FileService.java
Changing existing log4j logging to use slf4j
[simantics/platform.git] / bundles / org.simantics.utils / src / org / simantics / utils / FileService.java
1 package org.simantics.utils;\r
2 \r
3 import java.io.File;\r
4 import java.io.IOException;\r
5 \r
6 /**\r
7  * @author Tuukka Lehtonen\r
8  */\r
9 public interface FileService {\r
10 \r
11         public static interface DeleteOption {}\r
12 \r
13         public static class EffortOption implements DeleteOption {\r
14                 public final int maxTries;\r
15 \r
16                 private EffortOption(int maxTries) {\r
17                         this.maxTries = maxTries;\r
18                 }\r
19 \r
20                 public static EffortOption maxTries(int maxTries) {\r
21                         return new EffortOption(maxTries);\r
22                 }\r
23         }\r
24 \r
25         /**\r
26          * Schedules a file to be deleted at some point in the future when the\r
27          * system allows it to be deleted if ever.\r
28          * \r
29          * @param file\r
30          * @return an operation handle for tracking the progress of the deletion or\r
31          *         <code>null</code> if there's a deletion operation scheduled for\r
32          *         the provided file in the queue or the file does not exist.\r
33          */\r
34         IOperation<Boolean, IOException> scheduleDeleteIfExists(File file, DeleteOption... options);\r
35 \r
36 }\r