Skip to content
Snippets Groups Projects
Commit 57519116 authored by cramakri's avatar cramakri
Browse files

LMS-1887 Provide more accurate information to the user during download.

SVN: 18878
parent e378b3fe
No related merge requests found
......@@ -62,20 +62,32 @@ class CommandGet extends AbstractDssCommand<CommandGet.CommandGetArguments>
private static class DownloaderListener implements
FileInfoDssDownloader.FileInfoDssDownloaderListener
{
private final File targetDir;
DownloaderListener(File targetDir)
{
this.targetDir = targetDir;
}
public void willDownload(FileInfoDssDTO fileInfo)
{
System.out.println("downloading " + fileInfo.getPathInListing());
System.out.println("downloading " + getPathForFileInfo(fileInfo));
}
public void willCreateDirectory(FileInfoDssDTO fileInfo)
{
System.out.println("mkdir " + fileInfo.getPathInListing());
System.out.println("mkdir " + getPathForFileInfo(fileInfo));
}
public void didFinish()
{
System.out.println("Finished.");
}
private String getPathForFileInfo(FileInfoDssDTO fileInfo)
{
return targetDir.getPath() + "/" + fileInfo.getPathInListing();
}
}
private static class CommandGetExecutor extends AbstractDataSetExecutor<CommandGetArguments>
......@@ -120,7 +132,7 @@ class CommandGet extends AbstractDssCommand<CommandGet.CommandGetArguments>
FileInfoDssDownloader downloader =
new FileInfoDssDownloader(dataSet, fileInfos, outputDir,
new DownloaderListener());
new DownloaderListener(outputDir));
downloader.downloadFiles();
}
......
......@@ -50,20 +50,32 @@ class ReplicaDownloader
private static class DownloaderListener implements
FileInfoDssDownloader.FileInfoDssDownloaderListener
{
private final File targetDir;
DownloaderListener(File targetDir)
{
this.targetDir = targetDir;
}
public void willDownload(FileInfoDssDTO fileInfo)
{
System.out.println("downloading " + fileInfo.getPathInListing());
System.out.println("downloading " + getPathForFileInfo(fileInfo));
}
public void willCreateDirectory(FileInfoDssDTO fileInfo)
{
System.out.println("mkdir " + fileInfo.getPathInListing());
System.out.println("mkdir " + getPathForFileInfo(fileInfo));
}
public void didFinish()
{
System.out.println("Finished.");
}
private String getPathForFileInfo(FileInfoDssDTO fileInfo)
{
return targetDir.getPath() + "/" + fileInfo.getPathInListing();
}
}
protected void download()
......@@ -108,9 +120,10 @@ class ReplicaDownloader
IDataSetDss dataSetDss = component.getDataSet(dataSet.getCode());
FileInfoDssDTO[] fileInfos = dataSetDss.listFiles("/original/", true);
File targetDir = new File(outputDir, subfolderName);
FileInfoDssDownloader downloader =
new FileInfoDssDownloader(dataSetDss, fileInfos,
new File(outputDir, subfolderName), new DownloaderListener());
new FileInfoDssDownloader(dataSetDss, fileInfos, targetDir, new DownloaderListener(
targetDir));
downloader.downloadFiles();
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment