1 package org.simantics.backup;
\r
3 import java.nio.file.Path;
\r
4 import java.util.concurrent.Future;
\r
7 * Interface for providing backup capabilities to Simantics products.
\r
8 * BackupProviders are used in {@link BackupProviderService}.
\r
10 * @author Jani Simomaa
\r
12 public interface IBackupProvider {
\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
18 void lock() throws BackupException;
\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
28 * @return a future that can be waited upon to wait for the backup procedure
\r
31 Future<BackupException> backup(Path targetPath, int revision) throws BackupException;
\r
34 * The counterpart of {@link #lock()} that must be invoked and invoked only
\r
35 * after {@link #lock()} has been successfully invoked
\r
37 void unlock() throws BackupException;
\r
40 * Restore implementation for this provider.
\r
45 * TODO: change to return {@link Future} that can be waited upon
\r
47 void restore(Path fromPath, int revision) throws BackupException;
\r