001: /*
002: * Copyright 2001 Sun Microsystems, Inc. All rights reserved.
003: * PROPRIETARY/CONFIDENTIAL. Use of this product is subject to license terms.
004: */
005:
006: package com.sun.portal.search.util;
007:
008: import java.util.*;
009: import java.io.*;
010:
011: /**
012: * General purpose configuration parameters
013: */
014: public class SearchConfig {
015:
016: // XXX Should rename this and merge with RDMConfig
017:
018: // File defaults
019: public static final String CONFDIR = "config";
020: public static final String SEARCH_CONF = "search.conf";
021:
022: // Database configuration
023: public static final String DBDIR = "database-directory";
024: public static final String DBNAME = "database-name";
025: public static final String DBPARTS = "database-partitions";
026: public static final String DBLODGIR = "database-logdir";
027: public static final String DBMAX = "database-max-concurrent";
028: public static final String DBCLASS = "database-class";
029: public static final String DB_CACHE_SIZE = "database-cache-size-kb";
030: public static final String TAX_DBNAME = "taxonomy-database-name";
031:
032: // security
033: public static final String SECMODE = "security-mode";
034: public static final String SECMGR = "security-manager";
035: public static final String SEC_MAX_ROLESEARCH = "security-max-rolesearch";
036: public static final String SECDSAME = "security-dsame-group";
037: public static final String SECSUPERADMIN = "security-superadmin";
038: public static final String SECDSAME_USE_FILTERED_ROLES = "security-dsame-use-filtered-roles";
039:
040: // RDM configuration
041: public static final String SCHEMA = "schema-description";
042: public static final String SERVER = "server-description";
043: public static final String TAX = "taxonomy-description";
044: public static final String TAX_REFRESH = "taxonomy-description-refresh-rate";
045: public static final String QLFLUFF = "query-language-translation";
046: public static final String MVCLASS = "multiple-classifications";
047:
048: // Search configuration
049: public static final String PLATFORM = "search-platform";
050: public static final String MAX_INDEX_BATCH = "search-max-index-batch";
051: public static final String FIELD_MULTIPLIERS = "search-field-multipliers";
052: public static final String QUERY_THREADS = "search-query-threads";
053: public static final String INDEX_THREADS = "search-index-threads";
054: public static final String INDEX_TYPE = "search-index-type";
055: public static final String INDEX_PARTSIZE = "search-index-partition-size";
056: public static final String INDEX_MERGERATE = "search-index-merge-rate";
057: public static final String INDEX_MAXMERGEPARTS = "search-index-max-merge-partitions";
058: public static final String DICTIONARY_TYPE = "search-dictionary-type";
059: public static final String LOOKUP_LIMIT = "search-lookup-limit";
060: public static final String HIGHLIGHTS = "search-highlights";
061: public static final String HIGHLIGHT_TAGS = "search-highlight-tags";
062: public static final String MAX_PASSAGES = "search-max-passages";
063: public static final String PASSAGE_CONTEXT = "search-passage-context";
064: public static final String PASSAGE_SIZE = "search-passage-size";
065: public static final String HIGHLIGHT_TAGS_FIELD = "search-highlight-tags-field";
066: public static final String MAX_PASSAGES_FIELD = "search-max-passages-field";
067: public static final String PASSAGE_CONTEXT_FIELD = "search-passage-context-field";
068: public static final String PASSAGE_SIZE_FIELD = "search-passage-size-field";
069: public static final String SUMMARY_FROM_BODY = "search-summary-from-body";
070:
071: // Misc
072: public static final String INSTANCE_NAME = "instance-name";
073: public static final String CSID = "csid";
074: public static final String SERVER_ROOT = "server-root";
075: public static final String SERVER_HOSTNAME = "server-hostname";
076: public static final String SERVER_PORT = "server-port";
077: public static final String LOGDIR = "logdir";
078: public static final String TMPDIR = "tmpdir";
079: public static final String BINDIR = "bindir";
080: public static final String LIBDIR = "libdir";
081: public static final String LIBPATH = "libpath";
082: public static final String SENGINE_LOGFN = "search-logfile";
083: public static final String EXCLUDE_GV = "reports-exclude-gv-queries";
084:
085: // Admin look and feel
086: public static final String CATEGORY_ELEMENTS_PER_PAGE = "admin-category_editor_nodes_per_page";
087: public static final String CATEGORY_MAX_COMBO_ELEMENT = "admin-category_editor_max_combo_element";
088: public static final String CATEGORY_EDITOR_LAYOUT = "admin-category_editor_layout";
089: public static final String CHECK_DNS = "filters-check-dns";
090: public static final String CHECK_302 = "filters-check-redirect";
091: public static final String CHECK_VIRTUAL = "filters-check-virtual";
092: public static final String ROBOT_REFRESH = "robot-refresh";
093: public static final String ROBOT_LOGS = "rlog-max-logs";
094:
095: // additional
096: public static final String SEARCH_CONF_HEADER = "#\n# search.conf - Search configuration\n#\n";
097:
098: static Map map = new HashMap();
099: static String default_csid;
100: static SearchConfig searchcf; // singleton
101:
102: // Logger Names, debug is prepended for logging purposes to maintain
103: // consistency across Portal Server.
104: public static String RDM_LOGGER = "debug.com.sun.portal.search.rdm";
105: public static String RDMGR_LOGGER = "debug.com.sun.portal.search.rdmgr";
106: public static String RDMSERVER_LOGGER = "debug.com.sun.portal.search.rdmserver";
107: public static String SEARCH_LOGGER = "debug.com.sun.portal.search";
108: public static String AUTOCLASSIFY_LOGGER = "debug.com.sun.portal.search.autoclassify";
109:
110: // The following, even though referenced within the code are no longer used.
111: // The logging framework's config properties takes care of the log configuration
112: public static final String DEBUG_LOGFN = "debug-logfile";
113: public static final String DEBUG_LOGLV = "debug-loglevel";
114: public static final String RDM_LOGFN = "logfile";
115: public static final String RDM_DISABLE_LOG = "disable-rdm-log";
116: public static final String LOGROTATESIZE = "log-rotation-size";
117: public static final String RDMGR_LOGFN = "rdmgr-logfile";
118:
119: /* hidden */
120: private SearchConfig() {
121: }
122:
123: /**
124: * Load search.conf configuration file
125: */
126: static public void init(String filename) throws Exception {
127: searchcf = new SearchConfig();
128: PBlock.parsePBlockConfigFile(filename, map);
129: }
130:
131: /** @return the search config object */
132: static public SearchConfig getSearchConfig() {
133: return searchcf;
134: }
135:
136: /** Set the default CSID - XXX not checking valid CSID */
137: public void setDefault(String csid) {
138: default_csid = csid;
139: }
140:
141: /** Get the default CSID */
142: public String getDefault() {
143: return default_csid;
144: }
145:
146: /**
147: * Find a configuration parameter .
148: */
149: static public String getValue(String param) {
150: return (String) map.get(param);
151: }
152:
153: /**
154: * Sets a config value.
155: */
156: static public void setValue(Object key, Object value) {
157: if (map != null) {
158: if (map.containsKey(key)) {
159: map.remove(key);
160: }
161: map.put(key, value);
162: }
163: }
164:
165: /**
166: * Return the config map
167: */
168: static public HashMap getMap() {
169: return (HashMap) map;
170: }
171:
172: }
|