openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject svn commit: r1766250 - in /openwebbeans/microwave/trunk: microwave-core/src/main/java/org/apache/catalina/startup/ microwave-core/src/main/java/org/apache/microwave/ microwave-core/src/main/java/org/apache/microwave/openwebbeans/ microwave-gradle-plugi...
Date Sun, 23 Oct 2016 08:43:01 GMT
Author: rmannibucau
Date: Sun Oct 23 08:43:01 2016
New Revision: 1766250

URL: http://svn.apache.org/viewvc?rev=1766250&view=rev
Log:
svn diff

Modified:
    openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/catalina/startup/MicrowaveContextConfig.java
    openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/microwave/Microwave.java
    openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/microwave/openwebbeans/OWBTomcatWebScannerService.java
    openwebbeans/microwave/trunk/microwave-gradle-plugin/src/main/java/org/apache/microwave/gradle/MicrowaveExtension.java
    openwebbeans/microwave/trunk/microwave-gradle-plugin/src/main/java/org/apache/microwave/gradle/MicrowaveTask.java
    openwebbeans/microwave/trunk/microwave-maven-plugin/src/main/java/org/apache/microwave/maven/MicrowaveRunMojo.java

Modified: openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/catalina/startup/MicrowaveContextConfig.java
URL: http://svn.apache.org/viewvc/openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/catalina/startup/MicrowaveContextConfig.java?rev=1766250&r1=1766249&r2=1766250&view=diff
==============================================================================
--- openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/catalina/startup/MicrowaveContextConfig.java
(original)
+++ openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/catalina/startup/MicrowaveContextConfig.java
Sun Oct 23 08:43:01 2016
@@ -21,11 +21,11 @@ package org.apache.catalina.startup;
 import org.apache.catalina.WebResource;
 import org.apache.microwave.Microwave;
 import org.apache.microwave.logging.tomcat.LogFacade;
+import org.apache.microwave.openwebbeans.OWBTomcatWebScannerService;
 import org.apache.tomcat.util.descriptor.web.WebXml;
 import org.apache.webbeans.config.WebBeansContext;
 import org.apache.webbeans.corespi.scanner.xbean.CdiArchive;
 import org.apache.webbeans.corespi.scanner.xbean.OwbAnnotationFinder;
-import org.apache.webbeans.web.scanner.WebScannerService;
 
 import javax.servlet.ServletContainerInitializer;
 import javax.servlet.annotation.HandlesTypes;
@@ -44,6 +44,8 @@ import java.util.Map;
 import java.util.Set;
 import java.util.stream.Stream;
 
+import static java.util.Optional.ofNullable;
+
 public class MicrowaveContextConfig extends ContextConfig {
     private final Microwave.Builder configuration;
     private final Map<String, Collection<Class<?>>> webClasses = new HashMap<>();
@@ -66,7 +68,8 @@ public class MicrowaveContextConfig exte
         final ClassLoader old = thread.getContextClassLoader();
         thread.setContextClassLoader(loader);
         try {
-            final WebScannerService scannerService = WebScannerService.class.cast(WebBeansContext.getInstance().getScannerService());
+            final OWBTomcatWebScannerService scannerService = OWBTomcatWebScannerService.class.cast(WebBeansContext.getInstance().getScannerService());
+            ofNullable(context.getJarScanner()).ifPresent(s -> scannerService.setFilter(s.getJarScanFilter()));
             scannerService.scan();
             finder = scannerService.getFinder();
             finder.link();

Modified: openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/microwave/Microwave.java
URL: http://svn.apache.org/viewvc/openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/microwave/Microwave.java?rev=1766250&r1=1766249&r2=1766250&view=diff
==============================================================================
--- openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/microwave/Microwave.java
(original)
+++ openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/microwave/Microwave.java
Sun Oct 23 08:43:01 2016
@@ -51,6 +51,7 @@ import org.apache.microwave.tomcat.CDIIn
 import org.apache.microwave.tomcat.OWBJarScanner;
 import org.apache.microwave.tomcat.ProvidedLoader;
 import org.apache.microwave.tomcat.TomcatAutoInitializer;
+import org.apache.tomcat.JarScanFilter;
 import org.apache.tomcat.util.descriptor.web.LoginConfig;
 import org.apache.tomcat.util.descriptor.web.SecurityCollection;
 import org.apache.tomcat.util.descriptor.web.SecurityConstraint;
@@ -173,6 +174,15 @@ public class Microwave implements AutoCl
         } catch (final IOException e) {
             ctx.setDocBase(dir.getAbsolutePath());
         }
+        ofNullable(configuration.tomcatFilter).ifPresent(filter -> {
+            final OWBJarScanner jarScanner = new OWBJarScanner();
+            try {
+                jarScanner.setJarScanFilter(JarScanFilter.class.cast(Thread.currentThread().getContextClassLoader().loadClass(filter).newInstance()));
+            } catch (final ClassNotFoundException | InstantiationException | IllegalAccessException
e) {
+                throw new IllegalArgumentException(e);
+            }
+            ctx.setJarScanner(jarScanner);
+        });
         ctx.addLifecycleListener(new Tomcat.FixContextListener());
         ctx.addLifecycleListener(new MicrowaveContextConfig(configuration));
         ctx.addLifecycleListener(event -> {
@@ -715,10 +725,21 @@ public class Microwave implements AutoCl
         @CliOption(name = "use-shutdown-hook", description = "Use shutdown hook to automatically
stop the container on Ctrl+C")
         private boolean useShutdownHook = true;
 
+        @CliOption(name = "tomcat-filter", description = "A Tomcat JarScanFilter")
+        private String tomcatFilter;
+
         public Builder() { // load defaults
             loadFrom("microwave.properties");
         }
 
+        public String getTomcatFilter() {
+            return tomcatFilter;
+        }
+
+        public void setTomcatFilter(final String tomcatFilter) {
+            this.tomcatFilter = tomcatFilter;
+        }
+
         public boolean isTomcatScanning() {
             return tomcatScanning;
         }

Modified: openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/microwave/openwebbeans/OWBTomcatWebScannerService.java
URL: http://svn.apache.org/viewvc/openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/microwave/openwebbeans/OWBTomcatWebScannerService.java?rev=1766250&r1=1766249&r2=1766250&view=diff
==============================================================================
--- openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/microwave/openwebbeans/OWBTomcatWebScannerService.java
(original)
+++ openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/microwave/openwebbeans/OWBTomcatWebScannerService.java
Sun Oct 23 08:43:01 2016
@@ -38,6 +38,7 @@ public class OWBTomcatWebScannerService
             return;
         }
         super.scan();
+        filter = null;
     }
 
     @Override
@@ -70,4 +71,8 @@ public class OWBTomcatWebScannerService
 
         return filter.check(PLUGGABILITY, path.substring(filenameIdx)) ? -1 : (path.indexOf(".jar")
- 1);
     }
+
+    public void setFilter(final JarScanFilter filter) {
+        this.filter = filter;
+    }
 }

