Revision 9900
Added by Jing Tao over 7 years ago
PropertyService.java | ||
---|---|---|
32 | 32 |
import javax.servlet.ServletContext; |
33 | 33 |
import javax.servlet.http.HttpServletRequest; |
34 | 34 |
|
35 |
import org.apache.commons.configuration.ConfigurationException; |
|
35 | 36 |
import org.apache.log4j.Logger; |
37 |
import org.dataone.configuration.Settings; |
|
36 | 38 |
|
37 | 39 |
import edu.ucsb.nceas.metacat.shared.BaseService; |
38 | 40 |
import edu.ucsb.nceas.metacat.shared.ServiceException; |
... | ... | |
420 | 422 |
public static String getRecommendedExternalDir() { |
421 | 423 |
return RECOMMENDED_EXTERNAL_DIR; |
422 | 424 |
} |
425 |
|
|
426 |
/** |
|
427 |
* The properties on the Setting class isn't synchronized with the change the Metacat properties file. |
|
428 |
* This method synchronizes (reloads) the properties' change to the Setting class when the property file was modified. |
|
429 |
*/ |
|
430 |
public static void syncToSettings() throws GeneralPropertyException { |
|
431 |
try { |
|
432 |
Settings.getConfiguration(); |
|
433 |
Settings.augmentConfiguration(CONFIG_FILE_PATH); |
|
434 |
} catch (ConfigurationException e) { |
|
435 |
e.printStackTrace(); |
|
436 |
throw new GeneralPropertyException(e.getMessage()); |
|
437 |
} |
|
438 |
} |
|
423 | 439 |
|
424 | 440 |
} |
Also available in: Unified diff
Every time when we modified the metacat.properties file through the PropertyService, the Setting class will be updated as well. Otherwise, the values on the Setting class are still the old one.