Java Code Examples for org.codehaus.plexus.util.SelectorUtils

The following examples show how to use org.codehaus.plexus.util.SelectorUtils. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
public boolean matchPattern(IPath base, String pattern, String path) {
	String glob = ProjectUtils.resolveGlobPath(base, pattern).toOSString();
	if (base.getDevice() != null) {
		return SelectorUtils.matchPath(glob, path, false); // Case insensitive match in Windows
	} else {
		return SelectorUtils.matchPath(glob, path); // Case sensitive match in *nix
	}
}
 
Example 2
Source Project: sundrio   Source File: ArtifactRuleFilter.java    License: Apache License 2.0 5 votes vote down vote up
static boolean matches(Artifact artifact, Set<String> set) {
    Set<String> expanded = expand(set);
    String coords = String.format(ARTIFACT_FORMAT, artifact.getGroupId(),
            artifact.getArtifactId(),
            artifact.getVersion(),
            artifact.getType(),
            artifact.getClassifier());

    for (String e : expanded) {
        if (SelectorUtils.match(e, coords)) {
            return true;
        }
    }
    return false;
}
 
Example 3
Source Project: rice   Source File: ThemeBuilderUtils.java    License: Educational Community License v2.0 5 votes vote down vote up
/**
 * Determines if one of the given patterns matches the given name, or if the include list is null
 * or empty the file will be included
 *
 * @param name string to match
 * @param includes list of string patterns to match on
 * @return true if the name is a match, false if not
 */
public static boolean inIncludeList(String name, String[] includes) {
    if ((includes == null) || (includes.length == 0)) {
        return true;
    }

    for (String include : includes) {
        if (SelectorUtils.matchPath(include, name, false)) {
            return true;
        }
    }

    return false;
}
 
Example 4
Source Project: rice   Source File: ThemeBuilderUtils.java    License: Educational Community License v2.0 5 votes vote down vote up
/**
 * Determines if one of the given patterns matches the given name, or if the exclude list is null
 * or empty the file will not be excluded
 *
 * @param name string to match
 * @param excludes list of string patterns to match on
 * @return true if the name is a match, false if not
 */
public static boolean inExcludeList(String name, String[] excludes) {
    if ((excludes == null) || (excludes.length == 0)) {
        return false;
    }

    for (String exclude : excludes) {
        if (SelectorUtils.matchPath(exclude, name, false)) {
            return true;
        }
    }

    return false;
}