Author: mthl
Date: Sat Jul 13 21:38:51 2019 New Revision: 1863020 URL: http://svn.apache.org/viewvc?rev=1863020&view=rev Log: Improved: Deprecate ‘ContainerConfig#getConfiguration(String, String)’ (OFBIZ-11100) Since there is no global container configuration file anymore this method should not be used. It has been superseded by an overload which do not require to pass the file name of the configuration file. Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/container/ContainerConfig.java ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/container/NamingServiceContainer.java ofbiz/ofbiz-framework/trunk/framework/catalina/src/main/java/org/apache/ofbiz/catalina/container/CatalinaContainer.java ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/DelegatorContainer.java ofbiz/ofbiz-framework/trunk/framework/entityext/src/main/java/org/apache/ofbiz/entityext/data/EntityDataLoadContainer.java ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/ServiceContainer.java ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/mail/JavaMailContainer.java ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/rmi/RmiServiceContainer.java Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/container/ContainerConfig.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/container/ContainerConfig.java?rev=1863020&r1=1863019&r2=1863020&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/container/ContainerConfig.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/container/ContainerConfig.java Sat Jul 13 21:38:51 2019 @@ -30,7 +30,6 @@ import java.util.Map; import javax.xml.parsers.ParserConfigurationException; import org.apache.ofbiz.base.util.StringUtil; -import org.apache.ofbiz.base.util.UtilURL; import org.apache.ofbiz.base.util.UtilValidate; import org.apache.ofbiz.base.util.UtilXml; import org.w3c.dom.Document; @@ -49,29 +48,36 @@ public class ContainerConfig { private static Map<String, Configuration> configurations = new LinkedHashMap<>(); - public static Configuration getConfiguration(String containerName, String configFile) throws ContainerException { + /** + * Retrieves the container configuration element corresponding to a container name. + * + * @param containerName the name of the container to retrieve + * @param configFile the file name corresponding to the global container configuration file + * @return the corresponding configuration element. + * @throws ContainerException when no configuration element are found. + * @deprecated Use {@link #getConfiguration(String)} instead. + */ + @Deprecated + public static Configuration getConfiguration(String containerName, String configFile) + throws ContainerException { + return getConfiguration(containerName); + } + + /** + * Retrieves the container configuration element corresponding to a container name. + * + * @param containerName the name of the container to retrieve + * @return the corresponding configuration element. + * @throws ContainerException when no configuration element are found. + */ + public static Configuration getConfiguration(String containerName) throws ContainerException { Configuration configuration = configurations.get(containerName); if (configuration == null) { - getConfigurations(configFile); - configuration = configurations.get(containerName); - } - if (configuration == null) { throw new ContainerException("No container found with the name : " + containerName); } return configuration; } - public static Collection<Configuration> getConfigurations(String configFile) throws ContainerException { - if (UtilValidate.isEmpty(configFile)) { - throw new ContainerException("configFile argument cannot be null or empty"); - } - URL xmlUrl = UtilURL.fromResource(configFile); - if (xmlUrl == null) { - throw new ContainerException("Could not find container config file " + configFile); - } - return getConfigurations(xmlUrl); - } - public static Collection<Configuration> getConfigurations(URL xmlUrl) throws ContainerException { if (xmlUrl == null) { throw new ContainerException("xmlUrl argument cannot be null"); Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/container/NamingServiceContainer.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/container/NamingServiceContainer.java?rev=1863020&r1=1863019&r2=1863020&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/container/NamingServiceContainer.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/container/NamingServiceContainer.java Sat Jul 13 21:38:51 2019 @@ -54,7 +54,7 @@ public class NamingServiceContainer impl this.name =name; this.configFileLocation = configFile; - ContainerConfig.Configuration cfg = ContainerConfig.getConfiguration(name, configFileLocation); + ContainerConfig.Configuration cfg = ContainerConfig.getConfiguration(name); // get the naming (JNDI) port Modified: ofbiz/ofbiz-framework/trunk/framework/catalina/src/main/java/org/apache/ofbiz/catalina/container/CatalinaContainer.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/catalina/src/main/java/org/apache/ofbiz/catalina/container/CatalinaContainer.java?rev=1863020&r1=1863019&r2=1863020&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/catalina/src/main/java/org/apache/ofbiz/catalina/container/CatalinaContainer.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/catalina/src/main/java/org/apache/ofbiz/catalina/container/CatalinaContainer.java Sat Jul 13 21:38:51 2019 @@ -103,7 +103,7 @@ public class CatalinaContainer implement public void init(List<StartupCommand> ofbizCommands, String name, String configFile) throws ContainerException { this.name = name; - ContainerConfig.Configuration configuration = ContainerConfig.getConfiguration(name, configFile); + ContainerConfig.Configuration configuration = ContainerConfig.getConfiguration(name); Property engineConfig = retrieveTomcatEngineConfig(configuration); // tomcat setup Modified: ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/DelegatorContainer.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/DelegatorContainer.java?rev=1863020&r1=1863019&r2=1863020&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/DelegatorContainer.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/DelegatorContainer.java Sat Jul 13 21:38:51 2019 @@ -39,7 +39,7 @@ public class DelegatorContainer implemen public void init(List<StartupCommand> ofbizCommands, String name, String configFile) throws ContainerException { this.name = name; - ContainerConfig.Configuration cc = ContainerConfig.getConfiguration(name, configFile); + ContainerConfig.Configuration cc = ContainerConfig.getConfiguration(name); preloadedDelegatorNames = StringUtil.split(ContainerConfig.getPropertyValue(cc, "preloaded-delegators", "default"), ", "); } Modified: ofbiz/ofbiz-framework/trunk/framework/entityext/src/main/java/org/apache/ofbiz/entityext/data/EntityDataLoadContainer.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/entityext/src/main/java/org/apache/ofbiz/entityext/data/EntityDataLoadContainer.java?rev=1863020&r1=1863019&r2=1863020&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/entityext/src/main/java/org/apache/ofbiz/entityext/data/EntityDataLoadContainer.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/entityext/src/main/java/org/apache/ofbiz/entityext/data/EntityDataLoadContainer.java Sat Jul 13 21:38:51 2019 @@ -101,7 +101,7 @@ public class EntityDataLoadContainer imp ServiceDispatcher.enableJMS(false); ServiceDispatcher.enableSvcs(false); - Configuration configuration = ContainerConfig.getConfiguration(name, configFile); + Configuration configuration = ContainerConfig.getConfiguration(name); Property delegatorNameProp = configuration.getProperty("delegator-name"); String overrideDelegator = loadDataProps.get(DELEGATOR_NAME); Modified: ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/ServiceContainer.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/ServiceContainer.java?rev=1863020&r1=1863019&r2=1863020&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/ServiceContainer.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/ServiceContainer.java Sat Jul 13 21:38:51 2019 @@ -46,7 +46,7 @@ public class ServiceContainer implements public void init(List<StartupCommand> ofbizCommands, String name, String configFile) throws ContainerException { this.name = name; // initialize the LocalDispatcherFactory - ContainerConfig.Configuration cfg = ContainerConfig.getConfiguration(name, configFile); + ContainerConfig.Configuration cfg = ContainerConfig.getConfiguration(name); ContainerConfig.Configuration.Property dispatcherFactoryProperty = cfg.getProperty("dispatcher-factory"); if (dispatcherFactoryProperty == null || UtilValidate.isEmpty(dispatcherFactoryProperty.value)) { throw new ContainerException("Unable to initialize container " + name + ": dispatcher-factory property is not set"); Modified: ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/mail/JavaMailContainer.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/mail/JavaMailContainer.java?rev=1863020&r1=1863019&r2=1863020&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/mail/JavaMailContainer.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/mail/JavaMailContainer.java Sat Jul 13 21:38:51 2019 @@ -84,7 +84,7 @@ public class JavaMailContainer implement @Override public boolean start() throws ContainerException { - ContainerConfig.Configuration cfg = ContainerConfig.getConfiguration(name, configFile); + ContainerConfig.Configuration cfg = ContainerConfig.getConfiguration(name); String dispatcherName = ContainerConfig.getPropertyValue(cfg, "dispatcher-name", "JavaMailDispatcher"); String delegatorName = ContainerConfig.getPropertyValue(cfg, "delegator-name", "default"); this.deleteMail = "true".equals(ContainerConfig.getPropertyValue(cfg, "delete-mail", "false")); Modified: ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/rmi/RmiServiceContainer.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/rmi/RmiServiceContainer.java?rev=1863020&r1=1863019&r2=1863020&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/rmi/RmiServiceContainer.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/rmi/RmiServiceContainer.java Sat Jul 13 21:38:51 2019 @@ -60,7 +60,7 @@ public class RmiServiceContainer impleme @Override public boolean start() throws ContainerException { // get the container config - ContainerConfig.Configuration cfg = ContainerConfig.getConfiguration(containerName, configFile); + ContainerConfig.Configuration cfg = ContainerConfig.getConfiguration(containerName); ContainerConfig.Configuration.Property initialCtxProp = cfg.getProperty("use-initial-context"); ContainerConfig.Configuration.Property lookupHostProp = cfg.getProperty("bound-host"); ContainerConfig.Configuration.Property lookupPortProp = cfg.getProperty("bound-port"); |
Free forum by Nabble | Edit this page |