diff --git a/src/main/java/org/codelibs/fess/api/es/EsApiManager.java b/src/main/java/org/codelibs/fess/api/es/EsApiManager.java index ad8e7319c..b03058805 100644 --- a/src/main/java/org/codelibs/fess/api/es/EsApiManager.java +++ b/src/main/java/org/codelibs/fess/api/es/EsApiManager.java @@ -53,7 +53,7 @@ public class EsApiManager extends BaseApiManager { private static final Logger logger = LoggerFactory.getLogger(EsApiManager.class); @Resource - protected DynamicProperties crawlerProperties; + protected DynamicProperties systemProperties; protected String[] acceptedRoles = new String[] { "admin" }; 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 b0fe82409..a8fb86e95 100644 --- a/src/main/java/org/codelibs/fess/api/json/JsonApiManager.java +++ b/src/main/java/org/codelibs/fess/api/json/JsonApiManager.java @@ -65,7 +65,7 @@ public class JsonApiManager extends BaseApiManager { private static final Logger logger = LoggerFactory.getLogger(JsonApiManager.class); @Resource - protected DynamicProperties crawlerProperties; + protected DynamicProperties systemProperties; public JsonApiManager() { setPathPrefix("/json"); @@ -311,7 +311,7 @@ public class JsonApiManager extends BaseApiManager { } protected void processPopularWordRequest(final HttpServletRequest request, final HttpServletResponse response, final FilterChain chain) { - if (Constants.FALSE.equals(crawlerProperties.getProperty(Constants.WEB_API_POPULAR_WORD_PROPERTY, Constants.TRUE))) { + if (Constants.FALSE.equals(systemProperties.getProperty(Constants.WEB_API_POPULAR_WORD_PROPERTY, Constants.TRUE))) { writeJsonResponse(9, null, "Unsupported operation."); return; } @@ -357,7 +357,7 @@ public class JsonApiManager extends BaseApiManager { } protected void processFavoriteRequest(final HttpServletRequest request, final HttpServletResponse response, final FilterChain chain) { - if (Constants.FALSE.equals(crawlerProperties.getProperty(Constants.USER_FAVORITE_PROPERTY, Constants.FALSE))) { + if (Constants.FALSE.equals(systemProperties.getProperty(Constants.USER_FAVORITE_PROPERTY, Constants.FALSE))) { writeJsonResponse(9, null, "Unsupported operation."); return; } @@ -440,7 +440,7 @@ public class JsonApiManager extends BaseApiManager { } protected void processFavoritesRequest(final HttpServletRequest request, final HttpServletResponse response, final FilterChain chain) { - if (Constants.FALSE.equals(crawlerProperties.getProperty(Constants.USER_FAVORITE_PROPERTY, Constants.FALSE))) { + if (Constants.FALSE.equals(systemProperties.getProperty(Constants.USER_FAVORITE_PROPERTY, Constants.FALSE))) { writeJsonResponse(9, null, "Unsupported operation."); return; } diff --git a/src/main/java/org/codelibs/fess/api/suggest/SuggestApiManager.java b/src/main/java/org/codelibs/fess/api/suggest/SuggestApiManager.java index 4df9fe2ef..09bbfa884 100644 --- a/src/main/java/org/codelibs/fess/api/suggest/SuggestApiManager.java +++ b/src/main/java/org/codelibs/fess/api/suggest/SuggestApiManager.java @@ -47,7 +47,7 @@ public class SuggestApiManager extends BaseApiManager { } @Resource - protected DynamicProperties crawlerProperties; + protected DynamicProperties systemProperties; @Override public boolean matches(final HttpServletRequest request) { @@ -75,10 +75,10 @@ public class SuggestApiManager extends BaseApiManager { builder.setSize(parameter.getNum()); builder.addKind(SuggestItem.Kind.USER.toString()); - if (Constants.TRUE.equals(crawlerProperties.getProperty(Constants.SUGGEST_SEARCH_LOG_PROPERTY, Constants.TRUE))) { + if (Constants.TRUE.equals(systemProperties.getProperty(Constants.SUGGEST_SEARCH_LOG_PROPERTY, Constants.TRUE))) { builder.addKind(SuggestItem.Kind.QUERY.toString()); } - if (Constants.TRUE.equals(crawlerProperties.getProperty(Constants.SUGGEST_DOCUMENTS_PROPERTY, Constants.TRUE))) { + if (Constants.TRUE.equals(systemProperties.getProperty(Constants.SUGGEST_DOCUMENTS_PROPERTY, Constants.TRUE))) { builder.addKind(SuggestItem.Kind.DOCUMENT.toString()); } diff --git a/src/main/java/org/codelibs/fess/app/service/FailureUrlService.java b/src/main/java/org/codelibs/fess/app/service/FailureUrlService.java index 83369362f..8dc13444f 100644 --- a/src/main/java/org/codelibs/fess/app/service/FailureUrlService.java +++ b/src/main/java/org/codelibs/fess/app/service/FailureUrlService.java @@ -46,7 +46,7 @@ public class FailureUrlService implements Serializable { private static final long serialVersionUID = 1L; @Resource - protected DynamicProperties crawlerProperties; + protected DynamicProperties systemProperties; @Resource protected FailureUrlBhv failureUrlBhv; @@ -125,9 +125,9 @@ public class FailureUrlService implements Serializable { } public List getExcludedUrlList(final String configId) { - final String failureCountStr = crawlerProperties.getProperty(Constants.FAILURE_COUNT_THRESHOLD_PROPERTY); + final String failureCountStr = systemProperties.getProperty(Constants.FAILURE_COUNT_THRESHOLD_PROPERTY); final String ignoreFailureType = - crawlerProperties.getProperty(Constants.IGNORE_FAILURE_TYPE_PROPERTY, Constants.DEFAULT_IGNORE_FAILURE_TYPE); + systemProperties.getProperty(Constants.IGNORE_FAILURE_TYPE_PROPERTY, Constants.DEFAULT_IGNORE_FAILURE_TYPE); int failureCount = Constants.DEFAULT_FAILURE_COUNT; if (failureCountStr != null) { try { diff --git a/src/main/java/org/codelibs/fess/app/service/SearchService.java b/src/main/java/org/codelibs/fess/app/service/SearchService.java index e63eefaa9..6fbc98e8c 100644 --- a/src/main/java/org/codelibs/fess/app/service/SearchService.java +++ b/src/main/java/org/codelibs/fess/app/service/SearchService.java @@ -72,7 +72,7 @@ public class SearchService { // Attribute // @Resource - protected DynamicProperties crawlerProperties; + protected DynamicProperties systemProperties; @Resource protected FessEsClient fessEsClient; @@ -97,8 +97,7 @@ public class SearchService { final long requestedTime = systemHelper.getCurrentTimeAsLong(); final long startTime = System.currentTimeMillis(); - final boolean searchLogSupport = - Constants.TRUE.equals(crawlerProperties.getProperty(Constants.SEARCH_LOG_PROPERTY, Constants.TRUE)); + final boolean searchLogSupport = Constants.TRUE.equals(systemProperties.getProperty(Constants.SEARCH_LOG_PROPERTY, Constants.TRUE)); final String query = QueryStringBuilder.query(params.getQuery()).extraQueries(params.getExtraQueries()).fields(params.getFields()).build(); @@ -200,7 +199,7 @@ public class SearchService { final RoleQueryHelper roleQueryHelper = ComponentUtil.getRoleQueryHelper(); final SearchLog searchLog = new SearchLog(); - if (Constants.TRUE.equals(crawlerProperties.getProperty(Constants.USER_INFO_PROPERTY, Constants.TRUE))) { + if (Constants.TRUE.equals(systemProperties.getProperty(Constants.USER_INFO_PROPERTY, Constants.TRUE))) { final String userCode = userInfoHelper.getUserCode(); if (userCode != null) { searchLog.setUserSessionId(userCode); @@ -269,7 +268,7 @@ public class SearchService { langSet.remove(Constants.ALL_LANGUAGES); } return langSet.toArray(new String[langSet.size()]); - } else if (Constants.TRUE.equals(crawlerProperties.getProperty(Constants.USE_BROWSER_LOCALE_FOR_SEARCH_PROPERTY, Constants.FALSE))) { + } else if (Constants.TRUE.equals(systemProperties.getProperty(Constants.USE_BROWSER_LOCALE_FOR_SEARCH_PROPERTY, Constants.FALSE))) { final Set langSet = new HashSet<>(); final Enumeration locales = request.getLocales(); if (locales != null) { diff --git a/src/main/java/org/codelibs/fess/app/web/admin/badword/AdminBadwordAction.java b/src/main/java/org/codelibs/fess/app/web/admin/badword/AdminBadwordAction.java index 39deb754a..8e373568a 100644 --- a/src/main/java/org/codelibs/fess/app/web/admin/badword/AdminBadwordAction.java +++ b/src/main/java/org/codelibs/fess/app/web/admin/badword/AdminBadwordAction.java @@ -61,7 +61,7 @@ public class AdminBadwordAction extends FessAdminAction { @Resource private SystemHelper systemHelper; @Resource - protected DynamicProperties crawlerProperties; + protected DynamicProperties systemProperties; @Resource protected SuggestHelper suggestHelper; @@ -327,7 +327,7 @@ public class AdminBadwordAction extends FessAdminAction { } private String getCsvEncoding() { - return crawlerProperties.getProperty(Constants.CSV_FILE_ENCODING_PROPERTY, Constants.UTF_8); + return systemProperties.getProperty(Constants.CSV_FILE_ENCODING_PROPERTY, Constants.UTF_8); } // =================================================================================== diff --git a/src/main/java/org/codelibs/fess/app/web/admin/design/AdminDesignAction.java b/src/main/java/org/codelibs/fess/app/web/admin/design/AdminDesignAction.java index e1af555db..11a8223e5 100644 --- a/src/main/java/org/codelibs/fess/app/web/admin/design/AdminDesignAction.java +++ b/src/main/java/org/codelibs/fess/app/web/admin/design/AdminDesignAction.java @@ -55,7 +55,7 @@ public class AdminDesignAction extends FessAdminAction implements Serializable { // Attribute // ========= @Resource - private DynamicProperties crawlerProperties; + private DynamicProperties systemProperties; @Resource private SystemHelper systemHelper; @@ -83,7 +83,7 @@ public class AdminDesignAction extends FessAdminAction implements Serializable { } private boolean editable() { - return Constants.TRUE.equals(crawlerProperties.getProperty(Constants.WEB_DESIGN_EDITOR_PROPERTY, Constants.TRUE)); + return Constants.TRUE.equals(systemProperties.getProperty(Constants.WEB_DESIGN_EDITOR_PROPERTY, Constants.TRUE)); } private List loadFileNameItems() { diff --git a/src/main/java/org/codelibs/fess/app/web/admin/dict/kuromoji/AdminDictKuromojiAction.java b/src/main/java/org/codelibs/fess/app/web/admin/dict/kuromoji/AdminDictKuromojiAction.java index 8aacfe40e..ec1641bb2 100644 --- a/src/main/java/org/codelibs/fess/app/web/admin/dict/kuromoji/AdminDictKuromojiAction.java +++ b/src/main/java/org/codelibs/fess/app/web/admin/dict/kuromoji/AdminDictKuromojiAction.java @@ -57,7 +57,7 @@ public class AdminDictKuromojiAction extends FessAdminAction { @Resource private SystemHelper systemHelper; @Resource - protected DynamicProperties crawlerProperties; + protected DynamicProperties systemProperties; // =================================================================================== // Hook diff --git a/src/main/java/org/codelibs/fess/app/web/admin/dict/synonym/AdminDictSynonymAction.java b/src/main/java/org/codelibs/fess/app/web/admin/dict/synonym/AdminDictSynonymAction.java index 41462c719..ce36580fd 100644 --- a/src/main/java/org/codelibs/fess/app/web/admin/dict/synonym/AdminDictSynonymAction.java +++ b/src/main/java/org/codelibs/fess/app/web/admin/dict/synonym/AdminDictSynonymAction.java @@ -60,7 +60,7 @@ public class AdminDictSynonymAction extends FessAdminAction { @Resource private SystemHelper systemHelper; @Resource - protected DynamicProperties crawlerProperties; + protected DynamicProperties systemProperties; // =================================================================================== // Hook diff --git a/src/main/java/org/codelibs/fess/app/web/admin/elevateword/AdminElevatewordAction.java b/src/main/java/org/codelibs/fess/app/web/admin/elevateword/AdminElevatewordAction.java index 510c7ab96..2935c1e61 100644 --- a/src/main/java/org/codelibs/fess/app/web/admin/elevateword/AdminElevatewordAction.java +++ b/src/main/java/org/codelibs/fess/app/web/admin/elevateword/AdminElevatewordAction.java @@ -62,7 +62,7 @@ public class AdminElevatewordAction extends FessAdminAction { @Resource private SystemHelper systemHelper; @Resource - protected DynamicProperties crawlerProperties; + protected DynamicProperties systemProperties; @Resource protected SuggestHelper suggestHelper; @Resource @@ -342,7 +342,7 @@ public class AdminElevatewordAction extends FessAdminAction { } private String getCsvEncoding() { - return crawlerProperties.getProperty(Constants.CSV_FILE_ENCODING_PROPERTY, Constants.UTF_8); + return systemProperties.getProperty(Constants.CSV_FILE_ENCODING_PROPERTY, Constants.UTF_8); } // =================================================================================== 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 242f95eed..b884ef8c1 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 @@ -53,7 +53,7 @@ public class AdminGeneralAction extends FessAdminAction { // Attribute // ========= @Resource - protected DynamicProperties crawlerProperties; + protected DynamicProperties systemProperties; @Resource protected SystemHelper systemHelper; @@ -107,7 +107,7 @@ public class AdminGeneralAction extends FessAdminAction { }); saveInfo(messages -> messages.addSuccessSendTestmail(GLOBAL)); updateProperty(Constants.NOTIFICATION_TO_PROPERTY, form.notificationTo); - crawlerProperties.store(); + systemProperties.store(); } catch (final Exception e) { logger.warn("Failed to send a test mail.", e); saveError(messages -> messages.addErrorsFailedToSendTestmail(GLOBAL)); @@ -152,7 +152,7 @@ public class AdminGeneralAction extends FessAdminAction { updateProperty(Constants.LDAP_BASE_DN, form.ldapBaseDn); updateProperty(Constants.LDAP_ACCOUNT_FILTER, form.ldapAccountFilter); - crawlerProperties.store(); + systemProperties.store(); saveInfo(messages -> messages.addSuccessUpdateCrawlerParams(GLOBAL)); return redirect(getClass()); } @@ -163,45 +163,45 @@ public class AdminGeneralAction extends FessAdminAction { protected void updateForm(final EditForm form) { form.loginRequired = fessConfig.isLoginRequired() ? Constants.TRUE : Constants.FALSE; - form.incrementalCrawling = crawlerProperties.getProperty(Constants.INCREMENTAL_CRAWLING_PROPERTY, Constants.TRUE); + form.incrementalCrawling = systemProperties.getProperty(Constants.INCREMENTAL_CRAWLING_PROPERTY, Constants.TRUE); form.dayForCleanup = getPropertyAsInteger(Constants.DAY_FOR_CLEANUP_PROPERTY, Constants.DEFAULT_DAY_FOR_CLEANUP); - form.crawlingThreadCount = Integer.parseInt(crawlerProperties.getProperty(Constants.CRAWLING_THREAD_COUNT_PROPERTY, "5")); - form.searchLog = crawlerProperties.getProperty(Constants.SEARCH_LOG_PROPERTY, Constants.TRUE); - form.userInfo = crawlerProperties.getProperty(Constants.USER_INFO_PROPERTY, Constants.TRUE); - form.userFavorite = crawlerProperties.getProperty(Constants.USER_FAVORITE_PROPERTY, Constants.FALSE); - form.webApiJson = crawlerProperties.getProperty(Constants.WEB_API_JSON_PROPERTY, Constants.TRUE); - form.defaultLabelValue = crawlerProperties.getProperty(Constants.DEFAULT_LABEL_VALUE_PROPERTY, StringUtil.EMPTY); - form.appendQueryParameter = crawlerProperties.getProperty(Constants.APPEND_QUERY_PARAMETER_PROPERTY, Constants.FALSE); + form.crawlingThreadCount = Integer.parseInt(systemProperties.getProperty(Constants.CRAWLING_THREAD_COUNT_PROPERTY, "5")); + form.searchLog = systemProperties.getProperty(Constants.SEARCH_LOG_PROPERTY, Constants.TRUE); + form.userInfo = systemProperties.getProperty(Constants.USER_INFO_PROPERTY, Constants.TRUE); + form.userFavorite = systemProperties.getProperty(Constants.USER_FAVORITE_PROPERTY, Constants.FALSE); + form.webApiJson = systemProperties.getProperty(Constants.WEB_API_JSON_PROPERTY, Constants.TRUE); + form.defaultLabelValue = systemProperties.getProperty(Constants.DEFAULT_LABEL_VALUE_PROPERTY, StringUtil.EMPTY); + form.appendQueryParameter = systemProperties.getProperty(Constants.APPEND_QUERY_PARAMETER_PROPERTY, Constants.FALSE); form.ignoreFailureType = - crawlerProperties.getProperty(Constants.IGNORE_FAILURE_TYPE_PROPERTY, Constants.DEFAULT_IGNORE_FAILURE_TYPE); + systemProperties.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 = fessConfig.isWebApiPopularWord() ? Constants.TRUE : Constants.FALSE; - form.csvFileEncoding = crawlerProperties.getProperty(Constants.CSV_FILE_ENCODING_PROPERTY, Constants.UTF_8); + form.csvFileEncoding = systemProperties.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)); + Integer.parseInt(systemProperties.getProperty(Constants.PURGE_SEARCH_LOG_DAY_PROPERTY, Constants.DEFAULT_PURGE_DAY)); form.purgeJobLogDay = - Integer.parseInt(crawlerProperties.getProperty(Constants.PURGE_JOB_LOG_DAY_PROPERTY, Constants.DEFAULT_PURGE_DAY)); + Integer.parseInt(systemProperties.getProperty(Constants.PURGE_JOB_LOG_DAY_PROPERTY, Constants.DEFAULT_PURGE_DAY)); form.purgeUserInfoDay = - Integer.parseInt(crawlerProperties.getProperty(Constants.PURGE_USER_INFO_DAY_PROPERTY, Constants.DEFAULT_PURGE_DAY)); - form.purgeByBots = crawlerProperties.getProperty(Constants.PURGE_BY_BOTS_PROPERTY, Constants.DEFAULT_PURGE_BY_BOTS); - form.notificationTo = crawlerProperties.getProperty(Constants.NOTIFICATION_TO_PROPERTY, StringUtil.EMPTY); - form.suggestSearchLog = crawlerProperties.getProperty(Constants.SUGGEST_SEARCH_LOG_PROPERTY, Constants.TRUE); - form.suggestDocuments = crawlerProperties.getProperty(Constants.SUGGEST_DOCUMENTS_PROPERTY, Constants.TRUE); + Integer.parseInt(systemProperties.getProperty(Constants.PURGE_USER_INFO_DAY_PROPERTY, Constants.DEFAULT_PURGE_DAY)); + form.purgeByBots = systemProperties.getProperty(Constants.PURGE_BY_BOTS_PROPERTY, Constants.DEFAULT_PURGE_BY_BOTS); + form.notificationTo = systemProperties.getProperty(Constants.NOTIFICATION_TO_PROPERTY, StringUtil.EMPTY); + form.suggestSearchLog = systemProperties.getProperty(Constants.SUGGEST_SEARCH_LOG_PROPERTY, Constants.TRUE); + form.suggestDocuments = systemProperties.getProperty(Constants.SUGGEST_DOCUMENTS_PROPERTY, Constants.TRUE); form.purgeSuggestSearchLogDay = - Integer.parseInt(crawlerProperties.getProperty(Constants.PURGE_SUGGEST_SEARCH_LOG_DAY_PROPERTY, + Integer.parseInt(systemProperties.getProperty(Constants.PURGE_SUGGEST_SEARCH_LOG_DAY_PROPERTY, Constants.DEFAULT_SUGGEST_PURGE_DAY)); - form.ldapProviderUrl = crawlerProperties.getProperty(Constants.LDAP_PROVIDER_URL, StringUtil.EMPTY); - form.ldapSecurityPrincipal = crawlerProperties.getProperty(Constants.LDAP_SECURITY_PRINCIPAL, StringUtil.EMPTY); - form.ldapBaseDn = crawlerProperties.getProperty(Constants.LDAP_BASE_DN, StringUtil.EMPTY); - form.ldapAccountFilter = crawlerProperties.getProperty(Constants.LDAP_ACCOUNT_FILTER, StringUtil.EMPTY); + form.ldapProviderUrl = systemProperties.getProperty(Constants.LDAP_PROVIDER_URL, StringUtil.EMPTY); + form.ldapSecurityPrincipal = systemProperties.getProperty(Constants.LDAP_SECURITY_PRINCIPAL, StringUtil.EMPTY); + form.ldapBaseDn = systemProperties.getProperty(Constants.LDAP_BASE_DN, StringUtil.EMPTY); + form.ldapAccountFilter = systemProperties.getProperty(Constants.LDAP_ACCOUNT_FILTER, StringUtil.EMPTY); } private void updateProperty(final String key, final String value) { - crawlerProperties.setProperty(key, value == null ? StringUtil.EMPTY : value); + systemProperties.setProperty(key, value == null ? StringUtil.EMPTY : value); } private Integer getPropertyAsInteger(final String key, final int defaultValue) { - final String value = crawlerProperties.getProperty(Constants.CRAWLING_THREAD_COUNT_PROPERTY); + final String value = systemProperties.getProperty(Constants.CRAWLING_THREAD_COUNT_PROPERTY); if (value != null) { try { return Integer.valueOf(value); diff --git a/src/main/java/org/codelibs/fess/app/web/admin/systeminfo/AdminSysteminfoAction.java b/src/main/java/org/codelibs/fess/app/web/admin/systeminfo/AdminSysteminfoAction.java index 4ad233eed..0d3dcd7c7 100644 --- a/src/main/java/org/codelibs/fess/app/web/admin/systeminfo/AdminSysteminfoAction.java +++ b/src/main/java/org/codelibs/fess/app/web/admin/systeminfo/AdminSysteminfoAction.java @@ -44,7 +44,7 @@ public class AdminSysteminfoAction extends FessAdminAction { @Resource private SystemHelper systemHelper; @Resource - protected DynamicProperties crawlerProperties; + protected DynamicProperties systemProperties; private static final String[] bugReportLabels = { "file.separator", "file.encoding", "java.runtime.version", "java.vm.info", "java.vm.name", "java.vm.vendor", "java.vm.version", "os.arch", "os.name", "os.version", "user.country", "user.language", @@ -94,7 +94,7 @@ public class AdminSysteminfoAction extends FessAdminAction { protected void registerFessPropItems(final RenderData data) { final List> itemList = new ArrayList>(); - for (final Map.Entry entry : crawlerProperties.entrySet()) { + for (final Map.Entry entry : systemProperties.entrySet()) { itemList.add(createItem(entry.getKey(), entry.getValue())); } RenderDataUtil.register(data, "fessPropItems", itemList); @@ -106,7 +106,7 @@ public class AdminSysteminfoAction extends FessAdminAction { itemList.add(createPropItem(label)); } - for (final Map.Entry entry : crawlerProperties.entrySet()) { + for (final Map.Entry entry : systemProperties.entrySet()) { if (isBugReportTarget(entry.getKey())) { itemList.add(createItem(entry.getKey(), entry.getValue())); } diff --git a/src/main/java/org/codelibs/fess/app/web/admin/wizard/AdminWizardAction.java b/src/main/java/org/codelibs/fess/app/web/admin/wizard/AdminWizardAction.java index f76cdc95c..0004c55e2 100644 --- a/src/main/java/org/codelibs/fess/app/web/admin/wizard/AdminWizardAction.java +++ b/src/main/java/org/codelibs/fess/app/web/admin/wizard/AdminWizardAction.java @@ -55,7 +55,7 @@ public class AdminWizardAction extends FessAdminAction { // Attribute // @Resource - protected DynamicProperties crawlerProperties; + protected DynamicProperties systemProperties; @Resource protected WebConfigService webConfigService; @@ -226,7 +226,7 @@ public class AdminWizardAction extends FessAdminAction { } protected Integer getDefaultInteger(final String key, final Integer defaultValue) { - final String value = crawlerProperties.getProperty(key); + final String value = systemProperties.getProperty(key); if (value != null) { try { return Integer.parseInt(value); @@ -236,7 +236,7 @@ public class AdminWizardAction extends FessAdminAction { } protected Long getDefaultLong(final String key, final Long defaultValue) { - final String value = crawlerProperties.getProperty(key); + final String value = systemProperties.getProperty(key); if (value != null) { try { return Long.parseLong(value); @@ -246,7 +246,7 @@ public class AdminWizardAction extends FessAdminAction { } protected String getDefaultString(final String key, final String defaultValue) { - final String value = crawlerProperties.getProperty(key); + final String value = systemProperties.getProperty(key); if (value != null) { return value; } 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 3d59e3c61..a4ce3a31d 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 @@ -81,7 +81,7 @@ public abstract class FessSearchAction extends FessBaseAction { protected PopularWordHelper popularWordHelper; @Resource - protected DynamicProperties crawlerProperties; + protected DynamicProperties systemProperties; @Resource protected HttpServletRequest request; @@ -92,8 +92,8 @@ public abstract class FessSearchAction extends FessBaseAction { @Override public ActionResponse hookBefore(final ActionRuntime runtime) { // application may override - searchLogSupport = Constants.TRUE.equals(crawlerProperties.getProperty(Constants.SEARCH_LOG_PROPERTY, Constants.TRUE)); - favoriteSupport = Constants.TRUE.equals(crawlerProperties.getProperty(Constants.USER_FAVORITE_PROPERTY, Constants.FALSE)); + searchLogSupport = Constants.TRUE.equals(systemProperties.getProperty(Constants.SEARCH_LOG_PROPERTY, Constants.TRUE)); + favoriteSupport = Constants.TRUE.equals(systemProperties.getProperty(Constants.USER_FAVORITE_PROPERTY, Constants.FALSE)); runtime.registerData("searchLogSupport", searchLogSupport); runtime.registerData("favoriteSupport", favoriteSupport); if (fessConfig.isWebApiPopularWord()) { @@ -139,7 +139,7 @@ public abstract class FessSearchAction extends FessBaseAction { final List> labelTypeItems = labelTypeHelper.getLabelTypeItemList(); if (!labelTypeItems.isEmpty() && !fields.containsKey(FessSearchAction.LABEL_FIELD)) { - final String defaultLabelValue = crawlerProperties.getProperty(Constants.DEFAULT_LABEL_VALUE_PROPERTY, StringUtil.EMPTY); + final String defaultLabelValue = systemProperties.getProperty(Constants.DEFAULT_LABEL_VALUE_PROPERTY, StringUtil.EMPTY); if (StringUtil.isNotBlank(defaultLabelValue)) { final String[] values = defaultLabelValue.split("\n"); if (values != null && values.length > 0) { diff --git a/src/main/java/org/codelibs/fess/app/web/go/GoAction.java b/src/main/java/org/codelibs/fess/app/web/go/GoAction.java index cb6a9ae0f..60fd4e0f0 100644 --- a/src/main/java/org/codelibs/fess/app/web/go/GoAction.java +++ b/src/main/java/org/codelibs/fess/app/web/go/GoAction.java @@ -88,7 +88,7 @@ public class GoAction extends FessSearchAction { return redirect(ErrorAction.class); } - if (Constants.TRUE.equals(crawlerProperties.getProperty(Constants.SEARCH_LOG_PROPERTY, Constants.TRUE))) { + if (Constants.TRUE.equals(systemProperties.getProperty(Constants.SEARCH_LOG_PROPERTY, Constants.TRUE))) { final String userSessionId = userInfoHelper.getUserCode(); if (userSessionId != null) { final SearchLogHelper searchLogHelper = ComponentUtil.getSearchLogHelper(); @@ -127,7 +127,7 @@ public class GoAction extends FessSearchAction { } if (isFileSystemPath(url)) { - if (Constants.TRUE.equals(crawlerProperties.getProperty(Constants.SEARCH_FILE_PROXY_PROPERTY, Constants.TRUE))) { + if (Constants.TRUE.equals(systemProperties.getProperty(Constants.SEARCH_FILE_PROXY_PROPERTY, Constants.TRUE))) { final ViewHelper viewHelper = ComponentUtil.getViewHelper(); try { return viewHelper.asContentResponse(doc); diff --git a/src/main/java/org/codelibs/fess/crawler/FessCrawlerThread.java b/src/main/java/org/codelibs/fess/crawler/FessCrawlerThread.java index 662f05d61..c56b6b861 100644 --- a/src/main/java/org/codelibs/fess/crawler/FessCrawlerThread.java +++ b/src/main/java/org/codelibs/fess/crawler/FessCrawlerThread.java @@ -56,8 +56,8 @@ public class FessCrawlerThread extends CrawlerThread { @Override protected boolean isContentUpdated(final CrawlerClient client, final UrlQueue urlQueue) { - final DynamicProperties crawlerProperties = ComponentUtil.getSystemProperties(); - if (crawlerProperties.getProperty(Constants.INCREMENTAL_CRAWLING_PROPERTY, Constants.TRUE).equals(Constants.TRUE)) { + final DynamicProperties systemProperties = ComponentUtil.getSystemProperties(); + if (systemProperties.getProperty(Constants.INCREMENTAL_CRAWLING_PROPERTY, Constants.TRUE).equals(Constants.TRUE)) { log(logHelper, LogType.CHECK_LAST_MODIFIED, crawlerContext, urlQueue); final long startTime = System.currentTimeMillis(); diff --git a/src/main/java/org/codelibs/fess/dict/DictionaryManager.java b/src/main/java/org/codelibs/fess/dict/DictionaryManager.java index 03256cc3c..3a596138a 100644 --- a/src/main/java/org/codelibs/fess/dict/DictionaryManager.java +++ b/src/main/java/org/codelibs/fess/dict/DictionaryManager.java @@ -41,7 +41,7 @@ public class DictionaryManager { private static final Logger logger = LoggerFactory.getLogger(DictionaryManager.class); @Resource - protected DynamicProperties crawlerProperties; + protected DynamicProperties systemProperties; protected List creatorList = new ArrayList<>(); diff --git a/src/main/java/org/codelibs/fess/exec/Crawler.java b/src/main/java/org/codelibs/fess/exec/Crawler.java index be2fa4434..acdf933c8 100644 --- a/src/main/java/org/codelibs/fess/exec/Crawler.java +++ b/src/main/java/org/codelibs/fess/exec/Crawler.java @@ -81,7 +81,7 @@ public class Crawler implements Serializable { protected CrawlingInfoService crawlingInfoService; @Resource - protected DynamicProperties crawlerProperties; + protected DynamicProperties systemProperties; protected static class Options { @@ -206,17 +206,17 @@ public class Crawler implements Serializable { } final CrawlingInfoHelper crawlingInfoHelper = ComponentUtil.getCrawlingInfoHelper(); - final DynamicProperties crawlerProperties = ComponentUtil.getSystemProperties(); + final DynamicProperties systemProperties = ComponentUtil.getSystemProperties(); if (StringUtil.isNotBlank(options.propertiesPath)) { - crawlerProperties.reload(options.propertiesPath); + systemProperties.reload(options.propertiesPath); } else { try { final File propFile = File.createTempFile("crawler_", ".properties"); if (propFile.delete() && logger.isDebugEnabled()) { logger.debug("Deleted a temp file: " + propFile.getAbsolutePath()); } - crawlerProperties.reload(propFile.getAbsolutePath()); + systemProperties.reload(propFile.getAbsolutePath()); propFile.deleteOnExit(); // NOSONAR } catch (final IOException e) { logger.warn("Failed to create system properties file.", e); @@ -230,7 +230,7 @@ public class Crawler implements Serializable { dayForCleanupStr = options.expires; } else { dayForCleanupStr = - crawlerProperties.getProperty(Constants.DAY_FOR_CLEANUP_PROPERTY, Constants.DEFAULT_DAY_FOR_CLEANUP.toString()); + systemProperties.getProperty(Constants.DAY_FOR_CLEANUP_PROPERTY, Constants.DEFAULT_DAY_FOR_CLEANUP.toString()); } int dayForCleanup = -1; try { @@ -272,7 +272,7 @@ public class Crawler implements Serializable { } protected void sendMail(final Map infoMap) { - final String toStrs = (String) crawlerProperties.get(Constants.NOTIFICATION_TO_PROPERTY); + final String toStrs = (String) systemProperties.get(Constants.NOTIFICATION_TO_PROPERTY); if (StringUtil.isNotBlank(toStrs)) { final String[] toAddresses = toStrs.split(","); final Map dataMap = new HashMap<>(); diff --git a/src/main/java/org/codelibs/fess/exec/SuggestCreator.java b/src/main/java/org/codelibs/fess/exec/SuggestCreator.java index 4bf9d9fc0..d421d2e8a 100644 --- a/src/main/java/org/codelibs/fess/exec/SuggestCreator.java +++ b/src/main/java/org/codelibs/fess/exec/SuggestCreator.java @@ -113,17 +113,17 @@ public class SuggestCreator implements Serializable { } private static int process(final Options options) { - final DynamicProperties crawlerProperties = ComponentUtil.getSystemProperties(); + final DynamicProperties systemProperties = ComponentUtil.getSystemProperties(); if (StringUtil.isNotBlank(options.propertiesPath)) { - crawlerProperties.reload(options.propertiesPath); + systemProperties.reload(options.propertiesPath); } else { try { final File propFile = File.createTempFile("suggest_", ".properties"); if (propFile.delete() && logger.isDebugEnabled()) { logger.debug("Deleted a temp file: " + propFile.getAbsolutePath()); } - crawlerProperties.reload(propFile.getAbsolutePath()); + systemProperties.reload(propFile.getAbsolutePath()); propFile.deleteOnExit(); // NOSONAR } catch (final IOException e) { logger.warn("Failed to create system properties file.", e); @@ -140,8 +140,8 @@ public class SuggestCreator implements Serializable { } private int create() { - final DynamicProperties crawlerProperties = ComponentUtil.getSystemProperties(); - if (!Constants.TRUE.equals(crawlerProperties.getProperty(Constants.SUGGEST_DOCUMENTS_PROPERTY, Constants.TRUE))) { + final DynamicProperties systemProperties = ComponentUtil.getSystemProperties(); + if (!Constants.TRUE.equals(systemProperties.getProperty(Constants.SUGGEST_DOCUMENTS_PROPERTY, Constants.TRUE))) { logger.info("Skip create suggest document."); return 0; } @@ -171,12 +171,12 @@ public class SuggestCreator implements Serializable { private int purge(final LocalDateTime time) { final SuggestHelper suggestHelper = ComponentUtil.getSuggestHelper(); - final DynamicProperties crawlerProperties = ComponentUtil.getSystemProperties(); + final DynamicProperties systemProperties = ComponentUtil.getSystemProperties(); try { suggestHelper.purgeDocumentSuggest(time); final long cleanupDay = - Long.parseLong(crawlerProperties.getProperty(Constants.PURGE_SUGGEST_SEARCH_LOG_DAY_PROPERTY, + Long.parseLong(systemProperties.getProperty(Constants.PURGE_SUGGEST_SEARCH_LOG_DAY_PROPERTY, Constants.DEFAULT_SUGGEST_PURGE_DAY)); if (cleanupDay > 0) { suggestHelper.purgeSearchlogSuggest(time.minusDays(cleanupDay)); diff --git a/src/main/java/org/codelibs/fess/helper/DataIndexHelper.java b/src/main/java/org/codelibs/fess/helper/DataIndexHelper.java index 2778f7094..6712fb1b3 100644 --- a/src/main/java/org/codelibs/fess/helper/DataIndexHelper.java +++ b/src/main/java/org/codelibs/fess/helper/DataIndexHelper.java @@ -50,7 +50,7 @@ public class DataIndexHelper implements Serializable { private static final String DELETE_OLD_DOCS = "delete_old_docs"; @Resource - protected DynamicProperties crawlerProperties; + protected DynamicProperties systemProperties; @Resource public DataConfigService dataConfigService; @@ -94,7 +94,7 @@ public class DataIndexHelper implements Serializable { protected void doCrawl(final String sessionId, final List configList) { int multiprocessCrawlingCount = 5; - final String value = crawlerProperties.getProperty(Constants.CRAWLING_THREAD_COUNT_PROPERTY, "5"); + final String value = systemProperties.getProperty(Constants.CRAWLING_THREAD_COUNT_PROPERTY, "5"); try { multiprocessCrawlingCount = Integer.parseInt(value); } catch (final NumberFormatException e) { diff --git a/src/main/java/org/codelibs/fess/helper/QueryHelper.java b/src/main/java/org/codelibs/fess/helper/QueryHelper.java index 299c74918..4de72e749 100644 --- a/src/main/java/org/codelibs/fess/helper/QueryHelper.java +++ b/src/main/java/org/codelibs/fess/helper/QueryHelper.java @@ -79,7 +79,7 @@ public class QueryHelper implements Serializable { protected static final String INURL_FIELD = "inurl"; @Resource - protected DynamicProperties crawlerProperties; + protected DynamicProperties systemProperties; @Resource protected FessConfig fessConfig; diff --git a/src/main/java/org/codelibs/fess/helper/SearchLogHelper.java b/src/main/java/org/codelibs/fess/helper/SearchLogHelper.java index b2cc58a06..f9e03a8a6 100644 --- a/src/main/java/org/codelibs/fess/helper/SearchLogHelper.java +++ b/src/main/java/org/codelibs/fess/helper/SearchLogHelper.java @@ -54,7 +54,7 @@ public class SearchLogHelper { private static final Logger logger = LoggerFactory.getLogger(SearchLogHelper.class); @Resource - protected DynamicProperties crawlerProperties; + protected DynamicProperties systemProperties; public long userCheckInterval = 5 * 60 * 1000;// 5 min @@ -132,7 +132,7 @@ public class SearchLogHelper { } protected void processSearchLogQueue(final Queue queue) { - final String value = crawlerProperties.getProperty(Constants.PURGE_BY_BOTS_PROPERTY, StringUtil.EMPTY); + final String value = systemProperties.getProperty(Constants.PURGE_BY_BOTS_PROPERTY, StringUtil.EMPTY); String[] botNames; if (StringUtil.isBlank(value)) { botNames = StringUtil.EMPTY_STRINGS; diff --git a/src/main/java/org/codelibs/fess/helper/ViewHelper.java b/src/main/java/org/codelibs/fess/helper/ViewHelper.java index 3de46746f..4603e22b3 100644 --- a/src/main/java/org/codelibs/fess/helper/ViewHelper.java +++ b/src/main/java/org/codelibs/fess/helper/ViewHelper.java @@ -90,7 +90,7 @@ public class ViewHelper implements Serializable { protected UserAgentHelper userAgentHelper; @Resource - protected DynamicProperties crawlerProperties; + protected DynamicProperties systemProperties; public int descriptionLength = 200; @@ -247,44 +247,44 @@ public class ViewHelper implements Serializable { switch (ua) { case IE: if (isLocalFile) { - url = url.replaceFirst("file:/+", crawlerProperties.getProperty("file.protocol.winlocal.ie", "file://")); + url = url.replaceFirst("file:/+", systemProperties.getProperty("file.protocol.winlocal.ie", "file://")); } else { - url = url.replaceFirst("file:/+", crawlerProperties.getProperty("file.protocol.ie", "file://")); + url = url.replaceFirst("file:/+", systemProperties.getProperty("file.protocol.ie", "file://")); } break; case FIREFOX: if (isLocalFile) { - url = url.replaceFirst("file:/+", crawlerProperties.getProperty("file.protocol.winlocal.firefox", "file://")); + url = url.replaceFirst("file:/+", systemProperties.getProperty("file.protocol.winlocal.firefox", "file://")); } else { - url = url.replaceFirst("file:/+", crawlerProperties.getProperty("file.protocol.firefox", "file://///")); + url = url.replaceFirst("file:/+", systemProperties.getProperty("file.protocol.firefox", "file://///")); } break; case CHROME: if (isLocalFile) { - url = url.replaceFirst("file:/+", crawlerProperties.getProperty("file.protocol.winlocal.chrome", "file://")); + url = url.replaceFirst("file:/+", systemProperties.getProperty("file.protocol.winlocal.chrome", "file://")); } else { - url = url.replaceFirst("file:/+", crawlerProperties.getProperty("file.protocol.chrome", "file://")); + url = url.replaceFirst("file:/+", systemProperties.getProperty("file.protocol.chrome", "file://")); } break; case SAFARI: if (isLocalFile) { - url = url.replaceFirst("file:/+", crawlerProperties.getProperty("file.protocol.winlocal.safari", "file://")); + url = url.replaceFirst("file:/+", systemProperties.getProperty("file.protocol.winlocal.safari", "file://")); } else { - url = url.replaceFirst("file:/+", crawlerProperties.getProperty("file.protocol.safari", "file:////")); + url = url.replaceFirst("file:/+", systemProperties.getProperty("file.protocol.safari", "file:////")); } break; case OPERA: if (isLocalFile) { - url = url.replaceFirst("file:/+", crawlerProperties.getProperty("file.protocol.winlocal.opera", "file://")); + url = url.replaceFirst("file:/+", systemProperties.getProperty("file.protocol.winlocal.opera", "file://")); } else { - url = url.replaceFirst("file:/+", crawlerProperties.getProperty("file.protocol.opera", "file://")); + url = url.replaceFirst("file:/+", systemProperties.getProperty("file.protocol.opera", "file://")); } break; default: if (isLocalFile) { - url = url.replaceFirst("file:/+", crawlerProperties.getProperty("file.protocol.winlocal.other", "file://")); + url = url.replaceFirst("file:/+", systemProperties.getProperty("file.protocol.winlocal.other", "file://")); } else { - url = url.replaceFirst("file:/+", crawlerProperties.getProperty("file.protocol.other", "file://")); + url = url.replaceFirst("file:/+", systemProperties.getProperty("file.protocol.other", "file://")); } break; } @@ -305,7 +305,7 @@ public class ViewHelper implements Serializable { } protected String appendQueryParameter(final Map document, final String url) { - if (Constants.TRUE.equals(crawlerProperties.get(Constants.APPEND_QUERY_PARAMETER_PROPERTY))) { + if (Constants.TRUE.equals(systemProperties.get(Constants.APPEND_QUERY_PARAMETER_PROPERTY))) { final FessConfig fessConfig = ComponentUtil.getFessConfig(); final String mimetype = getString(document, fessConfig.getIndexFieldMimetype()); if (StringUtil.isNotBlank(mimetype)) { diff --git a/src/main/java/org/codelibs/fess/helper/WebFsIndexHelper.java b/src/main/java/org/codelibs/fess/helper/WebFsIndexHelper.java index 783ea5f07..a4705c1d4 100644 --- a/src/main/java/org/codelibs/fess/helper/WebFsIndexHelper.java +++ b/src/main/java/org/codelibs/fess/helper/WebFsIndexHelper.java @@ -51,7 +51,7 @@ public class WebFsIndexHelper implements Serializable { private static final Logger logger = LoggerFactory.getLogger(WebFsIndexHelper.class); @Resource - protected DynamicProperties crawlerProperties; + protected DynamicProperties systemProperties; @Resource public WebConfigService webConfigService; @@ -126,7 +126,7 @@ public class WebFsIndexHelper implements Serializable { protected void doCrawl(final String sessionId, final List webConfigList, final List fileConfigList) { int multiprocessCrawlingCount = 5; - final String value = crawlerProperties.getProperty(Constants.CRAWLING_THREAD_COUNT_PROPERTY, "5"); + final String value = systemProperties.getProperty(Constants.CRAWLING_THREAD_COUNT_PROPERTY, "5"); try { multiprocessCrawlingCount = Integer.parseInt(value); } catch (final NumberFormatException e) { diff --git a/src/main/java/org/codelibs/fess/job/PurgeLogJob.java b/src/main/java/org/codelibs/fess/job/PurgeLogJob.java index 32d82c817..525300eb3 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.getSystemProperties(); + final DynamicProperties systemProperties = ComponentUtil.getSystemProperties(); final SystemHelper systemHelper = ComponentUtil.getSystemHelper(); final StringBuilder resultBuf = new StringBuilder(); @@ -50,7 +50,7 @@ public class PurgeLogJob { // purge search logs try { - final String value = crawlerProperties.getProperty(Constants.PURGE_SEARCH_LOG_DAY_PROPERTY, Constants.DEFAULT_PURGE_DAY); + final String value = systemProperties.getProperty(Constants.PURGE_SEARCH_LOG_DAY_PROPERTY, Constants.DEFAULT_PURGE_DAY); final int days = Integer.parseInt(value); if (days >= 0) { searchLogService.deleteBefore(days); @@ -64,7 +64,7 @@ public class PurgeLogJob { // purge job logs try { - final String value = crawlerProperties.getProperty(Constants.PURGE_JOB_LOG_DAY_PROPERTY, Constants.DEFAULT_PURGE_DAY); + final String value = systemProperties.getProperty(Constants.PURGE_JOB_LOG_DAY_PROPERTY, Constants.DEFAULT_PURGE_DAY); final int days = Integer.parseInt(value); if (days >= 0) { jobLogService.deleteBefore(days); @@ -78,7 +78,7 @@ public class PurgeLogJob { // purge user info try { - final String value = crawlerProperties.getProperty(Constants.PURGE_USER_INFO_DAY_PROPERTY, Constants.DEFAULT_PURGE_DAY); + final String value = systemProperties.getProperty(Constants.PURGE_USER_INFO_DAY_PROPERTY, Constants.DEFAULT_PURGE_DAY); final int days = Integer.parseInt(value); if (days >= 0) { userInfoService.deleteBefore(days); diff --git a/src/main/java/org/codelibs/fess/util/ComponentUtil.java b/src/main/java/org/codelibs/fess/util/ComponentUtil.java index 48879e5e1..62d3333a2 100644 --- a/src/main/java/org/codelibs/fess/util/ComponentUtil.java +++ b/src/main/java/org/codelibs/fess/util/ComponentUtil.java @@ -110,7 +110,7 @@ public final class ComponentUtil { private static final String SYSTEM_HELPER = "systemHelper"; - private static final String CRAWLER_PROPERTIES = "crawlerProperties"; + private static final String CRAWLER_PROPERTIES = "systemProperties"; private static final String PROPERTIES_SUFFIX = "Properties"; diff --git a/src/main/resources/fess_config.xml b/src/main/resources/fess_config.xml index 04a27b904..ff43e0132 100644 --- a/src/main/resources/fess_config.xml +++ b/src/main/resources/fess_config.xml @@ -2,7 +2,7 @@ - + org.codelibs.fess.util.ResourceUtil.getConfPath("system.properties")