From: Ray Lee Date: Sat, 27 Apr 2019 02:56:58 +0000 (-0700) Subject: NOJIRA: Verify es is enabled before attempting to reindex. X-Git-Url: https://git.aero2k.de/?a=commitdiff_plain;h=f5d0c89d28fad568673c1342274e384c90fc0a0b;p=tmp%2Fjakarta-migration.git NOJIRA: Verify es is enabled before attempting to reindex. --- diff --git a/services/JaxRsServiceProvider/src/main/java/org/collectionspace/services/jaxrs/CSpaceResteasyBootstrap.java b/services/JaxRsServiceProvider/src/main/java/org/collectionspace/services/jaxrs/CSpaceResteasyBootstrap.java index 2d0ab8e85..0a8cbc797 100644 --- a/services/JaxRsServiceProvider/src/main/java/org/collectionspace/services/jaxrs/CSpaceResteasyBootstrap.java +++ b/services/JaxRsServiceProvider/src/main/java/org/collectionspace/services/jaxrs/CSpaceResteasyBootstrap.java @@ -1,5 +1,7 @@ package org.collectionspace.services.jaxrs; +import static org.nuxeo.elasticsearch.ElasticSearchConstants.ES_ENABLED_PROPERTY; + import javax.servlet.ServletContextEvent; import javax.ws.rs.core.Response; @@ -86,6 +88,12 @@ public class CSpaceResteasyBootstrap extends ResteasyBootstrap { } public void resetElasticSearchIndex() throws Exception { + boolean isEnabled = Boolean.parseBoolean(Framework.getProperty(ES_ENABLED_PROPERTY, "true")); + + if (!isEnabled) { + return; + } + ElasticSearchComponent es = (ElasticSearchComponent) Framework.getService(ElasticSearchService.class); for (String repositoryName : es.getRepositoryNames()) {