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 */ 023package dk.netarkivet.harvester.indexserver; 024 025import dk.netarkivet.common.exceptions.ArgumentNotValid; 026 027/** 028 * Encapsulates the options for the indexing process. 029 */ 030public class DigestOptions { 031 032 /** the useBlacklist set to true results in docs matching the mimefilter being ignored. */ 033 private final boolean useBlacklist; 034 035 /** 036 * An regular expression for the mimetypes to include or exclude from the index. According to the useBlacklist 037 * setting. 038 */ 039 private final String mimeFilter; 040 041 /** Avoid logging to STDOUT when indexing. */ 042 private final boolean verbose; 043 044 /** 045 * Set the needed options used by the DigestIndexer. 046 * 047 * @param useMimefilterAsBlacklist Are we using the mimeFilter as a black or a whitelist. 048 * @param verboseIndexing print logging to stdout while indexing, or not. 049 * @param theMimeFilter The given black or whitelist according to mimetype. 050 */ 051 public DigestOptions(boolean useMimefilterAsBlacklist, boolean verboseIndexing, String theMimeFilter) { 052 ArgumentNotValid.checkNotNullOrEmpty(theMimeFilter, "String theMimeFilter"); 053 this.useBlacklist = useMimefilterAsBlacklist; 054 this.mimeFilter = theMimeFilter; 055 this.verbose = verboseIndexing; 056 } 057 058 /** 059 * @return true if we use the mimefilter as a blacklist; false otherwise 060 */ 061 public boolean getUseBlacklist() { 062 return this.useBlacklist; 063 } 064 065 /** 066 * @return true, if we are verbose; otherwise false 067 */ 068 public boolean getVerboseMode() { 069 return this.verbose; 070 } 071 072 /** 073 * @return the mimefilter 074 */ 075 public String getMimeFilter() { 076 return this.mimeFilter; 077 } 078 079}