openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject svn commit: r1836259 - in /openwebbeans/meecrowave/trunk/meecrowave-core: ./ src/main/java/org/apache/meecrowave/cdi/ src/main/java/org/apache/meecrowave/openwebbeans/
Date Thu, 19 Jul 2018 09:14:14 GMT
Author: rmannibucau
Date: Thu Jul 19 09:14:13 2018
New Revision: 1836259

URL: http://svn.apache.org/viewvc?rev=1836259&view=rev
Log:
MEECROWAVE-129 decouple owb-se and owb-web from meecrowave-core

Modified:
    openwebbeans/meecrowave/trunk/meecrowave-core/pom.xml
    openwebbeans/meecrowave/trunk/meecrowave-core/src/main/java/org/apache/meecrowave/cdi/MeecrowaveSeContainerInitializer.java
    openwebbeans/meecrowave/trunk/meecrowave-core/src/main/java/org/apache/meecrowave/openwebbeans/OWBAutoSetup.java
    openwebbeans/meecrowave/trunk/meecrowave-core/src/main/java/org/apache/meecrowave/openwebbeans/OWBTomcatWebScannerService.java

Modified: openwebbeans/meecrowave/trunk/meecrowave-core/pom.xml
URL: http://svn.apache.org/viewvc/openwebbeans/meecrowave/trunk/meecrowave-core/pom.xml?rev=1836259&r1=1836258&r2=1836259&view=diff
==============================================================================
--- openwebbeans/meecrowave/trunk/meecrowave-core/pom.xml (original)
+++ openwebbeans/meecrowave/trunk/meecrowave-core/pom.xml Thu Jul 19 09:14:13 2018
@@ -59,12 +59,13 @@
       <artifactId>xbean-reflect</artifactId>
       <version>${xbean.version}</version>
     </dependency>
-    <dependency>
+    <dependency> <!-- it switches the SPI so don't deliver it if not needed -->
       <groupId>org.apache.openwebbeans</groupId>
       <artifactId>openwebbeans-se</artifactId>
       <version>${openwebbeans.version}</version>
+      <scope>provided</scope>
     </dependency>
-    <dependency>
+    <dependency> <!-- not that if a user adds owb-se this should get excluded -->
       <groupId>org.apache.openwebbeans</groupId>
       <artifactId>openwebbeans-web</artifactId>
       <version>${openwebbeans.version}</version>

Modified: openwebbeans/meecrowave/trunk/meecrowave-core/src/main/java/org/apache/meecrowave/cdi/MeecrowaveSeContainerInitializer.java
URL: http://svn.apache.org/viewvc/openwebbeans/meecrowave/trunk/meecrowave-core/src/main/java/org/apache/meecrowave/cdi/MeecrowaveSeContainerInitializer.java?rev=1836259&r1=1836258&r2=1836259&view=diff
==============================================================================
--- openwebbeans/meecrowave/trunk/meecrowave-core/src/main/java/org/apache/meecrowave/cdi/MeecrowaveSeContainerInitializer.java
(original)
+++ openwebbeans/meecrowave/trunk/meecrowave-core/src/main/java/org/apache/meecrowave/cdi/MeecrowaveSeContainerInitializer.java
Thu Jul 19 09:14:13 2018
@@ -131,6 +131,6 @@ public class MeecrowaveSeContainerInitia
 
     @Override
     protected ScannerService getScannerService() {
-        return new OWBTomcatWebScannerService(scannerService);
+        return new OWBTomcatWebScannerService(scannerService, scannerService::getFinder);
     }
 }

Modified: openwebbeans/meecrowave/trunk/meecrowave-core/src/main/java/org/apache/meecrowave/openwebbeans/OWBAutoSetup.java
URL: http://svn.apache.org/viewvc/openwebbeans/meecrowave/trunk/meecrowave-core/src/main/java/org/apache/meecrowave/openwebbeans/OWBAutoSetup.java?rev=1836259&r1=1836258&r2=1836259&view=diff
==============================================================================
--- openwebbeans/meecrowave/trunk/meecrowave-core/src/main/java/org/apache/meecrowave/openwebbeans/OWBAutoSetup.java
(original)
+++ openwebbeans/meecrowave/trunk/meecrowave-core/src/main/java/org/apache/meecrowave/openwebbeans/OWBAutoSetup.java
Thu Jul 19 09:14:13 2018
@@ -26,13 +26,13 @@ import org.apache.webbeans.configurator.
 import org.apache.webbeans.container.BeanManagerImpl;
 import org.apache.webbeans.intercept.InterceptorsManager;
 import org.apache.webbeans.servlet.WebBeansConfigurationListener;
