Skip to content
Permalink
Browse files

Issue #350: Fixed compilation errors. Had to move configs to central …

…location.

Signed-off-by: Juergen Fickel <juergen.fickel@bosch-si.com>
  • Loading branch information
jufickel-b committed May 17, 2019
1 parent db6ac4b commit 1c9432a466ee939b110b94062364b1b10011de46
Showing with 1,360 additions and 384 deletions.
  1. +8 −0 services/thingsearch/common/pom.xml
  2. +89 −0 ...ommon/src/main/java/org/eclipse/ditto/services/thingsearch/common/config/DefaultDeleteConfig.java
  3. +1 −1 ...on/src/main/java/org/eclipse/ditto/services/thingsearch/common}/config/DefaultDeletionConfig.java
  4. +100 −0 ...ain/java/org/eclipse/ditto/services/thingsearch/common/config/DefaultPersistenceStreamConfig.java
  5. +114 −0 .../src/main/java/org/eclipse/ditto/services/thingsearch/common/config/DefaultStreamCacheConfig.java
  6. +129 −0 ...ommon/src/main/java/org/eclipse/ditto/services/thingsearch/common/config/DefaultStreamConfig.java
  7. +95 −0 .../src/main/java/org/eclipse/ditto/services/thingsearch/common/config/DefaultStreamStageConfig.java
  8. +1 −1 ...mon/src/main/java/org/eclipse/ditto/services/thingsearch/common}/config/DefaultUpdaterConfig.java
  9. +55 −0 ...earch/common/src/main/java/org/eclipse/ditto/services/thingsearch/common/config/DeleteConfig.java
  10. +1 −1 ... → common/src/main/java/org/eclipse/ditto/services/thingsearch/common}/config/DeletionConfig.java
  11. +52 −26 ...common/src/main/java/org/eclipse/ditto/services/thingsearch/common}/config/DittoSearchConfig.java
  12. +67 −0 ...n/src/main/java/org/eclipse/ditto/services/thingsearch/common/config/PersistenceStreamConfig.java
  13. +50 −3 ...er → common/src/main/java/org/eclipse/ditto/services/thingsearch/common}/config/SearchConfig.java
  14. +82 −0 .../common/src/main/java/org/eclipse/ditto/services/thingsearch/common/config/StreamCacheConfig.java
  15. +112 −0 ...earch/common/src/main/java/org/eclipse/ditto/services/thingsearch/common/config/StreamConfig.java
  16. +74 −0 .../common/src/main/java/org/eclipse/ditto/services/thingsearch/common/config/StreamStageConfig.java
  17. +1 −1 ...r → common/src/main/java/org/eclipse/ditto/services/thingsearch/common}/config/UpdaterConfig.java
  18. +15 −2 ...rc/test/java/org/eclipse/ditto/services/thingsearch/common}/config/DefaultDeletionConfigTest.java
  19. +15 −2 ...src/test/java/org/eclipse/ditto/services/thingsearch/common}/config/DefaultUpdaterConfigTest.java
  20. 0 services/thingsearch/{updater-actors → common}/src/test/resources/deletion-test.conf
  21. 0 services/thingsearch/{updater-actors → common}/src/test/resources/updater-test.conf
  22. +21 −1 .../main/java/org/eclipse/ditto/services/thingsearch/persistence/write/model/AbstractWriteModel.java
  23. +4 −1 ...rc/main/java/org/eclipse/ditto/services/thingsearch/persistence/write/model/ThingDeleteModel.java
  24. +3 −2 ...src/main/java/org/eclipse/ditto/services/thingsearch/persistence/write/model/ThingWriteModel.java
  25. +20 −17 ...main/java/org/eclipse/ditto/services/thingsearch/persistence/write/streaming/EnforcementFlow.java
  26. +47 −30 .../java/org/eclipse/ditto/services/thingsearch/persistence/write/streaming/SearchUpdaterStream.java
  27. +0 −169 ...lipse/ditto/services/thingsearch/persistence/write/streaming/SearchUpdaterStreamConfigReader.java
  28. +39 −0 ...ce/src/test/java/org/eclipse/ditto/services/thingsearch/persistence/write/model/MetadataTest.java
  29. +39 −0 ...est/java/org/eclipse/ditto/services/thingsearch/persistence/write/model/ThingDeleteModelTest.java
  30. +31 −0 ...test/java/org/eclipse/ditto/services/thingsearch/persistence/write/model/ThingWriteModelTest.java
  31. +1 −1 ...ingsearch/starter/src/main/java/org/eclipse/ditto/services/thingsearch/starter/SearchService.java
  32. +2 −2 .../java/org/eclipse/ditto/services/thingsearch/starter/actors/SearchHealthCheckingActorFactory.java
  33. +30 −33 .../starter/src/main/java/org/eclipse/ditto/services/thingsearch/starter/actors/SearchRootActor.java
  34. +10 −6 services/thingsearch/starter/src/main/resources/things-search.conf
  35. +0 −1 .../org/eclipse/ditto/services/thingsearch/starter/actors/LastSuccessfulStreamCheckingActorTest.java
  36. +1 −0 ...er/src/test/java/org/eclipse/ditto/services/thingsearch/starter/config/DittoSearchConfigTest.java
  37. +12 −7 ...ter-actors/src/main/java/org/eclipse/ditto/services/thingsearch/updater/actors/ManualUpdater.java
  38. +2 −3 ...n/java/org/eclipse/ditto/services/thingsearch/updater/actors/PoliciesStreamSupervisorCreator.java
  39. +10 −7 ...ors/src/main/java/org/eclipse/ditto/services/thingsearch/updater/actors/PolicyEventForwarder.java
  40. +24 −65 ...s/src/main/java/org/eclipse/ditto/services/thingsearch/updater/actors/SearchUpdaterRootActor.java
  41. +2 −1 ...ain/java/org/eclipse/ditto/services/thingsearch/updater/actors/ThingsSearchNamespaceOpsActor.java
  42. +1 −1 ...ain/java/org/eclipse/ditto/services/thingsearch/updater/actors/ThingsStreamSupervisorCreator.java
