private boolean isIncluded()

in src/main/java/org/apache/sling/scripting/core/impl/jsr223/SlingScriptEngineManager.java [333:372]


    private boolean isIncluded(ScriptEngineFactory sef) {
        boolean include = false;

        if (!this.includePatterns.isEmpty()) {
            List<String> names = sef.getNames();
            for (String name : names) {
                for (Pattern p : this.includePatterns) {
                    if (p.matcher(name).matches()) {
                        include = true;
                        if (logger.isDebugEnabled()) {
                            logger.debug("ScriptEngineFactory \"{}\" matches the include pattern \"{}\" for name \"{}\"", sef.getEngineName(), p.pattern(), name);
                        }
                        break; // found a match so stop looking further
                    }
                }
                if (include) {
                    break; // break out of the outer loop too
                }
            }
        }

        if (include && !this.excludePatterns.isEmpty()) {
            List<String> names = sef.getNames();
            for (String name : names) {
                for (Pattern p : this.excludePatterns) {
                    if (p.matcher(name).matches()) {
                        include = false;
                        if (logger.isDebugEnabled()) {
                            logger.debug("ScriptEngineFactory \"{}\" matches the exclude pattern \"{}\" for name \"{}\" so it is not included", sef.getEngineName(), p.pattern(), name);
                        }
                        break; // found a match so stop looking further
                    }
                }
                if (!include) {
                    break; // break out of the outer loop too
                }
            }
        }
        return include;
    }