rename to systemProperties
This commit is contained in:
parent
5aeb0d05d9
commit
b7a620ccaa
27 changed files with 106 additions and 107 deletions
|
@ -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" };
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
||||
|
|
|
@ -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<String> 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 {
|
||||
|
|
|
@ -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<String> langSet = new HashSet<>();
|
||||
final Enumeration<Locale> locales = request.getLocales();
|
||||
if (locales != null) {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
// ===================================================================================
|
||||
|
|
|
@ -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<String> loadFileNameItems() {
|
||||
|
|
|
@ -57,7 +57,7 @@ public class AdminDictKuromojiAction extends FessAdminAction {
|
|||
@Resource
|
||||
private SystemHelper systemHelper;
|
||||
@Resource
|
||||
protected DynamicProperties crawlerProperties;
|
||||
protected DynamicProperties systemProperties;
|
||||
|
||||
// ===================================================================================
|
||||
// Hook
|
||||
|
|
|
@ -60,7 +60,7 @@ public class AdminDictSynonymAction extends FessAdminAction {
|
|||
@Resource
|
||||
private SystemHelper systemHelper;
|
||||
@Resource
|
||||
protected DynamicProperties crawlerProperties;
|
||||
protected DynamicProperties systemProperties;
|
||||
|
||||
// ===================================================================================
|
||||
// Hook
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
// ===================================================================================
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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<Map<String, String>> itemList = new ArrayList<Map<String, String>>();
|
||||
for (final Map.Entry<Object, Object> entry : crawlerProperties.entrySet()) {
|
||||
for (final Map.Entry<Object, Object> 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<Object, Object> entry : crawlerProperties.entrySet()) {
|
||||
for (final Map.Entry<Object, Object> entry : systemProperties.entrySet()) {
|
||||
if (isBugReportTarget(entry.getKey())) {
|
||||
itemList.add(createItem(entry.getKey(), entry.getValue()));
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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<Map<String, String>> 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) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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<DictionaryCreator> creatorList = new ArrayList<>();
|
||||
|
||||
|
|
|
@ -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<String, String> 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<String, String> dataMap = new HashMap<>();
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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<DataConfig> 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) {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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<SearchLog> 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;
|
||||
|
|
|
@ -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<String, Object> 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)) {
|
||||
|
|
|
@ -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<WebConfig> webConfigList, final List<FileConfig> 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) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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";
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<!DOCTYPE components PUBLIC "-//DBFLUTE//DTD LastaDi 1.0//EN"
|
||||
"http://dbflute.org/meta/lastadi10.dtd">
|
||||
<components>
|
||||
<component name="crawlerProperties" class="org.codelibs.core.misc.DynamicProperties">
|
||||
<component name="systemProperties" class="org.codelibs.core.misc.DynamicProperties">
|
||||
<arg>
|
||||
org.codelibs.fess.util.ResourceUtil.getConfPath("system.properties")
|
||||
</arg>
|
||||
|
|
Loading…
Add table
Reference in a new issue