use of maspack.fileutil.DefaultConsoleFileTransferListener in project artisynth_core by artisynth.
the class LibraryInstaller method verifyJars.
public boolean verifyJars(boolean updateLibs) throws Exception {
boolean allOK = true;
if (myJarnames.size() > 0) {
FileManager grabber = new FileManager();
grabber.setVerbosityLevel(LogLevel.ALL);
FileTransferListener listener = new DefaultConsoleFileTransferListener();
grabber.addTransferListener(listener);
// 100ms
grabber.getTransferMonitor().setPollSleep(100);
grabber.setDownloadDir(myLibDir);
grabber.setRemoteSource(myRemoteSource);
int options = (updateLibs ? FileManager.CHECK_HASH : 0);
for (String jarname : myJarnames) {
File jfile = new File(myLibDir, jarname);
if (!jfile.exists()) {
try {
grabber.getRemote(jarname);
System.out.println("Downloaded jar file " + jfile);
} catch (Exception e) {
if (isConnectionException(e)) {
throw e;
}
System.out.println("Failed to download jar file " + jfile + ":");
System.out.println(e.getMessage());
allOK = false;
}
} else if (updateLibs) {
try {
if (!grabber.equalsHash(jarname)) {
grabber.getRemote(jarname);
}
System.out.println("Updated jar file " + jfile);
} catch (Exception e) {
if (isConnectionException(e)) {
throw e;
}
System.out.println("Failed to update jar file " + jfile + ":");
System.out.println(e.getMessage());
}
}
}
}
return allOK;
}
use of maspack.fileutil.DefaultConsoleFileTransferListener in project artisynth_core by artisynth.
the class ArtisynthWebGrabber method addListener.
private void addListener() {
FileTransferListener listener = new DefaultConsoleFileTransferListener();
addTransferListener(listener);
}
Aggregations