Repository: dadoonet/elasticsearch-beyonder
Pull request #358 (2025-03-06 14:59:17)

Cleanup before release
* Fix the javadoc
* Replace `SettingsFinder.Defaults` inner class by `DefaultSettings` class


Patch:
diff --git a/src/main/java/fr/pilato/elasticsearch/tools/ElasticsearchBeyonder.java b/src/main/java/fr/pilato/elasticsearch/tools/ElasticsearchBeyonder.java
index 6d74783..93299b3 100644
--- a/src/main/java/fr/pilato/elasticsearch/tools/ElasticsearchBeyonder.java
+++ b/src/main/java/fr/pilato/elasticsearch/tools/ElasticsearchBeyonder.java
@@ -19,7 +19,7 @@
 
 package fr.pilato.elasticsearch.tools;
 
-import fr.pilato.elasticsearch.tools.util.SettingsFinder.Defaults;
+import fr.pilato.elasticsearch.tools.util.DefaultSettings;
 import fr.pilato.elasticsearch.tools.util.ResourceList;
 import org.elasticsearch.client.RestClient;
 import org.slf4j.Logger;
@@ -78,13 +78,17 @@ public class ElasticsearchBeyonder {
 
 	private static final Logger logger = LoggerFactory.getLogger(ElasticsearchBeyonder.class);
 
+	private ElasticsearchBeyonder() {
+		// empty
+	}
+
 	/**
 	 * Automatically scan classpath and creates indices, types, templates... in default dir.
 	 * @param client elasticsearch client
 	 * @throws Exception when beyonder can not start
 	 */
 	public static void start(RestClient client) throws Exception {
-		start(client, Defaults.ConfigDir, Defaults.ForceCreation);
+		start(client, DefaultSettings.ConfigDir, DefaultSettings.ForceCreation);
 	}
 
 	/**
@@ -94,7 +98,7 @@ public class ElasticsearchBeyonder {
 	 * @throws Exception when beyonder can not start
 	 */
 	public static void start(RestClient client, String root) throws Exception {
-		start(client, root, Defaults.ForceCreation);
+		start(client, root, DefaultSettings.ForceCreation);
 	}
 
 	/**
@@ -108,25 +112,25 @@ public class ElasticsearchBeyonder {
 		logger.info("starting automatic settings/mappings discovery");
 
 		// create index lifecycles
-		List<String> indexLifecycles = ResourceList.getResourceNames(root, Defaults.IndexLifecyclesDir);
+		List<String> indexLifecycles = ResourceList.getResourceNames(root, DefaultSettings.IndexLifecyclesDir);
 		for (String indexLifecycleName : indexLifecycles) {
 			createIndexLifecycle(client, root, indexLifecycleName);
 		}
 
 		// create component templates
-		List<String> componentTemplates = ResourceList.getResourceNames(root, Defaults.ComponentTemplatesDir);
+		List<String> componentTemplates = ResourceList.getResourceNames(root, DefaultSettings.ComponentTemplatesDir);
 		for (String componentTemplateName : componentTemplates) {
 			createComponentTemplate(client, root, componentTemplateName);
 		}
 
 		// create index templates
-		List<String> indexTemplateNames = ResourceList.getResourceNames(root, Defaults.IndexTemplatesDir);
+		List<String> indexTemplateNames = ResourceList.getResourceNames(root, DefaultSettings.IndexTemplatesDir);
 		for (String indexTemplateName : indexTemplateNames) {
 			createIndexTemplate(client, root, indexTemplateName);
 		}
 
 		// create pipelines
-		List<String> pipelineNames = ResourceList.getResourceNames(root, Defaults.PipelinesDir);
+		List<String> pipelineNames = ResourceList.getResourceNames(root, DefaultSettings.PipelinesDir);
 		for (String pipelineName : pipelineNames) {
 			createPipeline(client, root, pipelineName);
 		}
diff --git a/src/main/java/fr/pilato/elasticsearch/tools/updaters/ElasticsearchAliasUpdater.java b/src/main/java/fr/pilato/elasticsearch/tools/updaters/ElasticsearchAliasUpdater.java
index da587f0..6130cb9 100644
--- a/src/main/java/fr/pilato/elasticsearch/tools/updaters/ElasticsearchAliasUpdater.java
+++ b/src/main/java/fr/pilato/elasticsearch/tools/updaters/ElasticsearchAliasUpdater.java
@@ -19,7 +19,7 @@
 
 package fr.pilato.elasticsearch.tools.updaters;
 
-import fr.pilato.elasticsearch.tools.util.SettingsFinder;
+import fr.pilato.elasticsearch.tools.util.DefaultSettings;
 import org.elasticsearch.client.Request;
 import org.elasticsearch.client.Response;
 import org.elasticsearch.client.RestClient;
@@ -28,10 +28,17 @@ import org.slf4j.LoggerFactory;
 
 import static fr.pilato.elasticsearch.tools.util.SettingsReader.getJsonContent;
 
+/**
+ * Manage aliases in Elasticsearch.
+ */
 public class ElasticsearchAliasUpdater {
 
     private static final Logger logger = LoggerFactory.getLogger(ElasticsearchAliasUpdater.class);
 
+    private ElasticsearchAliasUpdater() {
+        // empty
+    }
+
     /**
      * Manage global aliases in Elasticsearch.
      * @param client Elasticsearch client
@@ -39,9 +46,9 @@ public class ElasticsearchAliasUpdater {
      * @throws Exception if something goes wrong
      */
     public static void manageAliases(RestClient client, String root) throws Exception {
-        String json = getJsonContent(root, null, SettingsFinder.Defaults.AliasesFile);
+        String json = getJsonContent(root, null, DefaultSettings.AliasesFile);
         if (json != null) {
-            logger.debug("Found [{}/{}.{}] file", root, SettingsFinder.Defaults.AliasesFile, SettingsFinder.Defaults.JsonFileExtension);
+            logger.debug("Found [{}/{}] file", root, DefaultSettings.AliasesFile);
             manageAliasesWithJsonInElasticsearch(client, json);
         }
     }
diff --git a/src/main/java/fr/pilato/elasticsearch/tools/updaters/ElasticsearchComponentTemplateUpdater.java b/src/main/java/fr/pilato/elasticsearch/tools/updaters/ElasticsearchComponentTemplateUpdater.java
index 7c16f7f..c93bb49 100644
--- a/src/main/java/fr/pilato/elasticsearch/tools/updaters/ElasticsearchComponentTemplateUpdater.java
+++ b/src/main/java/fr/pilato/elasticsearch/tools/updaters/ElasticsearchComponentTemplateUpdater.java
@@ -19,7 +19,7 @@
 
 package fr.pilato.elasticsearch.tools.updaters;
 
-import fr.pilato.elasticsearch.tools.util.SettingsFinder;
+import fr.pilato.elasticsearch.tools.util.DefaultSettings;
 import org.elasticsearch.client.Request;
 import org.elasticsearch.client.Response;
 import org.elasticsearch.client.RestClient;
@@ -36,6 +36,10 @@ public class ElasticsearchComponentTemplateUpdater {
 
 	private static final Logger logger = LoggerFactory.getLogger(ElasticsearchComponentTemplateUpdater.class);
 
+	private ElasticsearchComponentTemplateUpdater() {
+		// empty
+	}
+
 	/**
 	 * Create an component template in Elasticsearch.
 	 * @param client Elasticsearch client
@@ -44,7 +48,7 @@ public class ElasticsearchComponentTemplateUpdater {
 	 * @throws Exception if something goes wrong
 	 */
 	public static void createComponentTemplate(RestClient client, String root, String template) throws Exception {
-		String json = getJsonContent(root, SettingsFinder.Defaults.ComponentTemplatesDir, template);
+		String json = getJsonContent(root, DefaultSettings.ComponentTemplatesDir, template + DefaultSettings.JsonFileExtension);
 		createComponentTemplateWithJsonInElasticsearch(client, template, json);
 	}
 
diff --git a/src/main/java/fr/pilato/elasticsearch/tools/updaters/ElasticsearchDataUpdater.java b/src/main/java/fr/pilato/elasticsearch/tools/updaters/ElasticsearchDataUpdater.java
index 43accf0..aca5547 100644
--- a/src/main/java/fr/pilato/elasticsearch/tools/updaters/ElasticsearchDataUpdater.java
+++ b/src/main/java/fr/pilato/elasticsearch/tools/updaters/ElasticsearchDataUpdater.java
@@ -19,7 +19,7 @@
 
 package fr.pilato.elasticsearch.tools.updaters;
 
-import fr.pilato.elasticsearch.tools.util.SettingsFinder.Defaults;
+import fr.pilato.elasticsearch.tools.util.DefaultSettings;
 import org.elasticsearch.client.Request;
 import org.elasticsearch.client.Response;
 import org.elasticsearch.client.RestClient;
@@ -38,6 +38,10 @@ public class ElasticsearchDataUpdater {
 
 	private static final Logger logger = LoggerFactory.getLogger(ElasticsearchDataUpdater.class);
 
+	private ElasticsearchDataUpdater() {
+		// empty
+	}
+
 	/**
 	 * Load data from a given ndjson file within the classpath and send it to elasticsearch using the Bulk API.
 	 *
@@ -49,7 +53,7 @@ public class ElasticsearchDataUpdater {
 	 */
 	public static void loadBulkData(RestClient client, String root, String index, Collection<String> bulkFiles) throws Exception {
 		// If we don't have an index name, we will use _bulk as the subdir to use
-		String subdir = index == null ? Defaults.DataDir : index + "/" + Defaults.DataDir;
+		String subdir = index == null ? DefaultSettings.DataDir : index + "/" + DefaultSettings.DataDir;
 		for (String bulkFile : bulkFiles) {
 			String ndjson = getFileContent(root, subdir, bulkFile);
 			if (ndjson != null) {
@@ -74,7 +78,7 @@ public class ElasticsearchDataUpdater {
 			throw new Exception("You must provide an index name when you want to load data from a json file.");
 		}
 
-		String subdir = index + "/" + Defaults.DataDir;
+		String subdir = index + "/" + DefaultSettings.DataDir;
 		for (String jsonFile : jsonFiles) {
 			String json = getFileContent(root, subdir, jsonFile);
 			if (json != null) {
diff --git a/src/main/java/fr/pilato/elasticsearch/tools/updaters/ElasticsearchIndexLifecycleUpdater.java b/src/main/java/fr/pilato/elasticsearch/tools/updaters/ElasticsearchIndexLifecycleUpdater.java
index e28d9f0..6eec5d4 100644
--- a/src/main/java/fr/pilato/elasticsearch/tools/updaters/ElasticsearchIndexLifecycleUpdater.java
+++ b/src/main/java/fr/pilato/elasticsearch/tools/updaters/ElasticsearchIndexLifecycleUpdater.java
@@ -19,7 +19,7 @@
 
 package fr.pilato.elasticsearch.tools.updaters;
 
-import fr.pilato.elasticsearch.tools.util.SettingsFinder;
+import fr.pilato.elasticsearch.tools.util.DefaultSettings;
 import org.elasticsearch.client.Request;
 import org.elasticsearch.client.Response;
 import org.elasticsearch.client.RestClient;
@@ -35,6 +35,10 @@ public class ElasticsearchIndexLifecycleUpdater {
 
 	private static final Logger logger = LoggerFactory.getLogger(ElasticsearchIndexLifecycleUpdater.class);
 
+	private ElasticsearchIndexLifecycleUpdater() {
+		// empty
+	}
+
 	/**
 	 * Create an index lifecycle policy in Elasticsearch.
 	 * @param client Elasticsearch client
@@ -43,7 +47,7 @@ public class ElasticsearchIndexLifecycleUpdater {
 	 * @throws Exception if something goes wrong
 	 */
 	public static void createIndexLifecycle(RestClient client, String root, String policy) throws Exception {
-		String json = getJsonContent(root, SettingsFinder.Defaults.IndexLifecyclesDir, policy);
+		String json = getJsonContent(root, DefaultSettings.IndexLifecyclesDir, policy  + DefaultSettings.JsonFileExtension);
 		createIndexLifecycleWithJsonInElasticsearch(client, policy, json);
 	}
 
diff --git a/src/main/java/fr/pilato/elasticsearch/tools/updaters/ElasticsearchIndexTemplateUpdater.java b/src/main/java/fr/pilato/elasticsearch/tools/updaters/ElasticsearchIndexTemplateUpdater.java
index b96d9b5..99e5187 100644
--- a/src/main/java/fr/pilato/elasticsearch/tools/updaters/ElasticsearchIndexTemplateUpdater.java
+++ b/src/main/java/fr/pilato/elasticsearch/tools/updaters/ElasticsearchIndexTemplateUpdater.java
@@ -19,7 +19,7 @@
 
 package fr.pilato.elasticsearch.tools.updaters;
 
-import fr.pilato.elasticsearch.tools.util.SettingsFinder;
+import fr.pilato.elasticsearch.tools.util.DefaultSettings;
 import org.elasticsearch.client.Request;
 import org.elasticsearch.client.Response;
 import org.elasticsearch.client.RestClient;
@@ -36,6 +36,10 @@ public class ElasticsearchIndexTemplateUpdater {
 
 	private static final Logger logger = LoggerFactory.getLogger(ElasticsearchIndexTemplateUpdater.class);
 
+	private ElasticsearchIndexTemplateUpdater() {
+		// empty
+	}
+
 	/**
 	 * Create an index template in Elasticsearch.
 	 * @param client Elasticsearch client
@@ -44,7 +48,7 @@ public class ElasticsearchIndexTemplateUpdater {
 	 * @throws Exception if something goes wrong
 	 */
 	public static void createIndexTemplate(RestClient client, String root, String template) throws Exception {
-		String json = getJsonContent(root, SettingsFinder.Defaults.IndexTemplatesDir, template);
+		String json = getJsonContent(root, DefaultSettings.IndexTemplatesDir, template + DefaultSettings.JsonFileExtension);
 		createIndexTemplateWithJsonInElasticsearch(client, template, json);
 	}
 
diff --git a/src/main/java/fr/pilato/elasticsearch/tools/updaters/ElasticsearchIndexUpdater.java b/src/main/java/fr/pilato/elasticsearch/tools/updaters/ElasticsearchIndexUpdater.java
index 02af724..868db26 100644
--- a/src/main/java/fr/pilato/elasticsearch/tools/updaters/ElasticsearchIndexUpdater.java
+++ b/src/main/java/fr/pilato/elasticsearch/tools/updaters/ElasticsearchIndexUpdater.java
@@ -19,7 +19,7 @@
 
 package fr.pilato.elasticsearch.tools.updaters;
 
-import fr.pilato.elasticsearch.tools.util.SettingsFinder;
+import fr.pilato.elasticsearch.tools.util.DefaultSettings;
 import org.elasticsearch.client.Request;
 import org.elasticsearch.client.Response;
 import org.elasticsearch.client.ResponseException;
@@ -41,16 +41,21 @@ public class ElasticsearchIndexUpdater {
 
 	private static final Logger logger = LoggerFactory.getLogger(ElasticsearchIndexUpdater.class);
 
+	private ElasticsearchIndexUpdater() {
+		// empty
+	}
+
 	/**
 	 * Create a new index in Elasticsearch. Read also _settings.json if exists.
 	 * @param client Elasticsearch client
 	 * @param root dir within the classpath
 	 * @param index Index name
 	 * @param force Remove index if exists (Warning: remove all data)
+	 * @return true if we created the index and false if the index already existed
 	 * @throws Exception if the elasticsearch API call is failing
 	 */
 	public static boolean createIndex(RestClient client, String root, String index, boolean force) throws Exception {
-		String json = getJsonContent(root, index, SettingsFinder.Defaults.IndexSettingsFileName);
+		String json = getJsonContent(root, index, DefaultSettings.IndexSettingsFileName);
 		return createIndexWithSettings(client, index, json, force);
 	}
 
@@ -220,7 +225,7 @@ public class ElasticsearchIndexUpdater {
 	 * @throws Exception if the elasticsearch API call is failing
 	 */
 	public static void updateSettings(RestClient client, String root, String index) throws Exception {
-		String json = getJsonContent(root, index, SettingsFinder.Defaults.UpdateIndexSettingsFileName);
+		String json = getJsonContent(root, index, DefaultSettings.UpdateIndexSettingsFileName);
 		updateIndexWithSettingsInElasticsearch(client, index, json);
 	}
 
@@ -232,7 +237,7 @@ public class ElasticsearchIndexUpdater {
 	 * @throws Exception if the elasticsearch API call is failing
 	 */
 	public static void updateMapping(RestClient client, String root, String index) throws Exception {
-		String json = getJsonContent(root, index, SettingsFinder.Defaults.UpdateIndexMappingFileName);
+		String json = getJsonContent(root, index, DefaultSettings.UpdateIndexMappingFileName);
 		updateMappingInElasticsearch(client, index, json);
 	}
 }
diff --git a/src/main/java/fr/pilato/elasticsearch/tools/updaters/ElasticsearchPipelineUpdater.java b/src/main/java/fr/pilato/elasticsearch/tools/updaters/ElasticsearchPipelineUpdater.java
index 47bc452..9802df8 100644
--- a/src/main/java/fr/pilato/elasticsearch/tools/updaters/ElasticsearchPipelineUpdater.java
+++ b/src/main/java/fr/pilato/elasticsearch/tools/updaters/ElasticsearchPipelineUpdater.java
@@ -21,7 +21,7 @@ package fr.pilato.elasticsearch.tools.updaters;
 
 import java.io.IOException;
 
-import fr.pilato.elasticsearch.tools.util.SettingsFinder;
+import fr.pilato.elasticsearch.tools.util.DefaultSettings;
 import org.elasticsearch.client.Request;
 import org.elasticsearch.client.Response;
 import org.elasticsearch.client.ResponseException;
@@ -41,6 +41,10 @@ public class ElasticsearchPipelineUpdater {
 
     private static final Logger logger = LoggerFactory.getLogger(ElasticsearchPipelineUpdater.class);
 
+    private ElasticsearchPipelineUpdater() {
+        // empty
+    }
+
     /**
      * Create a pipeline in Elasticsearch.
      * 
@@ -50,7 +54,7 @@ public class ElasticsearchPipelineUpdater {
      * @throws Exception if something goes wrong
      */
     public static void createPipeline(RestClient client, String root, String pipeline) throws Exception {
-        String json = getJsonContent(root, SettingsFinder.Defaults.PipelinesDir, pipeline);
+        String json = getJsonContent(root, DefaultSettings.PipelinesDir, pipeline + DefaultSettings.JsonFileExtension);
         createPipelineWithJsonInElasticsearch(client, pipeline, json);
     }
 
diff --git a/src/main/java/fr/pilato/elasticsearch/tools/util/DefaultSettings.java b/src/main/java/fr/pilato/elasticsearch/tools/util/DefaultSettings.java
new file mode 100644
index 0000000..ee0df13
--- /dev/null
+++ b/src/main/java/fr/pilato/elasticsearch/tools/util/DefaultSettings.java
@@ -0,0 +1,94 @@
+/*
+ * Licensed to David Pilato (the "Author") under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. Author licenses this
+ * file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package fr.pilato.elasticsearch.tools.util;
+
+/**
+ * Settings finder
+ */
+public class DefaultSettings {
+	private DefaultSettings() {
+		// empty
+	}
+
+	/**
+	 * Default classpath dir: "elasticsearch"
+	 */
+	public static String ConfigDir = "elasticsearch";
+
+	/**
+	 * Json file extension: ".json"
+	 */
+	public static String JsonFileExtension = ".json";
+
+	/**
+	 * NdJson file extension: ".ndjson"
+	 */
+	public static String NdJsonFileExtension = ".ndjson";
+
+	/**
+	 * Default index settings file name: "_settings.json"
+	 */
+	public static String IndexSettingsFileName = "_settings.json";
+
+	/**
+	 * Default index update settings file name: "_update_settings.json"
+	 */
+	public static String UpdateIndexSettingsFileName = "_update_settings.json";
+
+	/**
+	 * Default index update mapping file name: "_update_mapping"
+	 */
+	public static String UpdateIndexMappingFileName = "_update_mapping.json";
+
+	/**
+	 * Default index templates directory: "_index_templates"
+	 */
+	public static String IndexTemplatesDir = "_index_templates";
+
+	/**
+	 * Default component templates directory: "_component_templates"
+	 */
+	public static String ComponentTemplatesDir = "_component_templates";
+
+	/**
+	 * Default ingest pipelines directory: "_pipelines"
+	 */
+	public static String PipelinesDir = "_pipelines";
+
+	/**
+	 * Default aliases file : "_aliases.json"
+	 */
+	public static String AliasesFile = "_aliases.json";
+
+	/**
+	 * Default index lifecycles directory: "_index_lifecycles"
+	 */
+	public static String IndexLifecyclesDir = "_index_lifecycles";
+
+	/**
+	 * Default data directory: "_data"
+	 */
+	public static String DataDir = "_data";
+
+	/**
+	 * Default setting of whether or not to force creation of indices and templates on start.
+	 */
+	public static boolean ForceCreation = false;
+}
diff --git a/src/main/java/fr/pilato/elasticsearch/tools/util/ResourceList.java b/src/main/java/fr/pilato/elasticsearch/tools/util/ResourceList.java
index 3702d39..db97021 100644
--- a/src/main/java/fr/pilato/elasticsearch/tools/util/ResourceList.java
+++ b/src/main/java/fr/pilato/elasticsearch/tools/util/ResourceList.java
@@ -42,6 +42,10 @@ public class ResourceList {
     private static final Logger logger = LoggerFactory.getLogger(ResourceList.class);
     private static final String[] NO_RESOURCE = {};
 
+    private ResourceList() {
+        // empty
+    }
+
     /**
      * List directory contents for a resource folder. Not recursive.
      * This is basically a brute-force implementation.
@@ -127,7 +131,7 @@ public class ResourceList {
         for (String resource : resources) {
             if (!resource.isEmpty()) {
                 String withoutIndex = resource.substring(resource.indexOf("/")+1);
-                String name = withoutIndex.substring(0, withoutIndex.indexOf(SettingsFinder.Defaults.JsonFileExtension));
+                String name = withoutIndex.substring(0, withoutIndex.indexOf(DefaultSettings.JsonFileExtension));
                 logger.trace(" - found [{}].", name);
                 names.add(name);
             }
@@ -147,7 +151,7 @@ public class ResourceList {
     public static List<String> getResourceNames(final String root, final String subdir) throws URISyntaxException, IOException {
         String path = root;
         if (root == null) {
-            path = SettingsFinder.Defaults.ConfigDir;
+            path = DefaultSettings.ConfigDir;
         }
         path += "/" + subdir + "/";
         logger.debug("Looking for resources in classpath under [{}].", path);
@@ -164,7 +168,7 @@ public class ResourceList {
     public static List<String> findIndexNames(final String root) throws IOException, URISyntaxException {
         String path = root;
         if (root == null) {
-            path = SettingsFinder.Defaults.ConfigDir;
+            path = DefaultSettings.ConfigDir;
         }
 
         logger.debug("Looking for indices in classpath under [{}].", path);
@@ -181,12 +185,12 @@ public class ResourceList {
                 } else {
                     key = resource;
                 }
-                if (!key.equals(SettingsFinder.Defaults.IndexTemplatesDir) &&
-                        !key.equals(SettingsFinder.Defaults.ComponentTemplatesDir) &&
-                        !key.equals(SettingsFinder.Defaults.PipelinesDir) &&
-                        !key.equals(SettingsFinder.Defaults.AliasesFile + SettingsFinder.Defaults.JsonFileExtension) &&
-                        !key.equals(SettingsFinder.Defaults.IndexLifecyclesDir) &&
-                        !key.equals(SettingsFinder.Defaults.DataDir) &&
+                if (!key.equals(DefaultSettings.IndexTemplatesDir) &&
+                        !key.equals(DefaultSettings.ComponentTemplatesDir) &&
+                        !key.equals(DefaultSettings.PipelinesDir) &&
+                        !key.equals(DefaultSettings.AliasesFile) &&
+                        !key.equals(DefaultSettings.IndexLifecyclesDir) &&
+                        !key.equals(DefaultSettings.DataDir) &&
                         !keys.contains(key)) {
                     logger.trace(" - found [{}].", key);
                     keys.add(key);
@@ -208,7 +212,7 @@ public class ResourceList {
      * @throws URISyntaxException this should not happen
      */
     public static Collection<String> findBulkFiles(final String root, final String index) throws IOException, URISyntaxException {
-        return findFilesByExtension(root, index, SettingsFinder.Defaults.NdJsonFileExtension);
+        return findFilesByExtension(root, index, DefaultSettings.NdJsonFileExtension);
     }
 
     /**
@@ -221,7 +225,7 @@ public class ResourceList {
      * @throws URISyntaxException this should not happen
      */
     public static Collection<String> findJsonFiles(final String root, final String index) throws IOException, URISyntaxException {
-        return findFilesByExtension(root, index, SettingsFinder.Defaults.JsonFileExtension);
+        return findFilesByExtension(root, index, DefaultSettings.JsonFileExtension);
     }
 
     /**
@@ -229,20 +233,21 @@ public class ResourceList {
      *
      * @param root  dir within the classpath
      * @param index index name
-     * @return a set of json files (*.json)
+     * @param extension the extension to look for like json or ndjson
+     * @return a set of files
      * @throws IOException        if we can't read the classpath or the filesystem
      * @throws URISyntaxException this should not happen
      */
-    public static Collection<String> findFilesByExtension(final String root, final String index, final String extension) throws IOException, URISyntaxException {
+    private static Collection<String> findFilesByExtension(final String root, final String index, final String extension) throws IOException, URISyntaxException {
         String path = root;
         String indexName = index;
         if (path == null) {
-            path = SettingsFinder.Defaults.ConfigDir;
+            path = DefaultSettings.ConfigDir;
         }
         if (indexName == null) {
-            indexName = SettingsFinder.Defaults.DataDir;
+            indexName = DefaultSettings.DataDir;
         } else {
-            indexName = indexName + "/" + SettingsFinder.Defaults.DataDir;
+            indexName = indexName + "/" + DefaultSettings.DataDir;
         }
 
         logger.debug("Looking for [{}] files in classpath under [{}/{}].", extension, path, indexName);
@@ -273,8 +278,8 @@ public class ResourceList {
     }
 
     /**
-     * Replace index name from a form of "<my-index-{now/d}-000001>" or "%3Cmy-index-%7Bnow%2Fd%7D-000001%3E"
-     * to "my-index-*-*".
+     * Replace index name from a form of {@code "<my-index-{now/d}-000001>"} or
+     * {@code "%3Cmy-index-%7Bnow%2Fd%7D-000001%3E"} to "my-index-*-*".
      * @param indexName the index name to replace
      * @return the replaced index name
      */
diff --git a/src/main/java/fr/pilato/elasticsearch/tools/util/SettingsFinder.java b/src/main/java/fr/pilato/elasticsearch/tools/util/SettingsFinder.java
deleted file mode 100644
index 8f05979..0000000
--- a/src/main/java/fr/pilato/elasticsearch/tools/util/SettingsFinder.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to David Pilato (the "Author") under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. Author licenses this
- * file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package fr.pilato.elasticsearch.tools.util;
-
-public class SettingsFinder {
-
-	public static class Defaults {
-		/**
-		 * Default classpath dir: "elasticsearch"
-		 */
-		public static String ConfigDir = "elasticsearch";
-
-		public static String JsonFileExtension = ".json";
-		public static String IndexSettingsFileName = "_settings";
-		public static String UpdateIndexSettingsFileName = "_update_settings";
-		public static String UpdateIndexMappingFileName = "_update_mapping";
-		public static String IndexTemplatesDir = "_index_templates";
-		public static String ComponentTemplatesDir = "_component_templates";
-		public static String PipelinesDir = "_pipelines";
-		public static String AliasesFile = "_aliases";
-		public static String IndexLifecyclesDir = "_index_lifecycles";
-		public static String DataDir = "_data";
-		public static String NdJsonFileExtension = ".ndjson";
-
-		/**
-		 * Default setting of whether or not to force creation of indices and templates on start.
-		 */
-		public static boolean ForceCreation = false;
-	}
-}
diff --git a/src/main/java/fr/pilato/elasticsearch/tools/util/SettingsReader.java b/src/main/java/fr/pilato/elasticsearch/tools/util/SettingsReader.java
index be1e7f9..d631050 100644
--- a/src/main/java/fr/pilato/elasticsearch/tools/util/SettingsReader.java
+++ b/src/main/java/fr/pilato/elasticsearch/tools/util/SettingsReader.java
@@ -28,10 +28,17 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.nio.charset.StandardCharsets;
 
+/**
+ * Setting files reader
+ */
 public class SettingsReader {
 
 	private static final Logger logger = LoggerFactory.getLogger(SettingsReader.class);
 
+	private SettingsReader() {
+		// empty
+	}
+
 	/**
 	 * Read a file content from the classpath
 	 * @param file filename
@@ -58,18 +65,25 @@ public class SettingsReader {
 	 * This method will read a file from the classpath and replace variables with environment variables
 	 * @param root		The root directory
 	 * @param subdir	The subdirectory
-	 * @param name		The resource name without the .json extension
+	 * @param name		The resource name
 	 * @return The content of the file
 	 */
 	public static String getJsonContent(String root, String subdir, String name) {
-		String content = getFileContent(root, subdir, name + SettingsFinder.Defaults.JsonFileExtension);
+		String content = getFileContent(root, subdir, name);
 		return StringSubstitutor.replace(content, System.getenv());
 	}
 
+	/**
+	 * Read the content of a file from the classpath
+	 * @param root		The root directory
+	 * @param subdir	The subdirectory
+	 * @param name		The resource name without the .json extension
+	 * @return The content of the file
+	 */
 	public static String getFileContent(String root, String subdir, String name) {
 		String path = root;
 		if (root == null) {
-			path = SettingsFinder.Defaults.ConfigDir;
+			path = DefaultSettings.ConfigDir;
 		}
 		if (subdir != null) {
 			path += "/" + subdir;


Test patch:
diff --git a/src/test/java/fr/pilato/elasticsearch/tools/BeyonderUnitTest.java b/src/test/java/fr/pilato/elasticsearch/tools/BeyonderUnitTest.java
index 9e3ca24..d4f8126 100644
--- a/src/test/java/fr/pilato/elasticsearch/tools/BeyonderUnitTest.java
+++ b/src/test/java/fr/pilato/elasticsearch/tools/BeyonderUnitTest.java
@@ -20,7 +20,7 @@
 package fr.pilato.elasticsearch.tools;
 
 import fr.pilato.elasticsearch.tools.util.ResourceList;
-import fr.pilato.elasticsearch.tools.util.SettingsFinder;
+import fr.pilato.elasticsearch.tools.util.DefaultSettings;
 import org.junit.Test;
 
 import java.io.ByteArrayInputStream;
@@ -61,21 +61,21 @@ public class BeyonderUnitTest extends AbstractBeyonderTest {
                 logger.debug("  --> index [{}]:", indexName);
                 assertThat(indexName, is(indices.get(iIndex)));
 
-                String settings = getJsonContent(root, indexName, SettingsFinder.Defaults.IndexSettingsFileName);
+                String settings = getJsonContent(root, indexName, DefaultSettings.IndexSettingsFileName);
                 logger.debug("    --> Settings: [{}]", settings);
             }
         } else {
             assertThat(indexNames, emptyIterable());
         }
 
-        check(ResourceList.getResourceNames(root, SettingsFinder.Defaults.ComponentTemplatesDir), componentTemplates,
-                (name) -> getJsonContent(root, SettingsFinder.Defaults.ComponentTemplatesDir, name));
-        check(ResourceList.getResourceNames(root, SettingsFinder.Defaults.IndexTemplatesDir), indexTemplates,
-                (name) -> getJsonContent(root, SettingsFinder.Defaults.IndexTemplatesDir, name));
-        check(ResourceList.getResourceNames(root, SettingsFinder.Defaults.PipelinesDir), pipelines,
-                (name) -> getJsonContent(root, SettingsFinder.Defaults.PipelinesDir, name));
-        check(ResourceList.getResourceNames(root, SettingsFinder.Defaults.IndexLifecyclesDir), indexLifecycles,
-                (name) -> getJsonContent(root, SettingsFinder.Defaults.IndexLifecyclesDir, name));
+        check(ResourceList.getResourceNames(root, DefaultSettings.ComponentTemplatesDir), componentTemplates,
+                (name) -> getJsonContent(root, DefaultSettings.ComponentTemplatesDir, name));
+        check(ResourceList.getResourceNames(root, DefaultSettings.IndexTemplatesDir), indexTemplates,
+                (name) -> getJsonContent(root, DefaultSettings.IndexTemplatesDir, name));
+        check(ResourceList.getResourceNames(root, DefaultSettings.PipelinesDir), pipelines,
+                (name) -> getJsonContent(root, DefaultSettings.PipelinesDir, name));
+        check(ResourceList.getResourceNames(root, DefaultSettings.IndexLifecyclesDir), indexLifecycles,
+                (name) -> getJsonContent(root, DefaultSettings.IndexLifecyclesDir, name));
     }
 
     private void check(List<String> names, List<String> expectedNames,
@@ -107,7 +107,7 @@ public class BeyonderUnitTest extends AbstractBeyonderTest {
         String indexName = "twitter";
 
         // when: this settings file is read
-        String settings = getJsonContent(folder, indexName, SettingsFinder.Defaults.IndexSettingsFileName);
+        String settings = getJsonContent(folder, indexName, DefaultSettings.IndexSettingsFileName);
         Map<String, Object> settingsMap = JsonUtil.asMap(new ByteArrayInputStream(settings.getBytes()));
 
         // then: the variables got replaced by environment variables of the same name