From 928fed665a842440179db42ef090be91217284ce Mon Sep 17 00:00:00 2001 From: Alex Rudyy Date: Fri, 13 Feb 2015 17:13:35 +0000 Subject: QPID-6390: [Java Broker] Move setting of initial properties from Main into Broker git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1659613 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/main/java/org/apache/qpid/server/Main.java | 39 ++++------------------ 1 file changed, 6 insertions(+), 33 deletions(-) (limited to 'qpid/java/broker') diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/Main.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/Main.java index 85fe7af0fb..be2252abbd 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/Main.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/Main.java @@ -25,9 +25,6 @@ import java.io.IOException; import java.io.InputStream; import java.net.MalformedURLException; import java.net.URL; -import java.util.HashSet; -import java.util.Properties; -import java.util.Set; import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.HelpFormatter; @@ -179,11 +176,14 @@ public class Main protected void execute() throws Exception { - String initialProperties = _commandLine.getOptionValue(OPTION_INITIAL_SYSTEM_PROPERTIES.getOpt()); - populateSystemPropertiesFromDefaults(initialProperties); - BrokerOptions options = new BrokerOptions(); + String initialProperties = _commandLine.getOptionValue(OPTION_INITIAL_SYSTEM_PROPERTIES.getOpt()); + if (initialProperties != null) + { + options.setInitialSystemProperties(initialProperties); + } + String initialConfigLocation = _commandLine.getOptionValue(OPTION_INITIAL_CONFIGURATION_PATH.getOpt()); if (initialConfigLocation != null) { @@ -320,33 +320,6 @@ public class Main } } - private void populateSystemPropertiesFromDefaults(final String initialProperties) throws IOException - { - URL initialPropertiesLocation; - if(initialProperties == null) - { - initialPropertiesLocation = getClass().getClassLoader().getResource("system.properties"); - } - else - { - initialPropertiesLocation = (new File(initialProperties)).toURI().toURL(); - } - - Properties props = new Properties(QpidProperties.asProperties()); - if(initialPropertiesLocation != null) - { - props.load(initialPropertiesLocation.openStream()); - } - - Set propertyNames = new HashSet<>(props.stringPropertyNames()); - propertyNames.removeAll(System.getProperties().stringPropertyNames()); - for (String propName : propertyNames) - { - System.setProperty(propName, props.getProperty(propName)); - } - - } - private void copyInitialConfigFile(final BrokerOptions options, final File destinationFile) { String initialConfigLocation = options.getInitialConfigurationLocation(); -- cgit v1.2.1