public void progressEvent(Object subject) {
if (stopping)
return;
// mark off some sort of progress...
HarvestEvent event = (HarvestEvent) subject;
processedFileCount++;
if (event.isSucessful()) {
event.getSource().setStatus(HarvestStatus.OK, null);
} else {
// find the error and 'mark' it
Object source = event.getError();
String comment = "";
if (source instanceof Throwable) {
comment = ((Throwable) source).getMessage();
}
LogMessage msg = new LogMessage(LogMessage.ERROR, source,
"Error harvesting file :"
+ event.getSource().getFile().getName(), comment);
LogManager.getInstance().logMessage(msg);
event.getSource().setStatus(HarvestStatus.ERROR,
comment + " <b>(log id=" + msg.getId() + ")</b>");
error = true;
}
String name = event.getSource().getFile().getName();
processedBytes += event.getSource().getFile().length();
// fancy bit... Work out how long it's taken so far - how long it will
// be yet!
long msEstimate = -1;
if (processedFileCount > 50) {
long ms = System.currentTimeMillis() - startTime;