openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r1841476 - /openwebbeans/meecrowave/trunk/meecrowave-core/src/main/java/org/apache/meecrowave/Meecrowave.java
Date Thu, 20 Sep 2018 13:45:54 GMT
Author: struberg
Date: Thu Sep 20 13:45:54 2018
New Revision: 1841476

URL: http://svn.apache.org/viewvc?rev=1841476&view=rev
Log:
MEECROWAVE-130 make webapps directory optional

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

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=1841476&r1=1841475&r2=1841476&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
Thu Sep 20 13:45:54 2018
@@ -63,6 +63,7 @@ import java.util.concurrent.atomic.Atomi
 import java.util.function.BiPredicate;
 import java.util.function.Consumer;
 import java.util.function.Function;
+import java.util.logging.Logger;
 import java.util.stream.Stream;
 import java.util.stream.StreamSupport;
 
@@ -141,6 +142,7 @@ public class Meecrowave implements AutoC
     protected ConfigurableBus clientBus;
     protected File base;
     protected final File ownedTempDir;
+    protected File workDir;
     protected InternalTomcat tomcat;
     protected volatile Thread hook;
 
@@ -466,18 +468,25 @@ public class Meecrowave implements AutoC
             final File conf = createDirectory(base, "conf");
             createDirectory(base, "lib");
             createDirectory(base, "logs");
-            createDirectory(base, "work");
-            createDirectory(base, "webapps");
 
+            // create the temp dir folder.
+            File tempDir;
             if (configuration.getTempDir() == null || configuration.getTempDir().length()
== 0) {
-                createDirectory(base, "temp");
+                tempDir = createDirectory(base, "temp");
             } else {
-                File tempDir = new File(configuration.getTempDir());
+                tempDir = new File(configuration.getTempDir());
                 if (!tempDir.exists()) {
                     tempDir.mkdirs();
                 }
             }
 
+            try {
+                workDir = createDirectory(base, "work");
+            } catch (IllegalStateException ise) {
+                // in case we could not create that directory we create it in the temp dir
folder
+                workDir = createDirectory(tempDir, "work");
+            }
+
             synchronize(conf, configuration.conf);
         }
 
@@ -498,7 +507,6 @@ public class Meecrowave implements AutoC
         }
 
         final File conf = new File(base, "conf");
-        final File webapps = new File(base, "webapps");
 
         tomcat.setBaseDir(base.getAbsolutePath());
         tomcat.setHostname(configuration.host);
@@ -573,12 +581,20 @@ public class Meecrowave implements AutoC
             tomcat.getEngine().setDefaultHost(configuration.host);
             final StandardHost host = new StandardHost();
             host.setName(configuration.host);
-            host.setAppBase(webapps.getAbsolutePath());
+
+            try {
+                final File webapps = createDirectory(base, "webapps");
+                host.setAppBase(webapps.getAbsolutePath());
+            } catch (IllegalStateException ise) {
+                Logger.getLogger(this.getClass().getName()).info("Could not create Tomcat
AppBase directory (webapps) in " +
+                    new File(base, "webapps").getAbsolutePath() + " . This is only a problem
if you deploy WARs!");
+            }
+
             host.setUnpackWARs(true); // forced for now cause OWB doesn't support war:file://
urls
             try {
-                host.setWorkDir(new File(base, "work").getCanonicalPath());
+                host.setWorkDir(workDir.getCanonicalPath());
             } catch (final IOException e) {
-                host.setWorkDir(new File(base, "work").getAbsolutePath());
+                host.setWorkDir(workDir.getAbsolutePath());
             }
             tomcat.setHost(host);
         }
@@ -1919,6 +1935,7 @@ public class Meecrowave implements AutoC
         public String getConf() {
             return conf;
         }
+
         public void setConf(final String conf) {
             this.conf = conf;
         }



Mime
View raw message