rename to system.properties

This commit is contained in:
Shinsuke Sugaya 2016-01-07 07:10:56 +09:00
parent 38f9329ebd
commit 4c130567fe
18 changed files with 53 additions and 35 deletions

View file

@ -103,7 +103,7 @@ public class Constants extends CoreLibConstants {
public static final String WEB_API_SUGGEST_PROPERTY = "web.api.suggest";
public static final String WEB_API_ANALYSIS_PROPERTY = "web.api.analysis";
public static final String WEB_API_POPULAR_WORD_PROPERTY = "web.api.popularword";
public static final String WEB_DESIGN_EDITOR_PROPERTY = "design.editor";
@ -115,8 +115,6 @@ public class Constants extends CoreLibConstants {
public static final String FAILURE_COUNT_THRESHOLD_PROPERTY = "failure.countthreshold";
public static final String WEB_API_POPULAR_WORD_PROPERTY = "web.api.popularword";
public static final String CSV_FILE_ENCODING_PROPERTY = "csv.file.encoding";
public static final String PURGE_SEARCH_LOG_DAY_PROPERTY = "purge.searchlog.day";

View file

@ -73,7 +73,7 @@ public class JsonApiManager extends BaseApiManager {
@Override
public boolean matches(final HttpServletRequest request) {
if (Constants.FALSE.equals(ComponentUtil.getCrawlerProperties().getProperty(Constants.WEB_API_JSON_PROPERTY, Constants.TRUE))) {
if (Constants.FALSE.equals(ComponentUtil.getSystemProperties().getProperty(Constants.WEB_API_JSON_PROPERTY, Constants.TRUE))) {
return false;
}

View file

@ -137,7 +137,7 @@ public class AdminGeneralAction extends FessAdminAction {
updateProperty(Constants.APPEND_QUERY_PARAMETER_PROPERTY, getCheckboxValue(form.appendQueryParameter));
updateProperty(Constants.IGNORE_FAILURE_TYPE_PROPERTY, form.ignoreFailureType);
updateProperty(Constants.FAILURE_COUNT_THRESHOLD_PROPERTY, form.failureCountThreshold.toString());
updateProperty(Constants.WEB_API_POPULAR_WORD_PROPERTY, getCheckboxValue(form.popularWord));
fessConfig.setWebApiPopularWord(Constants.ON.equalsIgnoreCase(form.popularWord));
updateProperty(Constants.CSV_FILE_ENCODING_PROPERTY, form.csvFileEncoding);
updateProperty(Constants.PURGE_SEARCH_LOG_DAY_PROPERTY, form.purgeSearchLogDay.toString());
updateProperty(Constants.PURGE_JOB_LOG_DAY_PROPERTY, form.purgeJobLogDay.toString());
@ -175,7 +175,7 @@ public class AdminGeneralAction extends FessAdminAction {
form.ignoreFailureType =
crawlerProperties.getProperty(Constants.IGNORE_FAILURE_TYPE_PROPERTY, Constants.DEFAULT_IGNORE_FAILURE_TYPE);
form.failureCountThreshold = getPropertyAsInteger(Constants.FAILURE_COUNT_THRESHOLD_PROPERTY, Constants.DEFAULT_FAILURE_COUNT);
form.popularWord = crawlerProperties.getProperty(Constants.WEB_API_POPULAR_WORD_PROPERTY, Constants.TRUE);
form.popularWord = fessConfig.isWebApiPopularWord() ? Constants.TRUE : Constants.FALSE;
form.csvFileEncoding = crawlerProperties.getProperty(Constants.CSV_FILE_ENCODING_PROPERTY, Constants.UTF_8);
form.purgeSearchLogDay =
Integer.parseInt(crawlerProperties.getProperty(Constants.PURGE_SEARCH_LOG_DAY_PROPERTY, Constants.DEFAULT_PURGE_DAY));

View file

@ -96,7 +96,9 @@ public abstract class FessSearchAction extends FessBaseAction {
favoriteSupport = Constants.TRUE.equals(crawlerProperties.getProperty(Constants.USER_FAVORITE_PROPERTY, Constants.FALSE));
runtime.registerData("searchLogSupport", searchLogSupport);
runtime.registerData("favoriteSupport", favoriteSupport);
runtime.registerData("popularWords", popularWordHelper.getWordList(null, null, null, null));// TODO parameters
if (fessConfig.isWebApiPopularWord()) {
runtime.registerData("popularWords", popularWordHelper.getWordList(null, null, null, null));// TODO parameters
}
return super.hookBefore(runtime);
}

View file

@ -56,7 +56,7 @@ public class FessCrawlerThread extends CrawlerThread {
@Override
protected boolean isContentUpdated(final CrawlerClient client, final UrlQueue<?> urlQueue) {
final DynamicProperties crawlerProperties = ComponentUtil.getCrawlerProperties();
final DynamicProperties crawlerProperties = ComponentUtil.getSystemProperties();
if (crawlerProperties.getProperty(Constants.INCREMENTAL_CRAWLING_PROPERTY, Constants.TRUE).equals(Constants.TRUE)) {
log(logHelper, LogType.CHECK_LAST_MODIFIED, crawlerContext, urlQueue);

View file

@ -206,7 +206,7 @@ public class Crawler implements Serializable {
}
final CrawlingInfoHelper crawlingInfoHelper = ComponentUtil.getCrawlingInfoHelper();
final DynamicProperties crawlerProperties = ComponentUtil.getCrawlerProperties();
final DynamicProperties crawlerProperties = ComponentUtil.getSystemProperties();
if (StringUtil.isNotBlank(options.propertiesPath)) {
crawlerProperties.reload(options.propertiesPath);
@ -219,7 +219,7 @@ public class Crawler implements Serializable {
crawlerProperties.reload(propFile.getAbsolutePath());
propFile.deleteOnExit(); // NOSONAR
} catch (final IOException e) {
logger.warn("Failed to create crawler properties file.", e);
logger.warn("Failed to create system properties file.", e);
}
}

View file

@ -113,20 +113,20 @@ public class SuggestCreator implements Serializable {
}
private static int process(final Options options) {
final DynamicProperties crawlerProperties = ComponentUtil.getCrawlerProperties();
final DynamicProperties crawlerProperties = ComponentUtil.getSystemProperties();
if (StringUtil.isNotBlank(options.propertiesPath)) {
crawlerProperties.reload(options.propertiesPath);
} else {
try {
final File propFile = File.createTempFile("crawler_", ".properties");
final File propFile = File.createTempFile("suggest_", ".properties");
if (propFile.delete() && logger.isDebugEnabled()) {
logger.debug("Deleted a temp file: " + propFile.getAbsolutePath());
}
crawlerProperties.reload(propFile.getAbsolutePath());
propFile.deleteOnExit(); // NOSONAR
} catch (final IOException e) {
logger.warn("Failed to create crawler properties file.", e);
logger.warn("Failed to create system properties file.", e);
}
}
@ -140,7 +140,7 @@ public class SuggestCreator implements Serializable {
}
private int create() {
final DynamicProperties crawlerProperties = ComponentUtil.getCrawlerProperties();
final DynamicProperties crawlerProperties = ComponentUtil.getSystemProperties();
if (!Constants.TRUE.equals(crawlerProperties.getProperty(Constants.SUGGEST_DOCUMENTS_PROPERTY, Constants.TRUE))) {
logger.info("Skip create suggest document.");
return 0;
@ -171,7 +171,7 @@ public class SuggestCreator implements Serializable {
private int purge(final LocalDateTime time) {
final SuggestHelper suggestHelper = ComponentUtil.getSuggestHelper();
final DynamicProperties crawlerProperties = ComponentUtil.getCrawlerProperties();
final DynamicProperties crawlerProperties = ComponentUtil.getSystemProperties();
try {
suggestHelper.purgeDocumentSuggest(time);

View file

@ -351,7 +351,7 @@ public class CrawlJob {
cmdList.add(propFile.getAbsolutePath());
try (FileOutputStream out = new FileOutputStream(propFile)) {
Properties prop = new Properties();
prop.putAll(ComponentUtil.getCrawlerProperties());
prop.putAll(ComponentUtil.getSystemProperties());
prop.store(out, cmdList.toString());
}

View file

@ -35,7 +35,7 @@ public class PurgeLogJob {
final SearchLogService searchLogService = ComponentUtil.getComponent(SearchLogService.class);
final JobLogService jobLogService = ComponentUtil.getComponent(JobLogService.class);
final UserInfoService userInfoService = ComponentUtil.getComponent(UserInfoService.class);
final DynamicProperties crawlerProperties = ComponentUtil.getCrawlerProperties();
final DynamicProperties crawlerProperties = ComponentUtil.getSystemProperties();
final SystemHelper systemHelper = ComponentUtil.getSystemHelper();
final StringBuilder resultBuf = new StringBuilder();

View file

@ -223,7 +223,7 @@ public class SuggestJob {
cmdList.add(propFile.getAbsolutePath());
try (FileOutputStream out = new FileOutputStream(propFile)) {
Properties prop = new Properties();
prop.putAll(ComponentUtil.getCrawlerProperties());
prop.putAll(ComponentUtil.getSystemProperties());
prop.store(out, cmdList.toString());
}

View file

@ -1484,9 +1484,9 @@ public class FessLabels extends ActionMessages {
/** The key of the message: Properties for Bug Report */
public static final String LABELS_system_info_bug_report_title = "{labels.system_info_bug_report_title}";
/** The key of the message: crawler.properties does not exist. Default values are applied. */
public static final String LABELS_system_info_crawler_properties_does_not_exist =
"{labels.system_info_crawler_properties_does_not_exist}";
/** The key of the message: system.properties does not exist. Default values are applied. */
public static final String LABELS_system_info_system_properties_does_not_exist =
"{labels.system_info_system_properties_does_not_exist}";
/** The key of the message: File Authentication */
public static final String LABELS_file_auth_configuration = "{labels.file_auth_configuration}";

View file

@ -21,23 +21,37 @@ import org.codelibs.fess.util.ComponentUtil;
import org.codelibs.fess.util.StreamUtil;
public interface FessProp {
public default String getProperty(final String key) {
return ComponentUtil.getCrawlerProperties().getProperty(key);
//
// system.properties
//
public default String getSystemProperty(final String key) {
return ComponentUtil.getSystemProperties().getProperty(key);
}
public default String getProperty(final String key, final String defaultValue) {
return ComponentUtil.getCrawlerProperties().getProperty(key, defaultValue);
return ComponentUtil.getSystemProperties().getProperty(key, defaultValue);
}
public default void setLoginRequired(final boolean value) {
ComponentUtil.getCrawlerProperties().setProperty(Constants.LOGIN_REQUIRED_PROPERTY, value ? Constants.TRUE : Constants.FALSE);
ComponentUtil.getSystemProperties().setProperty(Constants.LOGIN_REQUIRED_PROPERTY, value ? Constants.TRUE : Constants.FALSE);
}
public default boolean isLoginRequired() {
return Constants.TRUE.equalsIgnoreCase(ComponentUtil.getCrawlerProperties().getProperty(Constants.LOGIN_REQUIRED_PROPERTY,
return Constants.TRUE.equalsIgnoreCase(ComponentUtil.getSystemProperties().getProperty(Constants.LOGIN_REQUIRED_PROPERTY,
Constants.FALSE));
}
public default void setWebApiPopularWord(final boolean value) {
ComponentUtil.getSystemProperties().setProperty(Constants.WEB_API_POPULAR_WORD_PROPERTY, value ? Constants.TRUE : Constants.FALSE);
}
public default boolean isWebApiPopularWord() {
return Constants.TRUE.equalsIgnoreCase(ComponentUtil.getSystemProperties().getProperty(Constants.WEB_API_POPULAR_WORD_PROPERTY,
Constants.TRUE));
}
public default String getLdapInitialContextFactory() {
return getProperty(Constants.LDAP_INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
}
@ -47,7 +61,7 @@ public interface FessProp {
}
public default String getLdapProviderUrl() {
return getProperty(Constants.LDAP_PROVIDER_URL);
return getSystemProperty(Constants.LDAP_PROVIDER_URL);
}
public default String getLdapSecurityPrincipal(final String username) {
@ -55,13 +69,17 @@ public interface FessProp {
}
public default String getLdapBaseDn() {
return getProperty(Constants.LDAP_BASE_DN);
return getSystemProperty(Constants.LDAP_BASE_DN);
}
public default String getLdapAccountFilter() {
return getProperty(Constants.LDAP_ACCOUNT_FILTER);
return getSystemProperty(Constants.LDAP_ACCOUNT_FILTER);
}
//
// fess_*.properties
//
String getAuthenticationAdminRoles();
public default String[] getAuthenticationAdminRolesAsArray() {

View file

@ -139,7 +139,7 @@ public final class ComponentUtil {
return SingletonLaContainer.getComponent(groupName + PROPERTIES_SUFFIX);
}
public static DynamicProperties getCrawlerProperties() {
public static DynamicProperties getSystemProperties() {
return SingletonLaContainer.getComponent(CRAWLER_PROPERTIES);
}

View file

@ -4,7 +4,7 @@
<components>
<component name="crawlerProperties" class="org.codelibs.core.misc.DynamicProperties">
<arg>
org.codelibs.fess.util.ResourceUtil.getConfPath("crawler.properties")
org.codelibs.fess.util.ResourceUtil.getConfPath("system.properties")
</arg>
</component>

View file

@ -492,7 +492,7 @@ labels.system_info_env_title=Env Properties
labels.system_info_prop_title=System Properties
labels.system_info_fess_prop_title=Fess Properties
labels.system_info_bug_report_title=Properties for Bug Report
labels.system_info_crawler_properties_does_not_exist=crawler.properties does not exist. Default values are applied.
labels.system_info_system_properties_does_not_exist=system.properties does not exist. Default values are applied.
labels.file_auth_configuration=File Authentication
labels.file_auth_list_hostname=Hostname
labels.file_auth_list_file_crawling_config=Config Name

View file

@ -492,7 +492,7 @@ labels.system_info_env_title=Env Properties
labels.system_info_prop_title=System Properties
labels.system_info_fess_prop_title=Fess Properties
labels.system_info_bug_report_title=Properties for Bug Report
labels.system_info_crawler_properties_does_not_exist=crawler.properties does not exist. Default values are applied.
labels.system_info_system_properties_does_not_exist=system.properties does not exist. Default values are applied.
labels.file_auth_configuration=File Authentication
labels.file_auth_list_hostname=Hostname
labels.file_auth_list_file_crawling_config=Config Name

View file

@ -483,7 +483,7 @@ labels.system_info_env_title = \u74b0\u5883\u5909\u6570\u306e\u30d7\u30ed\u30d1\
labels.system_info_prop_title = \u30b7\u30b9\u30c6\u30e0\u306e\u30d7\u30ed\u30d1\u30c6\u30a3
labels.system_info_fess_prop_title = \u30a2\u30d7\u30ea\u306e\u30d7\u30ed\u30d1\u30c6\u30a3
labels.system_info_bug_report_title = \u30d0\u30b0\u30ec\u30dd\u30fc\u30c8\u306e\u30d7\u30ed\u30d1\u30c6\u30a3
labels.system_info_crawler_properties_does_not_exist = crawler.properties\u306f\u5b58\u5728\u3057\u307e\u305b\u3093\u3002\u30c7\u30d5\u30a9\u30eb\u30c8\u5024\u304c\u9069\u7528\u3055\u308c\u307e\u3059\u3002
labels.system_info_system_properties_does_not_exist = system.properties\u306f\u5b58\u5728\u3057\u307e\u305b\u3093\u3002\u30c7\u30d5\u30a9\u30eb\u30c8\u5024\u304c\u9069\u7528\u3055\u308c\u307e\u3059\u3002
labels.file_auth_configuration = \u30d5\u30a1\u30a4\u30eb\u8a8d\u8a3c
labels.file_auth_list_hostname = \u30db\u30b9\u30c8\u540d
labels.file_auth_list_file_crawling_config = \u8a2d\u5b9a\u540d

View file

@ -71,7 +71,7 @@
<c:if test="${empty fessPropItems}">
<textarea id="fessPropData" class="systemInfoData form-control"
readonly><la:message
key="labels.system_info_crawler_properties_does_not_exist" /></textarea>
key="labels.system_info_system_properties_does_not_exist" /></textarea>
</c:if>
<c:if test="${!empty fessPropItems}">
<textarea id="fessPropData" class="systemInfoData form-control"