-import org.apache.webbeans.web.context.WebConversationFilter;
 
 import javax.enterprise.context.ApplicationScoped;
 import javax.enterprise.inject.spi.Bean;
 import javax.enterprise.inject.spi.Extension;
 import javax.enterprise.inject.spi.configurator.BeanConfigurator;
 import javax.servlet.DispatcherType;
+import javax.servlet.Filter;
 import javax.servlet.FilterRegistration;
 import javax.servlet.ServletContainerInitializer;
 import javax.servlet.ServletContext;
@@ -48,8 +48,14 @@ public class OWBAutoSetup implements Ser
         final Meecrowave.Builder builder = Meecrowave.Builder.class.cast(ctx.getAttribute("meecrowave.configuration"));
         final Meecrowave instance = Meecrowave.class.cast(ctx.getAttribute("meecrowave.instance"));
         if (builder.isCdiConversation()) {
-            final FilterRegistration.Dynamic filter = ctx.addFilter("owb-conversation", WebConversationFilter.class);
-            filter.addMappingForUrlPatterns(EnumSet.allOf(DispatcherType.class), false, "/*");
+            try {
+                final Class<? extends Filter> clazz = (Class<? extends Filter>)
OWBAutoSetup.class.getClassLoader()
+                      .loadClass("org.apache.webbeans.web.context.WebConversationFilter");
+                final FilterRegistration.Dynamic filter = ctx.addFilter("owb-conversation",
clazz);
+                filter.addMappingForUrlPatterns(EnumSet.allOf(DispatcherType.class), false,
"/*");
+            } catch (final Exception e) {
+                // no-op
+            }
         }
 
         // eager boot to let injections work in listeners

Modified: openwebbeans/meecrowave/trunk/meecrowave-core/src/main/java/org/apache/meecrowave/openwebbeans/OWBTomcatWebScannerService.java
URL: http://svn.apache.org/viewvc/openwebbeans/meecrowave/trunk/meecrowave-core/src/main/java/org/apache/meecrowave/openwebbeans/OWBTomcatWebScannerService.java?rev=1836259&r1=1836258&r2=1836259&view=diff
==============================================================================
--- openwebbeans/meecrowave/trunk/meecrowave-core/src/main/java/org/apache/meecrowave/openwebbeans/OWBTomcatWebScannerService.java
(original)
+++ openwebbeans/meecrowave/trunk/meecrowave-core/src/main/java/org/apache/meecrowave/openwebbeans/OWBTomcatWebScannerService.java
Thu Jul 19 09:14:13 2018
@@ -20,11 +20,11 @@ package org.apache.meecrowave.openwebbea
 
 import org.apache.meecrowave.Meecrowave;
 import org.apache.meecrowave.logging.tomcat.LogFacade;
-import org.apache.openwebbeans.se.CDISeScannerService;
 import org.apache.tomcat.JarScanFilter;
 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.spi.BdaScannerService;
 import org.apache.webbeans.spi.BeanArchiveService;
 import org.apache.webbeans.util.WebBeansUtil;
 import org.apache.webbeans.web.scanner.WebScannerService;
@@ -44,6 +44,7 @@ import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
 import java.util.function.Consumer;
+import java.util.function.Supplier;
 import java.util.stream.Stream;
 
 import static java.util.Optional.of;
@@ -53,7 +54,8 @@ import static org.apache.tomcat.JarScanT
 
 public class OWBTomcatWebScannerService extends WebScannerService {
     private final LogFacade logger = new LogFacade(OWBTomcatWebScannerService.class.getName());
-    private final CDISeScannerService delegate;
+    private final BdaScannerService delegate;
+    private final Supplier<OwbAnnotationFinder> finderAccessor;
 
     protected JarScanFilter filter;
     private String jreBase;
@@ -65,12 +67,13 @@ public class OWBTomcatWebScannerService
     private Consumer<File> fileVisitor;
 
     public OWBTomcatWebScannerService() {
-        this(null);
+        this(null, null);
     }
 
 
-    public OWBTomcatWebScannerService(final CDISeScannerService delegate) {
+    public OWBTomcatWebScannerService(final BdaScannerService delegate, final Supplier<OwbAnnotationFinder>
finderAccessor) {
         this.delegate = delegate;
+        this.finderAccessor = finderAccessor;
     }
 
     @Override
@@ -82,8 +85,8 @@ public class OWBTomcatWebScannerService
 
     @Override
     public OwbAnnotationFinder getFinder() {
-        if (delegate != null) {
-            return delegate.getFinder();
+        if (finderAccessor != null) {
+            return finderAccessor.get();
         }
         return super.getFinder();
     }



Mime
View raw message