Coverage Report - org.mule.transport.file.filters.FilenameWildcardFilter
 
Classes in this File Line Coverage Branch Coverage Complexity
FilenameWildcardFilter
0%
0/10
0%
0/2
1.5
 
 1  
 /*
 2  
  * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
 3  
  * The software in this package is published under the terms of the CPAL v1.0
 4  
  * license, a copy of which has been included with this distribution in the
 5  
  * LICENSE.txt file.
 6  
  */
 7  
 package org.mule.transport.file.filters;
 8  
 
 9  
 import org.mule.api.MuleMessage;
 10  
 import org.mule.routing.filters.WildcardFilter;
 11  
 import org.mule.transport.file.FileConnector;
 12  
 
 13  
 import java.io.File;
 14  
 import java.io.FilenameFilter;
 15  
 
 16  
 /**
 17  
  * <code>FilenameWildcardFilter</code> filters incoming files from a directory,
 18  
  * based on file patterns.
 19  
  */
 20  
 public class FilenameWildcardFilter extends WildcardFilter implements FilenameFilter
 21  
 {
 22  
 
 23  
     public FilenameWildcardFilter()
 24  
     {
 25  0
         super();
 26  0
     }
 27  
 
 28  
     public FilenameWildcardFilter(String pattern)
 29  
     {
 30  0
         super(pattern);
 31  0
     }
 32  
 
 33  
     /**
 34  
      * Filter condition decider method. <p/> Returns
 35  
      * <code>boolean</code> <code>TRUE</code> if the file conforms to an
 36  
      * acceptable pattern or <code>FALSE</code> otherwise.
 37  
      * 
 38  
      * @param dir The directory to apply the filter to.
 39  
      * @param name The name of the file to apply the filter to.
 40  
      * @return indication of acceptance as boolean.
 41  
      */
 42  
     public boolean accept(File dir, String name)
 43  
     {
 44  0
         if (name == null)
 45  
         {
 46  0
             logger.warn("The filename and/or directory was null");
 47  0
             return false;
 48  
         }
 49  
         else
 50  
         {
 51  0
             return accept(name);
 52  
         }
 53  
     }
 54  
 
 55  
     public boolean accept(MuleMessage message)
 56  
     {
 57  
         // TODO revisit, shouldn't it be looking in the inbound scope?
 58  0
         Object filename = message.getOutboundProperty(FileConnector.PROPERTY_ORIGINAL_FILENAME);
 59  0
         return accept(filename);
 60  
     }
 61  
 
 62  
 }