]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.backup/src/org/simantics/backup/IBackupProvider.java
added org.simantics.backup
[simantics/platform.git] / bundles / org.simantics.backup / src / org / simantics / backup / IBackupProvider.java
1 package org.simantics.backup;\r
2 \r
3 import java.nio.file.Path;\r
4 import java.util.concurrent.Future;\r
5 \r
6 /**\r
7  * Interface for providing backup capabilities to Simantics products.\r
8  * BackupProviders are used in {@link BackupProviderService}.\r
9  * \r
10  * @author Jani Simomaa\r
11  */\r
12 public interface IBackupProvider {\r
13 \r
14     /**\r
15      * Lock the resources that are going to be backed up in a way that allows\r
16      * making an atomic and consistent copy of the backed up resources.\r
17      */\r
18     void lock() throws BackupException;\r
19 \r
20     /**\r
21      * Initiates or executes the backing up procedure of this provider. The\r
22      * backup procedure is allowed to return from this method and complete\r
23      * asynchronously. A {@link Future} is returned to allow waiting for backup\r
24      * to complete.\r
25      * \r
26      * @param targetPath\r
27      * @param revision\r
28      * @return a future that can be waited upon to wait for the backup procedure\r
29      *         to complete.\r
30      */\r
31     Future<BackupException> backup(Path targetPath, int revision) throws BackupException;\r
32 \r
33     /**\r
34      * The counterpart of {@link #lock()} that must be invoked and invoked only\r
35      * after {@link #lock()} has been successfully invoked\r
36      */\r
37     void unlock() throws BackupException;\r
38 \r
39     /**\r
40      * Restore implementation for this provider.\r
41      * \r
42      * @param fromPath\r
43      * @param revision\r
44      * \r
45      * TODO: change to return {@link Future} that can be waited upon\r
46      */\r
47     void restore(Path fromPath, int revision) throws BackupException;\r
48 \r
49 }\r