Project

General

Profile

« Previous | Next » 

Revision 5028

Added by daigle over 15 years ago

Persist skin properties across installations

View differences:

lib/metacat.properties.metadata.xml
21 21
		<name>Data Manager Configuration</name>
22 22
		<description>Data Manager Configuration Values.</description>
23 23
	</group>
24
	
25
	<config>
26
		<key>application.default-style</key>
27
		<label>Default Skin Style</label>
28
		<group>0</group>
29
		<index>0</index>
30
		<fieldType>hidden</fieldType>
31
		<description>
32
			Default skin type. Not shown on config page but we want it to backup.
33
		</description>
34
		<helpFile>properties.html#application.default-style</helpFile>
35
	</config>
24 36

  
25 37
	<config>
26 38
		<key>database.user</key>
lib/admin/auth-configuration.jsp
64 64
		Map<Integer, MetaDataGroup> groupMap = metadata.getGroups();
65 65
		Set<Integer> groupIdSet = groupMap.keySet();
66 66
		for (Integer groupId : groupIdSet) {
67
			if (groupId == 0) {
68
				continue;
69
			}
67 70
			// for this group, display the header (group name)
68 71
			MetaDataGroup metaDataGroup = (MetaDataGroup)groupMap.get(groupId);
69 72
%>
lib/admin/skins-configuration.jsp
109 109
		Map<Integer, MetaDataGroup> metaDataGroups = metaData.getGroups();
110 110
		Set<Integer> groupKeys = metaDataGroups.keySet();
111 111
		for (Integer groupkey : groupKeys) {
112
			if (groupkey == 0) {
113
				continue;
114
			}
112 115
			SortedMap<Integer, MetaDataProperty> propertyMap = metaData.getPropertiesInGroup(groupkey);
113 116
			Set<Integer> propertyKeys = propertyMap.keySet();
114 117
%>
lib/admin/properties-configuration.jsp
58 58
		// each group describes a section of properties
59 59
		Map<Integer, MetaDataGroup> groupMap = metadata.getGroups();
60 60
		Set<Integer> groupIdSet = groupMap.keySet();
61

  
62
		
61 63
		for (Integer groupId : groupIdSet) {
62 64
			// for this group, display the header (group name)
63 65
			MetaDataGroup metaDataGroup = (MetaDataGroup)groupMap.get(groupId);
66
			if (groupId == 0) {
67
				// get all the properties in this group
68
				Map<Integer, MetaDataProperty> propertyMap = 
69
					metadata.getPropertiesInGroup(metaDataGroup.getIndex());
70
				Set<Integer> propertyIndexes = propertyMap.keySet();
71
				// iterate through each property and display appropriately
72
				for (Integer propertyIndex : propertyIndexes) {
73
					MetaDataProperty metaDataProperty = propertyMap.get(propertyIndex);
74
	    			String fieldType = metaDataProperty.getFieldType(); 
75
	    			if (fieldType.equals("hidden")) {
64 76
%>
77
						<input type="hidden"
78
                               name="<%= metaDataProperty.getKey() %>" 	             		    	    	           		    	             			
79
	           		    	   value="<%= request.getAttribute(metaDataProperty.getKey()) %>"/>
80
<%
81
	    			}
82
				}
83
			} else {		
84
%>
65 85
		<h3><%= metaDataGroup.getName()  %></h3>
66 86
		<hr class="config-line">
67 87
<%
......
134 154
<%
135 155
    			}
136 156
			}
157
			}
137 158
		}
159
			
138 160
	}
139 161
%>
140 162

  
src/edu/ucsb/nceas/metacat/service/PropertyService.java
368 368
	/**
369 369
	 * Writes out backup configurable properties to a file.
370 370
	 */
371
	public static void persistMainBackupProperties(ServletContext servletContext)
371
	public static void persistMainBackupProperties()
372 372
			throws GeneralPropertyException {
373 373

  
374 374
		// Use the metadata to extract configurable properties from the 
src/edu/ucsb/nceas/metacat/admin/SkinsAdmin.java
41 41
import edu.ucsb.nceas.metacat.service.SkinPropertyService;
42 42
import edu.ucsb.nceas.metacat.util.RequestUtil;
43 43
import edu.ucsb.nceas.metacat.util.SkinUtil;
44
import edu.ucsb.nceas.utilities.FileUtil;
45 44
import edu.ucsb.nceas.utilities.MetaDataProperty;
46 45
import edu.ucsb.nceas.utilities.PropertiesMetaData;
47 46
import edu.ucsb.nceas.utilities.GeneralPropertyException;
......
227 226
					// configure form and preserve their entries.
228 227
					validationErrors.addAll(validateOptions(request, skinName));
229 228

  
230
//					// Try to create backup directories if necessary.
231
//					String backupDir = PropertyService.getBackupDir();
232
//					try {
233
//						FileUtil.createDirectory(backupDir);
234
//					} catch (IOException ioe) {	
235
//						String errorString = "Could not create directory: " + backupDir +
236
//							" : " + ioe.getMessage();
237
//						logMetacat.error(errorString);
238
//						validationErrors.add(errorString);
239
//					}
240

  
241 229
					// write the backup properties to a location outside the
242 230
					// application directories so they will be available after
243 231
					// the next upgrade
244 232
					SkinPropertyService.persistBackupProperties(skinName);
233
					PropertyService.persistMainBackupProperties();
245 234
				}
246 235
				
247
				// Now that the options have been set, change the
248
				// 'skinsConfigured'
249
				// option to 'true' so that normal metacat requests will go
250
				// through
236
				// Now that the options have been set, change the 'skinsConfigured'
237
				// option to 'true' so that normal metacat requests will go through
251 238
				PropertyService.setProperty("configutil.skinsConfigured",
252 239
						PropertyService.CONFIGURED);
253 240
			} catch (GeneralPropertyException gpe) {
src/edu/ucsb/nceas/metacat/admin/PropertiesAdmin.java
258 258
				// write the backup properties to a location outside the 
259 259
				// application directories so they will be available after
260 260
				// the next upgrade
261
				PropertyService.persistMainBackupProperties(
262
						request.getSession().getServletContext());
261
				PropertyService.persistMainBackupProperties();
263 262

  
264 263
			} catch (GeneralPropertyException gpe) {
265 264
				String errorMessage = "Problem getting or setting property while "
src/edu/ucsb/nceas/metacat/admin/GeoserverAdmin.java
188 188
					// write the backup properties to a location outside the
189 189
					// application directories so they will be available after
190 190
					// the next upgrade
191
					PropertyService.persistMainBackupProperties(request.getSession()
192
							.getServletContext());
191
					PropertyService.persistMainBackupProperties();
193 192
				}
194 193
			} catch (MetacatUtilException ue) {
195 194
				String errorMessage = "Error updating geoserver password: " + ue.getMessage();
src/edu/ucsb/nceas/metacat/admin/DBAdmin.java
225 225
				// Write out the configurable properties to a backup file
226 226
				// outside the install directory.
227 227

  
228
				PropertyService.persistMainBackupProperties(request.getSession()
229
						.getServletContext());
228
				PropertyService.persistMainBackupProperties();
230 229
			} catch (GeneralPropertyException gpe) {
231 230
				throw new AdminException("Problem getting or setting property while "
232 231
						+ "upgrading database: " + gpe.getMessage());

Also available in: Unified diff