Browse Source

rename to system.properties

Shinsuke Sugaya 9 years ago
parent
commit
4c130567fe

+ 1 - 3
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";

+ 1 - 1
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;
         }
 

+ 2 - 2
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));

+ 3 - 1
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);
     }
 

+ 1 - 1
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);

+ 2 - 2
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);
             }
         }
 

+ 5 - 5
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);

+ 1 - 1
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());
             }
 

+ 1 - 1
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();

+ 1 - 1
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());
             }
 

+ 3 - 3
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}";

+ 26 - 8
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() {

+ 1 - 1
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);
     }
 

+ 1 - 1
src/main/resources/fess_config.xml

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

+ 1 - 1
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

+ 1 - 1
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

+ 1 - 1
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

+ 1 - 1
src/main/webapp/WEB-INF/view/admin/systeminfo/admin_systeminfo.jsp

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