Examples of PathMatcher


Examples of java.nio.file.PathMatcher

        assertFalse(matcher.matches(Paths.get("com/jboss/foo.jar")));
    }

    @Test
    public void testComplete() {
        PathMatcher matcher = Matchers.parse("log:mvn:groupId:org.apache,org.foo and glob:**/*.jar and not **example**");

        assertFalse(matcher.matches(Paths.get("org")));
        assertFalse(matcher.matches(Paths.get("org/apache")));
        assertTrue(matcher.matches(Paths.get("org/apache/foo.jar")));
        assertFalse(matcher.matches(Paths.get("org/foo")));
        assertTrue(matcher.matches(Paths.get("org/foo/foo/bar.jar")));
        assertFalse(matcher.matches(Paths.get("org/foo/foo/bar.xml")));
        assertFalse(matcher.matches(Paths.get("org/foo/example/bar.jar")));
        assertFalse(matcher.matches(Paths.get("io/fabric8")));
        assertFalse(matcher.matches(Paths.get("io/fabric8/foo.jar")));
        assertFalse(matcher.matches(Paths.get("io/fabric8/foo.jar")));
    }
View Full Code Here

Examples of java.nio.file.PathMatcher

public class FilterBuilder {
   
    private FilterBuilder() {}
   
    public static DirectoryStream.Filter<Path> buildGlobFilter(String pattern) {
        final PathMatcher pathMatcher = getPathMatcher("glob:"+pattern);
        return new DirectoryStream.Filter<Path>() {
            @Override
            public boolean accept(Path entry) throws IOException {
                return pathMatcher.matches(entry);
            }
        };
    }
View Full Code Here

Examples of java.nio.file.PathMatcher

            }
        };
    }

    public static DirectoryStream.Filter<Path> buildRegexFilter(String pattern) {
        final PathMatcher pathMatcher = getPathMatcher("regex:"+pattern);
        return new DirectoryStream.Filter<Path>() {
            @Override
            public boolean accept(Path entry) throws IOException {
                return pathMatcher.matches(entry);
            }
        };
    }
View Full Code Here

Examples of org.codehaus.spice.salt.io.PathMatcher

        final String newBaseDirectory = FileUtil.normalize( baseDirectory );
        final String[] newIncludes = prefixPatterns( newBaseDirectory,
                                                     includes );
        final String[] newExcludes = prefixPatterns( newBaseDirectory,
                                                     excludes );
        final PathMatcher matcher = new PathMatcher( newIncludes,
                                                     newExcludes );
        final File[] files = FileUtil.resolveFileSet( base, matcher );
        try
        {
            return FileUtil.toURLs( files );
View Full Code Here

Examples of org.netbeans.spi.project.support.ant.PathMatcher

                            return new URL[]{root};
                        }

                        public boolean includes(URL root, String resource) {
                            if (matcher == null) {
                                matcher = new PathMatcher(
                                        evaluator.getProperty(ProjectProperties.INCLUDES),
                                        evaluator.getProperty(ProjectProperties.EXCLUDES),
                                        new File(URI.create(root.toExternalForm())));
                            }
                            return matcher.matches(resource, true);
View Full Code Here

Examples of org.netbeans.spi.project.support.ant.PathMatcher

                            return new URL[]{root};
                        }

                        public boolean includes(URL root, String resource) {
                            if (matcher == null) {
                                matcher = new PathMatcher(
                                        evaluator.getProperty(ProjectProperties.INCLUDES),
                                        evaluator.getProperty(ProjectProperties.EXCLUDES),
                                        new File(URI.create(root.toExternalForm())));
                            }
                            return matcher.matches(resource, true);
View Full Code Here

Examples of org.springframework.util.PathMatcher

  private boolean isAllowed(String resourcePath) {
    if (resourcePath.matches(PROTECTED_PATH)) {
      return false;
    }
    PathMatcher pathMatcher = new AntPathMatcher();
    for (String pattern : ALLOWED_RESOURCE_PATHS) {
      if (pathMatcher.match(pattern, resourcePath)) {
        return true;
      }
    }
    return false;
  }
View Full Code Here

Examples of org.springframework.util.PathMatcher

  private boolean isAllowed(String resourcePath) {
    if (resourcePath.matches(PROTECTED_PATH)) {
      return false;
    }
    PathMatcher pathMatcher = new AntPathMatcher();
    for (String pattern : allowedResourcePaths) {
      if (pathMatcher.match(pattern, resourcePath)) {
        return true;
      }
    }
    return false;
  }
View Full Code Here

Examples of org.springframework.util.PathMatcher

      return response.getOutputStream();
    }
  }

  private boolean matchesCompressedMimeTypes(String mimeType) {
    PathMatcher pathMatcher = new AntPathMatcher();
    Iterator compressedMimeTypesIt = compressedMimeTypes.iterator();
    while (compressedMimeTypesIt.hasNext()) {
      String compressedMimeType = (String) compressedMimeTypesIt.next();
      if (pathMatcher.match(compressedMimeType, mimeType)) {
        return true;
      }
    }
    return false;
  }
View Full Code Here

Examples of org.springframework.util.PathMatcher

  private boolean isAllowed(String resourcePath) {
    if (resourcePath.matches(protectedPath)) {
      return false;
    }
    PathMatcher pathMatcher = new AntPathMatcher();
    Iterator allowedResourcePathsIt = allowedResourcePaths.iterator();
    while (allowedResourcePathsIt.hasNext()) {
      String pattern = (String) allowedResourcePathsIt.next();
      if (pathMatcher.match(pattern, resourcePath)) {
        return true;
      }
    }
    return false;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.