Skip to content

Commit

Permalink
Merge branch 'master' into feature/graceful-shutdown
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Maute <stefan.maute@bosch.io>
  • Loading branch information
Stefan Maute committed Sep 8, 2022
2 parents d120e8a + dc04092 commit 9415fd9
Show file tree
Hide file tree
Showing 156 changed files with 1,884 additions and 1,758 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
[![License](https://img.shields.io/badge/License-EPL%202.0-green.svg)](https://opensource.org/licenses/EPL-2.0)
[![Lines of code](https://img.shields.io/badge/dynamic/xml.svg?label=Lines%20of%20code&url=https%3A%2F%2Fwww.openhub.net%2Fprojects%2Feclipse-ditto.xml%3Fapi_key%3D11ac3aa12a364fd87b461559a7eedcc53e18fb5a4cf1e43e02cb7a615f1f3d4f&query=%2Fresponse%2Fresult%2Fproject%2Fanalysis%2Ftotal_code_lines&colorB=lightgrey)](https://www.openhub.net/p/eclipse-ditto)

[Eclipse Ditto](https://eclipse.org/ditto/)™ is a technology in the IoT implementing a software pattern called “digital twins”.
[Eclipse Ditto](https://websites.eclipseprojects.io/ditto/)™ is a technology in the IoT implementing a software pattern called “digital twins”.
A digital twin is a virtual, cloud based, representation of his real world counterpart (real world “Things”, e.g. devices like sensors, smart heating, connected cars, smart grids, EV charging stations, …).

An ever growing list of [adopters](https://iot.eclipse.org/adopters/?#iot.ditto) makes use of Ditto as part of their IoT platforms - if you're as well using it, it would be super nice to show your [adoption here](https://iot.eclipse.org/adopters/how-to-be-listed-as-an-adopter/).

## Documentation

Find the documentation on the project site: [https://eclipse.org/ditto/](https://eclipse.org/ditto)
Find the documentation on the project site: [https://websites.eclipseprojects.io/ditto/](https://websites.eclipseprojects.io/ditto/)

## Eclipse Ditto™ explorer UI

Expand Down
4 changes: 4 additions & 0 deletions base/model/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,10 @@
<exclude>org.eclipse.ditto.base.model.signals.commands.exceptions</exclude>
<exclude>org.eclipse.ditto.base.model.headers.DittoHeaderDefinition#POLICY_ENFORCER_INVALIDATED_PREEMPTIVELY</exclude>
<exclude>org.eclipse.ditto.base.model.headers.DittoHeadersSizeChecker</exclude>
<exclude>org.eclipse.ditto.base.model.entity.id.RegexPatterns</exclude>
<exclude>org.eclipse.ditto.base.model.exceptions.DittoHeaderInvalidException#newCustomMessageBuilder(java.lang.String)</exclude>
<exclude>org.eclipse.ditto.base.model.namespaces.signals.commands.PurgeNamespaceResponse$JsonFields</exclude>
<exclude>org.eclipse.ditto.base.model.signals.commands.CommandResponseJsonDeserializer</exclude>
</excludes>
</parameter>
</configuration>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,50 +69,13 @@ public final class RegexPatterns {
public static final String ALLOWED_NAMESPACE_CHARACTERS_REGEX_INNER =
"[.-]" + ALLOWED_NAMESPACE_CHARACTERS_REGEX;

/**
* @deprecated Use {@link #ALLOWED_NAMESPACE_CHARACTERS_REGEX_INNER}. The name of the variable actually described
* the content, which has now changed. The name new describes the purpose.
*/
@Deprecated
public static final String ALLOWED_NAMESPACE_CHARACTERS_INCLUDING_DOT = ALLOWED_NAMESPACE_CHARACTERS_REGEX_INNER;

/**
* The regex pattern for namespaces which validates that the namespace conforms the java package notation.
*/
public static final String NAMESPACE_REGEX = "(?<" + NAMESPACE_GROUP_NAME + ">|(?:" +
"(?:" + ALLOWED_NAMESPACE_CHARACTERS_REGEX + ")" +
"(?:" + ALLOWED_NAMESPACE_CHARACTERS_REGEX_INNER + ")*+))";

/**
* Regex pattern that matches URL escapes. E.G. %3A for a colon (':').
* @deprecated since 2.4.0
*/
@Deprecated
public static final String URL_ESCAPES = "%\\p{XDigit}{2}";

/**
* Adds the $ to allowed characters. Its defined as separate constant because names are not allowed to start
* with $.
* @deprecated since 2.4.0
*/
@Deprecated
public static final String ALLOWED_CHARACTERS_IN_NAME_INCLUDING_DOLLAR = ALLOWED_CHARACTERS_IN_NAME + "$";

/**
* First part of an entity name.
* @deprecated since 2.4.0
*/
@Deprecated
public static final String URI_PATH_SEGMENT = "(?:[" + ALLOWED_CHARACTERS_IN_NAME + "]|" + URL_ESCAPES + ")";

/**
* Second part of an entity name: This part allows the $ symbol.
* @deprecated since 2.4.0
*/
@Deprecated
public static final String URI_PATH_SEGMENT_INCLUDING_DOLLAR =
"(?:[" + ALLOWED_CHARACTERS_IN_NAME_INCLUDING_DOLLAR + "]|" + URL_ESCAPES + ")";

/**
* The regex pattern for an Entity Name.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,18 +112,6 @@ public static DittoHeaderInvalidException.Builder newInvalidTypeBuilder(final He
return new DittoHeaderInvalidException.Builder(headerDefinition.getKey(), headerValue, headerType);
}

/**
* A mutable builder for a {@code DittoHeaderInvalidException} with a custom message.
*
* @param customMessage the custom message
* @return the builder.
* @deprecated as of Ditto 2.0 please use {@code newBuilder().message(String)}.
*/
@Deprecated
public static DittoHeaderInvalidException.Builder newCustomMessageBuilder(final String customMessage) {
return new DittoHeaderInvalidException.Builder(customMessage);
}

/**
* Returns a new mutable builder with a fluent API for creating a {@code DittoHeaderInvalidException}.
* The returned builder is initialized with a default message and a default description.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,9 @@

import org.eclipse.ditto.base.model.common.HttpStatus;
import org.eclipse.ditto.base.model.headers.DittoHeaders;
import org.eclipse.ditto.base.model.json.FieldType;
import org.eclipse.ditto.base.model.json.JsonParsableCommandResponse;
import org.eclipse.ditto.base.model.json.JsonSchemaVersion;
import org.eclipse.ditto.base.model.signals.commands.CommandResponseHttpStatusValidator;
import org.eclipse.ditto.base.model.signals.commands.CommandResponseJsonDeserializer;
import org.eclipse.ditto.json.JsonFieldDefinition;
import org.eclipse.ditto.json.JsonObject;

/**
Expand Down Expand Up @@ -112,7 +109,6 @@ public static PurgeNamespaceResponse failed(final CharSequence namespace,
* <ul>
* <li>{@link NamespaceCommandResponse.JsonFields#NAMESPACE},</li>
* <li>{@link NamespaceCommandResponse.JsonFields#RESOURCE_TYPE} or</li>
* <li>{@link PurgeNamespaceResponse.JsonFields#SUCCESSFUL}.</li>
* </ul>
*/
public static PurgeNamespaceResponse fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders) {
Expand Down Expand Up @@ -167,30 +163,4 @@ public String toString() {
return getClass().getSimpleName() + " [" + super.toString() + ", successful=" + isSuccessful() + "]";
}

/**
* This class contains definitions for all specific fields of a {@code PurgeNamespaceResponse}'s JSON
* representation.
*
* @deprecated as of 2.3.0 there are no additional JSON fields for {@code PurgeNamespaceResponse}.
*/
@Deprecated
@Immutable
public static final class JsonFields extends NamespaceCommandResponse.JsonFields {

/**
* This JSON field indicates whether the namespace was purged successfully.
*
* @deprecated as of 2.3.0 this field is not used anymore as the success
* status is derived from HTTP status code.
*/
@Deprecated
public static final JsonFieldDefinition<Boolean> SUCCESSFUL =
JsonFieldDefinition.ofBoolean("successful", FieldType.REGULAR, JsonSchemaVersion.V_2);

private JsonFields() {
throw new AssertionError();
}

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -29,60 +29,26 @@

/**
* This class helps to deserialize JSON to a sub-class of {@link CommandResponse}. Hereby this class extracts the
* values which are common for all command responses. All remaining required values have to be extracted in
* {@link CommandResponseJsonDeserializer.FactoryMethodFunction#create(org.eclipse.ditto.base.model.common.HttpStatus)}.
* There the actual command response object is created, too.
* values which are common for all command responses.
*/
public final class CommandResponseJsonDeserializer<T extends CommandResponse<?>> {

@Nullable private final JsonObject jsonObject;
private final String expectedCommandResponseType;
private final DeserializationFunction<T> deserializationFunction;

private CommandResponseJsonDeserializer(final CharSequence type,
@Nullable final JsonObject jsonObject,
final DeserializationFunction<T> deserializationFunction) {

this.jsonObject = jsonObject;
expectedCommandResponseType = ConditionChecker.checkArgument(checkNotNull(type, "type").toString(),
arg -> !arg.trim().isEmpty(),
() -> "The type must not be empty or blank.");
this.deserializationFunction = deserializationFunction;
}

/**
* Constructs a new {@code CommandResponseJsonDeserializer} object.
*
* @param type the type of the command response.
* @param jsonObject the JSON object to deserialize.
* @throws NullPointerException if any argument is {@code null}.
* @throws IllegalArgumentException if {@code type} is empty or blank.
* @deprecated as of 2.3.0 please use {@link #newInstance(CharSequence, DeserializationFunction)} instead.
*/
@Deprecated
public CommandResponseJsonDeserializer(final String type, final JsonObject jsonObject) {
this(type, checkJsonObjectNotNull(jsonObject), null);
}

private static JsonObject checkJsonObjectNotNull(@Nullable final JsonObject jsonObject) {
return checkNotNull(jsonObject, "jsonObject");
}

/**
* Constructs a new {@code CommandResponseJsonDeserializer} object.
*
* @param type the type of the target command response of deserialization.
* @param jsonString the JSON string to be deserialized.
* @throws NullPointerException if any argument is {@code null}.
* @throws IllegalArgumentException if {@code type} is empty or blank or if {@code jsonString} is empty.
* @throws org.eclipse.ditto.json.JsonParseException if {@code jsonString} does not contain a valid JSON object.
* @deprecated as of 2.3.0 please use {@link #newInstance(CharSequence, DeserializationFunction)} instead.
*/
@Deprecated
public CommandResponseJsonDeserializer(final String type, final String jsonString) {
this(type, JsonObject.of(jsonString));
}

/**
* Returns a new instance of {@code CommandResponseJsonDeserializer}.
*
Expand All @@ -99,33 +65,10 @@ public CommandResponseJsonDeserializer(final String type, final String jsonStrin
public static <T extends CommandResponse<?>> CommandResponseJsonDeserializer<T> newInstance(final CharSequence type,
final DeserializationFunction<T> deserializationFunction) {

return new CommandResponseJsonDeserializer(type,
null,
return new CommandResponseJsonDeserializer<>(type,
checkNotNull(deserializationFunction, "deserializationFunction"));
}

/**
* Partly deserializes the JSON which was given to this object's constructor. The factory method function which is
* given to this method is responsible for creating the actual {@code CommandResponseType}. This method receives
* the partly deserialized values which can be completed by implementors if further values are required.
*
* @param factoryMethodFunction creates the actual {@code CommandResponseType} object.
* @return the command response.
* @throws NullPointerException if {@code factoryMethodFunction} is {@code null}.
* @throws org.eclipse.ditto.json.JsonParseException if the JSON is invalid or if the command response type
* differs from the expected one.
* @deprecated as of 2.3.0 please use {@link #deserialize(JsonObject, DittoHeaders)} instead.
*/
@Deprecated
public T deserialize(final FactoryMethodFunction<T> factoryMethodFunction) {
final CommandResponseJsonDeserializer<T> deserializer =
new CommandResponseJsonDeserializer<>(expectedCommandResponseType,
checkJsonObjectNotNull(jsonObject),
context -> factoryMethodFunction.create(context.getDeserializedHttpStatus()));

return deserializer.deserialize(jsonObject, DittoHeaders.empty());
}

/**
* Deserializes the specified {@code JsonObject} argument to an instance of {@code CommandResponse}.
* Any exception that is thrown during deserialization will be subsumed as cause of a {@code JsonParseException}.
Expand Down Expand Up @@ -177,28 +120,6 @@ private JsonParseException newJsonParseException(final Exception cause) {
.build();
}

/**
* Represents a function that accepts three arguments to produce a {@code CommandResponse}. The arguments were
* extracted from a given JSON beforehand.
*
* @param <T> the type of the result of the function.
* @deprecated as of 2.3.0 please use {@link DeserializationFunction} instead.
*/
@Deprecated
@FunctionalInterface
public interface FactoryMethodFunction<T extends CommandResponse<?>> {

/**
* Creates a {@code CommandResponse} with the help of the given arguments.
*
* @param httpStatus the HTTP status of the response.
* @return the command response.
* @since 2.0.0
*/
T create(HttpStatus httpStatus);

}

/**
* Function that actually deserializes a {@code CommandResponse} from a provided {@link DeserializationContext}.
*
Expand Down
57 changes: 23 additions & 34 deletions bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@

<!-- ### Compile dependencies versions -->
<minimal-json.version>0.9.5</minimal-json.version>
<jackson-bom.version>2.13.2.20220328</jackson-bom.version>
<jackson-bom.version>2.13.4</jackson-bom.version>
<typesafe-config.version>1.4.2</typesafe-config.version>
<ssl-config-core.version>0.6.0</ssl-config-core.version>
<akka-bom.version>2.6.19</akka-bom.version>
<ssl-config-core.version>0.6.1</ssl-config-core.version>
<akka-bom.version>2.6.20</akka-bom.version>
<akka-persistence-mongo.version>3.0.8</akka-persistence-mongo.version>
<akka-http-bom.version>10.2.9</akka-http-bom.version>
<akka-management.version>1.1.3</akka-management.version>
<akka-stream-kafka.version>3.0.0</akka-stream-kafka.version>
<kafka-client.version>3.0.0</kafka-client.version>
<akka-http-bom.version>10.2.10</akka-http-bom.version>
<akka-management.version>1.1.4</akka-management.version>
<akka-stream-kafka.version>3.0.1</akka-stream-kafka.version>
<kafka-client.version>3.0.1</kafka-client.version>
<hivemq-mqtt-client.version>1.3.0</hivemq-mqtt-client.version>
<sshd.version>2.9.0</sshd.version>
<eddsa.version>0.3.0</eddsa.version>
Expand All @@ -53,28 +53,22 @@

<jjwt.version>0.11.5</jjwt.version>
<asm.version>9.2</asm.version>
<qpid-jms-client.version>1.5.0</qpid-jms-client.version>
<qpid-jms-client.version>1.6.0</qpid-jms-client.version>
<newmotion-akka-rabbitmq.version>6.0.0</newmotion-akka-rabbitmq.version>
<amqp-client.version>5.14.1</amqp-client.version>
<reactive-streams.version>1.0.3</reactive-streams.version>
<netty-bom.version>4.1.75.Final</netty-bom.version>
<amqp-client.version>5.14.2</amqp-client.version>
<reactive-streams.version>1.0.4</reactive-streams.version>
<netty-bom.version>4.1.80.Final</netty-bom.version>
<cloudevents.version>2.3.0</cloudevents.version>
<commons-net.version>3.8.0</commons-net.version>

<slf4j.version>1.7.36</slf4j.version>
<logback.version>1.2.11</logback.version>
<logstash-logback-encoder.version>7.0.1</logstash-logback-encoder.version>
<fluency.version>2.6.3</fluency.version>
<janino.version>3.1.6</janino.version>
<logstash-logback-encoder.version>7.2</logstash-logback-encoder.version>
<fluency.version>2.6.5</fluency.version>
<janino.version>3.1.7</janino.version>

<!-- ### Metrics and Tracing -->
<kamon.version>2.5.0</kamon.version>
<!-- When updating Kamon, please update the guava version below too to the used version in Kamon!
Guava is needed by kamon-opentelemetry (as traces are sent via gRPC library depending on Guava).
We need to explicitly "pin" it as a test dependency (docker-java-core) also pulls in Guava, but an older
version which somehow conflicts:
-->
<guava.version>30.0-android</guava.version>
<kamon.version>2.5.8</kamon.version>

<jsr305.version>3.0.2</jsr305.version>

Expand All @@ -92,23 +86,23 @@
-->
<js.long.version>3.2.0</js.long.version>

<caffeine.version>3.0.6</caffeine.version>
<caffeine.version>3.1.1</caffeine.version>
<classindex.version>3.11</classindex.version>

<!-- ### Testing dependencies versions -->
<junit.version>4.13.2</junit.version>
<junit-jupiter.version>5.8.2</junit-jupiter.version>
<assertj.version>3.22.0</assertj.version>
<assertj.version>3.23.1</assertj.version>
<mutability-detector.version>0.10.6</mutability-detector.version>
<equals-verifier.version>3.8.2</equals-verifier.version>
<mockito.version>4.2.0</mockito.version>
<jsonassert.version>1.5.0</jsonassert.version>
<awaitility.version>4.1.1</awaitility.version>
<equals-verifier.version>3.10.1</equals-verifier.version>
<mockito.version>4.7.0</mockito.version>
<jsonassert.version>1.5.1</jsonassert.version>
<awaitility.version>4.2.0</awaitility.version>
<akka-persistence-inmemory.version>2.5.15.2</akka-persistence-inmemory.version>

<jmh.version>1.34</jmh.version>
<jmh.version>1.35</jmh.version>

<scalatest.version>3.2.10</scalatest.version>
<scalatest.version>3.2.13</scalatest.version>
<docker-java.version>3.2.13</docker-java.version>
<system-rules.version>1.19.0</system-rules.version>
</properties>
Expand Down Expand Up @@ -460,11 +454,6 @@
<artifactId>kamon-executors_${scala.version}</artifactId>
<version>${kamon.version}</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>${guava.version}</version>
</dependency>

<!-- ### Compile - own artifacts ### -->
<dependency>
Expand Down
Loading

0 comments on commit 9415fd9

Please sign in to comment.