Coverage Report - org.mule.transport.email.filters.AbstractMailFilter
 
Classes in this File Line Coverage Branch Coverage Complexity
AbstractMailFilter
0%
0/8
0%
0/4
3.5
 
 1  
 /*
 2  
  * $Id: AbstractMailFilter.java 10489 2008-01-23 17:53:38Z dfeist $
 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.transport.email.filters;
 12  
 
 13  
 import org.mule.api.MuleMessage;
 14  
 import org.mule.api.routing.filter.Filter;
 15  
 import org.mule.util.ClassUtils;
 16  
 
 17  
 import javax.mail.Message;
 18  
 
 19  
 import org.apache.commons.logging.Log;
 20  
 import org.apache.commons.logging.LogFactory;
 21  
 
 22  
 /**
 23  
  * <code>AbstractMailFilter</code> is a base class for all javax.mail.Message
 24  
  * filters.
 25  
  */
 26  0
 public abstract class AbstractMailFilter implements Filter
 27  
 {
 28  
     /**
 29  
      * logger used by this class
 30  
      */
 31  0
     protected transient Log logger = LogFactory.getLog(getClass());
 32  
 
 33  
     public final boolean accept(MuleMessage message)
 34  
     {
 35  0
         if (message == null)
 36  
         {
 37  0
             return false;
 38  
         }
 39  
 
 40  0
         Object object = message.getPayload();
 41  0
         if (object instanceof Message)
 42  
         {
 43  0
             return accept((Message)object);
 44  
         }
 45  
         else
 46  
         {
 47  0
             throw new IllegalArgumentException("The Mail filter does not understand: "
 48  
                                                + ClassUtils.getSimpleName(object.getClass()));
 49  
         }
 50  
     }
 51  
 
 52  
     public abstract boolean accept(Message message);
 53  
 }