You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ad...@apache.org on 2011/03/03 06:21:21 UTC

svn commit: r1076529 - /ofbiz/trunk/framework/base/src/org/ofbiz/base/container/ContainerLoader.java

Author: adrianc
Date: Thu Mar  3 05:21:20 2011
New Revision: 1076529

URL: http://svn.apache.org/viewvc?rev=1076529&view=rev
Log:
Implemented a new feature: hot-deploy components can load containers. Just put the hot-deploy-containers.xml file in your component's config folder (or anywhere on the classpath) and it will used. The xml file's schema is the same as framework/base/config/ofbiz-containers.xml.

Modified:
    ofbiz/trunk/framework/base/src/org/ofbiz/base/container/ContainerLoader.java

Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/container/ContainerLoader.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/container/ContainerLoader.java?rev=1076529&r1=1076528&r2=1076529&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/container/ContainerLoader.java (original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/container/ContainerLoader.java Thu Mar  3 05:21:20 2011
@@ -20,7 +20,9 @@ package org.ofbiz.base.container;
 
 import java.io.PrintWriter;
 import java.io.StringWriter;
+import java.net.URL;
 import java.util.Collection;
+import java.util.Enumeration;
 import java.util.LinkedList;
 import java.util.List;
 
@@ -86,6 +88,23 @@ public class ContainerLoader implements 
                 }
             }
         }
+        // Get hot-deploy container configuration files
+        ClassLoader loader = Thread.currentThread().getContextClassLoader();
+        Enumeration<URL> resources;
+        try {
+            resources = loader.getResources("hot-deploy-containers.xml");
+            while (resources.hasMoreElements()) {
+                URL xmlUrl = resources.nextElement();
+                Debug.logInfo("Loading hot-deploy containers from " + xmlUrl, module);
+                Collection<ContainerConfig.Container> hotDeployContainers = ContainerConfig.getContainers(xmlUrl);
+                for (ContainerConfig.Container containerCfg : hotDeployContainers) {
+                    loadedContainers.add(loadContainer(containerCfg, args));
+                }
+            }
+        } catch (Exception e) {
+            Debug.logError(e, "Could not load hot-deploy-containers.xml", module);
+            throw new StartupException(e);
+        }
     }
 
     /**