diff --git a/Dockerfile b/Dockerfile index 73e831a..f6299a7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM adoptopenjdk/openjdk11:ubi-minimal-jre +FROM adoptopenjdk/openjdk11:alpine-jre RUN mkdir -p /para/lib diff --git a/LICENSE b/LICENSE index e71a285..56f5e0d 100755 --- a/LICENSE +++ b/LICENSE @@ -187,7 +187,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2021 Erudika LTD, https://erudika.com + Copyright 2022 Erudika LTD, https://erudika.com Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pom.xml b/pom.xml index 1f59715..d426047 100644 --- a/pom.xml +++ b/pom.xml @@ -61,7 +61,7 @@ com.erudika para-core - 1.43.3 + 1.44.0 provided @@ -90,7 +90,7 @@ org.opensearch.client opensearch-rest-high-level-client - 1.2.3 + 1.2.4 diff --git a/src/main/java/com/erudika/para/server/search/ElasticSearch.java b/src/main/java/com/erudika/para/server/search/ElasticSearch.java index 9f34eb5..b555617 100644 --- a/src/main/java/com/erudika/para/server/search/ElasticSearch.java +++ b/src/main/java/com/erudika/para/server/search/ElasticSearch.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2021 Erudika. https://erudika.com + * Copyright 2013-2022 Erudika. https://erudika.com * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,6 +26,7 @@ import com.erudika.para.core.search.Search; import com.erudika.para.core.utils.Config; import com.erudika.para.core.utils.Pager; +import com.erudika.para.core.utils.Para; import com.erudika.para.core.utils.Utils; import static com.erudika.para.server.search.ElasticSearchUtils.PROPS_PREFIX; import static com.erudika.para.server.search.ElasticSearchUtils.convertQueryStringToNestedQuery; @@ -101,7 +102,7 @@ public class ElasticSearch implements Search { private DAO dao; static { - if (Config.isSearchEnabled() && Config.getConfigParam("search", ""). + if (Para.getConfig().isSearchEnabled() && Para.getConfig().getConfigParam("search", ""). equalsIgnoreCase(ElasticSearch.class.getSimpleName())) { ElasticSearchUtils.initClient(); // set up automatic index creation and deletion @@ -409,8 +410,8 @@ protected

List

searchQuery(final String appid, SearchH } List

results = new ArrayList

