001/* 002 * #%L 003 * Netarchivesuite - archive 004 * %% 005 * Copyright (C) 2005 - 2018 The Royal Danish 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.archive.arcrepositoryadmin; 025 026import dk.netarkivet.common.exceptions.ArgumentNotValid; 027 028/** 029 * The status of the checksum for the bitpreservation database. 030 */ 031public enum ChecksumStatus { 032 /** The status is 'UNKNOWN' before a update has taken place. */ 033 UNKNOWN, 034 /** 035 * The status is 'CORRUPT' if the checksum of the replicafileinfo entry does not match the checksum of the majority 036 * of the other replicafileinfo entries for the same file but for the other replicas. 037 */ 038 CORRUPT, 039 /** 040 * The status is 'OK' if the checksum of the replicafileinfo entry is identical to the checksum of the other 041 * replicafileinfo entries for same file but for the other replicas. 042 */ 043 OK; 044 045 /** 046 * Method to retrieve the FileListStatus based on an integer. 047 * 048 * @param status A certain integer for the upload status 049 * @return The UploadStatus related to the certain integer 050 * @throws ArgumentNotValid If argument rt does not correspond to a UploadStatus. 051 */ 052 public static ChecksumStatus fromOrdinal(int status) throws ArgumentNotValid { 053 switch (status) { 054 case 0: 055 return UNKNOWN; 056 case 1: 057 return CORRUPT; 058 case 2: 059 return OK; 060 default: 061 throw new ArgumentNotValid("Invalid checksum status with number " + status); 062 } 063 } 064}