You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@manifoldcf.apache.org by kw...@apache.org on 2010/02/21 16:45:09 UTC
svn commit: r912362 -
/incubator/lcf/trunk/modules/framework/core/org/apache/lcf/core/system/LCF.java
Author: kwright
Date: Sun Feb 21 15:45:09 2010
New Revision: 912362
URL: http://svn.apache.org/viewvc?rev=912362&view=rev
Log:
Change the way property file paths are discovered, so that it's clearer.
Modified:
incubator/lcf/trunk/modules/framework/core/org/apache/lcf/core/system/LCF.java
Modified: incubator/lcf/trunk/modules/framework/core/org/apache/lcf/core/system/LCF.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/framework/core/org/apache/lcf/core/system/LCF.java?rev=912362&r1=912361&r2=912362&view=diff
==============================================================================
--- incubator/lcf/trunk/modules/framework/core/org/apache/lcf/core/system/LCF.java (original)
+++ incubator/lcf/trunk/modules/framework/core/org/apache/lcf/core/system/LCF.java Sun Feb 21 15:45:09 2010
@@ -54,13 +54,16 @@
protected static String masterDatabaseUsername = null;
protected static String masterDatabasePassword = null;
protected static java.util.Properties localProperties = null;
- protected static String configPath = null;
+ //protected static String configPath = null;
protected static long propertyFilelastMod = 0;
- protected static String propertyFileName = null;
+ protected static String propertyFilePath = null;
protected static final String applicationName = "lcf";
- // Property names
+ // System property names
+ public static final String lcfConfigFileProperty = "org.apache.lcf.configfile";
+
+ // Property file property names
public static final String masterDatabaseNameProperty = "org.apache.lcf.database.name";
public static final String masterDatabaseUsernameProperty = "org.apache.lcf.database.username";
public static final String masterDatabasePasswordProperty = "org.apache.lcf.database.password";
@@ -69,8 +72,8 @@
public static final String databaseHandleTimeoutProperty = "org.apache.lcf.database.handletimeout";
public static final String synchDirectoryProperty = "org.apache.lcf.synchdirectory";
- public static final String logDirectoryProperty = "org.apache.lcf.logdirectory";
public static final String logConfigFileProperty = "org.apache.lcf.logconfigfile";
+
/** Hack for BPA */
public static final String configSignalCommandProperty = "org.apache.lcf.configuration.change.command";
@@ -154,34 +157,29 @@
try
{
- String defaultLogConfigFile;
// Get system properties
java.util.Properties props = System.getProperties();
// First, look for a define that might indicate where to look
- configPath = (String)props.get("org.apache.lcf.location");
- if (configPath == null)
- configPath = (String)props.get("user.home") + "/"+applicationName;
- configPath = configPath.replace('\\', '/');
- propertyFileName = "properties.ini";
- defaultLogConfigFile = new File(configPath,"logging.ini").toString();
-
- // Make sure both the log path and the config path are present
- try
- {
- ensureFolder(configPath);
- }
- catch (LCFException e)
- {
- e.printStackTrace();
+
+ propertyFilePath = (String)props.get(lcfConfigFileProperty);
+ if (propertyFilePath == null)
+ {
+ String configPath = (String)props.get("user.home") + "/"+applicationName;
+ configPath = configPath.replace('\\', '/');
+ propertyFilePath = new File(configPath,"properties.ini").toString();
}
-
+
// Read .ini parameters
localProperties = new java.util.Properties();
checkProperties();
String logConfigFile = getProperty(logConfigFileProperty);
if (logConfigFile == null)
- logConfigFile = defaultLogConfigFile;
+ {
+ String configPath = (String)props.get("user.home") + "/"+applicationName;
+ configPath = configPath.replace('\\', '/');
+ logConfigFile = new File(configPath,"logging.ini").toString();
+ }
masterDatabaseName = getProperty(masterDatabaseNameProperty);
if (masterDatabaseName == null)
@@ -213,7 +211,7 @@
public static final void checkProperties()
throws LCFException
{
- File f = new File(getConfigPath(),propertyFileName); // for re-read
+ File f = new File(propertyFilePath); // for re-read
try
{
if (propertyFilelastMod != f.lastModified())
@@ -241,11 +239,13 @@
/** Get the path where all config files are.
*@return the path.
*/
+ /*
public static final String getConfigPath()
{
return configPath;
}
-
+ */
+
/** Read a property.
*@param s is the property name.
*@return the property value, as an object.