(hits.getHits().length); List keys = new LinkedList(); - boolean readFromIndex = Config.getConfigBoolean("read_from_index", false); - boolean cleanupIndex = Config.getConfigBoolean("sync_index_with_db", true); + boolean readFromIndex = Para.getConfig().getConfigBoolean("read_from_index", false); + boolean cleanupIndex = Para.getConfig().getConfigBoolean("sync_index_with_db", true); try { for (SearchHit hit : hits) { if (readFromIndex) { @@ -481,7 +482,7 @@ protected SearchHits searchQueryRaw(String appid, String type, QueryBuilder quer SortOrder order = page.isDesc() ? SortOrder.DESC : SortOrder.ASC; int max = page.getLimit(); int pageNum = (int) page.getPage(); - int start = (pageNum < 1 || pageNum > Config.MAX_PAGES) ? 0 : (pageNum - 1) * max; + int start = (pageNum < 1 || pageNum > Para.getConfig().maxPages()) ? 0 : (pageNum - 1) * max; if (query == null) { query = matchAllQuery(); @@ -624,12 +625,12 @@ private static void createIndexInternal(App app) { if (app != null) { String appid = app.getAppIdentifier(); if (app.isSharingIndex()) { - ElasticSearchUtils.addIndexAliasWithRouting(Config.getRootAppIdentifier(), appid); + ElasticSearchUtils.addIndexAliasWithRouting(Para.getConfig().getRootAppIdentifier(), appid); } else { - int shards = app.isRootApp() ? Config.getConfigInt("es.shards", 2) - : Config.getConfigInt("es.shards_for_child_apps", 1); - int replicas = app.isRootApp() ? Config.getConfigInt("es.replicas", 0) - : Config.getConfigInt("es.replicas_for_child_apps", 0); + int shards = app.isRootApp() ? Para.getConfig().getConfigInt("es.shards", 2) + : Para.getConfig().getConfigInt("es.shards_for_child_apps", 1); + int replicas = app.isRootApp() ? Para.getConfig().getConfigInt("es.replicas", 0) + : Para.getConfig().getConfigInt("es.replicas_for_child_apps", 0); ElasticSearchUtils.createIndex(appid, shards, replicas); } } @@ -651,7 +652,7 @@ public void onFailure(Exception ex) { logger.error("Failed to delete all objects in shared index for app '" + appid + "'", ex); } }); - ElasticSearchUtils.removeIndexAlias(Config.getRootAppIdentifier(), appid); + ElasticSearchUtils.removeIndexAlias(Para.getConfig().getRootAppIdentifier(), appid); } else { ElasticSearchUtils.deleteIndex(appid); } @@ -662,7 +663,7 @@ public void onFailure(Exception ex) { @Override public void index(ParaObject object) { - indexAllInternal(Config.getRootAppIdentifier(), Collections.singletonList(object)); + indexAllInternal(Para.getConfig().getRootAppIdentifier(), Collections.singletonList(object)); } @Override @@ -672,7 +673,7 @@ public void index(String appid, ParaObject object) { @Override public void unindex(ParaObject object) { - unindexAllInternal(Config.getRootAppIdentifier(), Collections.singletonList(object)); + unindexAllInternal(Para.getConfig().getRootAppIdentifier(), Collections.singletonList(object)); } @Override @@ -682,7 +683,7 @@ public void unindex(String appid, ParaObject object) { @Override public

void indexAll(List

objects) { - indexAllInternal(Config.getRootAppIdentifier(), objects); + indexAllInternal(Para.getConfig().getRootAppIdentifier(), objects); } @Override @@ -692,7 +693,7 @@ public

void indexAll(String appid, List

objects) { @Override public

void unindexAll(List

objects) { - unindexAllInternal(Config.getRootAppIdentifier(), objects); + unindexAllInternal(Para.getConfig().getRootAppIdentifier(), objects); } @Override @@ -702,7 +703,7 @@ public

void unindexAll(String appid, List

objects) { @Override public void unindexAll(Map terms, boolean matchAll) { - unindexAllInternal(Config.getRootAppIdentifier(), terms, matchAll); + unindexAllInternal(Para.getConfig().getRootAppIdentifier(), terms, matchAll); } @Override @@ -712,7 +713,7 @@ public void unindexAll(String appid, Map terms, boolean matchAll) { @Override public

P findById(String id) { - return findByIdInternal(Config.getRootAppIdentifier(), id); + return findByIdInternal(Para.getConfig().getRootAppIdentifier(), id); } @Override @@ -722,7 +723,7 @@ public

P findById(String appid, String id) { @Override public

List

findByIds(List ids) { - return findByIdsInternal(Config.getRootAppIdentifier(), ids); + return findByIdsInternal(Para.getConfig().getRootAppIdentifier(), ids); } @Override @@ -733,7 +734,7 @@ public

List

findByIds(String appid, List ids) @Override public

List

findNearby(String type, String query, int radius, double lat, double lng, Pager... pager) { - return findNearbyInternal(Config.getRootAppIdentifier(), type, query, radius, lat, lng, pager); + return findNearbyInternal(Para.getConfig().getRootAppIdentifier(), type, query, radius, lat, lng, pager); } @Override @@ -744,7 +745,7 @@ public

List

findNearby(String appid, String type, @Override public

List

findPrefix(String type, String field, String prefix, Pager... pager) { - return findPrefixInternal(Config.getRootAppIdentifier(), type, field, prefix, pager); + return findPrefixInternal(Para.getConfig().getRootAppIdentifier(), type, field, prefix, pager); } @Override @@ -754,7 +755,7 @@ public

List

findPrefix(String appid, String type, Stri @Override public

List

findQuery(String type, String query, Pager... pager) { - return findQueryInternal(Config.getRootAppIdentifier(), type, query, pager); + return findQueryInternal(Para.getConfig().getRootAppIdentifier(), type, query, pager); } @Override @@ -764,7 +765,7 @@ public

List

findQuery(String appid, String type, Strin @Override public

List

findNestedQuery(String type, String field, String query, Pager... pager) { - return findNestedQueryInternal(Config.getRootAppIdentifier(), type, field, query, pager); + return findNestedQueryInternal(Para.getConfig().getRootAppIdentifier(), type, field, query, pager); } @Override @@ -775,7 +776,7 @@ public

List

findNestedQuery(String appid, String type, @Override public

List

findSimilar(String type, String filterKey, String[] fields, String liketext, Pager... pager) { - return findSimilarInternal(Config.getRootAppIdentifier(), type, filterKey, fields, liketext, pager); + return findSimilarInternal(Para.getConfig().getRootAppIdentifier(), type, filterKey, fields, liketext, pager); } @Override @@ -786,7 +787,7 @@ public

List

findSimilar(String appid, String type, Str @Override public

List

findTagged(String type, String[] tags, Pager... pager) { - return findTaggedInternal(Config.getRootAppIdentifier(), type, tags, pager); + return findTaggedInternal(Para.getConfig().getRootAppIdentifier(), type, tags, pager); } @Override @@ -796,7 +797,7 @@ public

List

findTagged(String appid, String type, Stri @Override public

List

findTags(String keyword, Pager... pager) { - return findTagsInternal(Config.getRootAppIdentifier(), keyword, pager); + return findTagsInternal(Para.getConfig().getRootAppIdentifier(), keyword, pager); } @Override @@ -807,7 +808,7 @@ public

List

findTags(String appid, String keyword, Pag @Override public

List

findTermInList(String type, String field, List terms, Pager... pager) { - return findTermInListInternal(Config.getRootAppIdentifier(), type, field, terms, pager); + return findTermInListInternal(Para.getConfig().getRootAppIdentifier(), type, field, terms, pager); } @Override @@ -819,7 +820,7 @@ public

List

findTermInList(String appid, String type, @Override public

List

findTerms(String type, Map terms, boolean mustMatchBoth, Pager... pager) { - return findTermsInternal(Config.getRootAppIdentifier(), type, terms, mustMatchBoth, pager); + return findTermsInternal(Para.getConfig().getRootAppIdentifier(), type, terms, mustMatchBoth, pager); } @Override @@ -831,7 +832,7 @@ public

List

findTerms(String appid, String type, Map List

findWildcard(String type, String field, String wildcard, Pager... pager) { - return findWildcardInternal(Config.getRootAppIdentifier(), type, field, wildcard, pager); + return findWildcardInternal(Para.getConfig().getRootAppIdentifier(), type, field, wildcard, pager); } @Override @@ -842,7 +843,7 @@ public

List

findWildcard(String appid, String type, St @Override public Long getCount(String type) { - return getCountInternal(Config.getRootAppIdentifier(), type); + return getCountInternal(Para.getConfig().getRootAppIdentifier(), type); } @Override @@ -852,7 +853,7 @@ public Long getCount(String appid, String type) { @Override public Long getCount(String type, Map terms) { - return getCountInternal(Config.getRootAppIdentifier(), type, terms); + return getCountInternal(Para.getConfig().getRootAppIdentifier(), type, terms); } @Override diff --git a/src/main/java/com/erudika/para/server/search/ElasticSearchUtils.java b/src/main/java/com/erudika/para/server/search/ElasticSearchUtils.java index e3438f0..de8d0d5 100644 --- a/src/main/java/com/erudika/para/server/search/ElasticSearchUtils.java +++ b/src/main/java/com/erudika/para/server/search/ElasticSearchUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2021 Erudika. https://erudika.com + * Copyright 2013-2022 Erudika. https://erudika.com * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -160,21 +160,21 @@ public final class ElasticSearchUtils { * containing custom properties. This mode prevents an eventual field mapping explosion. */ static boolean nestedMode() { - return Config.getConfigBoolean("es.use_nested_custom_fields", false); + return Para.getConfig().getConfigBoolean("es.use_nested_custom_fields", false); } /** * @return true if asynchronous indexing/unindexing is enabled. */ static boolean asyncEnabled() { - return Config.getConfigBoolean("es.async_enabled", false); + return Para.getConfig().getConfigBoolean("es.async_enabled", false); } /** * @return true if we want the bulk processor to flush immediately after each bulk request. */ static boolean flushImmediately() { - return Config.getConfigBoolean("es.bulk.flush_immediately", true); + return Para.getConfig().getConfigBoolean("es.bulk.flush_immediately", true); } /** @@ -234,14 +234,14 @@ public static RestHighLevelClient getRESTClient() { if (restClient != null) { return restClient; } - String esScheme = Config.getConfigParam("es.restclient_scheme", Config.IN_PRODUCTION ? "https" : "http"); - String esHost = Config.getConfigParam("es.restclient_host", "localhost"); - int esPort = Config.getConfigInt("es.restclient_port", 9200); - boolean signRequests = Config.getConfigBoolean("es.sign_requests_to_aws", esHost.contains("amazonaws.com")); + String esScheme = Para.getConfig().getConfigParam("es.restclient_scheme", Para.getConfig().inProduction() ? "https" : "http"); + String esHost = Para.getConfig().getConfigParam("es.restclient_host", "localhost"); + int esPort = Para.getConfig().getConfigInt("es.restclient_port", 9200); + boolean signRequests = Para.getConfig().getConfigBoolean("es.sign_requests_to_aws", esHost.contains("amazonaws.com")); HttpHost host = new HttpHost(esHost, esPort, esScheme); RestClientBuilder clientBuilder = RestClient.builder(host); - String esPrefix = Config.getConfigParam("es.restclient_context_path", ""); + String esPrefix = Para.getConfig().getConfigParam("es.restclient_context_path", ""); if (StringUtils.isNotEmpty(esPrefix)) { clientBuilder.setPathPrefix(esPrefix); } @@ -266,8 +266,8 @@ public void onDestroy() { shutdownClient(); } }); - if (!existsIndex(Config.getRootAppIdentifier())) { - createIndex(Config.getRootAppIdentifier()); + if (!existsIndex(Para.getConfig().getRootAppIdentifier())) { + createIndex(Para.getConfig().getRootAppIdentifier()); } return restClient; } @@ -304,16 +304,16 @@ private static boolean createIndexWithoutAlias(String name, int shards, int repl return false; } if (shards <= 0) { - shards = Config.getConfigInt("es.shards", 2); + shards = Para.getConfig().getConfigInt("es.shards", 2); } if (replicas < 0) { - replicas = Config.getConfigInt("es.replicas", 0); + replicas = Para.getConfig().getConfigInt("es.replicas", 0); } try { Settings.Builder settings = Settings.builder(); settings.put("number_of_shards", Integer.toString(shards)); settings.put("number_of_replicas", Integer.toString(replicas)); - settings.put("auto_expand_replicas", Config.getConfigParam("es.auto_expand_replicas", "0-1")); + settings.put("auto_expand_replicas", Para.getConfig().getConfigParam("es.auto_expand_replicas", "0-1")); settings.put("analysis.analyzer.default.type", "standard"); settings.putList("analysis.analyzer.default.stopwords", "arabic", "armenian", "basque", "brazilian", "bulgarian", "catalan", @@ -340,7 +340,7 @@ private static boolean createIndexWithoutAlias(String name, int shards, int repl * @return true if created */ public static boolean createIndex(String appid) { - return createIndex(appid, Config.getConfigInt("es.shards", 2), Config.getConfigInt("es.replicas", 0)); + return createIndex(appid, Para.getConfig().getConfigInt("es.shards", 2), Para.getConfig().getConfigInt("es.replicas", 0)); } /** @@ -357,7 +357,7 @@ public static boolean createIndex(String appid, int shards, int replicas) { String indexName = appid.trim() + "_1"; boolean created = createIndexWithoutAlias(indexName, shards, replicas); if (created) { - boolean withAliasRouting = App.isRoot(appid) && Config.getConfigBoolean("es.root_index_sharing_enabled", false); + boolean withAliasRouting = App.isRoot(appid) && Para.getConfig().getConfigBoolean("es.root_index_sharing_enabled", false); boolean aliased = addIndexAlias(indexName, appid, withAliasRouting); if (!aliased) { logger.info("Created ES index '{}' without an alias '{}'.", indexName, appid); @@ -433,7 +433,7 @@ public static boolean rebuildIndex(DAO dao, App app, String destinationIndex, Pa if (!existsIndex(indexName)) { if (app.isSharingIndex()) { // add alias pointing to the root index - addIndexAliasWithRouting(getIndexName(Config.getRootAppIdentifier()), app.getAppIdentifier()); + addIndexAliasWithRouting(getIndexName(Para.getConfig().getRootAppIdentifier()), app.getAppIdentifier()); } else { logger.info("Creating '{}' index because it doesn't exist.", indexName); createIndex(indexName); @@ -453,7 +453,7 @@ public static boolean rebuildIndex(DAO dao, App app, String destinationIndex, Pa List> batch = new LinkedList<>(); Pager p = getPager(pager); - int batchSize = Config.getConfigInt("reindex_batch_size", p.getLimit()); + int batchSize = Para.getConfig().getConfigInt("reindex_batch_size", p.getLimit()); long reindexedCount = 0; List list; @@ -534,7 +534,7 @@ public void onFailure(Exception ex) { * @return number of unindexed documents. */ public static long deleteByQuery(String appid, QueryBuilder fb, ActionListener cb) { - int batchSize = Config.getConfigInt("unindex_batch_size", 1000); + int batchSize = Para.getConfig().getConfigInt("unindex_batch_size", 1000); boolean isSharingIndex = !App.isRoot(appid) && StringUtils.startsWith(appid, " "); String indexName = getIndexName(appid); DeleteByQueryRequest deleteByQueryReq = new DeleteByQueryRequest(indexName); @@ -810,12 +810,12 @@ private static BulkProcessor bulkProcessor(RestHighLevelClient client) { } private static BulkProcessor configureBulkProcessor(BulkProcessor.Builder builder) { - final int sizeLimit = Config.getConfigInt("es.bulk.size_limit_mb", 5); - final int actionLimit = Config.getConfigInt("es.bulk.action_limit", 1000); - final int concurrentRequests = Config.getConfigInt("es.bulk.concurrent_requests", 1); - final int flushInterval = Config.getConfigInt("es.bulk.flush_interval_ms", 5000); - final int backoffInitialDelayMs = Config.getConfigInt("es.bulk.backoff_initial_delay_ms", 50); - final int backoffNumRetries = Config.getConfigInt("es.bulk.max_num_retries", 8); + final int sizeLimit = Para.getConfig().getConfigInt("es.bulk.size_limit_mb", 5); + final int actionLimit = Para.getConfig().getConfigInt("es.bulk.action_limit", 1000); + final int concurrentRequests = Para.getConfig().getConfigInt("es.bulk.concurrent_requests", 1); + final int flushInterval = Para.getConfig().getConfigInt("es.bulk.flush_interval_ms", 5000); + final int backoffInitialDelayMs = Para.getConfig().getConfigInt("es.bulk.backoff_initial_delay_ms", 50); + final int backoffNumRetries = Para.getConfig().getConfigInt("es.bulk.max_num_retries", 8); builder.setBulkSize(new ByteSizeValue(sizeLimit, ByteSizeUnit.MB)); builder.setBulkActions(actionLimit); builder.setConcurrentRequests(concurrentRequests); @@ -883,7 +883,7 @@ public void onFailure(Exception e) { } private static void handleFailedRequests(Throwable t) { - if (t != null && Config.getConfigBoolean("es.fail_on_indexing_errors", false)) { + if (t != null && Para.getConfig().getConfigBoolean("es.fail_on_indexing_errors", false)) { throw new RuntimeException("Synchronous indexing operation failed!", t); } } @@ -1042,7 +1042,7 @@ public static Map getSourceFromParaObject(ParaObject po) { * @return source builder instance */ static SearchSourceBuilder getSourceBuilder(QueryBuilder query, int max) { - String trackTotalHits = Config.getConfigParam("es.track_total_hits", ""); + String trackTotalHits = Para.getConfig().getConfigParam("es.track_total_hits", ""); SearchSourceBuilder source = new SearchSourceBuilder().query(query).size(max); if (NumberUtils.isDigits(trackTotalHits)) { source.trackTotalHitsUpTo(NumberUtils.toInt(trackTotalHits, Config.DEFAULT_LIMIT)); @@ -1439,7 +1439,7 @@ static RestClientBuilder.HttpClientConfigCallback getAWSRequestSigningIntercepto awsCredentials(creds). doubleUrlEncode(true). signingName("es"). - signingRegion(Region.of(Config.getConfigParam("es.aws_region", "eu-west-1"))); + signingRegion(Region.of(Para.getConfig().getConfigParam("es.aws_region", "eu-west-1"))); URIBuilder uriBuilder; String httpMethod = request.getRequestLine().getMethod(); String resourcePath; @@ -1500,8 +1500,8 @@ static RestClientBuilder.HttpClientConfigCallback getAWSRequestSigningIntercepto } static RestClientBuilder.HttpClientConfigCallback getAuthenticationCallback() { - final String basicAuthLogin = Config.getConfigParam("es.basic_auth_login", ""); - final String basicAuthPassword = Config.getConfigParam("es.basic_auth_password", ""); + final String basicAuthLogin = Para.getConfig().getConfigParam("es.basic_auth_login", ""); + final String basicAuthPassword = Para.getConfig().getConfigParam("es.basic_auth_password", ""); if (StringUtils.isAnyEmpty(basicAuthLogin, basicAuthPassword)) { // no authentication diff --git a/src/main/java/com/erudika/para/server/search/rest/ProxyResourceHandler.java b/src/main/java/com/erudika/para/server/search/rest/ProxyResourceHandler.java index 3b39775..1d6ff12 100644 --- a/src/main/java/com/erudika/para/server/search/rest/ProxyResourceHandler.java +++ b/src/main/java/com/erudika/para/server/search/rest/ProxyResourceHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2021 Erudika. http://erudika.com + * Copyright 2013-2022 Erudika. http://erudika.com * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,7 +25,6 @@ import com.erudika.para.core.utils.ParaObjectUtils; import com.erudika.para.core.persistence.DAO; import com.erudika.para.core.rest.CustomResourceHandler; -import com.erudika.para.core.utils.Config; import com.erudika.para.core.utils.Pager; import com.erudika.para.server.search.ElasticSearchUtils; import com.fasterxml.jackson.databind.JsonNode; @@ -72,16 +71,16 @@ public class ProxyResourceHandler implements CustomResourceHandler { private static final Logger logger = LoggerFactory.getLogger(ProxyResourceHandler.class); - private final String esScheme = Config.getConfigParam("es.restclient_scheme", Config.IN_PRODUCTION ? "https" : "http"); - private final String esHost = Config.getConfigParam("es.restclient_host", - Config.getConfigParam("es.transportclient_host", "localhost")); - private final int esPort = Config.getConfigInt("es.restclient_port", 9200); + private final String esScheme = Para.getConfig().getConfigParam("es.restclient_scheme", Para.getConfig().inProduction() ? "https" : "http"); + private final String esHost = Para.getConfig().getConfigParam("es.restclient_host", + Para.getConfig().getConfigParam("es.transportclient_host", "localhost")); + private final int esPort = Para.getConfig().getConfigInt("es.restclient_port", 9200); private RestClient lowLevelClient; /** * Resource path. Defaults to '_elasticsearch'. */ - public static final String PATH = Config.getConfigParam("es.proxy_path", "_elasticsearch"); + public static final String PATH = Para.getConfig().getConfigParam("es.proxy_path", "_elasticsearch"); @Override public String getRelativePath() { @@ -114,7 +113,7 @@ public Response handleDelete(ContainerRequestContext ctx) { } Response proxyRequest(String method, ContainerRequestContext ctx) { - if (!Config.getConfigBoolean("es.proxy_enabled", false)) { + if (!Para.getConfig().getConfigBoolean("es.proxy_enabled", false)) { return Response.status(Response.Status.FORBIDDEN.getStatusCode(), "This feature is disabled.").build(); } String appid = ParaObjectUtils.getAppidFromAuthHeader(ctx.getHeaders().getFirst(HttpHeaders.AUTHORIZATION)); @@ -226,7 +225,7 @@ public String getCleanPath(String appid, String path) { } private Response handleReindexTask(String appid, String destinationIndex) { - if (!Config.getConfigBoolean("es.proxy_reindexing_enabled", false) || appid == null) { + if (!Para.getConfig().getConfigBoolean("es.proxy_reindexing_enabled", false) || appid == null) { return Response.status(Response.Status.FORBIDDEN.getStatusCode(), "This feature is disabled.").build(); } Pager pager = new Pager(); diff --git a/src/main/java/com/erudika/para/server/search/rest/ProxySubResourceHandler.java b/src/main/java/com/erudika/para/server/search/rest/ProxySubResourceHandler.java index 49908e5..207d3eb 100644 --- a/src/main/java/com/erudika/para/server/search/rest/ProxySubResourceHandler.java +++ b/src/main/java/com/erudika/para/server/search/rest/ProxySubResourceHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2021 Erudika. http://erudika.com + * Copyright 2013-2022 Erudika. http://erudika.com * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/com/erudika/para/server/rest/ProxyResourceHandlerIT.java b/src/test/java/com/erudika/para/server/rest/ProxyResourceHandlerIT.java index dc2d1c1..1727479 100644 --- a/src/test/java/com/erudika/para/server/rest/ProxyResourceHandlerIT.java +++ b/src/test/java/com/erudika/para/server/rest/ProxyResourceHandlerIT.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2021 Erudika. http://erudika.com + * Copyright 2013-2022 Erudika. http://erudika.com * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/com/erudika/para/server/search/ElasticSearchIT.java b/src/test/java/com/erudika/para/server/search/ElasticSearchIT.java index 6b167f8..e8409bc 100644 --- a/src/test/java/com/erudika/para/server/search/ElasticSearchIT.java +++ b/src/test/java/com/erudika/para/server/search/ElasticSearchIT.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2021 Erudika. https://erudika.com + * Copyright 2013-2022 Erudika. https://erudika.com * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,6 +24,7 @@ import static com.erudika.para.server.search.SearchTest.u; import com.erudika.para.core.utils.Config; import com.erudika.para.core.utils.Pager; +import com.erudika.para.core.utils.Para; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -54,7 +55,7 @@ public static void setUpClass() { //System.setProperty("para.es.async_enabled", "true"); //System.setProperty("para.es.bulk.concurrent_requests", "0"); s = new ElasticSearch(); - ElasticSearchUtils.createIndex(Config.getRootAppIdentifier()); + ElasticSearchUtils.createIndex(Para.getConfig().getRootAppIdentifier()); ElasticSearchUtils.createIndex(appid1); ElasticSearchUtils.createIndex(appid2); ElasticSearchUtils.createIndex(appid3); @@ -63,7 +64,7 @@ public static void setUpClass() { @AfterClass public static void tearDownClass() { - ElasticSearchUtils.deleteIndex(Config.getRootAppIdentifier()); + ElasticSearchUtils.deleteIndex(Para.getConfig().getRootAppIdentifier()); ElasticSearchUtils.deleteIndex(appid1); ElasticSearchUtils.deleteIndex(appid2); ElasticSearchUtils.deleteIndex(appid3); @@ -128,7 +129,7 @@ public void testRangeQuery() { public void testSharedIndex() { String app1 = "myapp1"; String app2 = " myapp2"; // IMPORTANT! See "para.prepend_shared_appids_with_space" - String root = Config.getRootAppIdentifier(); + String root = Para.getConfig().getRootAppIdentifier(); String type = "cat"; App rootApp = new App("rootapp"); diff --git a/src/test/java/com/erudika/para/server/search/SearchTest.java b/src/test/java/com/erudika/para/server/search/SearchTest.java index e00a470..8a95123 100644 --- a/src/test/java/com/erudika/para/server/search/SearchTest.java +++ b/src/test/java/com/erudika/para/server/search/SearchTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2021 Erudika. https://erudika.com + * Copyright 2013-2022 Erudika. https://erudika.com * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License.