openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject svn commit: r1780144 - in /openwebbeans/meecrowave/trunk/meecrowave-core/src/main/java/org/apache: catalina/startup/MeecrowaveContextConfig.java meecrowave/Meecrowave.java
Date Wed, 25 Jan 2017 08:20:38 GMT
Author: rmannibucau
Date: Wed Jan 25 08:20:37 2017
New Revision: 1780144

URL: http://svn.apache.org/viewvc?rev=1780144&view=rev
Log:
MEECROWAVE-10 no need of that classpath/fake folder

Modified:
    openwebbeans/meecrowave/trunk/meecrowave-core/src/main/java/org/apache/catalina/startup/MeecrowaveContextConfig.java
    openwebbeans/meecrowave/trunk/meecrowave-core/src/main/java/org/apache/meecrowave/Meecrowave.java

Modified: openwebbeans/meecrowave/trunk/meecrowave-core/src/main/java/org/apache/catalina/startup/MeecrowaveContextConfig.java
URL: http://svn.apache.org/viewvc/openwebbeans/meecrowave/trunk/meecrowave-core/src/main/java/org/apache/catalina/startup/MeecrowaveContextConfig.java?rev=1780144&r1=1780143&r2=1780144&view=diff
==============================================================================
--- openwebbeans/meecrowave/trunk/meecrowave-core/src/main/java/org/apache/catalina/startup/MeecrowaveContextConfig.java
(original)
+++ openwebbeans/meecrowave/trunk/meecrowave-core/src/main/java/org/apache/catalina/startup/MeecrowaveContextConfig.java
Wed Jan 25 08:20:37 2017
@@ -55,10 +55,20 @@ public class MeecrowaveContextConfig ext
 
     private final Meecrowave.Builder configuration;
     private final Map<String, Collection<Class<?>>> webClasses = new HashMap<>();
+    private final boolean fixDocBase;
     private OwbAnnotationFinder finder;
 
-    public MeecrowaveContextConfig(final Meecrowave.Builder configuration) {
+    public MeecrowaveContextConfig(final Meecrowave.Builder configuration, final boolean
fixDocBase) {
         this.configuration = configuration;
+        this.fixDocBase = fixDocBase;
+    }
+
+    @Override
+    protected void fixDocBase() throws IOException {
+        if (!fixDocBase) {
+            return;
+        }
+        super.fixDocBase();
     }
 
     @Override

Modified: openwebbeans/meecrowave/trunk/meecrowave-core/src/main/java/org/apache/meecrowave/Meecrowave.java
URL: http://svn.apache.org/viewvc/openwebbeans/meecrowave/trunk/meecrowave-core/src/main/java/org/apache/meecrowave/Meecrowave.java?rev=1780144&r1=1780143&r2=1780144&view=diff
==============================================================================
--- openwebbeans/meecrowave/trunk/meecrowave-core/src/main/java/org/apache/meecrowave/Meecrowave.java
(original)
+++ openwebbeans/meecrowave/trunk/meecrowave-core/src/main/java/org/apache/meecrowave/Meecrowave.java
Wed Jan 25 08:20:37 2017
@@ -199,11 +199,7 @@ public class Meecrowave implements AutoC
         new LogFacade(Meecrowave.class.getName()).info("--------------- " + base + meta.context);
 
 
-        final File dir = ofNullable(meta.docBase).orElseGet(() -> {
-            final File d = new File(ownedTempDir, "classpath/fake-" + meta.context.replace("/",
""));
-            IO.mkdirs(d);
-            return d;
-        });
+        final File dir = ofNullable(meta.docBase).orElse(null);
 
         final OWBJarScanner scanner = new OWBJarScanner();
         final StandardContext ctx = new StandardContext();
@@ -211,11 +207,13 @@ public class Meecrowave implements AutoC
         ctx.setName(meta.context);
         ctx.setJarScanner(scanner);
         ctx.setInstanceManager(new CDIInstanceManager());
-        try {
-            ctx.setDocBase(dir.getCanonicalPath());
-        } catch (final IOException e) {
-            ctx.setDocBase(dir.getAbsolutePath());
-        }
+        ofNullable(dir).ifPresent(d -> {
+            try {
+                ctx.setDocBase(d.getCanonicalPath());
+            } catch (final IOException e) {
+                ctx.setDocBase(d.getAbsolutePath());
+            }
+        });
         ofNullable(configuration.tomcatFilter).ifPresent(filter -> {
             try {
                 scanner.setJarScanFilter(JarScanFilter.class.cast(Thread.currentThread().getContextClassLoader().loadClass(filter).newInstance()));
@@ -223,7 +221,7 @@ public class Meecrowave implements AutoC
                 throw new IllegalArgumentException(e);
             }
         });
-        ctx.addLifecycleListener(new MeecrowaveContextConfig(configuration));
+        ctx.addLifecycleListener(new MeecrowaveContextConfig(configuration, dir != null));
         ctx.addLifecycleListener(event -> {
             switch (event.getType()) {
                 case Lifecycle.AFTER_START_EVENT:
@@ -316,7 +314,7 @@ public class Meecrowave implements AutoC
             try {
                 tomcat.getHost().removeChild(ctx);
             } finally {
-                if (dir != meta.docBase) {
+                if (dir != null && dir != meta.docBase) {
                     IO.delete(dir);
                 }
             }



Mime
View raw message