001/* 002 * #%L 003 * Netarchivesuite - harvester 004 * %% 005 * Copyright (C) 2005 - 2014 The Royal Danish Library, the Danish State and University Library, 006 * the National Library of France and the Austrian National Library. 007 * %% 008 * This program is free software: you can redistribute it and/or modify 009 * it under the terms of the GNU Lesser General Public License as 010 * published by the Free Software Foundation, either version 2.1 of the 011 * License, or (at your option) any later version. 012 * 013 * This program is distributed in the hope that it will be useful, 014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 016 * GNU General Lesser Public License for more details. 017 * 018 * You should have received a copy of the GNU General Lesser Public 019 * License along with this program. If not, see 020 * <http://www.gnu.org/licenses/lgpl-2.1.html>. 021 * #L% 022 */ 023 024package dk.netarkivet.harvester.datamodel; 025 026import java.util.Date; 027 028/** 029 * DomainConfigPair class for extracted information on harvests on a specific domain. 030 */ 031public class DomainHarvestInfo { 032 033 /** The name of the domain. */ 034 private final String domainName; 035 /** The Id of the job. */ 036 private final long jobID; 037 /** The Id of the harvestdefinition, which this job was generated from. */ 038 private final long harvestID; 039 /** The number of the harvest. */ 040 private final int harvestNum; 041 /** The name of the harvestdefinition. */ 042 private final String harvestName; 043 /** The name of the configuration. */ 044 private final String configName; 045 /** The date when the harvestjob started. */ 046 private final Date startDate; 047 /** The date when the harvestjob finished. */ 048 private final Date endDate; 049 /** How many bytes were downloaded by this job for this domain. */ 050 private final long bytesDownloaded; 051 /** How many documents(URIs) were downloaded by this job for this domain. */ 052 private final long docsDownloaded; 053 /** 054 * The reason why the harvestjob stopped harvesting any more URIs from this domain. 055 */ 056 private final StopReason reason; 057 058 /** 059 * Constructor for a DomainHarvestInfo object. 060 * 061 * @param domainName The given domain 062 * @param jobID The Id of the job that harvested this domain 063 * @param harvestName The name of the harvestdefinition behind the job 064 * @param harvestID The ID of the harvestdefinition behind the job 065 * @param harvestNum The number of the harvest 066 * @param configName The name of the configuration 067 * @param startDate The date when the harvestjob started 068 * @param endDate The date when the harvestjob finished 069 * @param bytesDownloaded How many bytes were downloaded by this job for this domain 070 * @param docsDownloaded How many documents(URIs) were downloaded by this job for this domain. 071 * @param reason The reason why the harvestjob stopped harvesting any more URIs from this domain. 072 */ 073 DomainHarvestInfo(String domainName, long jobID, String harvestName, long harvestID, int harvestNum, 074 String configName, Date startDate, Date endDate, long bytesDownloaded, long docsDownloaded, 075 StopReason reason) { 076 this.domainName = domainName; 077 this.jobID = jobID; 078 this.harvestID = harvestID; 079 this.harvestName = harvestName; 080 this.harvestNum = harvestNum; 081 this.configName = configName; 082 this.startDate = startDate; 083 this.endDate = endDate; 084 this.bytesDownloaded = bytesDownloaded; 085 this.docsDownloaded = docsDownloaded; 086 this.reason = reason; 087 } 088 089 /** 090 * Get the domain Name. 091 * 092 * @return the domain Name. 093 */ 094 public String getDomain() { 095 return domainName; 096 } 097 098 /** 099 * Get the Id of the job that harvested this domain. 100 * 101 * @return the Id of the job that harvested this domain 102 */ 103 public long getJobID() { 104 return jobID; 105 } 106 107 /** 108 * Get the name of the harvestdefinition behind the job. 109 * 110 * @return The name of the harvestdefinition behind the job 111 */ 112 public String getHarvestName() { 113 return harvestName; 114 } 115 116 /** 117 * Get the ID of the harvestdefinition behind the job. 118 * 119 * @return The ID of the harvestdefinition behind the job 120 */ 121 public long getHarvestID() { 122 return harvestID; 123 } 124 125 /** 126 * Get the number of the harvest. 127 * 128 * @return The number of the harvest 129 */ 130 public int getHarvestNum() { 131 return harvestNum; 132 } 133 134 /** 135 * Get the name of the configuration. 136 * 137 * @return The name of the configuration 138 */ 139 public String getConfigName() { 140 return configName; 141 } 142 143 /** 144 * Get the date when the harvestjob started. 145 * 146 * @return Get the date when the harvestjob started. 147 */ 148 public Date getStartDate() { 149 return startDate; 150 } 151 152 /** 153 * Get the date when the harvestjob finished. 154 * 155 * @return Get the date when the harvestjob finished. 156 */ 157 public Date getEndDate() { 158 return endDate; 159 } 160 161 /** 162 * Get the number of bytes that were downloaded by this job for this domain. 163 * 164 * @return The number of bytes that were downloaded by this job for this domain. 165 */ 166 public long getBytesDownloaded() { 167 return bytesDownloaded; 168 } 169 170 /** 171 * Get the number of documents (URIs) that were downloaded by this job for this domain. 172 * 173 * @return The number of documents (URIs) that were downloaded by this job for this domain. 174 */ 175 public long getDocsDownloaded() { 176 return docsDownloaded; 177 } 178 179 /** 180 * Get the reason why the harvestjob stopped harvesting any more URIs from this domain. 181 * 182 * @return The reason why the harvestjob stopped harvesting any more URIs from this domain. 183 */ 184 public StopReason getStopReason() { 185 return reason; 186 } 187 188 @Override 189 public String toString() { 190 return "DomainHarvestInfo{" + "domainName='" + domainName + '\'' + ", jobID=" + jobID + ", harvestID=" 191 + harvestID + ", harvestNum=" + harvestNum + ", harvestName='" + harvestName + '\'' + ", configName='" 192 + configName + '\'' + ", startDate=" + startDate + ", endDate=" + endDate + ", bytesDownloaded=" 193 + bytesDownloaded + ", docsDownloaded=" + docsDownloaded + ", reason=" + reason + '}'; 194 } 195 196}