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

The following examples show how to use org.apache.tomcat.util.file.Matcher. 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 File: StandardJarScanFilter.java    From Tomcat8-Source-Read with 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 File: TomcatLoader.java    From tomee with Apache License 2.0 4 votes vote down vote up
@Override
public boolean accept(final String name) {
    return Matcher.matchName(entries, name);
}