Coverage Report - org.mule.samples.errorhandler.BusinessErrorManager
 
Classes in this File Line Coverage Branch Coverage Complexity
BusinessErrorManager
0%
0/10
N/A
1
 
 1  
 /*
 2  
  * $Id: BusinessErrorManager.java 7976 2007-08-21 14:26:13Z dirk.olmes $
 3  
  * --------------------------------------------------------------------------------------
 4  
  * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
 5  
  *
 6  
  * The software in this package is published under the terms of the CPAL v1.0
 7  
  * license, a copy of which has been included with this distribution in the
 8  
  * LICENSE.txt file.
 9  
  */
 10  
 
 11  
 package org.mule.samples.errorhandler;
 12  
 
 13  
 import org.mule.umo.UMOEventContext;
 14  
 import org.mule.umo.UMOException;
 15  
 import org.mule.umo.lifecycle.Callable;
 16  
 import org.mule.util.StringMessageUtils;
 17  
 
 18  
 import java.util.ArrayList;
 19  
 import java.util.List;
 20  
 
 21  
 import org.apache.commons.logging.Log;
 22  
 import org.apache.commons.logging.LogFactory;
 23  
 
 24  
 /**
 25  
  * The <code>BusinessErrorManager</code> is the UMO Component that processes 
 26  
  * exceptions of type org.mule.samples.errorhandler.exceptions.BusinessException.
 27  
  * The business method simply reports the errors and stops any further processing.
 28  
  */
 29  0
 public class BusinessErrorManager implements Callable
 30  
 {
 31  
     /** logger used by this class */
 32  0
     private static transient Log logger = LogFactory.getLog(BusinessErrorManager.class);
 33  
 
 34  
     public Object onCall(UMOEventContext context) throws UMOException
 35  
     {
 36  0
         ErrorMessage msg = (ErrorMessage)context.getTransformedMessage();
 37  
         // Do something with the error message
 38  0
         List msgs = new ArrayList();
 39  
 
 40  0
         msgs.add(LocaleMessage.businessErrorManagerError());
 41  0
         msgs.add(LocaleMessage.errorDetail(msg.getException().getDetailMessage()));
 42  0
         msgs.add(LocaleMessage.errorClass(msg.getException().getClass()));
 43  
 
 44  0
         logger.info("\n" + StringMessageUtils.getBoilerPlate(msgs, '*', 80));
 45  0
         context.setStopFurtherProcessing(true);
 46  0
         return null;
 47  
     }
 48  
 
 49  
 }