Java Code Examples for org.apache.tomcat.util.file.Matcher

The following examples show how to use org.apache.tomcat.util.file.Matcher. 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
Source Project: Tomcat8-Source-Read   Source File: StandardJarScanFilter.java    License: MIT License 4 votes vote down vote up
@Override
public boolean check(JarScanType jarScanType, String jarName) {
    Lock readLock = configurationLock.readLock();
    readLock.lock();
    try {
        final boolean defaultScan;
        final Set<String> toSkip;
        final Set<String> toScan;
        switch (jarScanType) {
            case TLD: {
                defaultScan = defaultTldScan;
                toSkip = tldSkipSet;
                toScan = tldScanSet;
                break;
            }
            case PLUGGABILITY: {
                defaultScan = defaultPluggabilityScan;
                toSkip = pluggabilitySkipSet;
                toScan = pluggabilityScanSet;
                break;
            }
            case OTHER:
            default: {
                defaultScan = true;
                toSkip = defaultSkipSet;
                toScan = defaultScanSet;
            }
        }
        if (defaultScan) {
            if (Matcher.matchName(toSkip, jarName)) {
                if (Matcher.matchName(toScan, jarName)) {
                    return true;
                } else {
                    return false;
                }
            }
            return true;
        } else {
            if (Matcher.matchName(toScan, jarName)) {
                if (Matcher.matchName(toSkip, jarName)) {
                    return false;
                } else {
                    return true;
                }
            }
            return false;
        }
    } finally {
        readLock.unlock();
    }
}
 
Example 2
Source Project: tomee   Source File: TomcatLoader.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public boolean accept(final String name) {
    return Matcher.matchName(entries, name);
}