public org . modeshape . jcr . api . Problems restoreRepository ( final JcrRepository repository , final File backupDirectory , final RestoreOptions options ) throws RepositoryException { final String backupLocString = backupDirectory . getAbsolutePath ( ) ; LOGGER . debug ( "Beginning restore of '{0}' repository from {1} with options {2}" , repository . getName ( ) , backupLocString , options ) ; // Put the repository into the 'restoring' state ... repository . prepareToRestore ( ) ; // Create the activity ... final RestoreActivity restoreActivity = createRestoreActivity ( backupDirectory , options ) ; org . modeshape . jcr . api . Problems problems = null ; try { if ( runningState . suspendExistingUserTransaction ( ) ) { LOGGER . debug ( "Suspended existing active user transaction before the restore operation starts" ) ; } problems = new JcrProblems ( restoreActivity . execute ( ) ) ; if ( ! problems . hasProblems ( ) ) { // restart the repository ... try { repository . completeRestore ( options ) ; } catch ( Throwable t ) { restoreActivity . problems . addError ( t , JcrI18n . repositoryCannotBeRestartedAfterRestore , repository . getName ( ) , t . getMessage ( ) ) ; } finally { runningState . resumeExistingUserTransaction ( ) ; } } } catch ( SystemException e ) { throw new RuntimeException ( e ) ; } LOGGER . debug ( "Completed restore of '{0}' repository from {1}" , repository . getName ( ) , backupLocString ) ; return problems ; }
Start asynchronously backing up the repository .