001    /**
002     * 
003     */
004    package org.wdssii.core.fam;
005    
006    import java.io.FilenameFilter;
007    
008    import org.apache.commons.logging.Log;
009    import org.apache.commons.logging.LogFactory;
010    
011    /**
012     * @author lakshman
013     *
014     */
015    public class FamIndexHelperFactory {
016            private static Log log = LogFactory.getLog(FamIndexHelperFactory.class);
017            public static FamIndexHelper newHelper(){
018                    try{
019                            return new FamIndexHelperInotifyImpl();
020                    } catch (Throwable e){
021                            log.warn("Can not use inotify, so using 'ls' instead ", e);
022                            return new FamIndexHelperLsImpl();
023                    }
024            }
025            
026            public static FamIndexHelper newHelper(FilenameFilter filter){
027                    try{
028                            return new FamIndexHelperInotifyImpl(filter);
029                    } catch (Throwable e){
030                            log.warn("Can not use inotify, so using 'ls' instead ", e);
031                            return new FamIndexHelperLsImpl(filter);
032                    }
033            }
034    }