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