Revision 9900
Added by Jing Tao over 8 years ago
src/edu/ucsb/nceas/metacat/admin/AuthAdmin.java | ||
---|---|---|
190 | 190 |
// we need to write the options from memory to the properties |
191 | 191 |
// file |
192 | 192 |
PropertyService.persistProperties(); |
193 |
PropertyService.syncToSettings(); |
|
193 | 194 |
|
194 | 195 |
// Validate that the options provided are legitimate. Note that |
195 | 196 |
// we've allowed them to persist their entries. As of this point |
src/edu/ucsb/nceas/metacat/admin/D1Admin.java | ||
---|---|---|
326 | 326 |
|
327 | 327 |
// persist them all |
328 | 328 |
PropertyService.persistProperties(); |
329 |
PropertyService.syncToSettings(); |
|
329 | 330 |
|
330 | 331 |
// save a backup in case the form has errors, we reload from these |
331 | 332 |
PropertyService.persistMainBackupProperties(); |
src/edu/ucsb/nceas/metacat/admin/EZIDAdmin.java | ||
---|---|---|
215 | 215 |
PropertyService.setPropertyNoPersist("guid.ezid.doishoulder.1", doishoulder); |
216 | 216 |
// persist them all |
217 | 217 |
PropertyService.persistProperties(); |
218 |
PropertyService.syncToSettings(); |
|
218 | 219 |
// save a backup in case the form has errors, we reload from these |
219 | 220 |
PropertyService.persistMainBackupProperties(); |
220 | 221 |
} |
src/edu/ucsb/nceas/metacat/admin/GeoserverAdmin.java | ||
---|---|---|
201 | 201 |
PropertyService.setPropertyNoPersist("geoserver.context", context); |
202 | 202 |
boolean reconfig = PropertyService.checkAndSetProperty(request, "geoserver.GEOSERVER_DATA_DIR"); |
203 | 203 |
PropertyService.persistProperties(); |
204 |
PropertyService.syncToSettings(); |
|
204 | 205 |
// put the web.xml in place |
205 | 206 |
reconfig = true; //force all the time in cases where geoserver has been redeployed |
206 | 207 |
if (reconfig) { |
src/edu/ucsb/nceas/metacat/admin/PropertiesAdmin.java | ||
---|---|---|
140 | 140 |
externalDir + FileUtil.getFS() + "solr-home"); |
141 | 141 |
|
142 | 142 |
PropertyService.persistProperties(); |
143 |
PropertyService.syncToSettings(); |
|
143 | 144 |
|
144 | 145 |
// Add the list of properties from metacat.properties to the request |
145 | 146 |
Vector<String> propertyNames = PropertyService.getPropertyNames(); |
src/edu/ucsb/nceas/metacat/properties/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.