Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * $Id: CommonExceptionType.java 130 2009-06-05 17:01:24Z karianna $
   * $URL: https://ikasaneip.svn.sourceforge.net/svnroot/ikasaneip/tags/ikasan-0.7.3/common/src/main/java/org/ikasan/common/CommonExceptionType.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;
 
 // Imported log4j classes
This is an enumeration of common exception types providing categories within the CommonException and CommonRuntimeException. NOTE: The important definition in the enum is the name of the enum which is instantiated. This name is used to match in the exceptionResolver.xml for the associated component group. The enum description and id are there for potential logging and future use.

Author(s):
Ikasan Development Team
 
 public enum CommonExceptionType 
     implements ExceptionType
 {
    
Exception type not defined
 
     UNDEFINED("Exception type was not defined", 0),
    
Failure to instantiate an object within the ResourceLoader class
 
     RESOURCE_LOADER_FAILED("Failed on invocation within ResourceLoader", 1),
    
Failure to instantiate an Envelope
 
     ENVELOPE_INSTANTIATION_FAILED("Failed on instantiate an Envelope", 2),
    
Failure to instantiate a Payload
 
     PAYLOAD_INSTANTIATION_FAILED("Failed on instantiate a Payload", 3),
    
We must ensure each payload has a name
 
     INVALID_PAYLOAD_NAME("Payload name was undefined or invalid", 4),
    
We must ensure each payload has a valid spec
 
     INVALID_PAYLOAD_SPEC("Payload spec was undefined or invalid", 5),
    
We must ensure each payload has a source system
 
     INVALID_PAYLOAD_SRC_SYSTEM("Payload srcSystem was undefined or invalid", 6),
    
Failure on validation of an XML document
 
     FAILED_XML_VALIDATION("Failed on validation of an XML document", 7),
     ;

    
Logger
 
     private Logger logger = Logger.getLogger(CommonExceptionType.class);

    
exception type description
 
     private String description = null;
    
exception type unique identifier
 
     private int id = 0;

    
Creates a new instance of CommonExceptionType with the specified exception description and id.

Parameters:
description
id
 
     private CommonExceptionType(final String descriptionfinal int id)
     {
         this. = description;
         this. = id;
         .debug("CommonExceptionType constructor created id [" + this. + "]."); //$NON-NLS-1$
     }

    
Returns CommonExceptionType description.

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

    
Returns CommonExceptionType id.

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

    
Returns an array of current all CommonExceptionTypes.

Returns:
CommonExceptionType[] these exception types
    public static ExceptionType[] getExceptionTypes()
    {
        return CommonExceptionType.values();
    }

    
Get actual name of the enum instance

Returns:
String
    public String getName()
    {
        return this.name();
    }
    
    
Comparison for enum equality

Parameters:
exceptionType
Returns:
boolean
    public boolean equals(ExceptionType exceptionType
    {
        if(exceptionType == null)
            return false;
        if(exceptionType.getName().equals(this.name()))
            return true;
        return false;
    }
    
// main() method
// /////////////////////////////////////////////////////////////////////////////

    
Runs this class for testing.

Parameters:
args
    public static void main(String args[])
    {
        for (ExceptionType exceptionType: CommonExceptionType.getExceptionTypes())
        {
            ..println(exceptionType);
        }
        System.exit(0);
    }
New to GrepCode? Check out our FAQ X