@@ -73,6 +73,10 @@
<artifactId>ditto-signals-events-things</artifactId>
</dependency>

<dependency>
<groupId>org.eclipse.ditto</groupId>
<artifactId>ditto-services-base</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.ditto</groupId>
<artifactId>ditto-services-models-policies</artifactId>
@@ -90,5 +94,9 @@
<groupId>org.eclipse.ditto</groupId>
<artifactId>ditto-services-utils-cluster</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.ditto</groupId>
<artifactId>ditto-services-utils-persistence</artifactId>
</dependency>
</dependencies>
</project>
@@ -0,0 +1,89 @@
/*
* Copyright (c) 2019 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.eclipse.ditto.services.thingsearch.common.config;

import java.io.Serializable;
import java.util.Objects;

import javax.annotation.concurrent.Immutable;

import org.eclipse.ditto.services.utils.config.ConfigWithFallback;

import com.typesafe.config.Config;

/**
* This class is the default implementation of {@link DeleteConfig}.
*/
@Immutable
public final class DefaultDeleteConfig implements DeleteConfig, Serializable {

private static final String CONFIG_PATH = "delete";

private static final long serialVersionUID = -4078280758858400852L;

private final boolean deleteEvent;
private final boolean deleteNamespace;

private DefaultDeleteConfig(final ConfigWithFallback configWithFallback) {
deleteEvent = configWithFallback.getBoolean(DeleteConfigValue.EVENT.getConfigPath());
deleteNamespace = configWithFallback.getBoolean(DeleteConfigValue.NAMESPACE.getConfigPath());
}

/**
* Returns an instance of DefaultDeleteConfig based on the settings of the specified Config.
*
* @param config is supposed to provide the settings of the delete config at {@code configPath}.
* @return the instance.
* @throws org.eclipse.ditto.services.utils.config.DittoConfigError if {@code config} is invalid.
*/
public static DefaultDeleteConfig of(final Config config) {
return new DefaultDeleteConfig(ConfigWithFallback.newInstance(config, CONFIG_PATH, DeleteConfigValue.values()));
}

@Override
public boolean isDeleteEvent() {
return deleteEvent;
}

@Override
public boolean isDeleteNamespace() {
return deleteNamespace;
}

@Override
public boolean equals(final Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
final DefaultDeleteConfig that = (DefaultDeleteConfig) o;
return deleteEvent == that.deleteEvent &&
deleteNamespace == that.deleteNamespace;
}

@Override
public int hashCode() {
return Objects.hash(deleteEvent, deleteNamespace);
}

@Override
public String toString() {
return getClass().getSimpleName() + " [" +
"deleteEvent=" + deleteEvent +
", deleteNamespace=" + deleteNamespace +
"]";
}

}
@@ -10,7 +10,7 @@
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.eclipse.ditto.services.thingsearch.updater.config;
package org.eclipse.ditto.services.thingsearch.common.config;

