01: /*
02: * Copyright 2001 Sun Microsystems, Inc. All rights reserved.
03: * PROPRIETARY/CONFIDENTIAL. Use of this product is subject to license terms.
04: */
05:
06: package com.sun.portal.search.rdmserver;
07:
08: import com.sun.portal.search.rdm.*;
09: import com.sun.portal.search.soif.*;
10: import com.sun.portal.search.util.*;
11:
12: import java.io.*;
13: import java.util.*;
14:
15: /**
16: * The RDMConfig structure is a bunch of initialization information
17: * that the RDM servers use during their existence
18: */
19: public class RDMConfig {
20:
21: // XXX this should replace (or be replaced by) searchcf.
22:
23: String serverroot; // base directory for all operations
24: SearchConfig searchcf;
25:
26: public RDMConfig() throws Exception {
27: this (".");
28: }
29:
30: public RDMConfig(String serverroot) throws Exception {
31:
32: if (serverroot == null)
33: throw new Exception(
34: "rdm-init requires 'server.root' parameter.");
35:
36: this .serverroot = serverroot;
37:
38: // Load config file
39: String searchConfFile = null;
40: try {
41: searchConfFile = serverroot + File.separator
42: + SearchConfig.CONFDIR + File.separator
43: + SearchConfig.SEARCH_CONF;
44: SearchConfig.init(searchConfFile);
45: searchcf = SearchConfig.getSearchConfig();
46: } catch (Exception e) {
47: throw new Exception("Failed to access config file: "
48: + searchConfFile + ": " + e);
49: }
50:
51: String csid = searchcf.getValue(SearchConfig.CSID);
52: searchcf.setDefault(csid);
53:
54: }
55:
56: public String getServerRoot() {
57: return serverroot;
58: }
59:
60: }
|