1 18 package net.sf.drftpd.master.config; 19 20 import java.util.ArrayList ; 21 22 import net.sf.drftpd.remotefile.LinkedRemoteFileInterface; 23 24 import org.apache.oro.text.GlobCompiler; 25 import org.apache.oro.text.regex.MalformedPatternException; 26 import org.apache.oro.text.regex.Pattern; 27 import org.apache.oro.text.regex.Perl5Matcher; 28 29 30 31 35 public class ExcludePath { 36 private Pattern _pat; 37 public ExcludePath(Pattern pat) { 38 _pat = pat; 39 } 40 41 public boolean checkPath(LinkedRemoteFileInterface file) { 42 String path = file.getPath(); 43 if(file.isDirectory()) path = path.concat("/"); 44 Perl5Matcher m = new Perl5Matcher(); 45 return m.matches(path, _pat); 46 } 47 48 public static void makePermission(ArrayList arr, String st) 49 throws MalformedPatternException { 50 arr.add( 51 new ExcludePath( 52 new GlobCompiler().compile(st))); 53 } 54 } | Popular Tags |