예제 #1
0
 /**
  * Defaults to glob.
  *
  * @param path A Globbular path
  * @param searchGroups Force search in Groups
  * @param searchFolders Force search in folders
  */
 public ContainerVisitor(String path, Boolean searchGroups, Boolean searchFolders) {
   // TODO: This should do some checks to make sure $ is escaped for a regex
   if (path.endsWith("$")) {
     searchGroups = false;
     path = path.substring(0, path.length() - 1);
   } else if (path.endsWith("^")) {
     searchFolders = false;
     path = path.substring(0, path.length() - 1);
   }
   searchGroups = searchGroups == null ? Boolean.TRUE : searchGroups;
   searchFolders = searchFolders == null ? Boolean.TRUE : searchFolders;
   // TODO: Glob check?
   String globPath = "glob:" + path;
   filter =
       new ContainerFilter(
           PathMatchers.getPathMatcher(globPath, "/"), searchGroups, searchFolders);
 }
예제 #2
0
    public ContainerVisitor(String syntaxAndPattern) {
      boolean searchGroups = true;
      boolean searchFolders = true;

      // TODO: This should do some checks to make sure $ is escaped for a regex
      if (syntaxAndPattern.endsWith("$")) {
        searchGroups = false;
      } else if (syntaxAndPattern.endsWith("^")) {
        searchFolders = false;
      }
      if (!searchFolders || !searchGroups) {
        syntaxAndPattern = syntaxAndPattern.substring(0, syntaxAndPattern.length() - 1);
      }
      filter =
          new ContainerFilter(
              PathMatchers.getPathMatcher(syntaxAndPattern, "/"), searchGroups, searchFolders);
    }