diff --git a/framework/base/config/ofbiz-containers.xml b/framework/base/config/ofbiz-containers.xml deleted file mode 100644 index 726fadc201..0000000000 --- a/framework/base/config/ofbiz-containers.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - diff --git a/framework/base/dtd/ofbiz-containers.xsd b/framework/base/dtd/ofbiz-containers.xsd deleted file mode 100644 index 956b45883a..0000000000 --- a/framework/base/dtd/ofbiz-containers.xsd +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/container/Container.java b/framework/base/src/main/java/org/apache/ofbiz/base/container/Container.java index baa9eeddcc..39f654ac0d 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/container/Container.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/container/Container.java @@ -45,12 +45,14 @@ public interface Container { * * @param ofbizCommands Command-line arguments. * @param name Unique name of the container's instance. - * @param configFile Location of the configuration file used to load this container. + * @param configFile always {@code null} but used to be the location of the global + * container configuration file which does not exist anymore * @throws ContainerException If an error was encountered. Throwing this exception * will halt container loading, so it should be thrown only when other containers * might depend on this one. */ - public void init(List ofbizCommands, String name, String configFile) throws ContainerException; + void init(List ofbizCommands, String name, String configFile) + throws ContainerException; /** * Start the container process. This method must not block - implementations diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/container/ContainerLoader.java b/framework/base/src/main/java/org/apache/ofbiz/base/container/ContainerLoader.java index 43efda53b1..79c805b715 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/container/ContainerLoader.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/container/ContainerLoader.java @@ -66,14 +66,17 @@ public class ContainerLoader { // loaders defined in startup (e.g. main, test, load-data, etc ...) List loaders = config.loaders; - // load containers defined in ofbiz-containers.xml - Debug.logInfo("[Startup] Loading containers...", module); - List ofbizContainerConfigs = filterContainersHavingMatchingLoaders( - loaders, retrieveOfbizContainers(config.containerConfig)); - loadedContainers.addAll(loadContainersFromConfigurations(ofbizContainerConfigs, config, ofbizCommands)); + // Load mandatory container providing access to containers from components. + try { + ComponentContainer cc = new ComponentContainer(); + cc.init(ofbizCommands, "component-container", null); + loadedContainers.add(cc); + } catch (ContainerException e) { + throw new StartupException("Cannot init() component-container", e); + } - // load containers defined in components - Debug.logInfo("[Startup] Loading component containers...", module); + // Load containers defined in components. + Debug.logInfo("[Startup] Loading containers...", module); List componentContainerConfigs = filterContainersHavingMatchingLoaders( loaders, ComponentConfig.getAllConfigurations()); loadedContainers.addAll(loadContainersFromConfigurations(componentContainerConfigs, config, ofbizCommands)); @@ -82,15 +85,6 @@ public class ContainerLoader { startLoadedContainers(); } - private static Collection retrieveOfbizContainers(String configFile) - throws StartupException { - try { - return ContainerConfig.getConfigurations(configFile); - } catch (ContainerException e) { - throw new StartupException(e); - } - } - private static List filterContainersHavingMatchingLoaders(List loaders, Collection containerConfigs) { return containerConfigs.stream() @@ -116,15 +110,16 @@ public class ContainerLoader { List loadContainers = new ArrayList<>(); for (ContainerConfig.Configuration containerCfg : containerConfigs) { Debug.logInfo("Loading container: " + containerCfg.name, module); - Container tmpContainer = loadContainer(config.containerConfig, containerCfg, ofbizCommands); + Container tmpContainer = loadContainer(containerCfg, ofbizCommands); loadContainers.add(tmpContainer); Debug.logInfo("Loaded container: " + containerCfg.name, module); } return loadContainers; } - private static Container loadContainer(String configFile, ContainerConfig.Configuration containerCfg, - List ofbizCommands) throws StartupException { + + private static Container loadContainer(ContainerConfig.Configuration containerCfg, List ofbizCommands) + throws StartupException { // load the container class ClassLoader loader = Thread.currentThread().getContextClassLoader(); Class containerClass; @@ -150,7 +145,7 @@ public class ContainerLoader { // initialize the container object try { - containerObj.init(ofbizCommands, containerCfg.name, configFile); + containerObj.init(ofbizCommands, containerCfg.name, null); } catch (ContainerException e) { throw new StartupException("Cannot init() " + containerCfg.name, e); } diff --git a/framework/start/src/main/java/org/apache/ofbiz/base/start/Config.java b/framework/start/src/main/java/org/apache/ofbiz/base/start/Config.java index 47ac95b985..15c3730f4b 100644 --- a/framework/start/src/main/java/org/apache/ofbiz/base/start/Config.java +++ b/framework/start/src/main/java/org/apache/ofbiz/base/start/Config.java @@ -40,7 +40,6 @@ public final class Config { public final String adminKey; public final int portOffset; public final int adminPort; - public final String containerConfig; public final List loaders; public final String logDir; public final boolean shutdownAfterLoad; @@ -57,8 +56,6 @@ public final class Config { adminKey = getProperty(props, "ofbiz.admin.key", "NA"); portOffset = getPortOffsetValue(ofbizCommands, "0"); adminPort = getAdminPort(props, 0, portOffset); - containerConfig = getAbsolutePath(props, "ofbiz.container.config", - "framework/base/config/ofbiz-containers.xml", ofbizHome); loaders = Arrays.asList(getProperty(props, "ofbiz.start.loaders", "").split(",")); logDir = getAbsolutePath(props, "ofbiz.log.dir", "runtime/logs", ofbizHome); shutdownAfterLoad = getProperty(props, "ofbiz.auto.shutdown", "false").equalsIgnoreCase("true");