32 |
32 |
import java.util.Set;
|
33 |
33 |
import java.util.Vector;
|
34 |
34 |
|
35 |
|
import javax.servlet.ServletContext;
|
|
35 |
|
36 |
36 |
import javax.servlet.http.HttpServletRequest;
|
37 |
37 |
import javax.xml.transform.TransformerException;
|
38 |
38 |
|
39 |
39 |
import org.apache.log4j.Logger;
|
40 |
40 |
|
41 |
41 |
import edu.ucsb.nceas.metacat.util.SkinUtil;
|
42 |
|
import edu.ucsb.nceas.metacat.util.SystemUtil;
|
43 |
42 |
import edu.ucsb.nceas.metacat.util.UtilException;
|
44 |
43 |
import edu.ucsb.nceas.utilities.FileUtil;
|
45 |
44 |
import edu.ucsb.nceas.utilities.GeneralPropertyException;
|
... | ... | |
51 |
50 |
* A suite of utility classes for the skin configuration utility
|
52 |
51 |
*/
|
53 |
52 |
public class SkinPropertyService extends BaseService {
|
54 |
|
|
|
53 |
|
55 |
54 |
private static SkinPropertyService skinService = null;
|
56 |
|
|
|
55 |
|
57 |
56 |
private static boolean bypassAlreadyChecked = false;
|
58 |
|
|
59 |
|
private static String SKIN_DIR = null;
|
|
57 |
|
60 |
58 |
private static String BACKUP_DIR = null;
|
61 |
|
|
|
59 |
|
62 |
60 |
private static Vector<String> skinNames = null;
|
63 |
|
|
64 |
|
private static HashMap<String, SortedProperties> skinPropertiesMap = null;
|
|
61 |
|
|
62 |
private static HashMap<String, SortedProperties> skinPropertiesMap = null;
|
65 |
63 |
private static HashMap<String, SortedProperties> skinBackupPropertiesMap = null;
|
66 |
64 |
private static HashMap<String, PropertiesMetaData> skinMetaDataMap = null;
|
67 |
|
|
|
65 |
|
68 |
66 |
private static Logger logMetacat = Logger.getLogger(SkinPropertyService.class);
|
69 |
67 |
|
70 |
68 |
/**
|
71 |
69 |
* private constructor since this is a singleton
|
72 |
70 |
*
|
73 |
|
* @param servletContext the context we will use to get relative paths
|
|
71 |
* @param servletContext
|
|
72 |
* the context we will use to get relative paths
|
74 |
73 |
*/
|
75 |
74 |
private SkinPropertyService() throws ServiceException {
|
76 |
75 |
try {
|
... | ... | |
84 |
83 |
+ ioe.getMessage());
|
85 |
84 |
}
|
86 |
85 |
}
|
87 |
|
|
|
86 |
|
88 |
87 |
/**
|
89 |
88 |
* Get the single instance of SkinPropertyService.
|
90 |
89 |
*
|
91 |
|
* @param servletContext the context we will use to get relative paths
|
|
90 |
* @param servletContext
|
|
91 |
* the context we will use to get relative paths
|
92 |
92 |
* @return the single instance of SkinPropertyService
|
93 |
93 |
*/
|
94 |
94 |
public static SkinPropertyService getInstance() throws ServiceException {
|
... | ... | |
97 |
97 |
}
|
98 |
98 |
return skinService;
|
99 |
99 |
}
|
100 |
|
|
|
100 |
|
101 |
101 |
public boolean refreshable() {
|
102 |
102 |
return true;
|
103 |
103 |
}
|
104 |
|
|
|
104 |
|
105 |
105 |
protected void doRefresh() throws ServiceException {
|
106 |
106 |
try {
|
107 |
107 |
initialize();
|
... | ... | |
113 |
113 |
+ " property error: " + gpe.getMessage());
|
114 |
114 |
}
|
115 |
115 |
}
|
116 |
|
|
|
116 |
|
117 |
117 |
/**
|
118 |
118 |
* Initialize the singleton.
|
119 |
119 |
*
|
120 |
120 |
* @param servletContext
|
121 |
121 |
* the context we will use to get relative paths
|
122 |
122 |
*/
|
123 |
|
private void initialize() throws IOException,
|
124 |
|
GeneralPropertyException, ServiceException {
|
|
123 |
private void initialize() throws IOException, GeneralPropertyException,
|
|
124 |
ServiceException {
|
125 |
125 |
|
126 |
126 |
logMetacat.debug("Initializing SkinService");
|
127 |
127 |
|
128 |
|
BACKUP_DIR = PropertyService.getProperty("application.backupDir") + FileUtil.getFS() + ".metacat";
|
|
128 |
BACKUP_DIR = PropertyService.getProperty("application.backupDir")
|
|
129 |
+ FileUtil.getFS() + ".metacat";
|
129 |
130 |
|
130 |
131 |
skinNames = SkinUtil.getSkinNames();
|
131 |
132 |
|
... | ... | |
138 |
139 |
String propertyFilePath = ServiceService.getRealSkinDir()
|
139 |
140 |
+ FileUtil.getFS() + skinName + FileUtil.getFS() + skinName
|
140 |
141 |
+ ".properties";
|
|
142 |
|
|
143 |
if (FileUtil.getFileStatus(propertyFilePath) < FileUtil.EXISTS_READ_WRITABLE) {
|
|
144 |
logMetacat.error("Skin property file: " + propertyFilePath
|
|
145 |
+ " does not exist read/writable");
|
|
146 |
continue;
|
|
147 |
}
|
|
148 |
|
141 |
149 |
SortedProperties skinProperties = new SortedProperties(propertyFilePath);
|
142 |
150 |
skinProperties.load();
|
143 |
151 |
skinPropertiesMap.put(skinName, skinProperties);
|
... | ... | |
146 |
154 |
+ FileUtil.getFS() + skinName + FileUtil.getFS() + skinName
|
147 |
155 |
+ ".properties.metadata.xml";
|
148 |
156 |
if (FileUtil.getFileStatus(metaDataFilePath) == FileUtil.DOES_NOT_EXIST) {
|
149 |
|
throw new GeneralPropertyException("Could not find skin property metadata file: " + metaDataFilePath);
|
|
157 |
throw new GeneralPropertyException(
|
|
158 |
"Could not find skin property metadata file: "
|
|
159 |
+ metaDataFilePath);
|
150 |
160 |
} else {
|
151 |
|
PropertiesMetaData skinMetaData = new PropertiesMetaData(metaDataFilePath);
|
|
161 |
PropertiesMetaData skinMetaData = new PropertiesMetaData(
|
|
162 |
metaDataFilePath);
|
152 |
163 |
skinMetaDataMap.put(skinName, skinMetaData);
|
153 |
|
}
|
|
164 |
}
|
154 |
165 |
|
155 |
|
String backupPropertyFilePath =
|
156 |
|
BACKUP_DIR + FileUtil.getFS() + skinName + ".properties.backup";
|
|
166 |
String backupPropertyFilePath = BACKUP_DIR + FileUtil.getFS() + skinName
|
|
167 |
+ ".properties.backup";
|
157 |
168 |
if (FileUtil.getFileStatus(backupPropertyFilePath) > FileUtil.DOES_NOT_EXIST) {
|
158 |
|
SortedProperties skinBackupProperties =
|
159 |
|
new SortedProperties(backupPropertyFilePath);
|
|
169 |
SortedProperties skinBackupProperties = new SortedProperties(
|
|
170 |
backupPropertyFilePath);
|
160 |
171 |
skinBackupProperties.load();
|
161 |
172 |
skinBackupPropertiesMap.put(skinName, skinBackupProperties);
|
162 |
173 |
} else {
|
163 |
|
logMetacat.info("Could not find backup properties for skin: " + skinName
|
164 |
|
+ ". Backup file does not exist: " + backupPropertyFilePath);
|
|
174 |
logMetacat.info("Could not find backup properties for skin: "
|
|
175 |
+ skinName + ". Backup file does not exist: "
|
|
176 |
+ backupPropertyFilePath);
|
165 |
177 |
}
|
166 |
178 |
}
|
167 |
179 |
} catch (TransformerException te) {
|
... | ... | |
170 |
182 |
}
|
171 |
183 |
|
172 |
184 |
/**
|
173 |
|
* Utility method to get a property value from the properties file for
|
174 |
|
* a specific skin.
|
|
185 |
* Utility method to get a property value from the properties file for a
|
|
186 |
* specific skin.
|
175 |
187 |
*
|
176 |
|
* @param skinName the skin for which we want to retrieve the property
|
|
188 |
* @param skinName
|
|
189 |
* the skin for which we want to retrieve the property
|
177 |
190 |
* @param propertyName
|
178 |
191 |
* the name of the property requested
|
179 |
192 |
* @return the String value for the property
|
... | ... | |
182 |
195 |
throws PropertyNotFoundException {
|
183 |
196 |
SortedProperties skinProperties = skinPropertiesMap.get(skinName);
|
184 |
197 |
if (skinProperties == null) {
|
185 |
|
throw new PropertyNotFoundException("There is not property map for " + skinName);
|
|
198 |
throw new PropertyNotFoundException("There is not property map for "
|
|
199 |
+ skinName);
|
186 |
200 |
}
|
187 |
201 |
return skinProperties.getProperty(propertyName);
|
188 |
202 |
}
|
189 |
|
|
|
203 |
|
190 |
204 |
/**
|
191 |
|
* Get a set of all property names for a given skin.
|
192 |
|
*
|
193 |
|
* @param skinName the skin for which we want to retrieve the property
|
194 |
|
* names
|
195 |
|
* @return Set of property names
|
196 |
|
*/
|
197 |
|
public static Vector<String> getPropertyNames(String skinName) throws PropertyNotFoundException {
|
|
205 |
* Get a set of all property names for a given skin.
|
|
206 |
*
|
|
207 |
* @param skinName
|
|
208 |
* the skin for which we want to retrieve the property names
|
|
209 |
* @return Set of property names
|
|
210 |
*/
|
|
211 |
public static Vector<String> getPropertyNames(String skinName)
|
|
212 |
throws PropertyNotFoundException {
|
198 |
213 |
SortedProperties skinProperties = skinPropertiesMap.get(skinName);
|
199 |
214 |
if (skinProperties == null) {
|
200 |
|
throw new PropertyNotFoundException("There is not property map for " + skinName);
|
|
215 |
throw new PropertyNotFoundException("There is not property map for "
|
|
216 |
+ skinName);
|
201 |
217 |
}
|
202 |
|
return skinProperties.getPropertyNames();
|
203 |
|
}
|
204 |
|
|
|
218 |
return skinProperties.getPropertyNames();
|
|
219 |
}
|
205 |
220 |
|
206 |
221 |
/**
|
207 |
222 |
* Get a Set of all property names that start with the groupName prefix.
|
... | ... | |
210 |
225 |
* the prefix of the keys to search for.
|
211 |
226 |
* @return Vector of property names
|
212 |
227 |
*/
|
213 |
|
public static Vector<String> getPropertyNamesByGroup(String skinName, String groupName) throws PropertyNotFoundException {
|
|
228 |
public static Vector<String> getPropertyNamesByGroup(String skinName, String groupName)
|
|
229 |
throws PropertyNotFoundException {
|
214 |
230 |
SortedProperties skinProperties = skinPropertiesMap.get(skinName);
|
215 |
231 |
if (skinProperties == null) {
|
216 |
|
throw new PropertyNotFoundException("There is not property map for " + skinName);
|
|
232 |
throw new PropertyNotFoundException("There is not property map for "
|
|
233 |
+ skinName);
|
217 |
234 |
}
|
218 |
|
return skinProperties.getPropertyNamesByGroup(groupName);
|
219 |
|
}
|
220 |
|
|
|
235 |
return skinProperties.getPropertyNamesByGroup(groupName);
|
|
236 |
}
|
|
237 |
|
221 |
238 |
/**
|
222 |
|
* Get the main backup properties file. These are configurable properties that
|
223 |
|
* are stored outside the metacat install directories so the user does not
|
224 |
|
* need to re-enter all the configuration information every time they do an
|
225 |
|
* upgrade.
|
|
239 |
* Get the main backup properties file. These are configurable properties
|
|
240 |
* that are stored outside the metacat install directories so the user does
|
|
241 |
* not need to re-enter all the configuration information every time they do
|
|
242 |
* an upgrade.
|
226 |
243 |
*
|
227 |
244 |
* @return a SortedProperties object with the backup properties
|
228 |
245 |
*/
|
229 |
246 |
public static HashMap<String, SortedProperties> getProperties() {
|
230 |
247 |
return skinPropertiesMap;
|
231 |
248 |
}
|
232 |
|
|
|
249 |
|
233 |
250 |
/**
|
234 |
|
* Get the main backup properties file. These are configurable properties that
|
235 |
|
* are stored outside the metacat install directories so the user does not
|
236 |
|
* need to re-enter all the configuration information every time they do an
|
237 |
|
* upgrade.
|
|
251 |
* Get the main backup properties file. These are configurable properties
|
|
252 |
* that are stored outside the metacat install directories so the user does
|
|
253 |
* not need to re-enter all the configuration information every time they do
|
|
254 |
* an upgrade.
|
238 |
255 |
*
|
239 |
256 |
* @return a SortedProperties object with the backup properties
|
240 |
257 |
*/
|
... | ... | |
243 |
260 |
}
|
244 |
261 |
|
245 |
262 |
/**
|
246 |
|
* Get the main backup properties file. These are configurable properties that
|
247 |
|
* are stored outside the metacat install directories so the user does not
|
248 |
|
* need to re-enter all the configuration information every time they do an
|
249 |
|
* upgrade.
|
|
263 |
* Get the main backup properties file. These are configurable properties
|
|
264 |
* that are stored outside the metacat install directories so the user does
|
|
265 |
* not need to re-enter all the configuration information every time they do
|
|
266 |
* an upgrade.
|
250 |
267 |
*
|
251 |
268 |
* @return a SortedProperties object with the backup properties
|
252 |
269 |
*/
|
253 |
270 |
public static HashMap<String, SortedProperties> getBackupProperties() {
|
254 |
271 |
return skinBackupPropertiesMap;
|
255 |
272 |
}
|
256 |
|
|
|
273 |
|
257 |
274 |
/**
|
258 |
|
* Get the main backup properties file. These are configurable properties that
|
259 |
|
* are stored outside the metacat install directories so the user does not
|
260 |
|
* need to re-enter all the configuration information every time they do an
|
261 |
|
* upgrade.
|
|
275 |
* Get the main backup properties file. These are configurable properties
|
|
276 |
* that are stored outside the metacat install directories so the user does
|
|
277 |
* not need to re-enter all the configuration information every time they do
|
|
278 |
* an upgrade.
|
262 |
279 |
*
|
263 |
280 |
* @return a SortedProperties object with the backup properties
|
264 |
281 |
*/
|
265 |
282 |
public static SortedProperties getBackupProperties(String skinName) {
|
266 |
283 |
return skinBackupPropertiesMap.get(skinName);
|
267 |
284 |
}
|
268 |
|
|
|
285 |
|
269 |
286 |
/**
|
270 |
287 |
* Get the main properties metadata. This is retrieved from an xml file that
|
271 |
288 |
* describes the attributes of configurable properties.
|
... | ... | |
275 |
292 |
public static HashMap<String, PropertiesMetaData> getMetaData() {
|
276 |
293 |
return skinMetaDataMap;
|
277 |
294 |
}
|
278 |
|
|
|
295 |
|
279 |
296 |
/**
|
280 |
297 |
* Get the main properties metadata. This is retrieved from an xml file that
|
281 |
298 |
* describes the attributes of configurable properties.
|
... | ... | |
295 |
312 |
* @param newValue
|
296 |
313 |
* the new value for the property
|
297 |
314 |
*/
|
298 |
|
public static void setProperty(String skinName, String propertyName, String newValue) throws IOException, GeneralPropertyException {
|
|
315 |
public static void setProperty(String skinName, String propertyName, String newValue)
|
|
316 |
throws IOException, GeneralPropertyException {
|
299 |
317 |
SortedProperties skinProperties = skinPropertiesMap.get(skinName);
|
300 |
318 |
if (skinProperties == null) {
|
301 |
|
throw new GeneralPropertyException("There is not property map for " + skinName);
|
|
319 |
throw new GeneralPropertyException("There is not property map for "
|
|
320 |
+ skinName);
|
302 |
321 |
}
|
303 |
322 |
skinProperties.setProperty(propertyName, newValue);
|
304 |
323 |
skinProperties.store();
|
... | ... | |
317 |
336 |
* @param newValue
|
318 |
337 |
* the new value for the property
|
319 |
338 |
*/
|
320 |
|
public static void setPropertyNoPersist(String skinName, String propertyName, String newValue) throws GeneralPropertyException {
|
|
339 |
public static void setPropertyNoPersist(String skinName, String propertyName,
|
|
340 |
String newValue) throws GeneralPropertyException {
|
321 |
341 |
SortedProperties skinProperties = skinPropertiesMap.get(skinName);
|
322 |
342 |
if (skinProperties == null) {
|
323 |
|
throw new GeneralPropertyException("There is not property map for " + skinName);
|
|
343 |
throw new GeneralPropertyException("There is not property map for "
|
|
344 |
+ skinName);
|
324 |
345 |
}
|
325 |
346 |
skinProperties.setPropertyNoPersist(propertyName, newValue);
|
326 |
347 |
}
|
327 |
348 |
|
328 |
349 |
/**
|
329 |
|
* Save the properties to a properties file. Note, the
|
330 |
|
* order and comments will be preserved.
|
|
350 |
* Save the properties to a properties file. Note, the order and comments
|
|
351 |
* will be preserved.
|
331 |
352 |
*/
|
332 |
|
public static void persistProperties(String skinName) throws IOException, GeneralPropertyException {
|
|
353 |
public static void persistProperties(String skinName) throws IOException,
|
|
354 |
GeneralPropertyException {
|
333 |
355 |
SortedProperties skinProperties = skinPropertiesMap.get(skinName);
|
334 |
356 |
if (skinProperties == null) {
|
335 |
|
throw new GeneralPropertyException("There is not property map for " + skinName);
|
|
357 |
throw new GeneralPropertyException("There is not property map for "
|
|
358 |
+ skinName);
|
336 |
359 |
}
|
337 |
360 |
skinProperties.store();
|
338 |
361 |
}
|
... | ... | |
347 |
370 |
persistProperties(skinName);
|
348 |
371 |
}
|
349 |
372 |
}
|
350 |
|
|
|
373 |
|
351 |
374 |
/**
|
352 |
375 |
* Writes out backup configurable properties to a file.
|
353 |
376 |
*/
|
354 |
|
public static void persistBackupProperties(String skinName) throws GeneralPropertyException {
|
|
377 |
public static void persistBackupProperties(String skinName)
|
|
378 |
throws GeneralPropertyException {
|
355 |
379 |
try {
|
356 |
380 |
String metaDataFilePath = ServiceService.getRealSkinDir() + FileUtil.getFS()
|
357 |
381 |
+ skinName + FileUtil.getFS() + skinName + ".properties.metadata.xml";
|
... | ... | |
361 |
385 |
|
362 |
386 |
// Use the metadata to extract configurable properties from the
|
363 |
387 |
// overall properties list, and store those properties.
|
364 |
|
SortedProperties backupProperties =
|
365 |
|
new SortedProperties(backupPropertyFilePath);
|
366 |
|
|
|
388 |
SortedProperties backupProperties = new SortedProperties(
|
|
389 |
backupPropertyFilePath);
|
|
390 |
|
367 |
391 |
// Populate the backup properties for main metacat properties using
|
368 |
392 |
// the associated metadata file
|
369 |
393 |
PropertiesMetaData mainMetadata = new PropertiesMetaData(metaDataFilePath);
|
370 |
394 |
Set<String> mainKeySet = mainMetadata.getKeys();
|
371 |
395 |
for (String propertyKey : mainKeySet) {
|
372 |
|
backupProperties.addProperty(propertyKey, getProperty(skinName, propertyKey));
|
|
396 |
backupProperties.addProperty(propertyKey, getProperty(skinName,
|
|
397 |
propertyKey));
|
373 |
398 |
}
|
374 |
|
|
|
399 |
|
375 |
400 |
// store the properties to file
|
376 |
401 |
backupProperties.store();
|
377 |
402 |
|
378 |
403 |
} catch (TransformerException te) {
|
379 |
|
throw new GeneralPropertyException("Could not transform backup properties xml: "
|
380 |
|
+ te.getMessage());
|
|
404 |
throw new GeneralPropertyException(
|
|
405 |
"Could not transform backup properties xml: " + te.getMessage());
|
381 |
406 |
} catch (IOException ioe) {
|
382 |
|
throw new GeneralPropertyException("Could not backup configurable properties: "
|
383 |
|
+ ioe.getMessage());
|
|
407 |
throw new GeneralPropertyException(
|
|
408 |
"Could not backup configurable properties: " + ioe.getMessage());
|
384 |
409 |
} catch (ServiceException se) {
|
385 |
410 |
throw new GeneralPropertyException("Could not get skins property file: "
|
386 |
411 |
+ se.getMessage());
|
387 |
412 |
}
|
388 |
413 |
}
|
389 |
|
|
|
414 |
|
390 |
415 |
/**
|
391 |
416 |
* Reports whether properties are fully configured.
|
392 |
417 |
*
|
... | ... | |
402 |
427 |
+ pnfe.getMessage());
|
403 |
428 |
}
|
404 |
429 |
}
|
405 |
|
|
|
430 |
|
406 |
431 |
/**
|
407 |
|
* Take input from the user in an HTTP request about an property to be changed
|
408 |
|
* and update the metacat property file with that new value if it has
|
409 |
|
* changed from the value that was originally set.
|
|
432 |
* Take input from the user in an HTTP request about an property to be
|
|
433 |
* changed and update the metacat property file with that new value if it
|
|
434 |
* has changed from the value that was originally set.
|
410 |
435 |
*
|
411 |
436 |
* @param request
|
412 |
437 |
* that was generated by the user
|
... | ... | |
415 |
440 |
* @param propertyName
|
416 |
441 |
* the name of the property to be checked and set
|
417 |
442 |
*/
|
418 |
|
public static void checkAndSetProperty(HttpServletRequest request, String skinName, String propertyName)
|
419 |
|
throws GeneralPropertyException {
|
|
443 |
public static void checkAndSetProperty(HttpServletRequest request, String skinName,
|
|
444 |
String propertyName) throws GeneralPropertyException {
|
420 |
445 |
String newValue = request.getParameter(skinName + "." + propertyName);
|
421 |
|
checkAndSetProperty(newValue, skinName, propertyName);
|
|
446 |
checkAndSetProperty(newValue, skinName, propertyName);
|
422 |
447 |
}
|
423 |
|
|
|
448 |
|
424 |
449 |
/**
|
425 |
|
* Check user input against existing value
|
426 |
|
* and update the metacat property file with that new value if it has
|
427 |
|
* changed from the value that was originally set.
|
|
450 |
* Check user input against existing value and update the metacat property
|
|
451 |
* file with that new value if it has changed from the value that was
|
|
452 |
* originally set.
|
428 |
453 |
*
|
429 |
454 |
* @param newValue
|
430 |
455 |
* the value that was returned by the form
|
... | ... | |
433 |
458 |
* @param propertyName
|
434 |
459 |
* the name of the property to be checked and set
|
435 |
460 |
*/
|
436 |
|
public static void checkAndSetProperty(String newValue, String skinName, String propertyName)
|
437 |
|
throws GeneralPropertyException {
|
|
461 |
public static void checkAndSetProperty(String newValue, String skinName,
|
|
462 |
String propertyName) throws GeneralPropertyException {
|
438 |
463 |
String oldValue = SkinPropertyService.getProperty(skinName, propertyName);
|
439 |
464 |
if (newValue != null && !newValue.equals(oldValue)) {
|
440 |
465 |
SkinPropertyService.setPropertyNoPersist(skinName, propertyName, newValue);
|
441 |
466 |
}
|
442 |
467 |
}
|
443 |
|
|
|
468 |
|
444 |
469 |
/**
|
445 |
|
* Reports whether the metacat configuration utility should be run.
|
446 |
|
* Returns false if
|
447 |
|
* -- dev.runConfiguration=false and
|
448 |
|
* -- backup properties file exists
|
449 |
|
* Note that dev.runConfiguration should only be set to false when
|
|
470 |
* Reports whether the metacat configuration utility should be run. Returns
|
|
471 |
* false if -- dev.runConfiguration=false and -- backup properties file
|
|
472 |
* exists Note that dev.runConfiguration should only be set to false when
|
450 |
473 |
* reinstalling the same version of the application in developement.
|
451 |
474 |
*
|
452 |
|
* @return a boolean that is false if dev.runConfiguration is false and
|
453 |
|
* the backup properties file exists.
|
|
475 |
* @return a boolean that is false if dev.runConfiguration is false and the
|
|
476 |
* backup properties file exists.
|
454 |
477 |
*/
|
455 |
478 |
public static boolean bypassConfiguration() {
|
456 |
479 |
boolean bypass = false;
|
457 |
|
|
|
480 |
|
458 |
481 |
// We only want to go through the check once to see if we want to
|
459 |
|
// bypass the configuration. We don't want to run through all of
|
460 |
|
// this every time we hit metacat.
|
|
482 |
// bypass the configuration. We don't want to run through all of
|
|
483 |
// this every time we hit metacat.
|
461 |
484 |
if (bypassAlreadyChecked) {
|
462 |
485 |
return bypass;
|
463 |
486 |
}
|
464 |
|
|
465 |
|
try {
|
|
487 |
|
|
488 |
try {
|
466 |
489 |
// check how dev.runConfiguration is set in metacat.properties
|
467 |
|
String strRunConfiguration = PropertyService.getProperty("dev.runConfiguration");
|
|
490 |
String strRunConfiguration = PropertyService
|
|
491 |
.getProperty("dev.runConfiguration");
|
468 |
492 |
bypass = !(Boolean.parseBoolean(strRunConfiguration));
|
469 |
|
|
|
493 |
|
470 |
494 |
// if the deb.runConfiguration is true, return false here.
|
471 |
495 |
if (!bypass) {
|
472 |
496 |
bypassAlreadyChecked = true;
|
... | ... | |
475 |
499 |
|
476 |
500 |
// the system is bypassing the configuration utility. We need to
|
477 |
501 |
// get the backup properties and replace existing properties with
|
478 |
|
// backup values. We do this for main and org properties.
|
|
502 |
// backup values. We do this for main and org properties.
|
479 |
503 |
for (String skinName : skinNames) {
|
480 |
504 |
SortedProperties backupProperties = getBackupProperties(skinName);
|
481 |
|
Vector<String> backupPropertyNames =
|
482 |
|
backupProperties.getPropertyNames();
|
|
505 |
Vector<String> backupPropertyNames = backupProperties.getPropertyNames();
|
483 |
506 |
for (String backupPropertyName : backupPropertyNames) {
|
484 |
507 |
String value = backupProperties.getProperty(backupPropertyName);
|
485 |
508 |
backupProperties.setPropertyNoPersist(backupPropertyName, value);
|
Only configure skins that are correctly configured in the skins directory.