tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject svn commit: r1296179 - /openejb/trunk/openejb/server/openejb-server/src/main/java/org/apache/openejb/server/ServiceManager.java
Date Fri, 02 Mar 2012 12:55:36 GMT
Author: rmannibucau
Date: Fri Mar  2 12:55:36 2012
New Revision: 1296179

URL: http://svn.apache.org/viewvc?rev=1296179&view=rev
Log:
OPENEJB-1791 managing conf.d folder for services

Modified:
    openejb/trunk/openejb/server/openejb-server/src/main/java/org/apache/openejb/server/ServiceManager.java

Modified: openejb/trunk/openejb/server/openejb-server/src/main/java/org/apache/openejb/server/ServiceManager.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/server/openejb-server/src/main/java/org/apache/openejb/server/ServiceManager.java?rev=1296179&r1=1296178&r2=1296179&view=diff
==============================================================================
--- openejb/trunk/openejb/server/openejb-server/src/main/java/org/apache/openejb/server/ServiceManager.java
(original)
+++ openejb/trunk/openejb/server/openejb-server/src/main/java/org/apache/openejb/server/ServiceManager.java
Fri Mar  2 12:55:36 2012
@@ -16,15 +16,6 @@
  */
 package org.apache.openejb.server;
 
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-
 import org.apache.openejb.EnvProps;
 import org.apache.openejb.assembler.classic.OpenEjbConfiguration;
 import org.apache.openejb.assembler.classic.ServiceInfo;
@@ -36,6 +27,14 @@ import org.apache.openejb.util.Logger;
 import org.apache.xbean.recipe.ObjectRecipe;
 import org.apache.xbean.recipe.Option;
 
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
 /**
  * @version $Rev$ $Date$
  * @org.apache.xbean.XBean element="serviceManager"
@@ -169,17 +168,26 @@ public abstract class ServiceManager {
         final File conf = base.getDirectory("conf");
         if (conf.exists()) {
             File serviceConfig = new File(conf, serviceName + ".properties");
+            if (!serviceConfig.exists()) {
+                serviceConfig = new File(conf, "conf.d/" + serviceConfig.getName()); // name
was already built so use it
+            }
             if (serviceConfig.exists()) {
                 IO.readProperties(serviceConfig, serviceProperties);
             } else {
+                final File confD = serviceConfig.getParentFile();
+                if (!confD.exists() && !confD.mkdirs()) {
+                    logger.warning("can't create " + serviceConfig.getPath());
+                }
 
-                if (EnvProps.extractConfigurationFiles()){
+                if (confD.exists()) {
+                    if (EnvProps.extractConfigurationFiles()) {
 
-                    final String rawPropsContent = (String) serviceProperties.get(Properties.class);
-                    IO.copy(IO.read(rawPropsContent), serviceConfig);
+                        final String rawPropsContent = (String) serviceProperties.get(Properties.class);
+                        IO.copy(IO.read(rawPropsContent), serviceConfig);
 
-                } else {
-                    serviceProperties.put("disabled", "true");
+                    } else {
+                        serviceProperties.put("disabled", "true");
+                    }
                 }
             }
         }



Mime
View raw message