Project

General

Profile

« Previous | Next » 

Revision 4108

Added by daigle over 16 years ago

Fix backup file pathing issues. Modify checkAndSetProperty to get skin specific values from request.

View differences:

src/edu/ucsb/nceas/metacat/service/SkinPropertyService.java
130 130
				PropertiesMetaData skinMetaData = new PropertiesMetaData(metaDataFilePath);
131 131
				skinMetaDataMap.put(skinName, skinMetaData);
132 132

  
133
				String backupPropertyFilePath = servletContext.getRealPath(BACKUP_DIR)
134
						+ FileUtil.getFS() + skinName + ".properties.metadata.xml";
135
				SortedProperties skinBackupProperties = new SortedProperties(
136
						backupPropertyFilePath);
133
				String backupPropertyFilePath = 
134
					BACKUP_DIR + FileUtil.getFS() + skinName + ".properties.metadata.xml";
135
				SortedProperties skinBackupProperties = 
136
					new SortedProperties(backupPropertyFilePath);
137 137
				skinBackupProperties.load();
138 138
				skinBackupPropertiesMap.put(skinName, skinBackupProperties);
139 139
			}
......
181 181
	 * 
182 182
	 * @param groupName
183 183
	 *            the prefix of the keys to search for.
184
	 * @return enumeration of property names
184
	 * @return Vector of property names
185 185
	 */
186 186
    public static Vector<String> getPropertyNamesByGroup(String skinName, String groupName) throws PropertyNotFoundException {  
187 187
		SortedProperties skinProperties = skinPropertiesMap.get(skinName);
......
330 330
		String metaDataFilePath = servletContext.getRealPath(SKIN_DIR) + FileUtil.getFS()
331 331
				+ skinName + FileUtil.getFS() + skinName + ".properties.metadata.xml";
332 332
		
333
		String backupPropertyFilePath = servletContext.getRealPath(BACKUP_DIR)
334
				+ FileUtil.getFS() + skinName + ".properties.metadata.xml";
333
		String backupPropertyFilePath = 
334
			BACKUP_DIR + FileUtil.getFS() + skinName + ".properties.metadata.xml";
335 335

  
336 336
		// Use the metadata to extract configurable properties from the 
337 337
		// overall properties list, and store those properties.
......
344 344
			PropertiesMetaData mainMetadata = new PropertiesMetaData(metaDataFilePath);
345 345
			Set<String> mainKeySet = mainMetadata.getKeys();
346 346
			for (String propertyKey : mainKeySet) {
347
				backupProperties.setProperty(propertyKey, getProperty(skinName, propertyKey));
347
				backupProperties.addProperty(propertyKey, getProperty(skinName, propertyKey));
348 348
			}
349 349
			
350 350
			// store the properties to file
......
399 399
	 * @param propertyName
400 400
	 *            the name of the property to be checked and set
401 401
	 */
402
	public static void checkAndSetProperty(String skinName, HttpServletRequest request,String propertyName) 
402
	public static void checkAndSetProperty(HttpServletRequest request, String skinName, String propertyName) 
403 403
			throws GeneralPropertyException {
404 404
		String value = SkinPropertyService.getProperty(skinName, propertyName);
405
		String newValue = request.getParameter(propertyName);
405
		String newValue = request.getParameter(skinName + "." + propertyName);
406 406
		if (newValue != null && !newValue.equals(value)) {
407 407
			SkinPropertyService.setPropertyNoPersist(skinName, propertyName, newValue);
408 408
		}

Also available in: Unified diff