001/* 002 * #%L 003 * Netarchivesuite - common 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.common; 024 025import dk.netarkivet.common.utils.Settings; 026 027/** 028 * Settings common to the entire NetarchiveSuite. 029 */ 030public class CommonSettings { 031 /** The default place in classpath where the settings file can be found. */ 032 private static final String DEFAULT_SETTINGS_CLASSPATH = "dk/netarkivet/common/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 /** The path in the XML-tree for the settings branch. (Used by deploy). */ 047 public static String SETTINGS = "settings"; 048 049 /** 050 * <b>settings.common.environmentName</b>: <br> 051 * The name of the environment in which this code is running. E.g. PROD, RELEASETEST. It is used as a Common prefix 052 * to all JMS channels created in a NetarchiveSuite installation. 053 */ 054 public static String ENVIRONMENT_NAME = "settings.common.environmentName"; 055 056 /** 057 * <b>settings.common.tempDir</b>: <br> 058 * Common temporary directory for all applications. Some subdirs of this directory must be set to have AllPermision 059 * in the conf/security.conf file, or the web pages won't work. 060 */ 061 public static String DIR_COMMONTEMPDIR = "settings.common.tempDir"; 062 063 /** 064 * <b>settings.common.remoteFile.class</b>: <br> 065 * The class to use for RemoteFile objects (for transferring files around). This class must implement the 066 * dk.netarkivet.common.distribute.RemoteFile interface. 067 */ 068 public static String REMOTE_FILE_CLASS = "settings.common.remoteFile.class"; 069 070 /** 071 * <b>settings.common.jms.class</b>: <br> 072 * Selects the broker class to be used. Must be subclass of dk.netarkivet.common.distribute.JMSConnection. 073 */ 074 public static String JMS_BROKER_CLASS = "settings.common.jms.class"; 075 076 /** 077 * <b>settings.common.jms.retries</b>: <br> 078 * Selects the number of times the JMS connection tries to reconnect to the broker. 079 */ 080 public static String JMS_BROKER_RETRIES = "settings.common.jms.retries"; 081 082 /** 083 * <b>settings.common.http.port</b>: <br> 084 * The *unique* (per host) port number that may or may not be used to serve http. 085 */ 086 public static String HTTP_PORT_NUMBER = "settings.common.http.port"; 087 088 /** 089 * <b>settings.common.arcrepositoryClient.class</b>: <br> 090 * The class that implements the ArcRepositoryClient. The class must implement the interface 091 * dk.netarkivet.common.distribute.arcrepository.ArcRepositoryClient This class will be instantiated by the 092 * ArcRepositoryClientFactory. 093 */ 094 public static String ARC_REPOSITORY_CLIENT = "settings.common.arcrepositoryClient.class"; 095 096 /** 097 * <b>settings.common.batch.maxExceptions</b>: <br> 098 * The maximum number of exceptions to be stored for a batch job. 099 */ 100 public static String MAX_NUM_BATCH_EXCEPTIONS = "settings.common.batch.maxExceptions"; 101 102 /** 103 * <b>settings.common.batch.loggingInterval</b>: <br/> 104 * The time between logging the status of a batch job. 105 */ 106 public static String BATCH_LOGGING_INTERVAL = "settings.common.batch.loggingInterval"; 107 108 /** 109 * <b>settings.common.batch.defaultBatchTimeout</b>: <br/> 110 * The default timeout for batchjobs. This will be used for batchjobs which has the batchJobTimeout set to -1 111 * (inherited value from FileBatchJob). 112 */ 113 public static String BATCH_DEFAULT_TIMEOUT = "settings.common.batch.defaultBatchTimeout"; 114 115 /** 116 * <b>settings.common.monitorregistryClient.class</b>: <br> 117 * Which class to use for monitor registry. Must implement the interface 118 * dk.netarkivet.common.distribute.monitorregistry.MonitorRegistryClient. 119 */ 120 public static String MONITOR_REGISTRY_CLIENT = "settings.common.monitorregistryClient.class"; 121 122 /** 123 * <b>settings.common.monitorregistryClient.reregisterdelay</b>: <br> 124 * Delay between every reregistering in minutes, e.g. 1 for one minute. 125 */ 126 public static String MONITOR_REGISTRY_CLIENT_REREGISTERDELAY = "settings.common.monitorregistryClient.reregisterdelay"; 127 128 /** 129 * <b>settings.common.indexClient.class</b>: <br> 130 * The class instantiated to give access to indices. The class must implement the interface 131 * dk.netarkivet.common.distribute.indexserver.JobIndexCache The class instantiations are manufactored by 132 * IndexClientFactory. 133 */ 134 public static String INDEXSERVER_CLIENT = "settings.common.indexClient.class"; 135 136 /** 137 * <b>settings.common.unixSort.useCommonTempDir</b>: <br> 138 * When using the Unix sort command, by default it stores temporary files in the system temp dir, but if this 139 * setting is set to true, then it will be configured to use the common temp dir defined by common.settings.tempDir. 140 * By default the value is false (use system temp), which is the legacy behavior. This setting is part of the fix 141 * for Jira issue NAS-1995. 142 * 143 * @see #DIR_COMMONTEMPDIR 144 */ 145 public static String UNIX_SORT_USE_COMMON_TEMP_DIR = "settings.common.unixSort.useCommonTempDir"; 146 147 /** 148 * <b>settings.common.cacheDir</b>: <br> 149 * The name of the directory where cache data global to the entire machine can be stored. Various kinds of caches 150 * should be stored in subdirectories of this. 151 */ 152 public static String CACHE_DIR = "settings.common.cacheDir"; 153 154 // TODO Currently only used by heritrix shutdown - move to harvester 155 // settings? 156 /** 157 * <b>settings.common.processTimeout</b>: <br> 158 * The number of milliseconds we wait for processes to react to shutdown requests. 159 */ 160 public static String PROCESS_TIMEOUT = "settings.common.processTimeout"; 161 162 /** 163 * <b>settings.common.notifications.class</b>: <br> 164 * The implementation class for notifications, e.g. error notification. The class must extend 165 * dk.netarkivet.common.utils.Notifications 166 */ 167 public static String NOTIFICATIONS_CLASS = "settings.common.notifications.class"; 168 169 /** 170 * <b>settings.common.mail.server</b>: <br> 171 * The mail server to use when sending mails. 172 */ 173 public static String MAIL_SERVER = "settings.common.mail.server"; 174 175 /** 176 * <b>settings.common.jmx.port</b>: <br> 177 * The port to use for JMX. 178 */ 179 public static String JMX_PORT = "settings.common.jmx.port"; 180 181 /** 182 * <b>settings.common.jmx.rmiPort</b>: <br> 183 * The JMX's RMI port to use for internal communication with beans. 184 */ 185 public static String JMX_RMI_PORT = "settings.common.jmx.rmiPort"; 186 187 /** 188 * <b>settings.common.jmx.passwordFile</b>: <br> 189 * The password file, containing information about who may connect to the beans. The file has a format defined by 190 * the JMX standard, 191 * 192 * @see <URL:http://java.sun.com/j2se/1.5.0/docs/guide/management/agent.html#PasswordAccessFiles> 193 */ 194 public static String JMX_PASSWORD_FILE = "settings.common.jmx.passwordFile"; 195 196 /** 197 * <b>settings.common.jmx.accessFile</b>: <br> 198 * The access file, containing information about who have which JMX roles have which access privileges. The file has 199 * a format defined by the JMX standard, 200 * 201 * @see <URL:http://java.sun.com/j2se/1.5.0/docs/guide/management/agent.html#PasswordAccessFiles> 202 */ 203 public static String JMX_ACCESS_FILE = "settings.common.jmx.accessFile"; 204 205 /** 206 * <b>settings.common.jmx.timeout</b>: <br> 207 * How many seconds we will wait before giving up on a JMX connection. 208 */ 209 public static String JMX_TIMEOUT = "settings.common.jmx.timeout"; 210 211 /** 212 * <b>settings.common.webinterface</b>: <br> 213 * The entire webinterface setting structure. 214 */ 215 public static String WEBINTERFACE_SETTINGS = "settings.common.webinterface"; 216 217 /** 218 * <b>settings.common.webinterface.hideInactiveTemplates</b>;<br/> 219 * Boolean valued String. If true, inactive harvest templates are entirely hidden in the GUI - it will be impossible 220 * to see them or change their state to "active". If false, the GUI will include functionality to change the 221 * status of template from inactive to active and vice-versa. 222 */ 223 public static String HIDE_INACTIVE_TEMPLATES = "settings.common.webinterface.hideInactiveTemplates"; 224 225 /** 226 * settings.common.webinterface.<b>language</b>: <br> 227 * The entire language setting structure under the webinterface setting. Is repeated for each language 228 */ 229 public static String WEBINTERFACE_LANGUAGE = "language"; 230 231 /** 232 * settings.common.webinterface.language.<b>locale</b>: <br> 233 * The locale the GUI is available as under specific language setting. 234 */ 235 public static String WEBINTERFACE_LANGUAGE_LOCALE = "locale"; 236 237 /** 238 * settings.common.webinterface.language.<b>name</b>: <br> 239 * The native name of the language for the locale under specific language setting. 240 */ 241 public static String WEBINTERFACE_LANGUAGE_NAME = "name"; 242 243 /** 244 * <b>settings.common.webinterface.siteSection.class</b>: <br> 245 * The subclass of SiteSection that defines a part of the web interface. Is part of repeated siteSection settings 246 * for each part. 247 */ 248 public static String SITESECTION_CLASS = "settings.common.webinterface.siteSection.class"; 249 250 /** 251 * <b>settings.common.webinterface.siteSection.webapplication</b>: <br> 252 * The directory or war-file containing the web application for a site section. Is part of repeated siteSection 253 * settings for each part. 254 */ 255 public static String SITESECTION_WEBAPPLICATION = "settings.common.webinterface.siteSection.webapplication"; 256 257 /** 258 * <b>settings.common.webinterface.harvestStatus.defaultPageSize</b>: <br> 259 * The default number of jobs to show in the harvest status section, on one result page. 260 */ 261 public static String HARVEST_STATUS_DFT_PAGE_SIZE = "settings.common.webinterface.harvestStatus.defaultPageSize"; 262 263 /** 264 * <b>settings.common.topLevelDomains.tld</b>: <br> 265 * Extra valid top level domain, like .co.uk, .dk, .org., not part of current embedded public_suffix_list.dat file 266 * in common/common-core/src/main/resources/dk/netarkivet/common/utils/public_suffix_list.dat 267 * downloaded from https://www.publicsuffix.org/list/public_suffix_list.dat 268 */ 269 public static String TLDS = "settings.common.topLevelDomains.tld"; 270 271 // TODO Currently only used by harvestscheduler - move to harvester 272 // settings? 273 /** 274 * <b>settings.common.database.class</b>: <br> 275 * The class that defines DB-specific methods. This class must extend the DBSpecifics class 276 */ 277 public static String DB_SPECIFICS_CLASS = "settings.common.database.class"; 278 279 /** 280 * If DB_SPECIFICS_CLASS contains this string then a Derby database is in use. 281 */ 282 public static String DB_IS_DERBY_IF_CONTAINS = "Derby"; 283 284 /** 285 * <b>settings.common.database.baseUrl</b>: <br> 286 * The URL to use to connect to the database specified in the DB_SPECIFICS_CLASS setting. 287 */ 288 public static String DB_BASE_URL = "settings.common.database.baseUrl"; 289 290 /** 291 * <b>settings.common.database.machine</b>: <br> 292 * Used for the external harvest definition database. The machine where the harvest definition database is located. 293 */ 294 public static String DB_MACHINE = "settings.common.database.machine"; 295 296 /** 297 * <b>settings.common.database.port</b>: <br> 298 * Used for the external harvest definition database. The port where the external harvest definition database is 299 * attached. 300 */ 301 public static String DB_PORT = "settings.common.database.port"; 302 303 /** 304 * <b>settings.common.database.dir</b>: <br> 305 * Used for the external harvest definition database. The directory where the external harvest definition database 306 * is located. 307 */ 308 public static String DB_DIR = "settings.common.database.dir"; 309 310 /** 311 * <b>settings.common.database.validityCheckTimeout</b>: <br> 312 * Timeout in seconds to check for the validity of a JDBC connection on the server. This is the time in seconds to 313 * wait for the database operation used to validate the connection to complete. If the timeout period expires before 314 * the operation completes, this method returns false. A value of 0 indicates a timeout is not applied to the 315 * database operation. 316 * <p> 317 * {@link java.sql.Connection#isValid(int)} 318 */ 319 public static String DB_CONN_VALID_CHECK_TIMEOUT = "settings.common.database.validityCheckTimeout"; 320 321 /** 322 * <b>settings.common.database.pool.minSize</b>: <br> 323 * Configure the minimum size of the DB connection pool. Default value is 5. 324 */ 325 public static String DB_POOL_MIN_SIZE = "settings.common.database.pool.minSize"; 326 327 /** 328 * <b>settings.common.database.pool.maxSize</b>: <br> 329 * Configure the maximum size of the DB connection pool. Default value is 10. 330 */ 331 public static String DB_POOL_MAX_SIZE = "settings.common.database.pool.maxSize"; 332 333 /** 334 * <b>settings.common.database.pool.acquireInc</b>: <br> 335 * Configure the increment size DB connection pool. Default value is 5 (half the max size). 336 */ 337 public static String DB_POOL_ACQ_INC = "settings.common.database.pool.acquireInc"; 338 339 /** 340 * <b>settings.common.database.pool.maxStm</b>: <br> 341 * Configure statement pooling, by setting the global maximum number of pooled prepared statements for a data 342 * source. Default value is 0. Note that if both {@link #DB_POOL_MAX_STM} and {@link #DB_POOL_MAX_STM_PER_CONN} are 343 * set to zero, statement pooling is fully deactivated. 344 * 345 * @see <a href="http://www.mchange.com/projects/c3p0/index.html">c3p0 documentation</a> 346 */ 347 public static String DB_POOL_MAX_STM = "settings.common.database.pool.maxStm"; 348 349 /** 350 * <b>settings.common.database.pool.maxStmPerConn</b>: <br> 351 * Configure statement pooling, by setting the global maximum number of pooled prepared statements for a data 352 * source. Default value is 0. Note that if both {@link #DB_POOL_MAX_STM} and {@link #DB_POOL_MAX_STM_PER_CONN} are 353 * set to zero, statement pooling is fully deactivated. 354 * 355 * @see <a href="http://www.mchange.com/projects/c3p0/index.html">c3p0 documentation</a> 356 */ 357 public static String DB_POOL_MAX_STM_PER_CONN = "settings.common.database.pool.maxStmPerConn"; 358 359 /** 360 * <b>settings.common.database.pool.idleConnTestPeriod</b>: <br> 361 * Configure idle connection testing period in seconds. Default is 0, which means no idle connection testing 362 * 363 * @see <a href="http://www.mchange.com/projects/c3p0/index.html#idleConnectionTestPeriod"/> 364 */ 365 public static String DB_POOL_IDLE_CONN_TEST_PERIOD = "settings.common.database.pool.idleConnTestPeriod"; 366 367 /** 368 * <b>settings.common.database.pool.idleConnTestOnCheckin</b>: <br> 369 * Configure if a connection validity should be checked when returned to the pool. Default is false. 370 * 371 * @see <a href="http://www.mchange.com/projects/c3p0/index.html#testConnectionOnCheckin"/> 372 */ 373 public static String DB_POOL_IDLE_CONN_TEST_ON_CHECKIN = "settings.common.database.pool.idleConnTestOnCheckin"; 374 375 /** 376 * <b>settings.common.database.pool.idleConnTestQuery</b>: <br> 377 * The SQL query to be used when testing an idle connection. Default is empty, which means using c3p0 defaults. 378 * 379 * @see <a href="http://www.mchange.com/projects/c3p0/index.html#preferredTestQuery"/> 380 */ 381 public static String DB_POOL_IDLE_CONN_TEST_QUERY = "settings.common.database.pool.idleConnTestQuery"; 382 383 /** 384 * <b>settings.common.database.pool.maxConnectionAge</b>: <br> 385 * The maxConnectionAge in seconds for each connection in the pool. 386 * The default is one hour (3600 seconds) 387 * 388 * @see <a href="http://www.mchange.com/projects/c3p0/index.html#maxConnectionAge"/> 389 */ 390 public static String DB_POOL_MAX_CONNECTION_AGE = "settings.common.database.pool.maxConnectionAge"; 391 392 /** 393 * The username for login to the harvest database. 394 */ 395 public static String DB_USERNAME = "settings.common.database.username"; 396 397 /** 398 * The password for login to the harvest database. 399 */ 400 public static String DB_PASSWORD = "settings.common.database.password"; 401 402 /** 403 * <b>settings.common.repository.limitForRecordDatatransferInFile</b>: <br> 404 * When the length record exceeds this number, the contents of the record will be transferred using a RemoteFile. 405 */ 406 public static String BITARCHIVE_LIMIT_FOR_RECORD_DATATRANSFER_IN_FILE = "settings.common.repository.limitForRecordDatatransferInFile"; 407 408 /** 409 * <b>settings.common.replicas</b>: <br> 410 * The entire settings for all replicas in the environment. NOTE: settings for checksum replicas are not use yet 411 */ 412 public static String REPLICAS_SETTINGS = "settings.common.replicas"; 413 414 /** 415 * settings.common.replicas.<b>replica</b>: <br> 416 * The path to settings belonging to an individual replica, placed under the replicas setting. 417 */ 418 public static String REPLICA_TAG = "replica"; 419 420 /** 421 * settings.common.replicas.replica.<b>replicaId</b>: <br> 422 * The tags for identifier of the replica, placed under the replica tag. The replica id is used internally in e.g. 423 * naming of channels. 424 */ 425 public static String REPLICAID_TAG = "replicaId"; 426 /** 427 * settings.common.replicas.replica.<b>replicaName</b>: <br> 428 * The tags for name of the replica, placed under the replica tag. The replica name is used in interfaces like the 429 * GUI or command-line batch-programs. The name can be the same value as the id. 430 */ 431 public static String REPLICANAME_TAG = "replicaName"; 432 /** 433 * settings.common.replicas.replica.<b>replicaType</b>: <br> 434 * The tags for type of the replica, placed under the replica tag. The type is used to identify whether it is a 435 * bitarchive or a checksum replica. NOTE: checksum replicas are not implemented yet Possible values are defined in 436 * ReplicaType 437 */ 438 public static String REPLICATYPE_TAG = "replicaType"; 439 440 /** 441 * <b>settings.common.replicas.replica.replicaId</b>: <br> 442 * The identifiers of all replicas in the environment. 443 */ 444 public static String REPLICA_IDS = REPLICAS_SETTINGS + "." + REPLICA_TAG + "." + REPLICAID_TAG; 445 446 /** 447 * <b>settings.common.useReplicaId</b>: <br> 448 * Default bitarchive to use for e.g. batch jobs (if none is specified). 449 */ 450 public static String USE_REPLICA_ID = "settings.common.useReplicaId"; 451 452 /** 453 * <b>settings.common.thisPhysicalLocation</b>: <br> 454 * Physical location of where the application is running. Only use for System state GUI and deploy 455 */ 456 public static String THIS_PHYSICAL_LOCATION = "settings.common.thisPhysicalLocation"; 457 458 /** 459 * <b>settings.common.applicationName</b>: <br> 460 * The name of the application, e.g. "BitarchiveServerApplication". The monitor puts this with each log message. 461 */ 462 public static String APPLICATION_NAME = "settings.common.applicationName"; 463 464 /** 465 * <b>settings.common.applicationInstanceId</b>: <br> 466 * The identifier of the instance of the application. This is used when there are more than one of the same 467 * application running on the same machine, e.g. when more harvesters are running on the same machine or more 468 * bitarchive applications are running on the same machine. 469 */ 470 public static String APPLICATION_INSTANCE_ID = "settings.common.applicationInstanceId"; 471 472 /** 473 * <b>settings.common.freespaceprovider.class</b>: <br> 474 * The implementation class for free space provider, e.g. dk.netarkivet.common.utils.DefaultFreeSpaceProvider. The 475 * class must implement FreeSpaceProvider-Interface. 476 */ 477 public static String FREESPACE_PROVIDER_CLASS = "settings.common.freespaceprovider.class"; 478 479 /** 480 * <b>settings.common.batch.batchjobs.batchjob.class</b>: <br/> 481 * The list of batchjobs to be runnable from the GUI. Must be the complete path to the batchjob classes (e.g. 482 * dk.netarkivet.archive.arcrepository.bitpreservation.ChecksumJob). Must inherit FileBatchJob. 483 */ 484 public static String BATCHJOBS_CLASS = "settings.common.batch.batchjobs.batchjob.class"; 485 486 /** 487 * <b>settings.common.batch.batchjobs.batchjob.jarfile</b>: <br/> 488 * The list of the corresponding jar-files containing the batchjob. This will be used for LoadableJarBatchJobs. If 489 * no file is specified, it is assumed, that the batchjob exists with the default classpath of the involved 490 * applications (BitarchiveMonitor, ArcRepository, GUIWebServer and BitArchive). 491 */ 492 public static String BATCHJOBS_JARFILE = "settings.common.batch.batchjobs.batchjob.jarfile"; 493 494 /** 495 * <b>settings.common.batch.baseDir</b>: <br/> 496 * The directory where the resulting files will be placed when running a batchjob through the GUI interface. 497 */ 498 public static String BATCHJOBS_BASEDIR = "settings.common.batch.baseDir"; 499 /** 500 * <b>settings.common.remoteFile.serverName</b>: <br> 501 * The setting for the FTP-server used. 502 */ 503 public static String FTP_SERVER_NAME = "settings.common.remoteFile.serverName"; 504 /** 505 * <b>settings.common.remoteFile.serverPort</b>: <br> 506 * The setting for the FTP-server port used. 507 */ 508 public static String FTP_SERVER_PORT = "settings.common.remoteFile.serverPort"; 509 /** 510 * <b>settings.common.remoteFile.userName</b>: <br> 511 * The setting for the FTP username. 512 */ 513 public static String FTP_USER_NAME = "settings.common.remoteFile.userName"; 514 /** 515 * <b>settings.common.remoteFile.userPassword</b>: <br> 516 * The setting for the FTP password. * 517 */ 518 public static String FTP_USER_PASSWORD = "settings.common.remoteFile.userPassword"; 519 /** 520 * <b>settings.common.remoteFile.retries</b>: <br> 521 * The setting for the number of times FTPRemoteFile should try before giving up a copyTo operation or logOn 522 * operation. 523 */ 524 public static String FTP_RETRIES_SETTINGS = "settings.common.remoteFile.retries"; 525 /** 526 * <b>settings.common.remoteFile.datatimeout</b>: <br> 527 * The setting for the FTP data timeout in seconds. The default value is 600 (10 minutes). 528 */ 529 public static String FTP_DATATIMEOUT_SETTINGS = "settings.common.remoteFile.datatimeout"; 530 531 /** 532 * <b>settings.common.organization</b>: <br> 533 * The name of the organization responsible. The default value is netarkivet.dk 534 */ 535 public static String ORGANIZATION = "settings.common.organization"; 536 537 /** 538 * Specifies the suffix of a regex which can identify valid metadata files by job number. Thus preceding 539 * the value of this setting with .* will find all metadata files. 540 */ 541 public static String METADATAFILE_REGEX_SUFFIX = "settings.common.metadata.fileregexsuffix"; 542 543}