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