Modified: openwebbeans/microwave/trunk/microwave-gradle-plugin/src/main/java/org/apache/microwave/gradle/MicrowaveExtension.java
URL: http://svn.apache.org/viewvc/openwebbeans/microwave/trunk/microwave-gradle-plugin/src/main/java/org/apache/microwave/gradle/MicrowaveExtension.java?rev=1766250&r1=1766249&r2=1766250&view=diff
==============================================================================
--- openwebbeans/microwave/trunk/microwave-gradle-plugin/src/main/java/org/apache/microwave/gradle/MicrowaveExtension.java
(original)
+++ openwebbeans/microwave/trunk/microwave-gradle-plugin/src/main/java/org/apache/microwave/gradle/MicrowaveExtension.java
Sun Oct 23 08:43:01 2016
@@ -64,6 +64,15 @@ public class MicrowaveExtension {
     private boolean jaxrsProviderSetup = true;
     private boolean loggingGlobalSetup = true;
     private boolean useShutdownHook = true;
+    private String tomcatFilter;
+
+    public String getTomcatFilter() {
+        return tomcatFilter;
+    }
+
+    public void setTomcatFilter(final String tomcatFilter) {
+        this.tomcatFilter = tomcatFilter;
+    }
 
     public boolean isUseShutdownHook() {
         return useShutdownHook;

Modified: openwebbeans/microwave/trunk/microwave-gradle-plugin/src/main/java/org/apache/microwave/gradle/MicrowaveTask.java
URL: http://svn.apache.org/viewvc/openwebbeans/microwave/trunk/microwave-gradle-plugin/src/main/java/org/apache/microwave/gradle/MicrowaveTask.java?rev=1766250&r1=1766249&r2=1766250&view=diff
==============================================================================
--- openwebbeans/microwave/trunk/microwave-gradle-plugin/src/main/java/org/apache/microwave/gradle/MicrowaveTask.java
(original)
+++ openwebbeans/microwave/trunk/microwave-gradle-plugin/src/main/java/org/apache/microwave/gradle/MicrowaveTask.java
Sun Oct 23 08:43:01 2016
@@ -125,6 +125,10 @@ public class MicrowaveTask extends Defau
 
     @Input
     @Optional
+    private String tomcatFilter;
+
+    @Input
+    @Optional
     private String loginConfig;
 
     @Input
@@ -799,4 +803,12 @@ public class MicrowaveTask extends Defau
     public void setUseShutdownHook(final boolean useShutdownHook) {
         this.useShutdownHook = useShutdownHook;
     }
+
+    public String getTomcatFilter() {
+        return tomcatFilter;
+    }
+
+    public void setTomcatFilter(final String tomcatFilter) {
+        this.tomcatFilter = tomcatFilter;
+    }
 }

Modified: openwebbeans/microwave/trunk/microwave-maven-plugin/src/main/java/org/apache/microwave/maven/MicrowaveRunMojo.java
URL: http://svn.apache.org/viewvc/openwebbeans/microwave/trunk/microwave-maven-plugin/src/main/java/org/apache/microwave/maven/MicrowaveRunMojo.java?rev=1766250&r1=1766249&r2=1766250&view=diff
==============================================================================
--- openwebbeans/microwave/trunk/microwave-maven-plugin/src/main/java/org/apache/microwave/maven/MicrowaveRunMojo.java
(original)
+++ openwebbeans/microwave/trunk/microwave-maven-plugin/src/main/java/org/apache/microwave/maven/MicrowaveRunMojo.java
Sun Oct 23 08:43:01 2016
@@ -172,6 +172,9 @@ public class MicrowaveRunMojo extends Ab
     @Parameter(defaultValue = "${project}", readonly = true, required = true)
     private MavenProject project;
 
+    @Parameter(property = "microwave.tomcatFilter")
+    private String tomcatFilter;
+
     @Parameter(property = "microwave.context", defaultValue = "")
     private String context;
 



Mime
View raw message