Package nz.govt.natlib.meta

Examples of nz.govt.natlib.meta.HarvestEvent


  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;
View Full Code Here


  }

  private static class HarvestProgressListener implements ProgressListener {

    public void progressEvent(Object subject) {
      HarvestEvent event = (HarvestEvent) subject;
      if (!event.isSucessful()) {
        LogManager.getInstance().logMessage(
            (Throwable) event.getError());
      }
    }
View Full Code Here

TOP

Related Classes of nz.govt.natlib.meta.HarvestEvent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.