Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * $Id: ComponentState.java 22 2009-05-18 17:20:44Z mitcje $
   * $URL: https://ikasaneip.svn.sourceforge.net/svnroot/ikasaneip/tags/ikasan-0.7.3/common/src/main/java/org/ikasan/common/component/ComponentState.java $
   * 
   * ====================================================================
   * Ikasan Enterprise Integration Platform
   * Copyright (c) 2003-2008 Mizuho International plc and individual contributors as indicated
   * by the @authors tag. See the copyright.txt in the distribution for a
   * full listing of individual contributors.
  *
  * This is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License as
  * published by the Free Software Foundation; either version 2.1 of
  * the License, or (at your option) any later version.
  *
  * This software is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this software; if not, write to the 
  * Free Software Foundation Europe e.V. Talstrasse 110, 40217 Dusseldorf, Germany 
  * or see the FSF site: http://www.fsfeurope.org/.
  * ====================================================================
  */
 package org.ikasan.common.component;
 
Class used to report the status of a generic runtime component.

Author(s):
Ikasan Development Team
 
 public enum ComponentState
 {
    
Component state cannot be identified
 
     UNKNOWN(new Integer(0), "Unknown""Cannot determine component status"), //$NON-NLS-1$ //$NON-NLS-2$
     
Component stopped
 
     STOPPED(new Integer(10), "Stopped""Component is not currently running"), //$NON-NLS-1$ //$NON-NLS-2$
     
Component running
 
     RUNNING(new Integer(20), "Running""Component is running and happy"), //$NON-NLS-1$ //$NON-NLS-2$
     
Component running suspiciously
 
     RUNNING_SUSPICIOUS(new Integer(30), "Running Suspicious"//$NON-NLS-1$
             "Component is running, but acting suspiciously (ie. high number of exceptions)"), //$NON-NLS-1$
     
Component recovering
 
     RECOVERING(new Integer(40), "Recovering""Component is in a retry/recovery state"), //$NON-NLS-1$//$NON-NLS-2$
     
Component error
 
     ERROR(new Integer(50), "Error"//$NON-NLS-1$
             "Component is running, but in an error state. It needs attention"), //$NON-NLS-1$
     ;
    
Logger
 
     private static Logger logger = Logger.getLogger(ComponentState.class);

    
unique id of the state
 
     private final Integer id;

    
name of the state
 
     private final String state;

    
short state description for logging purposes
 
     private final String description;

    
Default Constructor

Parameters:
id - The state id
state - The state
description - The description of the state
 
     private ComponentState(final Integer idfinal String statefinal String description)
     {
         this. = id;
         this. = state;
         this. = description;
     }

    
Getter for id

Returns:
the id
 
     public Integer getId()
     {
         .debug("Getting id [" + this. + "]..."); //$NON-NLS-1$ //$NON-NLS-2$
         return this.;
     }

    
Getter for state

Returns:
the state
 
     public String getState()
     {
         .debug("Getting state [" + this. + "]..."); //$NON-NLS-1$ //$NON-NLS-2$
         return this.;
     }

    
Getter for description

Returns:
the description
    public String getDescription()
    {
        .debug("Getting description [" + this. + "]..."); //$NON-NLS-1$ //$NON-NLS-2$
        return this.;
    }

    
Instance comparison

Parameters:
status - The status
Returns:
boolean true if they are equal
    public boolean equals(ComponentState status)
    {
        if (status == null)
        {
            return false;
        }
        return this..equals(status.id);
    }
New to GrepCode? Check out our FAQ X