diff --git a/src/main/java/org/codelibs/fess/Constants.java b/src/main/java/org/codelibs/fess/Constants.java index c8615749d..42f4553c9 100644 --- a/src/main/java/org/codelibs/fess/Constants.java +++ b/src/main/java/org/codelibs/fess/Constants.java @@ -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"; diff --git a/src/main/java/org/codelibs/fess/api/json/JsonApiManager.java b/src/main/java/org/codelibs/fess/api/json/JsonApiManager.java index 46463e432..b0fe82409 100644 --- a/src/main/java/org/codelibs/fess/api/json/JsonApiManager.java +++ b/src/main/java/org/codelibs/fess/api/json/JsonApiManager.java @@ -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; } diff --git a/src/main/java/org/codelibs/fess/app/web/admin/general/AdminGeneralAction.java b/src/main/java/org/codelibs/fess/app/web/admin/general/AdminGeneralAction.java index 0cbd0b03c..242f95eed 100644 --- a/src/main/java/org/codelibs/fess/app/web/admin/general/AdminGeneralAction.java +++ b/src/main/java/org/codelibs/fess/app/web/admin/general/AdminGeneralAction.java @@ -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)); diff --git a/src/main/java/org/codelibs/fess/app/web/base/FessSearchAction.java b/src/main/java/org/codelibs/fess/app/web/base/FessSearchAction.java index a45703b1a..3d59e3c61 100644 --- a/src/main/java/org/codelibs/fess/app/web/base/FessSearchAction.java +++ b/src/main/java/org/codelibs/fess/app/web/base/FessSearchAction.java @@ -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); } diff --git a/src/main/java/org/codelibs/fess/crawler/FessCrawlerThread.java b/src/main/java/org/codelibs/fess/crawler/FessCrawlerThread.java index 1eed30de4..662f05d61 100644 --- a/src/main/java/org/codelibs/fess/crawler/FessCrawlerThread.java +++ b/src/main/java/org/codelibs/fess/crawler/FessCrawlerThread.java @@ -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); diff --git a/src/main/java/org/codelibs/fess/exec/Crawler.java b/src/main/java/org/codelibs/fess/exec/Crawler.java index 568b764ed..ef7e9298b 100644 --- a/src/main/java/org/codelibs/fess/exec/Crawler.java +++ b/src/main/java/org/codelibs/fess/exec/Crawler.java @@ -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); } } diff --git a/src/main/java/org/codelibs/fess/exec/SuggestCreator.java b/src/main/java/org/codelibs/fess/exec/SuggestCreator.java index 9b38fd97a..4bf9d9fc0 100644 --- a/src/main/java/org/codelibs/fess/exec/SuggestCreator.java +++ b/src/main/java/org/codelibs/fess/exec/SuggestCreator.java @@ -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); diff --git a/src/main/java/org/codelibs/fess/job/CrawlJob.java b/src/main/java/org/codelibs/fess/job/CrawlJob.java index d24b9100d..ff5f4cf8c 100644 --- a/src/main/java/org/codelibs/fess/job/CrawlJob.java +++ b/src/main/java/org/codelibs/fess/job/CrawlJob.java @@ -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()); } diff --git a/src/main/java/org/codelibs/fess/job/PurgeLogJob.java b/src/main/java/org/codelibs/fess/job/PurgeLogJob.java index 5e117457d..32d82c817 100644 --- a/src/main/java/org/codelibs/fess/job/PurgeLogJob.java +++ b/src/main/java/org/codelibs/fess/job/PurgeLogJob.java @@ -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(); diff --git a/src/main/java/org/codelibs/fess/job/SuggestJob.java b/src/main/java/org/codelibs/fess/job/SuggestJob.java index a1b0e6dca..9c815dc67 100644 --- a/src/main/java/org/codelibs/fess/job/SuggestJob.java +++ b/src/main/java/org/codelibs/fess/job/SuggestJob.java @@ -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()); } diff --git a/src/main/java/org/codelibs/fess/mylasta/action/FessLabels.java b/src/main/java/org/codelibs/fess/mylasta/action/FessLabels.java index 0e69731b8..d6cf58267 100644 --- a/src/main/java/org/codelibs/fess/mylasta/action/FessLabels.java +++ b/src/main/java/org/codelibs/fess/mylasta/action/FessLabels.java @@ -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}"; diff --git a/src/main/java/org/codelibs/fess/mylasta/direction/FessProp.java b/src/main/java/org/codelibs/fess/mylasta/direction/FessProp.java index f82ea2d78..00a93edf8 100644 --- a/src/main/java/org/codelibs/fess/mylasta/direction/FessProp.java +++ b/src/main/java/org/codelibs/fess/mylasta/direction/FessProp.java @@ -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() { diff --git a/src/main/java/org/codelibs/fess/util/ComponentUtil.java b/src/main/java/org/codelibs/fess/util/ComponentUtil.java index 2c92bf282..48879e5e1 100644 --- a/src/main/java/org/codelibs/fess/util/ComponentUtil.java +++ b/src/main/java/org/codelibs/fess/util/ComponentUtil.java @@ -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); } diff --git a/src/main/resources/fess_config.xml b/src/main/resources/fess_config.xml index de79b4b63..04a27b904 100644 --- a/src/main/resources/fess_config.xml +++ b/src/main/resources/fess_config.xml @@ -4,7 +4,7 @@ - org.codelibs.fess.util.ResourceUtil.getConfPath("crawler.properties") + org.codelibs.fess.util.ResourceUtil.getConfPath("system.properties") diff --git a/src/main/resources/fess_label.properties b/src/main/resources/fess_label.properties index ca3659dc3..ea20f29de 100644 --- a/src/main/resources/fess_label.properties +++ b/src/main/resources/fess_label.properties @@ -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 diff --git a/src/main/resources/fess_label_en.properties b/src/main/resources/fess_label_en.properties index ca3659dc3..ea20f29de 100644 --- a/src/main/resources/fess_label_en.properties +++ b/src/main/resources/fess_label_en.properties @@ -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 diff --git a/src/main/resources/fess_label_ja.properties b/src/main/resources/fess_label_ja.properties index afdae8c1b..9d5daae63 100644 --- a/src/main/resources/fess_label_ja.properties +++ b/src/main/resources/fess_label_ja.properties @@ -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 diff --git a/src/main/webapp/WEB-INF/view/admin/systeminfo/admin_systeminfo.jsp b/src/main/webapp/WEB-INF/view/admin/systeminfo/admin_systeminfo.jsp index e3a4e1051..e8895534f 100644 --- a/src/main/webapp/WEB-INF/view/admin/systeminfo/admin_systeminfo.jsp +++ b/src/main/webapp/WEB-INF/view/admin/systeminfo/admin_systeminfo.jsp @@ -71,7 +71,7 @@ + key="labels.system_info_system_properties_does_not_exist" />