1 |
4080
|
daigle
|
/**
|
2 |
|
|
* '$RCSfile$'
|
3 |
|
|
* Purpose: A Class that implements administrative methods
|
4 |
|
|
* Copyright: 2008 Regents of the University of California and the
|
5 |
|
|
* National Center for Ecological Analysis and Synthesis
|
6 |
|
|
* Authors: Michael Daigle
|
7 |
|
|
*
|
8 |
|
|
* '$Author$'
|
9 |
|
|
* '$Date$'
|
10 |
|
|
* '$Revision$'
|
11 |
|
|
*
|
12 |
|
|
* This program is free software; you can redistribute it and/or modify
|
13 |
|
|
* it under the terms of the GNU General Public License as published by
|
14 |
|
|
* the Free Software Foundation; either version 2 of the License, or
|
15 |
|
|
* (at your option) any later version.
|
16 |
|
|
*
|
17 |
|
|
* This program is distributed in the hope that it will be useful,
|
18 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
19 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
20 |
|
|
* GNU General Public License for more details.
|
21 |
|
|
*
|
22 |
|
|
* You should have received a copy of the GNU General Public License
|
23 |
|
|
* along with this program; if not, write to the Free Software
|
24 |
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
25 |
|
|
*/
|
26 |
|
|
|
27 |
|
|
package edu.ucsb.nceas.metacat.util;
|
28 |
|
|
|
29 |
|
|
import java.util.Vector;
|
30 |
|
|
|
31 |
|
|
import org.apache.log4j.Logger;
|
32 |
|
|
|
33 |
5030
|
daigle
|
import edu.ucsb.nceas.metacat.properties.PropertyService;
|
34 |
5015
|
daigle
|
import edu.ucsb.nceas.metacat.shared.MetacatUtilException;
|
35 |
4080
|
daigle
|
import edu.ucsb.nceas.utilities.PropertyNotFoundException;
|
36 |
|
|
import edu.ucsb.nceas.utilities.StringUtil;
|
37 |
|
|
|
38 |
|
|
public class SkinUtil {
|
39 |
|
|
|
40 |
|
|
private static Logger logMetacat = Logger.getLogger(SkinUtil.class);
|
41 |
|
|
|
42 |
|
|
/**
|
43 |
|
|
* private constructor - all methods are static so there is no no need to
|
44 |
|
|
* instantiate.
|
45 |
|
|
*/
|
46 |
|
|
private SkinUtil() {
|
47 |
|
|
}
|
48 |
|
|
|
49 |
|
|
/**
|
50 |
|
|
* Reports whether skins are fully configured.
|
51 |
|
|
*
|
52 |
|
|
* @return a boolean that is true if skins are not unconfigured and false
|
53 |
|
|
* otherwise
|
54 |
|
|
*/
|
55 |
4854
|
daigle
|
public static boolean areSkinsConfigured() throws MetacatUtilException {
|
56 |
4080
|
daigle
|
try {
|
57 |
|
|
return !PropertyService.getProperty("configutil.skinsConfigured").equals(
|
58 |
|
|
PropertyService.UNCONFIGURED);
|
59 |
|
|
} catch (PropertyNotFoundException pnfe) {
|
60 |
4854
|
daigle
|
throw new MetacatUtilException("Could not determine if database is configured: "
|
61 |
4080
|
daigle
|
+ pnfe.getMessage());
|
62 |
|
|
}
|
63 |
|
|
}
|
64 |
|
|
|
65 |
|
|
/**
|
66 |
|
|
* Gets a list of available skin names by parsing a csv property from
|
67 |
|
|
* metacat.properties.
|
68 |
|
|
*
|
69 |
|
|
* @return a Vector of Strings holding skin names
|
70 |
|
|
*/
|
71 |
|
|
public static Vector<String> getSkinNames() throws PropertyNotFoundException {
|
72 |
|
|
String skinStringList = PropertyService.getProperty("skin.names");
|
73 |
|
|
return StringUtil.toVector(skinStringList, ',');
|
74 |
|
|
}
|
75 |
|
|
|
76 |
|
|
}
|