Project

General

Profile

« Previous | Next » 

Revision 8326

Added by Jing Tao about 11 years ago

Add a util class for dataone configuration.

View differences:

src/edu/ucsb/nceas/metacat/util/DataONEConfigUtil.java
1
/**
2
 *  '$RCSfile$'
3
 *  Copyright: 2008 Regents of the University of California and the
4
 *             National Center for Ecological Analysis and Synthesis
5
 *    Authors: Jing Tao
6
 * 
7
 *   '$Author: tao $'
8
 *     '$Date: 2008-07-06 21:25:34 -0700 (Sun, 06 Jul 2008) $'
9
 * '$Revision: 4080 $'
10
 *
11
 * This program is free software; you can redistribute it and/or modify
12
 * it under the terms of the GNU General Public License as published by
13
 * the Free Software Foundation; either version 2 of the License, or
14
 * (at your option) any later version.
15
 *
16
 * This program is distributed in the hope that it will be useful,
17
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19
 * GNU General Public License for more details.
20
 *
21
 * You should have received a copy of the GNU General Public License
22
 * along with this program; if not, write to the Free Software
23
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
24
 */
25

  
26
package edu.ucsb.nceas.metacat.util;
27

  
28
import edu.ucsb.nceas.metacat.properties.PropertyService;
29
import edu.ucsb.nceas.metacat.shared.MetacatUtilException;
30
import edu.ucsb.nceas.utilities.PropertyNotFoundException;
31

  
32
/**
33
 * A utility class for configuring DataONE setting
34
 * @author tao
35
 *
36
 */
37
public class DataONEConfigUtil {
38
    /**
39
     * Reports whether dataONE is configured.
40
     * 
41
     * @return a boolean that is true if dataONE setting is configured or bypassed
42
     */
43
    public static boolean isGeoserverConfigured() throws MetacatUtilException {
44
        String dataoneConfiguredString = PropertyService.UNCONFIGURED;
45
        try {
46
            dataoneConfiguredString = PropertyService.getProperty("configutil.dataoneConfigured");
47
        } catch (PropertyNotFoundException pnfe) {
48
            throw new MetacatUtilException("Could not determine if DataONE are configured: "
49
                    + pnfe.getMessage());
50
        }
51
        // geoserver is configured if not unconfigured
52
        return !dataoneConfiguredString.equals(PropertyService.UNCONFIGURED);
53
    }
54
}

Also available in: Unified diff