001/*
002 * #%L
003 * Netarchivesuite - monitor
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.monitor;
024
025import dk.netarkivet.common.utils.Settings;
026
027/**
028 * Provides access to monitor settings. The settings are retrieved from an settings.xml file under monitor dir.
029 */
030public class MonitorSettings {
031    /** The default place in classpath where the settings file can be found. */
032    private static final String DEFAULT_SETTINGS_CLASSPATH = "dk/netarkivet/monitor/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 setting names used should be declared and documented here */
047
048    /**
049     * <b>settings.monitor.jmxUsername</b>: <br>
050     * The username used to connect to the all MBeanservers started by the application. The username must correspond to
051     * the value stored in the jmxremote.password file (name defined in setting settings.common.jmx.passwordFile).
052     */
053    public static String JMX_USERNAME_SETTING = "settings.monitor.jmxUsername";
054
055    /**
056     * <b>settings.monitor.jmxPassword</b>: <br>
057     * The password used to connect to the all MBeanservers started by the application. The password must correspond to
058     * the value stored in the jmxremote.password file (name defined in setting settings.common.jmx.passwordFile).
059     */
060    public static String JMX_PASSWORD_SETTING = "settings.monitor.jmxPassword";
061
062    /**
063     * <b>settings.monitor.logging.historySize</b>: <br>
064     * The number of logmessages from each application visible in the monitor.
065     */
066    public static String LOGGING_HISTORY_SIZE = "settings.monitor.logging.historySize";
067
068    /**
069     * <b>settings.monitor.jmxProxyTimeout</b>: <br>
070     * The number of milliseconds we wait for a connection to other machines when we proxy all machines MBeans to one
071     * place for monitoring, for instance in the Status GUI site section.
072     */
073    public static String JMX_PROXY_TIMEOUT = "settings.monitor.jmxProxyTimeout";
074
075    /** Delay between every reregistering in minutes. */
076    public static String DEFAULT_REREGISTER_DELAY = "settings.monitor.reregisterDelay";
077
078    /**
079     * <b>settings.monitor.prefferedMaxJMXLogLength</b>: <br/>
080     * The preferred length at which lines in the JMX log will be wrapped. (default 70)
081     */
082    public static String JMX_PREFERRED_MAX_LOG_LENGTH = "settings.monitor.preferredMaxJMXLogLength";
083
084    /**
085     * The absolute maximum length at which lines in the JMX log will be wrapped, even if this means breaking the line
086     * within a word. (default 100)
087     */
088    public static String JMX_ABSOLUTE_MAX_LOG_LENGTH = "settings.monitor.absoluteMaxJMXLogLength";
089
090}