bdelacretaz commented on a change in pull request #6: URL: https://github.com/apache/sling-org-apache-sling-scripting-core/pull/6#discussion_r582327166
########## File path: src/main/java/org/apache/sling/scripting/core/impl/jsr223/SlingScriptEngineManager.java ########## @@ -237,17 +273,79 @@ public void bundleChanged(BundleEvent event) { } @Activate - private void activate(final BundleContext bundleContext) { + private void activate(final Config config, final BundleContext bundleContext) { + String[] includes = config.includes(); + if (includes == null) { + this.includePatterns = Collections.emptySet(); + } else { + this.includePatterns = new HashSet<>(); + for (String pattern : includes) { + if (!pattern.isEmpty()) { + Pattern p = Pattern.compile(pattern); + includePatterns.add(p); + } + } + } + + String[] excludes = config.excludes(); + if (excludes == null) { + this.excludePatterns = Collections.emptySet(); + } else { + this.excludePatterns = new HashSet<>(); + for (String pattern : excludes) { + if (!pattern.isEmpty()) { + Pattern p = Pattern.compile(pattern); + excludePatterns.add(p); + } + } + } + this.bundleContext = bundleContext; bundleContext.addBundleListener(this); updateFactories(); } + /** + * Check if the given factory matches any of the include/excludes patterns + * + * @param sef the factory to check + * @return true if included, false otherwise + */ + private boolean isIncluded(ScriptEngineFactory sef) { Review comment: Maybe log which pattern matches? Sorry to be picky... Many hours lost to regexp issues over time :-) ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org