import java.io.Serializable;
import java.text.MessageFormat;
@@ -0,0 +1,100 @@
/*
* Copyright (c) 2019 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.eclipse.ditto.services.thingsearch.common.config;

import java.io.Serializable;
import java.util.Objects;

import javax.annotation.Nullable;
import javax.annotation.concurrent.Immutable;

import org.eclipse.ditto.services.base.config.supervision.ExponentialBackOffConfig;
import org.eclipse.ditto.services.utils.config.ConfigWithFallback;

import com.typesafe.config.Config;

/**
* This class is the default implementation of {@link PersistenceStreamConfig}.
*/
@Immutable
public final class DefaultPersistenceStreamConfig implements PersistenceStreamConfig, Serializable {

private static final String CONFIG_PATH = "persistence";

private static final long serialVersionUID = 49154106468833606L;

private final int maxBulkSize;
private final DefaultStreamStageConfig defaultStreamStageConfig;

private DefaultPersistenceStreamConfig(final ConfigWithFallback persistenceStreamScopedConfig,
final DefaultStreamStageConfig defaultStreamStageConfig) {

maxBulkSize = persistenceStreamScopedConfig.getInt(PersistenceStreamConfigValue.MAX_BULK_SIZE.getConfigPath());
this.defaultStreamStageConfig = defaultStreamStageConfig;
}

/**
* Returns an instance of DefaultPersistenceStreamConfig based on the settings of the specified Config.
*
* @param config is supposed to provide the settings of the persistence stream config at {@value CONFIG_PATH}.
* @return the instance.
* @throws org.eclipse.ditto.services.utils.config.DittoConfigError if {@code config} is invalid.
*/
public static DefaultPersistenceStreamConfig of(final Config config) {
return new DefaultPersistenceStreamConfig(
ConfigWithFallback.newInstance(config, CONFIG_PATH, PersistenceStreamConfigValue.values()),
DefaultStreamStageConfig.getInstance(config, CONFIG_PATH));
}

@Override
public int getMaxBulkSize() {
return maxBulkSize;
}

@Override
public int getParallelism() {
return defaultStreamStageConfig.getParallelism();
}

@Override
public ExponentialBackOffConfig getExponentialBackOffConfig() {
return defaultStreamStageConfig.getExponentialBackOffConfig();
}

@Override
public boolean equals(@Nullable final Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
final DefaultPersistenceStreamConfig that = (DefaultPersistenceStreamConfig) o;
return maxBulkSize == that.maxBulkSize &&
defaultStreamStageConfig.equals(that.defaultStreamStageConfig);
}

@Override
public int hashCode() {
return Objects.hash(maxBulkSize, defaultStreamStageConfig);
}

@Override
public String toString() {
return getClass().getSimpleName() + " [" +
"maxBulkSize=" + maxBulkSize +
", defaultStreamStageConfig=" + defaultStreamStageConfig +
"]";
}

}
@@ -0,0 +1,114 @@
/*
* Copyright (c) 2019 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.eclipse.ditto.services.thingsearch.common.config;

import java.io.Serializable;
import java.time.Duration;
import java.util.Objects;

import javax.annotation.concurrent.Immutable;

import org.eclipse.ditto.services.utils.cache.config.DefaultCacheConfig;
import org.eclipse.ditto.services.utils.config.ConfigWithFallback;

import com.typesafe.config.Config;

/**
* This class is the default implementation of {@link StreamCacheConfig}.
*/
@Immutable
public final class DefaultStreamCacheConfig implements StreamCacheConfig, Serializable {

private static final String CONFIG_PATH = "cache";

private static final long serialVersionUID = -4331586939252742694L;

private final String dispatcherName;
private final Duration retryDelay;
private final DefaultCacheConfig genericCacheConfig;

private DefaultStreamCacheConfig(final ConfigWithFallback streamCacheScopedConfig,
final DefaultCacheConfig genericCacheConfig) {

dispatcherName = streamCacheScopedConfig.getString(StreamCacheConfigValue.DISPATCHER_NAME.getConfigPath());
retryDelay = streamCacheScopedConfig.getDuration(StreamCacheConfigValue.RETRY_DELAY.getConfigPath());
this.genericCacheConfig = genericCacheConfig;
}

/**
* Returns an instance of DefaultStreamCacheConfig based on the settings of the specified Config.
*
* @param config is supposed to provide the settings of the stream cache config at {@value CONFIG_PATH}.
* @return the instance.
* @throws org.eclipse.ditto.services.utils.config.DittoConfigError if {@code config} is invalid.
*/
public static DefaultStreamCacheConfig of(final Config config) {
return new DefaultStreamCacheConfig(
ConfigWithFallback.newInstance(config, CONFIG_PATH, StreamCacheConfigValue.values()),
DefaultCacheConfig.of(config, CONFIG_PATH));
}

@Override
public String getDispatcherName() {
return dispatcherName;
}

@Override
public Duration getRetryDelay() {
return retryDelay;
}

@Override
public long getMaximumSize() {
return genericCacheConfig.getMaximumSize();
}

@Override
public Duration getExpireAfterWrite() {
return genericCacheConfig.getExpireAfterWrite();
}

@Override
public Duration getExpireAfterAccess() {
return genericCacheConfig.getExpireAfterAccess();
}

@Override
public boolean equals(final Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
final DefaultStreamCacheConfig that = (DefaultStreamCacheConfig) o;
return dispatcherName.equals(that.dispatcherName) &&
retryDelay.equals(that.retryDelay) &&
genericCacheConfig.equals(that.genericCacheConfig);
}

@Override
public int hashCode() {
return Objects.hash(dispatcherName, retryDelay, genericCacheConfig);
}

@Override
public String toString() {
return getClass().getSimpleName() + " [" +
"dispatcherName=" + dispatcherName +
", retryDelay=" + retryDelay +
", genericCacheConfig=" + genericCacheConfig +
"]";
}

}

0 comments on commit 1c9432a

Please sign in to comment.
You can’t perform that action at this time.