Revision 4766
Added by daigle about 15 years ago
PropertyService.java | ||
---|---|---|
41 | 41 |
import edu.ucsb.nceas.metacat.util.UtilException; |
42 | 42 |
import edu.ucsb.nceas.utilities.FileUtil; |
43 | 43 |
import edu.ucsb.nceas.utilities.GeneralPropertyException; |
44 |
import edu.ucsb.nceas.utilities.MetaDataProperty; |
|
44 | 45 |
import edu.ucsb.nceas.utilities.PropertiesMetaData; |
45 | 46 |
import edu.ucsb.nceas.utilities.PropertyNotFoundException; |
46 | 47 |
import edu.ucsb.nceas.utilities.SortedProperties; |
... | ... | |
364 | 365 |
// Populate the backup properties for main metacat properties using |
365 | 366 |
// the associated metadata file |
366 | 367 |
PropertiesMetaData mainMetadata = new PropertiesMetaData(propertiesMetaDataFilePath); |
367 |
Set<String> mainKeySet = mainMetadata.getKeys(); |
|
368 |
|
|
369 |
Map<String, MetaDataProperty> mainKeyMap = mainMetadata.getProperties(); |
|
370 |
Set<String> mainKeySet = mainKeyMap.keySet(); |
|
368 | 371 |
for (String propertyKey : mainKeySet) { |
369 |
backupProperties.addProperty(propertyKey, getProperty(propertyKey)); |
|
372 |
// don't backup passwords |
|
373 |
MetaDataProperty metaData = mainKeyMap.get(propertyKey); |
|
374 |
if (!metaData.getFieldType().equals(MetaDataProperty.PASSWORD_TYPE)) { |
|
375 |
backupProperties.addProperty(propertyKey, getProperty(propertyKey)); |
|
376 |
} |
|
370 | 377 |
} |
371 | 378 |
|
372 | 379 |
// store the properties to file |
... | ... | |
399 | 406 |
// Populate the backup properties for auth properties using |
400 | 407 |
// the associated metadata file |
401 | 408 |
PropertiesMetaData authMetadata = new PropertiesMetaData(authMetaDataFilePath); |
402 |
|
|
403 |
Set<String> authKeySet = authMetadata.getKeys(); |
|
409 |
|
|
410 |
Map<String, MetaDataProperty> authKeyMap = authMetadata.getProperties(); |
|
411 |
Set<String> authKeySet = authKeyMap.keySet(); |
|
404 | 412 |
for (String propertyKey : authKeySet) { |
405 |
backupProperties.addProperty(propertyKey, getProperty(propertyKey)); |
|
413 |
// don't backup passwords |
|
414 |
MetaDataProperty metaData = authKeyMap.get(propertyKey); |
|
415 |
if (!metaData.getFieldType().equals(MetaDataProperty.PASSWORD_TYPE)) { |
|
416 |
backupProperties.addProperty(propertyKey, getProperty(propertyKey)); |
|
417 |
} |
|
406 | 418 |
} |
407 | 419 |
|
408 | 420 |
// store the properties to file |
Also available in: Unified diff
Do not back up password properties