// for the Neo4jBackup class to throw an exception.
if ( backupPath.listFiles() == null
|| backupPath.listFiles().length == 0
|| !( new File( backupPath, "neostore" ) ).exists() )
{
throw new NoBackupFoundationException(
"No foundation in: " + backupPath.getAbsolutePath() );
}
// Perform backup
GraphDatabaseService genericDb = DatabaseLocator.getGraphDatabase();
if ( genericDb instanceof EmbeddedGraphDatabase )
{
Backup backup = Neo4jBackup.allDataSources(
(EmbeddedGraphDatabase) genericDb,
backupPath.getAbsolutePath() );
backup.doBackup();
}
else
{
throw new UnsupportedOperationException(
"Performing backups on non-local databases is currently not supported." );
}
}
catch ( IllegalStateException e )
{
throw new NoBackupFoundationException(
"No foundation in: " + backupPath.getAbsolutePath() );
}
catch ( IOException e )
{
throw new BackupFailedException(