This is an automated email from the ASF dual-hosted git repository.
shuber pushed a commit to branch unomi-1.6.x
in repository https://gitbox.apache.org/repos/asf/unomi.git
The following commit(s) were added to refs/heads/unomi-1.6.x by this push:
new 6e7d9b2 UNOMI-188 Replace persistence service settings with OSGi
config admin properties (#328)
6e7d9b2 is described below
commit 6e7d9b24c9fd486280c433699b32912c4154392e
Author: Serge Huber <[email protected]>
AuthorDate: Fri Jul 30 08:41:54 2021 +0200
UNOMI-188 Replace persistence service settings with OSGi config admin
properties (#328)
- The getSetting/setSettings(s) methods on the persistence service could be
potentially abused and cause security issues so they are replaced by using OSGi
configuration administration property updates
(cherry picked from commit 85672bb175c505e9e03ec0e691b408e028e6a8c5)
---
.../org/apache/unomi/itests/ProfileServiceIT.java | 18 +++--
.../ElasticSearchPersistenceServiceImpl.java | 80 +++++++++-------------
.../unomi/persistence/spi/PersistenceService.java | 29 --------
3 files changed, 45 insertions(+), 82 deletions(-)
diff --git a/itests/src/test/java/org/apache/unomi/itests/ProfileServiceIT.java
b/itests/src/test/java/org/apache/unomi/itests/ProfileServiceIT.java
index 3d9536b..ee4b204 100644
--- a/itests/src/test/java/org/apache/unomi/itests/ProfileServiceIT.java
+++ b/itests/src/test/java/org/apache/unomi/itests/ProfileServiceIT.java
@@ -35,9 +35,14 @@ import org.ops4j.pax.exam.junit.PaxExam;
import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
import org.ops4j.pax.exam.spi.reactors.PerSuite;
import org.ops4j.pax.exam.util.Filter;
+import org.osgi.service.cm.Configuration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
import javax.inject.Inject;
/**
@@ -117,9 +122,14 @@ public class ProfileServiceIT extends BaseIT {
// Relevant only when throwExceptions system property is true
@Test
- public void testGetProfileWithWrongScrollerIdThrowException() throws
InterruptedException, NoSuchFieldException, IllegalAccessException {
- boolean throwExceptionCurrent = (boolean)
persistenceService.getSetting("throwExceptions");
- persistenceService.setSetting("throwExceptions", true);
+ public void testGetProfileWithWrongScrollerIdThrowException() throws
InterruptedException, NoSuchFieldException, IllegalAccessException, IOException
{
+ boolean throwExceptionCurrent = false;
+ Configuration elasticSearchConfiguration =
configurationAdmin.getConfiguration("org.apache.unomi.persistence.elasticsearch");
+ if (elasticSearchConfiguration != null) {
+ throwExceptionCurrent = Boolean.getBoolean((String)
elasticSearchConfiguration.getProperties().get("throwExceptions"));
+ }
+
+ updateConfiguration(PersistenceService.class.getName(),
"org.apache.unomi.persistence.elasticsearch", "throwExceptions", true);
Query query = new Query();
query.setLimit(2);
@@ -133,7 +143,7 @@ public class ProfileServiceIT extends BaseIT {
// Should get here since this scenario should throw exception
}
finally {
- persistenceService.setSetting("throwExceptions",
throwExceptionCurrent);
+ updateConfiguration(PersistenceService.class.getName(),
"org.apache.unomi.persistence.elasticsearch", "throwExceptions",
throwExceptionCurrent);
}
}
diff --git
a/persistence-elasticsearch/core/src/main/java/org/apache/unomi/persistence/elasticsearch/ElasticSearchPersistenceServiceImpl.java
b/persistence-elasticsearch/core/src/main/java/org/apache/unomi/persistence/elasticsearch/ElasticSearchPersistenceServiceImpl.java
index e6f6caf..bf2250c 100644
---
a/persistence-elasticsearch/core/src/main/java/org/apache/unomi/persistence/elasticsearch/ElasticSearchPersistenceServiceImpl.java
+++
b/persistence-elasticsearch/core/src/main/java/org/apache/unomi/persistence/elasticsearch/ElasticSearchPersistenceServiceImpl.java
@@ -148,7 +148,7 @@ public class ElasticSearchPersistenceServiceImpl implements
PersistenceService,
public static final String PRIMARY_TERM = "primary_term";
private static final Logger logger =
LoggerFactory.getLogger(ElasticSearchPersistenceServiceImpl.class.getName());
- private static boolean throwExceptions = false;
+ private boolean throwExceptions = false;
private RestHighLevelClient client;
private BulkProcessor bulkProcessor;
private String elasticSearchAddresses;
@@ -396,7 +396,7 @@ public class ElasticSearchPersistenceServiceImpl implements
PersistenceService,
public void start() throws Exception {
// on startup
- new InClassLoaderExecute<Object>(null, null, this.bundleContext,
this.fatalIllegalStateErrors) {
+ new InClassLoaderExecute<Object>(null, null, this.bundleContext,
this.fatalIllegalStateErrors, throwExceptions) {
public Object execute(Object... args) throws Exception {
bulkProcessorConcurrentRequests =
System.getProperty(BULK_PROCESSOR_CONCURRENT_REQUESTS,
bulkProcessorConcurrentRequests);
@@ -602,7 +602,7 @@ public class ElasticSearchPersistenceServiceImpl implements
PersistenceService,
public void stop() {
- new InClassLoaderExecute<Object>(null, null, this.bundleContext,
this.fatalIllegalStateErrors) {
+ new InClassLoaderExecute<Object>(null, null, this.bundleContext,
this.fatalIllegalStateErrors, throwExceptions) {
protected Object execute(Object... args) throws IOException {
logger.info("Closing ElasticSearch persistence backend...");
if (bulkProcessor != null) {
@@ -726,33 +726,13 @@ public class ElasticSearchPersistenceServiceImpl
implements PersistenceService,
}
@Override
- public void setSettings(Map<String, Object> settings) throws
NoSuchFieldException, IllegalAccessException {
- for (Map.Entry<String, Object> setting : settings.entrySet())
- setSetting(setting.getKey(), setting.getValue());
- }
-
- @Override
- public void setSetting(String fieldName, Object value) throws
NoSuchFieldException, IllegalAccessException {
- Field field = this.getClass().getDeclaredField(fieldName);
- field.set(getClass(), value);
- }
-
- @Override
- public Object getSetting(String fieldName) throws NoSuchFieldException,
IllegalAccessException {
- Field field = this.getClass().getDeclaredField(fieldName);
- return field.get(getClass());
- }
-
-
-
- @Override
public <T extends Item> T load(final String itemId, final Class<T> clazz) {
return load(itemId, null, clazz);
}
@Override
public <T extends Item> T load(final String itemId, final Date dateHint,
final Class<T> clazz) {
- return new InClassLoaderExecute<T>(metricsService,
this.getClass().getName() + ".loadItem", this.bundleContext,
this.fatalIllegalStateErrors) {
+ return new InClassLoaderExecute<T>(metricsService,
this.getClass().getName() + ".loadItem", this.bundleContext,
this.fatalIllegalStateErrors, throwExceptions) {
protected T execute(Object... args) throws Exception {
try {
String itemType = Item.getItemType(clazz);
@@ -829,7 +809,7 @@ public class ElasticSearchPersistenceServiceImpl implements
PersistenceService,
final boolean useBatching = useBatchingOption == null ?
this.useBatchingForSave : useBatchingOption;
final boolean alwaysOverwrite = alwaysOverwriteOption == null ?
this.alwaysOverwrite : alwaysOverwriteOption;
- Boolean result = new InClassLoaderExecute<Boolean>(metricsService,
this.getClass().getName() + ".saveItem", this.bundleContext,
this.fatalIllegalStateErrors) {
+ Boolean result = new InClassLoaderExecute<Boolean>(metricsService,
this.getClass().getName() + ".saveItem", this.bundleContext,
this.fatalIllegalStateErrors, throwExceptions) {
protected Boolean execute(Object... args) throws Exception {
try {
String source =
ESCustomObjectMapper.getObjectMapper().writeValueAsString(item);
@@ -896,7 +876,7 @@ public class ElasticSearchPersistenceServiceImpl implements
PersistenceService,
@Override
public boolean update(final Item item, final Date dateHint, final Class
clazz, final Map source, final boolean alwaysOverwrite) {
- Boolean result = new InClassLoaderExecute<Boolean>(metricsService,
this.getClass().getName() + ".updateItem", this.bundleContext,
this.fatalIllegalStateErrors) {
+ Boolean result = new InClassLoaderExecute<Boolean>(metricsService,
this.getClass().getName() + ".updateItem", this.bundleContext,
this.fatalIllegalStateErrors, throwExceptions) {
protected Boolean execute(Object... args) throws Exception {
try {
UpdateRequest updateRequest = createUpdateRequest(clazz,
dateHint, item, source, alwaysOverwrite);
@@ -942,7 +922,7 @@ public class ElasticSearchPersistenceServiceImpl implements
PersistenceService,
if (items.size() == 0)
return new ArrayList<>();
- List<String> result = new
InClassLoaderExecute<List<String>>(metricsService, this.getClass().getName() +
".updateItems", this.bundleContext, this.fatalIllegalStateErrors) {
+ List<String> result = new
InClassLoaderExecute<List<String>>(metricsService, this.getClass().getName() +
".updateItems", this.bundleContext, this.fatalIllegalStateErrors,
throwExceptions) {
protected List<String> execute(Object... args) throws Exception {
long batchRequestStartTime = System.currentTimeMillis();
@@ -973,7 +953,7 @@ public class ElasticSearchPersistenceServiceImpl implements
PersistenceService,
@Override
public boolean updateWithQueryAndScript(final Date dateHint, final
Class<?> clazz, final String[] scripts, final Map<String, Object>[]
scriptParams, final Condition[] conditions) {
- Boolean result = new InClassLoaderExecute<Boolean>(metricsService,
this.getClass().getName() + ".updateWithQueryAndScript", this.bundleContext,
this.fatalIllegalStateErrors) {
+ Boolean result = new InClassLoaderExecute<Boolean>(metricsService,
this.getClass().getName() + ".updateWithQueryAndScript", this.bundleContext,
this.fatalIllegalStateErrors, throwExceptions) {
protected Boolean execute(Object... args) throws Exception {
try {
String itemType = Item.getItemType(clazz);
@@ -1030,7 +1010,7 @@ public class ElasticSearchPersistenceServiceImpl
implements PersistenceService,
@Override
public boolean updateWithScript(final Item item, final Date dateHint,
final Class<?> clazz, final String script, final Map<String, Object>
scriptParams) {
- Boolean result = new InClassLoaderExecute<Boolean>(metricsService,
this.getClass().getName() + ".updateWithScript", this.bundleContext,
this.fatalIllegalStateErrors) {
+ Boolean result = new InClassLoaderExecute<Boolean>(metricsService,
this.getClass().getName() + ".updateWithScript", this.bundleContext,
this.fatalIllegalStateErrors, throwExceptions) {
protected Boolean execute(Object... args) throws Exception {
try {
String itemType = Item.getItemType(clazz);
@@ -1071,7 +1051,7 @@ public class ElasticSearchPersistenceServiceImpl
implements PersistenceService,
@Override
public <T extends Item> boolean remove(final String itemId, final Class<T>
clazz) {
- Boolean result = new InClassLoaderExecute<Boolean>(metricsService,
this.getClass().getName() + ".removeItem", this.bundleContext,
this.fatalIllegalStateErrors) {
+ Boolean result = new InClassLoaderExecute<Boolean>(metricsService,
this.getClass().getName() + ".removeItem", this.bundleContext,
this.fatalIllegalStateErrors, throwExceptions) {
protected Boolean execute(Object... args) throws Exception {
try {
String itemType = Item.getItemType(clazz);
@@ -1092,7 +1072,7 @@ public class ElasticSearchPersistenceServiceImpl
implements PersistenceService,
}
public <T extends Item> boolean removeByQuery(final Condition query, final
Class<T> clazz) {
- Boolean result = new InClassLoaderExecute<Boolean>(metricsService,
this.getClass().getName() + ".removeByQuery", this.bundleContext,
this.fatalIllegalStateErrors) {
+ Boolean result = new InClassLoaderExecute<Boolean>(metricsService,
this.getClass().getName() + ".removeByQuery", this.bundleContext,
this.fatalIllegalStateErrors, throwExceptions) {
protected Boolean execute(Object... args) throws Exception {
try {
String itemType = Item.getItemType(clazz);
@@ -1157,7 +1137,7 @@ public class ElasticSearchPersistenceServiceImpl
implements PersistenceService,
public boolean indexTemplateExists(final String templateName) {
- Boolean result = new InClassLoaderExecute<Boolean>(metricsService,
this.getClass().getName() + ".indexTemplateExists", this.bundleContext,
this.fatalIllegalStateErrors) {
+ Boolean result = new InClassLoaderExecute<Boolean>(metricsService,
this.getClass().getName() + ".indexTemplateExists", this.bundleContext,
this.fatalIllegalStateErrors, throwExceptions) {
protected Boolean execute(Object... args) throws IOException {
IndexTemplatesExistRequest indexTemplatesExistRequest = new
IndexTemplatesExistRequest(templateName);
return
client.indices().existsTemplate(indexTemplatesExistRequest,
RequestOptions.DEFAULT);
@@ -1171,7 +1151,7 @@ public class ElasticSearchPersistenceServiceImpl
implements PersistenceService,
}
public boolean removeIndexTemplate(final String templateName) {
- Boolean result = new InClassLoaderExecute<Boolean>(metricsService,
this.getClass().getName() + ".removeIndexTemplate", this.bundleContext,
this.fatalIllegalStateErrors) {
+ Boolean result = new InClassLoaderExecute<Boolean>(metricsService,
this.getClass().getName() + ".removeIndexTemplate", this.bundleContext,
this.fatalIllegalStateErrors, throwExceptions) {
protected Boolean execute(Object... args) throws IOException {
DeleteIndexTemplateRequest deleteIndexTemplateRequest = new
DeleteIndexTemplateRequest(templateName);
AcknowledgedResponse deleteIndexTemplateResponse =
client.indices().deleteTemplate(deleteIndexTemplateRequest,
RequestOptions.DEFAULT);
@@ -1186,7 +1166,7 @@ public class ElasticSearchPersistenceServiceImpl
implements PersistenceService,
}
public boolean createMonthlyIndexTemplate() {
- Boolean result = new InClassLoaderExecute<Boolean>(metricsService,
this.getClass().getName() + ".createMonthlyIndexTemplate", this.bundleContext,
this.fatalIllegalStateErrors) {
+ Boolean result = new InClassLoaderExecute<Boolean>(metricsService,
this.getClass().getName() + ".createMonthlyIndexTemplate", this.bundleContext,
this.fatalIllegalStateErrors, throwExceptions) {
protected Boolean execute(Object... args) throws IOException {
boolean executedSuccessfully = true;
for (String itemName : itemsMonthlyIndexed) {
@@ -1227,7 +1207,7 @@ public class ElasticSearchPersistenceServiceImpl
implements PersistenceService,
public boolean createIndex(final String itemType) {
String index = getIndex(itemType);
- Boolean result = new InClassLoaderExecute<Boolean>(metricsService,
this.getClass().getName() + ".createIndex", this.bundleContext,
this.fatalIllegalStateErrors) {
+ Boolean result = new InClassLoaderExecute<Boolean>(metricsService,
this.getClass().getName() + ".createIndex", this.bundleContext,
this.fatalIllegalStateErrors, throwExceptions) {
protected Boolean execute(Object... args) throws IOException {
GetIndexRequest getIndexRequest = new GetIndexRequest(index);
boolean indexExists = client.indices().exists(getIndexRequest,
RequestOptions.DEFAULT);
@@ -1248,7 +1228,7 @@ public class ElasticSearchPersistenceServiceImpl
implements PersistenceService,
public boolean removeIndex(final String itemType) {
String index = getIndex(itemType);
- Boolean result = new InClassLoaderExecute<Boolean>(metricsService,
this.getClass().getName() + ".removeIndex", this.bundleContext,
this.fatalIllegalStateErrors) {
+ Boolean result = new InClassLoaderExecute<Boolean>(metricsService,
this.getClass().getName() + ".removeIndex", this.bundleContext,
this.fatalIllegalStateErrors, throwExceptions) {
protected Boolean execute(Object... args) throws IOException {
GetIndexRequest getIndexRequest = new GetIndexRequest(index);
boolean indexExists = client.indices().exists(getIndexRequest,
RequestOptions.DEFAULT);
@@ -1319,7 +1299,7 @@ public class ElasticSearchPersistenceServiceImpl
implements PersistenceService,
@Override
public Map<String, Map<String, Object>> getPropertiesMapping(final String
itemType) {
- return new InClassLoaderExecute<Map<String, Map<String,
Object>>>(metricsService, this.getClass().getName() + ".getPropertiesMapping",
this.bundleContext, this.fatalIllegalStateErrors) {
+ return new InClassLoaderExecute<Map<String, Map<String,
Object>>>(metricsService, this.getClass().getName() + ".getPropertiesMapping",
this.bundleContext, this.fatalIllegalStateErrors, throwExceptions) {
@SuppressWarnings("unchecked")
protected Map<String, Map<String, Object>> execute(Object... args)
throws Exception {
// Get all mapping for current itemType
@@ -1416,7 +1396,7 @@ public class ElasticSearchPersistenceServiceImpl
implements PersistenceService,
}
public boolean saveQuery(final String queryName, final String query) {
- Boolean result = new InClassLoaderExecute<Boolean>(metricsService,
this.getClass().getName() + ".saveQuery", this.bundleContext,
this.fatalIllegalStateErrors) {
+ Boolean result = new InClassLoaderExecute<Boolean>(metricsService,
this.getClass().getName() + ".saveQuery", this.bundleContext,
this.fatalIllegalStateErrors, throwExceptions) {
protected Boolean execute(Object... args) throws Exception {
//Index the query = register it in the percolator
try {
@@ -1451,7 +1431,7 @@ public class ElasticSearchPersistenceServiceImpl
implements PersistenceService,
@Override
public boolean removeQuery(final String queryName) {
- Boolean result = new InClassLoaderExecute<Boolean>(metricsService,
this.getClass().getName() + ".removeQuery", this.bundleContext,
this.fatalIllegalStateErrors) {
+ Boolean result = new InClassLoaderExecute<Boolean>(metricsService,
this.getClass().getName() + ".removeQuery", this.bundleContext,
this.fatalIllegalStateErrors, throwExceptions) {
protected Boolean execute(Object... args) throws Exception {
//Index the query = register it in the percolator
try {
@@ -1590,7 +1570,7 @@ public class ElasticSearchPersistenceServiceImpl
implements PersistenceService,
}
private long queryCount(final QueryBuilder filter, final String itemType) {
- return new InClassLoaderExecute<Long>(metricsService,
this.getClass().getName() + ".queryCount", this.bundleContext,
this.fatalIllegalStateErrors) {
+ return new InClassLoaderExecute<Long>(metricsService,
this.getClass().getName() + ".queryCount", this.bundleContext,
this.fatalIllegalStateErrors, throwExceptions) {
@Override
protected Long execute(Object... args) throws IOException {
@@ -1606,7 +1586,7 @@ public class ElasticSearchPersistenceServiceImpl
implements PersistenceService,
}
private <T extends Item> PartialList<T> query(final QueryBuilder query,
final String sortBy, final Class<T> clazz, final int offset, final int size,
final String[] routing, final String scrollTimeValidity) {
- return new InClassLoaderExecute<PartialList<T>>(metricsService,
this.getClass().getName() + ".query", this.bundleContext,
this.fatalIllegalStateErrors) {
+ return new InClassLoaderExecute<PartialList<T>>(metricsService,
this.getClass().getName() + ".query", this.bundleContext,
this.fatalIllegalStateErrors, throwExceptions) {
@Override
protected PartialList<T> execute(Object... args) throws Exception {
@@ -1732,7 +1712,7 @@ public class ElasticSearchPersistenceServiceImpl
implements PersistenceService,
@Override
public <T extends Item> PartialList<T> continueScrollQuery(final Class<T>
clazz, final String scrollIdentifier, final String scrollTimeValidity) {
- return new InClassLoaderExecute<PartialList<T>>(metricsService,
this.getClass().getName() + ".continueScrollQuery", this.bundleContext,
this.fatalIllegalStateErrors) {
+ return new InClassLoaderExecute<PartialList<T>>(metricsService,
this.getClass().getName() + ".continueScrollQuery", this.bundleContext,
this.fatalIllegalStateErrors, throwExceptions) {
@Override
protected PartialList<T> execute(Object... args) throws Exception {
@@ -1792,7 +1772,7 @@ public class ElasticSearchPersistenceServiceImpl
implements PersistenceService,
private Map<String, Long> aggregateQuery(final Condition filter, final
BaseAggregate aggregate, final String itemType,
final boolean optimizedQuery, int queryBucketSize) {
- return new InClassLoaderExecute<Map<String, Long>>(metricsService,
this.getClass().getName() + ".aggregateQuery", this.bundleContext,
this.fatalIllegalStateErrors) {
+ return new InClassLoaderExecute<Map<String, Long>>(metricsService,
this.getClass().getName() + ".aggregateQuery", this.bundleContext,
this.fatalIllegalStateErrors, throwExceptions) {
@Override
protected Map<String, Long> execute(Object... args) throws
IOException {
@@ -1976,7 +1956,7 @@ public class ElasticSearchPersistenceServiceImpl
implements PersistenceService,
@Override
public void refresh() {
- new InClassLoaderExecute<Boolean>(metricsService,
this.getClass().getName() + ".refresh", this.bundleContext,
this.fatalIllegalStateErrors) {
+ new InClassLoaderExecute<Boolean>(metricsService,
this.getClass().getName() + ".refresh", this.bundleContext,
this.fatalIllegalStateErrors, throwExceptions) {
protected Boolean execute(Object... args) {
if (bulkProcessor != null) {
bulkProcessor.flush();
@@ -1993,7 +1973,7 @@ public class ElasticSearchPersistenceServiceImpl
implements PersistenceService,
@Override
public <T extends Item> void refreshIndex(Class<T> clazz, Date dateHint){
- new InClassLoaderExecute<Boolean>(metricsService,
this.getClass().getName() + ".refreshIndex", this.bundleContext,
this.fatalIllegalStateErrors) {
+ new InClassLoaderExecute<Boolean>(metricsService,
this.getClass().getName() + ".refreshIndex", this.bundleContext,
this.fatalIllegalStateErrors, throwExceptions) {
protected Boolean execute(Object... args) {
try {
String itemType = Item.getItemType(clazz);
@@ -2011,7 +1991,7 @@ public class ElasticSearchPersistenceServiceImpl
implements PersistenceService,
@Override
public void purge(final Date date) {
- new InClassLoaderExecute<Object>(metricsService,
this.getClass().getName() + ".purgeWithDate", this.bundleContext,
this.fatalIllegalStateErrors) {
+ new InClassLoaderExecute<Object>(metricsService,
this.getClass().getName() + ".purgeWithDate", this.bundleContext,
this.fatalIllegalStateErrors, throwExceptions) {
@Override
protected Object execute(Object... args) throws Exception {
@@ -2047,7 +2027,7 @@ public class ElasticSearchPersistenceServiceImpl
implements PersistenceService,
@Override
public void purge(final String scope) {
- new InClassLoaderExecute<Void>(metricsService,
this.getClass().getName() + ".purgeWithScope", this.bundleContext,
this.fatalIllegalStateErrors) {
+ new InClassLoaderExecute<Void>(metricsService,
this.getClass().getName() + ".purgeWithScope", this.bundleContext,
this.fatalIllegalStateErrors, throwExceptions) {
@Override
protected Void execute(Object... args) throws IOException {
QueryBuilder query = termQuery("scope", scope);
@@ -2099,7 +2079,7 @@ public class ElasticSearchPersistenceServiceImpl
implements PersistenceService,
@Override
public Map<String, Double> getSingleValuesMetrics(final Condition
condition, final String[] metrics, final String field, final String itemType) {
- return new InClassLoaderExecute<Map<String, Double>>(metricsService,
this.getClass().getName() + ".getSingleValuesMetrics", this.bundleContext,
this.fatalIllegalStateErrors) {
+ return new InClassLoaderExecute<Map<String, Double>>(metricsService,
this.getClass().getName() + ".getSingleValuesMetrics", this.bundleContext,
this.fatalIllegalStateErrors, throwExceptions) {
@Override
protected Map<String, Double> execute(Object... args) throws
IOException {
@@ -2171,12 +2151,14 @@ public class ElasticSearchPersistenceServiceImpl
implements PersistenceService,
private MetricsService metricsService;
private BundleContext bundleContext;
private String[] fatalIllegalStateErrors; // Errors that if occur -
stop the application
+ private boolean throwExceptions;
- public InClassLoaderExecute(MetricsService metricsService, String
timerName, BundleContext bundleContext, String[] fatalIllegalStateErrors) {
+ public InClassLoaderExecute(MetricsService metricsService, String
timerName, BundleContext bundleContext, String[] fatalIllegalStateErrors,
boolean throwExceptions) {
this.timerName = timerName;
this.metricsService = metricsService;
this.bundleContext = bundleContext;
this.fatalIllegalStateErrors = fatalIllegalStateErrors;
+ this.throwExceptions = throwExceptions;
}
protected abstract T execute(Object... args) throws Exception;
diff --git
a/persistence-spi/src/main/java/org/apache/unomi/persistence/spi/PersistenceService.java
b/persistence-spi/src/main/java/org/apache/unomi/persistence/spi/PersistenceService.java
index 96d46de..636939a 100644
---
a/persistence-spi/src/main/java/org/apache/unomi/persistence/spi/PersistenceService.java
+++
b/persistence-spi/src/main/java/org/apache/unomi/persistence/spi/PersistenceService.java
@@ -81,35 +81,6 @@ public interface PersistenceService {
<T extends Item> PartialList<T> getAllItems(final Class<T> clazz, int
offset, int size, String sortBy, String scrollTimeValidity);
/**
- * Set settings of the persistence service
- *
- * @param settings map of setting name and it's value
- * @throws NoSuchFieldException if the field does not exist
- * @throws IllegalAccessException field is not accessible to be changed
- */
- void setSettings(Map<String, Object> settings) throws
NoSuchFieldException, IllegalAccessException;
-
- /**
- * Set settings of the persistence service
- *
- * @param fieldName name of the field to set
- * @param value value of the field to set
- * @throws NoSuchFieldException if the field does not exist
- * @throws IllegalAccessException field is not accessible to be changed
- */
- void setSetting(String fieldName, Object value) throws
NoSuchFieldException, IllegalAccessException;
-
- /**
- * Get settings of the persistence service
- *
- * @param fieldName name of the field to get
- * @return an object corresponding to the field that was accessed
- * @throws NoSuchFieldException if the field does not exist
- * @throws IllegalAccessException field is not accessible to be changed
- */
- Object getSetting(String fieldName) throws NoSuchFieldException,
IllegalAccessException;
-
- /**
* Return true if the item which is saved in the persistence service is
consistent
*
* @param item the item to the check if consistent