bdelacretaz commented on a change in pull request #6:
URL: 
https://github.com/apache/sling-org-apache-sling-scripting-core/pull/6#discussion_r581970224



##########
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:
       I think we need some DEBUG logs in this method, to be able to understand 
why a script engine is included or not




----------------------------------------------------------------
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


Reply via email to