1 34 package org.dspace.checker; 35 36 import java.text.SimpleDateFormat ; 37 import java.util.Date ; 38 39 import org.apache.log4j.Logger; 40 import org.dspace.core.I18N; 41 42 54 public class ResultsLogger implements ChecksumResultsCollector 55 { 56 59 private static final Logger LOG = Logger.getLogger(ResultsLogger.class); 60 61 64 private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat ( 65 "MM/dd/yyyy hh:mm:ss"); 66 67 70 Date startDate = null; 71 72 75 private ChecksumResultDAO resultDAO; 76 77 80 private ResultsLogger() 81 { 82 ; 83 } 84 85 91 public ResultsLogger(Date startDt) 92 { 93 this.resultDAO = new ChecksumResultDAO(); 94 95 LOG.info(msg("run-start-time") + ": " + DATE_FORMAT.format(startDt)); 96 } 97 98 105 private String msg(String key) 106 { 107 return I18N.message(key, ResultsLogger.class); 108 } 109 110 117 public void collect(BitstreamInfo info) 118 { 119 LOG.info("******************************************************"); 120 LOG.info(msg("bitstream-id") + ": " + info.getBitstreamId()); 121 LOG.info(msg("bitstream-info-found") + ": " + info.getInfoFound()); 122 LOG.info(msg("bitstream-marked-deleted") + ": " + info.getDeleted()); 123 LOG.info(msg("bitstream-found") + ": " + info.getBitstreamFound()); 124 LOG.info(msg("to-be-processed") + ": " + info.getToBeProcessed()); 125 LOG.info(msg("internal-id") + ": " + info.getInternalId()); 126 LOG.info(msg("name") + ": " + info.getName()); 127 LOG.info(msg("store-number") + ": " + info.getStoreNumber()); 128 LOG.info(msg("size") + ": " + info.getSize()); 129 LOG.info(msg("bitstream-format") + ": " + info.getBitstreamFormatId()); 130 LOG.info(msg("user-format-description") + ": " 131 + info.getUserFormatDescription()); 132 LOG.info(msg("source") + ": " + info.getSource()); 133 LOG 134 .info(msg("checksum-algorithm") + ": " 135 + info.getChecksumAlgorithm()); 136 LOG.info(msg("previous-checksum") + ": " + info.getStoredChecksum()); 137 LOG.info(msg("previous-checksum-date") 138 + ": " 139 + ((info.getProcessEndDate() != null) ? DATE_FORMAT.format(info 140 .getProcessEndDate()) : "unknown")); 141 LOG.info(msg("new-checksum") + ": " + info.getCalculatedChecksum()); 142 LOG.info(msg("checksum-comparison-result") + ": " 143 + resultDAO.getChecksumCheckStr(info.getChecksumCheckResult())); 144 LOG.info("\n\n"); 145 } 146 } 147 | Popular Tags |