001/* 002 * #%L 003 * Netarchivesuite - archive 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.archive; 024 025import dk.netarkivet.common.utils.Settings; 026 027/** 028 * Settings specific to the archive module of NetarchiveSuite. 029 */ 030public class ArchiveSettings { 031 /** The default place in classpath where the settings file can be found. */ 032 private static final String DEFAULT_SETTINGS_CLASSPATH = "dk/netarkivet/archive/settings.xml"; 033 034 /* 035 * The static initialiser is called when the class is loaded. It will add default values for all settings defined in 036 * this class, by loading them from a settings.xml file in classpath. 037 */ 038 static { 039 Settings.addDefaultClasspathSettings(DEFAULT_SETTINGS_CLASSPATH); 040 } 041 042 // NOTE: The constants defining setting names below are left non-final on 043 // purpose! Otherwise, the static initialiser that loads default values 044 // will not run. 045 046 /** 047 * <b>settings.archive.arcrepository.baseDir</b>: <br> 048 * Absolute/relative path to where the "central list of files and checksums" (admin.data) is written. Used by 049 * ArcRepository and BitPreservation. 050 */ 051 public static String DIRS_ARCREPOSITORY_ADMIN = "settings.archive.arcrepository.baseDir"; 052 053 /** 054 * <b>settings.archive.arcrepository.uploadRetries</b>: <br> 055 * The maximum number of times an arc file is attempted uploaded if the initial upload fails. 056 */ 057 public static String ARCREPOSITORY_UPLOAD_RETRIES = "settings.archive.arcrepository.uploadRetries"; 058 059 /** 060 * <b>settings.archive.bitarchive.minSpaceLeft</b>: <br> 061 * The minimum amount of bytes left *in any dir* that we will allow a bitarchive machine to accept uploads with. 062 * When no dir has more space than this, the bitarchive machine stops listening for uploads. This value should at 063 * the very least be greater than the largest ARC file you expect to receive. 064 */ 065 public static String BITARCHIVE_MIN_SPACE_LEFT = "settings.archive.bitarchive.minSpaceLeft"; 066 067 /** 068 * <b>settings.archive.bitarchive.minSpaceRequired</b>: <br> 069 * The minimum amount of bytes required left *in all dirs* after we have accepted an upload. If no dir has enough 070 * space to store a received file and still have at least this much space left, the operation will result in an 071 * error. 072 */ 073 public static String BITARCHIVE_MIN_SPACE_REQUIRED = "settings.archive.bitarchive.minSpaceRequired"; 074 075 /** 076 * <b>settings.archive.bitarchive.baseFileDir</b>: <br> 077 * These are the directories where ARC files are stored (in a subdir). If more than one is given, they are used from 078 * one end. This setting may be repeated, to define multiple directories. Note: This value should always be so much 079 * lower than minSpaceRequired, that the difference matches at least the size of files we expect to receive. 080 */ 081 public static String BITARCHIVE_SERVER_FILEDIR = "settings.archive.bitarchive.baseFileDir"; 082 083 /** 084 * <b>settings.archive.bitarchive.heartbeatFrequency</b>: <br> 085 * The frequency in milliseconds of heartbeats that are sent by each BitarchiveServer to the BitarchiveMonitor. 086 */ 087 public static String BITARCHIVE_HEARTBEAT_FREQUENCY = "settings.archive.bitarchive.heartbeatFrequency"; 088 089 /** 090 * <b>settings.archive.bitarchive.acceptableHeartbeatDelay</b>: <br> 091 * If we haven't heard from a bit archive within this many milliseconds, we don't expect it to be online and won't 092 * wait for them to reply on a batch job. This number should be significantly greater than heartbeatFrequency to 093 * account for temporary network congestion. 094 */ 095 public static String BITARCHIVE_ACCEPTABLE_HEARTBEAT_DELAY = "settings.archive.bitarchive.acceptableHeartbeatDelay"; 096 097 /** 098 * <b>settings.archive.bitarchive.batchMessageTimeout</b>: <br> 099 * The BitarchiveMonitorServer will listen for BatchEndedMessages for this many milliseconds before it decides that 100 * a batch job is taking too long and returns just the replies it has received at that point. 101 */ 102 public static String BITARCHIVE_BATCH_JOB_TIMEOUT = "settings.archive.bitarchive.batchMessageTimeout"; 103 104 /** 105 * <b>settings.archive.bitarchive.thisCredentials</b>: <br> 106 * Credentials to enter in the GUI for "deleting" ARC files in this bit archive. 107 */ 108 public static String ENVIRONMENT_THIS_CREDENTIALS = "settings.archive.bitarchive.thisCredentials"; 109 110 /** 111 * <b>settings.archive.bitpreservation.baseDir</b>: <br> 112 * Absolute or relative path to dir containing results of file-list-batch-jobs and checksumming batch jobs for bit 113 * preservation. 114 */ 115 public static String DIR_ARCREPOSITORY_BITPRESERVATION = "settings.archive.bitpreservation.baseDir"; 116 117 /** 118 * <b>settings.archive.admin.class</b>: <br> 119 * The path to the settings for the adminstration instance class. 120 */ 121 public static String ADMIN_CLASS = "settings.archive.admin.class"; 122 123 /** 124 * <b>settings.archive.admin.database.baseUrl</b>: <br> 125 * Setting for giving the base URL to the database used by the ReplicaCacheDatabase class. It has the default value: 126 * 'jdbc:derby'. Do not retrieve this directly, use in stead the function 127 * dk.netarkivet.archive.arcrepositoryadmin.DBConnect.getArchiveUrl(). 128 * <p> 129 * If a specific url is wanted, and not constructed from the 4 different parts, just assign the entire URL to this 130 * setting and set the other settings to the empty string. 131 */ 132 public static String BASEURL_ARCREPOSITORY_ADMIN_DATABASE = "settings.archive.admin.database.baseUrl"; 133 134 /** 135 * <b>settings.archive.admin.database.machine</b>: <br> 136 * Setting for giving the machine of the external database used by the ReplicaCacheDatabase class. It is default: 137 * 'localhost'. If this is empty, then it will be ignored. Do not retrieve this directly, use in stead the function 138 * dk.netarkivet.archive.arcrepositoryadmin.DBConnect.getArchiveUrl(). 139 */ 140 public static String MACHINE_ARCREPOSITORY_ADMIN_DATABASE = "settings.archive.admin.database.machine"; 141 142 /** 143 * <b>settings.archive.admin.database.port</b>: <br> 144 * Setting for giving the port of the external database used by the ReplicaCacheDatabase class. It is default: 145 * '1527'. If this is empty, then it will be ignored. Do not retrieve this directly, use in stead the function 146 * dk.netarkivet.archive.arcrepositoryadmin.DBConnect.getArchiveUrl(). 147 */ 148 public static String PORT_ARCREPOSITORY_ADMIN_DATABASE = "settings.archive.admin.database.port"; 149 150 /** 151 * <b>settings.archive.admin.database.dir</b>: <br> 152 * Setting for giving the machine of the external database used by the ReplicaCacheDatabase class. It is default: 153 * 'admindb'. If this is empty, then it will be ignored. Do not retrieve this directly, use in stead the function 154 * dk.netarkivet.archive.arcrepositoryadmin.DBConnect.getArchiveUrl(). 155 */ 156 public static String DIR_ARCREPOSITORY_ADMIN_DATABASE = "settings.archive.admin.database.dir"; 157 158 /** 159 * <b>settings.archive.admin.database.class</b>: <br> 160 * Setting for which class is used for handling the database for the DatabaseBasedActiveBitPreservation class. 161 */ 162 public static String CLASS_ARCREPOSITORY_ADMIN_DATABASE = "settings.archive.admin.database.class"; 163 164 /** 165 * <b>settings.archive.admin.database.reconnectMaxRetries</b>:<br/> 166 * Setting for the maximum number of attempts to reconnect to the admin database. 167 */ 168 public static String RECONNECT_MAX_TRIES_ADMIN_DATABASE = "settings.archive.admin.database.reconnectMaxRetries"; 169 170 /** 171 * <b>settings.archive.admin.database.reconnectRetryDelay</b>:<br/> 172 * Settings for the delay between the attempts to reconnect to the admin database. 173 */ 174 public static String RECONNECT_DELAY_ADMIN_DATABASE = "settings.archive.admin.database.reconnectRetryDelay"; 175 176 /** 177 * <b>settings.archive.admin.database.validityCheckTimeout</b>: <br> 178 * Timeout in seconds to check for the validity of a JDBC connection on the server. This is the time in seconds to 179 * wait for the database operation used to validate the connection to complete. If the timeout period expires before 180 * the operation completes, this method returns false. A value of 0 indicates a timeout is not applied to the 181 * database operation. 182 * <p> 183 * {@link java.sql.Connection#isValid(int)} 184 */ 185 public static String DB_CONN_VALID_CHECK_TIMEOUT = "settings.archive.admin.database.validityCheckTimeout"; 186 187 /** 188 * <b>settings.archive.admin.database.pool.minSize</b>: <br> 189 * Configure the minimum size of the DB connection pool. Default value is 5. 190 */ 191 public static String DB_POOL_MIN_SIZE = "settings.archive.admin.database.pool.minSize"; 192 193 /** 194 * <b>settings.archive.admin.database.pool.maxSize</b>: <br> 195 * Configure the maximum size of the DB connection pool. Default value is 10. 196 */ 197 public static String DB_POOL_MAX_SIZE = "settings.archive.admin.database.pool.maxSize"; 198 199 /** 200 * <b>settings.archive.admin.database.pool.acquireInc</b>: <br> 201 * Configure the increment size DB connection pool. Default value is 5 (half the max size). 202 */ 203 public static String DB_POOL_ACQ_INC = "settings.archive.admin.database.pool.acquireInc"; 204 205 /** 206 * <b>settings.archive.admin.database.pool.maxStm</b>: <br> 207 * Configure statement pooling, by setting the global maximum number of pooled prepared statements for a data 208 * source. Default value is 0. Note that if both {@link #DB_POOL_MAX_STM} and {@link #DB_POOL_MAX_STM_PER_CONN} are 209 * set to zero, statement pooling is fully deactivated. 210 * 211 * @see <a href="http://www.mchange.com/projects/c3p0/index.html#maxStatements"> c3p0 maxStatements 212 * documentation</a> 213 */ 214 public static String DB_POOL_MAX_STM = "settings.archive.admin.database.pool.maxStm"; 215 216 /** 217 * <b>settings.archive.admin.database.pool.maxStmPerConn</b>: <br> 218 * Configure statement pooling, by setting the global maximum number of pooled prepared statements for a data 219 * source. Default value is 0. Note that if both {@link #DB_POOL_MAX_STM} and {@link #DB_POOL_MAX_STM_PER_CONN} are 220 * set to zero, statement pooling is fully deactivated. 221 * 222 * @see <a href="http://www.mchange.com/projects/c3p0/index.html#maxStatementsPerConnection"> c3p0 223 * maxStatementsPerConnection documentation</a> 224 */ 225 public static String DB_POOL_MAX_STM_PER_CONN = "settings.archive.admin.database.pool.maxStmPerConn"; 226 227 /** 228 * <b>settings.archive.admin.database.pool.idleConnTestPeriod</b>: <br> 229 * Configure idle connection testing period in seconds. Default is 0, which means no idle connection testing 230 * 231 * @see <a href="http://www.mchange.com/projects/c3p0/index.html#idleConnectionTestPeriod"> c3p0 232 * idleConnectionTestPeriod documentation</a> 233 */ 234 public static String DB_POOL_IDLE_CONN_TEST_PERIOD = "settings.archive.admin.database.pool.idleConnTestPeriod"; 235 236 /** 237 * <b>settings.archive.admin.database.pool.idleConnTestOnCheckin</b>: <br> 238 * Configure if a connection validity should be checked when returned to the pool. Default is false. 239 * 240 * @see <a href="http://www.mchange.com/projects/c3p0/index.html#testConnectionOnCheckin"> c3p0 241 * testConnectionOnCheckin documentation</a> 242 */ 243 public static String DB_POOL_IDLE_CONN_TEST_ON_CHECKIN = "settings.archive.admin.database.pool.idleConnTestOnCheckin"; 244 245 /** 246 * <b>settings.archive.admin.database.pool.idleConnTestQuery</b>: <br> 247 * The SQL query to be used when testing an idle connection. Default is empty, which means using c3p0 defaults. 248 * 249 * @see <a href="http://www.mchange.com/projects/c3p0/index.html#preferredTestQuery"> c3p0 preferredTestQuery 250 * documentation</a> 251 */ 252 public static String DB_POOL_IDLE_CONN_TEST_QUERY = "settings.archive.admin.database.pool.idleConnTestQuery"; 253 254 /** 255 * The user name for login to the admin database. Default value is empty (no username passed to database 256 * connection). 257 */ 258 public static String DB_USERNAME = "settings.archive.admin.database.username"; 259 260 /** 261 * The password name for login to the admin database.Default values is empty (no password passed to database 262 * connection). 263 */ 264 public static String DB_PASSWORD = "settings.archive.admin.database.password"; 265 266 /** 267 * <b>settings.archive.bitpreservation.class</b>: <br> 268 * Setting for which instance of ActiveBitPreservation that should be used for preservation. 269 */ 270 public static String CLASS_ARCREPOSITORY_BITPRESERVATION = "settings.archive.bitpreservation.class"; 271 272 /** 273 * <b>settings.archive.checksum.baseDir</b>: <br> 274 * The directory for the checksum file. 275 */ 276 public static String CHECKSUM_BASEDIR = "settings.archive.checksum.baseDir"; 277 278 /** 279 * <b>settings.archive.checksum.minSpaceLeft</b>: <br> 280 * The path to the settings for the minimum amount of space left for the checksum archive to receive new upload 281 * messages. 282 */ 283 public static String CHECKSUM_MIN_SPACE_LEFT = "settings.archive.checksum.minSpaceLeft"; 284 285 /** 286 * <b>settings.archive.checksum.class</b> This decides how to store the checksums, in file, og BDB database. By 287 * default, it is stored in a file 288 */ 289 public static String CHECKSUM_ARCHIVE_CLASS = "settings.archive.checksum.archive.class"; 290 291 /** 292 * <b>settings.archive.checksum.usePrecomputedChecksum</b>: This decides whether or not use the pre-computed checksum sent as part of the StoreMessage and UploadMessage 293 * The default is false 294 */ 295 public static String CHECKSUM_USE_PRECOMPUTED_CHECKSUM_DURING_UPLOAD= "settings.archive.checksum.usePrecomputedChecksumDuringUpload"; 296 297 298 /** 299 * <b>settings.archive.bitarchive.singleChecksumTimeout</b>: <br> 300 * The path to the settings for the maximum time usage for the calculation of the checksum for a single file. Used 301 * to set a timelimit to the batchjob for the GetChecksumMessage. 302 */ 303 public static String SINGLE_CHECKSUM_TIMEOUT = "settings.archive.bitarchive.singleChecksumTimeout"; 304}