当前位置: 首页>>代码示例>>Java>>正文


Java SelectorUtils.matchPath方法代码示例

本文整理汇总了Java中org.apache.tools.ant.types.selectors.SelectorUtils.matchPath方法的典型用法代码示例。如果您正苦于以下问题:Java SelectorUtils.matchPath方法的具体用法?Java SelectorUtils.matchPath怎么用?Java SelectorUtils.matchPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.tools.ant.types.selectors.SelectorUtils的用法示例。


在下文中一共展示了SelectorUtils.matchPath方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: findStrayThirdPartyBinaries

import org.apache.tools.ant.types.selectors.SelectorUtils; //导入方法依赖的package包/类
private void findStrayThirdPartyBinaries(File dir, String prefix, Set<String> violations, List<String> ignoredPatterns) throws IOException {
    for (String n : findHgControlledFiles(dir)) {
        File f = new File(dir, n);
        if (f.isDirectory()) {
            findStrayThirdPartyBinaries(f, prefix + n + "/", violations, ignoredPatterns);
        } else if (n.matches(".*\\.(jar|zip)")) {
            String path = prefix + n;
            boolean ignored = false;
            for (String pattern : ignoredPatterns) {
                if (SelectorUtils.matchPath(pattern, path)) {
                    ignored = true;
                    break;
                }
            }
            if (!ignored && dir.getName().equals("external") &&
                    new File(new File(dir.getParentFile(), "nbproject"), "project.xml").isFile()) {
                ignored = true;
            }
            if (!ignored) {
                violations.add(path);
            } else {
                //System.err.println("accepted: " + path);
            }
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:VerifyLibsAndLicenses.java

示例2: scanForExtraFiles

import org.apache.tools.ant.types.selectors.SelectorUtils; //导入方法依赖的package包/类
private void scanForExtraFiles(File d, String prefix, Set<String> files, String cluster, StringBuilder extraFiles) {
    if (prefix.equals("update_tracking/")) {
        return;
    }
    for (String n : d.list()) {
        File f = new File(d, n);
        if (f.getName().equals(".lastModified")) {
            continue;
        }
        if (f.isDirectory()) {
            scanForExtraFiles(f, prefix + n + "/", files, cluster, extraFiles);
        } else {
            String path = prefix + n;
            if ( patterns != null )
                for( String p: patterns.getExcludePatterns(getProject()) ) 
                    if (SelectorUtils.matchPath(p, path)) return;
                
            if (!files.contains(path)) {
                extraFiles.append("\n" + cluster + ": untracked file " + path);
                f.delete();
            }
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:DeleteUnreferencedClusterFiles.java

示例3: matchesArtifactPattern

import org.apache.tools.ant.types.selectors.SelectorUtils; //导入方法依赖的package包/类
public synchronized boolean matchesArtifactPattern( String relativePath )
{
    // Correct the slash pattern.
    relativePath = relativePath.replace( '\\', '/' );

    if ( artifactPatterns == null )
    {
        artifactPatterns = getFileTypePatterns( ARTIFACTS );
    }

    for ( String pattern : artifactPatterns )
    {
        if ( SelectorUtils.matchPath( pattern, relativePath, false ) )
        {
            // Found match
            return true;
        }
    }

    // No match.
    return false;
}
 
开发者ID:ruikom,项目名称:apache-archiva,代码行数:23,代码来源:FileTypes.java

示例4: matchesDefaultExclusions

import org.apache.tools.ant.types.selectors.SelectorUtils; //导入方法依赖的package包/类
public boolean matchesDefaultExclusions( String relativePath )
{
    // Correct the slash pattern.
    relativePath = relativePath.replace( '\\', '/' );

    for ( String pattern : DEFAULT_EXCLUSIONS )
    {
        if ( SelectorUtils.matchPath( pattern, relativePath, false ) )
        {
            // Found match
            return true;
        }
    }

    // No match.
    return false;
}
 
开发者ID:ruikom,项目名称:apache-archiva,代码行数:18,代码来源:FileTypes.java

示例5: excluded

import org.apache.tools.ant.types.selectors.SelectorUtils; //导入方法依赖的package包/类
private boolean excluded(File f, String prefix) { // #68929
    String pathAbs = f.getAbsolutePath();
    if (!pathAbs.startsWith(prefix)) {
        throw new BuildException("Examined file " + f + " should have a path starting with " + prefix, getLocation());
    }
    // Cannot just call matchPath on the pathAbs because a relative pattern will *never* match an absolute path!
    String path = pathAbs.substring(prefix.length());
    for (String exclude : DirectoryScanner.getDefaultExcludes()) {
        if (SelectorUtils.matchPath(exclude.replace('/', File.separatorChar), path)) {
            return true;
        }
    }
    return false;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:Branding.java

示例6: matchesPattern

import org.apache.tools.ant.types.selectors.SelectorUtils; //导入方法依赖的package包/类
/**
 * Tests whitelist and blacklist patterns against path.
 *
 * @param path     the path to test.
 * @param patterns the list of patterns to check.
 * @return true if the path matches at least 1 pattern in the provided patterns list.
 */
private boolean matchesPattern( String path, List<String> patterns )
{
    if ( CollectionUtils.isEmpty( patterns ) )
    {
        return false;
    }

    if ( !path.startsWith( "/" ) )
    {
        path = "/" + path;
    }

    for ( String pattern : patterns )
    {
        if ( !pattern.startsWith( "/" ) )
        {
            pattern = "/" + pattern;
        }

        if ( SelectorUtils.matchPath( pattern, path, false ) )
        {
            return true;
        }
    }

    return false;
}
 
开发者ID:ruikom,项目名称:apache-archiva,代码行数:35,代码来源:DefaultRepositoryProxyConnectors.java

示例7: isCandidate

import org.apache.tools.ant.types.selectors.SelectorUtils; //导入方法依赖的package包/类
/**
 * flow:
 *
 * 0. no match for extension -> return false
 * 1. no include, no exclude -> don't filter. return true
 * 2. no include, yes exclude -> return isExcludeMatch(file) ? false : true
 * 3. yes include, no exclude -> return isIncludeMatch(file) ?  true : false
 *
 * 4. yes include, yes exclude ->
 *  if(isExcludeMatch(file)) {
 *    return false
 *  }
 *
 *  return isIncludeMatch(file))
 *
 * @param relativePath
 * @return
 */
private boolean isCandidate(String relativePath, String[] extensions, List<String> includeFilter, List<String> excludeFilter) {
    relativePath = relativePath.replaceAll("\\\\", "/");
    boolean isMatch = true;

    if(!isExtension(relativePath, extensions)) {
        return false;
    }

    if(excludeFilter != null) {
        for (String exclusion : excludeFilter) {
            if(SelectorUtils.matchPath(exclusion, relativePath, false)) {
                return false;
            }
        }
    }

    if(includeFilter.size() > 0) {
        for (String inclusion : includeFilter) {
            if(SelectorUtils.matchPath(inclusion, relativePath, false)) {
                return true;
            }
        }
        isMatch = false;
    }

    return isMatch;
}
 
开发者ID:jenkinsci,项目名称:checkmarx-plugin,代码行数:46,代码来源:OSAScanner.java

示例8: match

import org.apache.tools.ant.types.selectors.SelectorUtils; //导入方法依赖的package包/类
/**
 * Convert the paths into absolute normalized paths and match or test for prefix equality.
 * 
 * @param pattern the path representing the pattern
 * @param path the path to be matched
 * @param prefix do a prefix check of <code>pattern</code> in <code>path</code> or match
 *   <code>pattern</code> as ANT pattern in <code>path</code>
 * @return <code>true</code> if <code>path</code> matches <code>pattern</code>, <code>false</code> else
 */
private static boolean match(Path pattern, Path path, boolean prefix) {
    boolean result;
    // just use the ANT stuff / prefix but use the absolute paths
    String sPattern = PathUtils.normalize(pattern.getAbsolutePath().getAbsolutePath());
    String sPath = PathUtils.normalize(path.getAbsolutePath().getAbsolutePath());
    if (prefix) {
        result = sPath.startsWith(sPattern);
    } else {
        result = SelectorUtils.matchPath(sPattern, sPath); 
    }
    return result;
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:22,代码来源:Path.java

示例9: matches

import org.apache.tools.ant.types.selectors.SelectorUtils; //导入方法依赖的package包/类
private boolean matches(List<String> patterns, String candidate) {
    for (String pattern : patterns) {
        if (SelectorUtils.matchPath(pattern, candidate)) {
            return true;
        }
    }
    return false;
}
 
开发者ID:spring-projects,项目名称:aws-ant,代码行数:9,代码来源:S3Scanner.java

示例10: matchPath

import org.apache.tools.ant.types.selectors.SelectorUtils; //导入方法依赖的package包/类
/**
 * Tests whether or not a given path matches a given pattern.
 *
 * @param pattern The pattern to match against. Must not be
 *                <code>null</code>.
 * @param str     The path to match, as a String. Must not be
 *                <code>null</code>.
 *
 * @return <code>true</code> if the pattern matches against the string,
 *         or <code>false</code> otherwise.
 */
protected static boolean matchPath( String pattern, String str ) {
    return SelectorUtils.matchPath( pattern, str );
}
 
开发者ID:subclipse,项目名称:svnant,代码行数:15,代码来源:SvnDirScanner.java

示例11: matchPath

import org.apache.tools.ant.types.selectors.SelectorUtils; //导入方法依赖的package包/类
/**
 * Test whether or not a given path matches a given pattern.
 *
 * @param pattern The pattern to match against. Must not be
 *                <code>null</code>.
 * @param str     The path to match, as a String. Must not be
 *                <code>null</code>.
 *
 * @return <code>true</code> if the pattern matches against the string,
 *         or <code>false</code> otherwise.
 */
protected static boolean matchPath(final String pattern, final String str) {
    return SelectorUtils.matchPath(pattern, str);
}
 
开发者ID:apache,项目名称:ant,代码行数:15,代码来源:DirectoryScanner.java

示例12: matchPath

import org.apache.tools.ant.types.selectors.SelectorUtils; //导入方法依赖的package包/类
/**
 * Tests whether or not a given path matches a given pattern.
 *
 * @param pattern The pattern to match against. Must not be
 *                <code>null</code>.
 * @param str     The path to match, as a String. Must not be
 *                <code>null</code>.
 *
 * @return <code>true</code> if the pattern matches against the string,
 *         or <code>false</code> otherwise.
 */
protected static boolean matchPath(String pattern, String str) {
    return SelectorUtils.matchPath(pattern, str);
}
 
开发者ID:evlist,项目名称:orbeon-forms,代码行数:15,代码来源:DirectoryScanner.java


注:本文中的org.apache.tools.ant.types.selectors.SelectorUtils.matchPath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。