diff --git a/src/main/java/org/codelibs/fess/Constants.java b/src/main/java/org/codelibs/fess/Constants.java index c8615749d40220df150a37b2448a8018ff9ec0b4..42f4553c90a4cffddb3690fbb080e618a542bc46 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 46463e432e1be105403f9642c42a907a35badb02..b0fe824099ed9ae206c4593f9d5b8d3a5cef4a27 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 0cbd0b03c1e75f1b5e86d17f9f2e98361dd73a06..242f95eed6e6beb9743a9a037027540d6d7421ec 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 a45703b1a8fd87e1ef16949686e8fde4cdfebbe7..3d59e3c615bddf26d7e7f0335a6d02ee89f2ad36 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 1eed30de44526936968ed99f502dca2e0cfe7149..662f05d61a0c88e2b987aee619957bd621f1ad2e 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 568b764ed6d35d23846128ca29945ff75ad17caa..ef7e9298b497957aeee67ee912118d1aef5abeae 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 9b38fd97a4719a8baaccfeda058c8aa23c7c7735..4bf9d9fc038d7be6c810d4da91f285338e93270f 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 d24b9100d1a905cebc2bd654de73b7d8a7c7067a..ff5f4cf8c8f0137f1e1e53a8b583521ba028cf56 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 5e117457df672f3c4bc11f5636cb9347313bc9fd..32d82c81792db18c8715151034076052e7e4f528 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 a1b0e6dcab84e45782b8d2d177ed9b99951e5c5a..9c815dc679568781b7db916024abc0774b323506 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 0e69731b80640e22c43c1e85bd1d3d1625ade1bd..d6cf58267229d13dea6d426883a6f0002cd1d98e 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 f82ea2d789ede60c5103eedb0b232caf3264b268..00a93edf8357502eec4bc1553c73c0dd2de3cd2b 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 2c92bf282a2a419ac13b11854751be905f959146..48879e5e12e31691ee6b989040feb89662f2aee7 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 de79b4b63e7bf18c0adc8a8b433bef7469bd2e3d..04a27b904f4d6f5c754b1b6b48d1569f7ec4197f 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 ca3659dc3d0b8904e5f7dd15bedb0f8e3dcab443..ea20f29debc0a98821243e793b9d0236bddd3dba 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 ca3659dc3d0b8904e5f7dd15bedb0f8e3dcab443..ea20f29debc0a98821243e793b9d0236bddd3dba 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 afdae8c1b5c9153d10cca14639fff8abbcb15c04..9d5daae632301e7da52df612c349498c9fe23ff3 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 e3a4e105138eda615bff0dbd4689978effe521ec..e8895534fb2634ba71d9475b2ef9fd06bf4713fa 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" />