/***************************************
 *                                     *
 *  JBoss: The OpenSource J2EE WebOS   *
 *                                     *
 *  Distributable under LGPL license.  *
 *  See terms of license at gnu.org.   *
 *                                     *
 ***************************************/
 
package org.jboss.monitor.alarm;

/**
 * Alarm Constants.
 *
 * An alarm can be of two types:
 *
 * Stateless, when the producing MBean keeps no state about the occurence
 * of the alarm. The produced alarm notification must have alarmState STATE_NONE
 * and the valid severities are SEVERITY_NORMAL -> SEVERITY_UNKNOWN
 *
 * Stateful, when the producing MBean keeps state about the occurence
 * of the alarm. The first notification must carry alarmState STATE_CREATED,
 * with valid severities SEVERITY_WARNING -> SEVERITY_UNKNOWN. Any change
 * in the alarm (severity) must generate an alarm notification with alarmState
 * STATE_CHANGED and valid severities SEVERITY_WARNING -> SEVERITY_UNKNOWN.
 * The clearance of the alarm must be indicates with an alarm notification
 * with alarmState STATE_CLEARED and a severity of SEVERITY_NORMAL.
 *
 * This complexity is required in order to be able to easily correlate
 * alarms and associaty the generation and clearence of system faults.
 *
 * @author  <a href="mailto:dimitris@jboss.org">Dimitris Andreadis</a>
 *
 * @version $Revision: 1.1.4.1 $
**/
public interface Alarm
{
   // Constants -----------------------------------------------------

   /** default server id */
   public static final String DEFAULT_SERVER_ID = "jboss";
   
   /** the possible states of an alarm */
   public static final int STATE_CLEARED   = 0;
   public static final int STATE_CHANGED   = 1;
   public static final int STATE_CREATED   = 2;
   public static final int STATE_NONE      = 3;
   
   /** stringfied alarm states */
   public static final String[] STATE_STRINGS = {
      "CLEARED", "CHANGED", "CREATED", "NONE"
   };
   
   /** the possible severities of an alarm */
   public static final int SEVERITY_NORMAL   = 0;
   public static final int SEVERITY_WARNING  = 1;
   public static final int SEVERITY_MINOR    = 2;
   public static final int SEVERITY_MAJOR    = 3;
   public static final int SEVERITY_CRITICAL = 4;   
   public static final int SEVERITY_UNKNOWN  = 5;

   /** stringfied severities */
   public static final String[] SEVERITY_STRINGS = {
      "NORMAL", "WARNING", "MINOR", "MAJOR", "CRITICAL", "UNKNOWN"
   };
}