Project

General

Profile

« Previous | Next » 

Revision 4632

Added by daigle about 16 years ago

catch and report missing skins configuration files.

View differences:

src/edu/ucsb/nceas/metacat/service/SkinPropertyService.java
137 137
				String metaDataFilePath = servletContext.getRealPath(SKIN_DIR)
138 138
						+ FileUtil.getFS() + skinName + FileUtil.getFS() + skinName
139 139
						+ ".properties.metadata.xml";
140
				PropertiesMetaData skinMetaData = new PropertiesMetaData(metaDataFilePath);
141
				skinMetaDataMap.put(skinName, skinMetaData);
140
				if (FileUtil.getFileStatus(metaDataFilePath) == FileUtil.DOES_NOT_EXIST) {
141
					throw new GeneralPropertyException("Could not find skin property metadata file: " + metaDataFilePath);
142
				} else {
143
					PropertiesMetaData skinMetaData = 
144
						new PropertiesMetaData(metaDataFilePath);
145
					skinMetaDataMap.put(skinName, skinMetaData);
146
				} 
142 147

  
143 148
				String backupPropertyFilePath = 
144 149
					BACKUP_DIR + FileUtil.getFS() + skinName + ".properties.backup";
145
				SortedProperties skinBackupProperties = 
146
					new SortedProperties(backupPropertyFilePath);
147
				skinBackupProperties.load();
148
				skinBackupPropertiesMap.put(skinName, skinBackupProperties);
150
				if (FileUtil.getFileStatus(backupPropertyFilePath) > FileUtil.DOES_NOT_EXIST) {
151
					SortedProperties skinBackupProperties = 
152
						new SortedProperties(backupPropertyFilePath);
153
					skinBackupProperties.load();
154
					skinBackupPropertiesMap.put(skinName, skinBackupProperties);
155
				} else {
156
					logMetacat.info("Could not find backup properties for skin: " + skinName
157
							+ ". Backup file does not exist: " + backupPropertyFilePath);
158
				}
149 159
			}
150 160
		} catch (TransformerException te) {
151 161
			throw new GeneralPropertyException(te.getMessage());
src/edu/ucsb/nceas/metacat/admin/SkinsAdmin.java
136 136
					// properties with backup properties.  This allows previously 
137 137
					// set properties to be preserved in an application upgrade.
138 138
					SortedProperties backupProperties = backupPropertiesMap.get(skinName);
139
					for (String propertyName : backupProperties.getPropertyNames())
140
					{
141
						localSkinProperties.put(propertyName, 
142
							backupProperties.getProperty(propertyName));
139
					if (backupProperties == null) {
140
						logMetacat.warn("Could not find backup properties for skin: "
141
								+ skinName);
142
					} else {
143
						for (String propertyName : backupProperties.getPropertyNames()) {
144
							localSkinProperties.put(propertyName, 
145
									backupProperties.getProperty(propertyName));
146
						}
143 147
					}
144 148
								
145 149
					localPropertyMap.put(skinName, localSkinProperties);					

Also available in: Unified diff