-
Language:
English
-
Language:
English
Red Hat Training
A Red Hat training course is available for Red Hat JBoss Data Virtualization
13.5. Restore a Repository
Once you have a complete backup on disk, you can then restore a repository back to the state captured within the backup using the
restoreRepository
method provided by the org.modeshape.jcr.api.RepositoryManager interface.
To do this, start a repository (or perhaps a new instance of a repository with a different configuration) and, before it is used by any applications, restore the content.
The following code demonstrates usage of the restore method:
org.modeshape.jcr.api.RepositoryManager repoMgr = ... java.io.File backupDirectory = ... Problems problems = repoMgr.restoreRepository(backupDirectory); if ( problems.hasProblems() ) { System.out.println("Problems backing up the repository:"); // Report the problems (we'll just print them out) ... for ( Problem problem : problems ) { System.out.println(problem); } } else { System.out.println("The restoration was successful"); }
Once a restore succeeds, the newly-restored repository will be restarted and ready for use.