1 31 32 package org.opencms.staticexport; 33 34 import org.opencms.util.CmsStringUtil; 35 36 import java.util.ArrayList ; 37 import java.util.Iterator ; 38 import java.util.List ; 39 import java.util.regex.Pattern ; 40 41 51 public class CmsExportFolderMatcher { 52 53 54 private List m_vfsFolders; 55 56 62 public CmsExportFolderMatcher(List vfsFolders, String checkResource) { 63 64 m_vfsFolders = new ArrayList (); 65 66 Iterator i = vfsFolders.iterator(); 67 while (i.hasNext()) { 68 m_vfsFolders.add(Pattern.compile((String )i.next())); 69 } 70 71 m_vfsFolders.add(Pattern.compile(CmsStringUtil.escapePattern(checkResource))); 72 73 } 74 75 81 public boolean match(String vfsName) { 82 83 boolean match = false; 84 85 for (int j = 0; j < m_vfsFolders.size(); j++) { 86 Pattern pattern = (Pattern )m_vfsFolders.get(j); 87 match = pattern.matcher(vfsName).matches(); 88 if (match) { 89 break; 90 } 91 } 92 return match; 93 } 94 } 95 | Popular Tags |