You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by rg...@apache.org on 2016/10/13 14:32:23 UTC
svn commit: r1764698 -
/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/BrokerOptions.java
Author: rgodfrey
Date: Thu Oct 13 14:32:23 2016
New Revision: 1764698
URL: http://svn.apache.org/viewvc?rev=1764698&view=rev
Log:
QPID-7457 : Allow qpid.work_dir to be set as a system property rather than overridden by QPID_WORK
Modified:
qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/BrokerOptions.java
Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/BrokerOptions.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/BrokerOptions.java?rev=1764698&r1=1764697&r2=1764698&view=diff
==============================================================================
--- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/BrokerOptions.java (original)
+++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/BrokerOptions.java Thu Oct 13 14:32:23 2016
@@ -283,30 +283,37 @@ public class BrokerOptions
return Collections.unmodifiableMap(properties);
}
- private String getWorkDir()
+ private String getProperty(String propName, String altPropName, String defaultValue)
{
- if(!_configProperties.containsKey(QPID_WORK_DIR))
+ String value = getProperty(propName);
+ if(value == null)
{
- String qpidWork = System.getProperty(BrokerProperties.PROPERTY_QPID_WORK);
- if (qpidWork == null)
+ value = getProperty(altPropName);
+ if(value == null)
{
- return FALLBACK_WORK_DIR.getAbsolutePath();
+ value = defaultValue;
}
-
- return qpidWork;
}
+ return value;
+ }
- return _configProperties.get(QPID_WORK_DIR);
+ private String getProperty(String propName)
+ {
+ return _configProperties.containsKey(propName)
+ ? _configProperties.get(propName)
+ : System.getProperties().containsKey(propName)
+ ? System.getProperty(propName)
+ : System.getenv(propName);
}
- private String getHomeDir()
+ private String getWorkDir()
{
- if(!_configProperties.containsKey(QPID_HOME_DIR))
- {
- return System.getProperty(BrokerProperties.PROPERTY_QPID_HOME);
- }
+ return getProperty(QPID_WORK_DIR, BrokerProperties.PROPERTY_QPID_WORK, FALLBACK_WORK_DIR.getAbsolutePath());
+ }
- return _configProperties.get(QPID_HOME_DIR);
+ private String getHomeDir()
+ {
+ return getProperty(QPID_HOME_DIR, BrokerProperties.PROPERTY_QPID_HOME, null);
}
/*
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org