throw( new BuildException( msg ) );
} else {
log( msg, Project.MSG_ERR );
}
} else {
final Restore restore = new Restore();
final RestoreListener listener = new DefaultRestoreListener();
restore.restore( listener, user, password, restorePassword, file, uri );
}
} else if( dirSet != null ) {
final DirectoryScanner scanner = dirSet.getDirectoryScanner( getProject() );
scanner.scan();
final String[] includedFiles = scanner.getIncludedFiles();
log( "Found " + includedFiles.length + " files.\n" );
for( final String included : includedFiles ) {
dir = new File( scanner.getBasedir() + File.separator + included );
final File contentsFile = new File( dir, "__contents__.xml" );
if( !contentsFile.exists() ) {
final String msg = "Did not found file " + contentsFile.getAbsolutePath();
if( failonerror ) {
throw( new BuildException( msg ) );
} else {
log( msg, Project.MSG_ERR );
}
} else {
log( "Restoring from " + contentsFile.getAbsolutePath() + " ...\n" );
// TODO subdirectories as sub-collections?
final Restore restore = new Restore();
final RestoreListener listener = new DefaultRestoreListener();
restore.restore( listener, user, password, restorePassword, contentsFile, uri );
}
}
} else if( zipFile != null ) {
log( "Restoring from " + zipFile.getAbsolutePath(), Project.MSG_INFO );
if( !zipFile.exists() ) {
final String msg = "File not found: " + zipFile.getAbsolutePath();
if( failonerror ) {
throw( new BuildException( msg ) );
} else {
log( msg, Project.MSG_ERR );
}
} else {
final Restore restore = new Restore();
final RestoreListener listener = new DefaultRestoreListener();
restore.restore( listener, user, password, restorePassword, zipFile, uri );
}
}
}
catch( final Exception e ) {