Skip to content

Commit bb336d0

Browse files
committed
Ditto 3.0 preparation: removed deprecated marked code and adjusted japicmp excludes accordingly
Signed-off-by: Thomas Jaeckle <[email protected]>
1 parent 825c3c5 commit bb336d0

File tree

53 files changed

+70
-686
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+70
-686
lines changed

base/model/pom.xml

+4
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,10 @@
134134
<!--<exclude></exclude>-->
135135
<exclude>org.eclipse.ditto.base.model.signals.commands.exceptions</exclude>
136136
<exclude>org.eclipse.ditto.base.model.headers.DittoHeaderDefinition#POLICY_ENFORCER_INVALIDATED_PREEMPTIVELY</exclude>
137+
<exclude>org.eclipse.ditto.base.model.entity.id.RegexPatterns</exclude>
138+
<exclude>org.eclipse.ditto.base.model.exceptions.DittoHeaderInvalidException#newCustomMessageBuilder(java.lang.String)</exclude>
139+
<exclude>org.eclipse.ditto.base.model.namespaces.signals.commands.PurgeNamespaceResponse$JsonFields</exclude>
140+
<exclude>org.eclipse.ditto.base.model.signals.commands.CommandResponseJsonDeserializer</exclude>
137141
</excludes>
138142
</parameter>
139143
</configuration>

base/model/src/main/java/org/eclipse/ditto/base/model/entity/id/RegexPatterns.java

-37
Original file line numberDiff line numberDiff line change
@@ -69,50 +69,13 @@ public final class RegexPatterns {
6969
public static final String ALLOWED_NAMESPACE_CHARACTERS_REGEX_INNER =
7070
"[.-]" + ALLOWED_NAMESPACE_CHARACTERS_REGEX;
7171

72-
/**
73-
* @deprecated Use {@link #ALLOWED_NAMESPACE_CHARACTERS_REGEX_INNER}. The name of the variable actually described
74-
* the content, which has now changed. The name new describes the purpose.
75-
*/
76-
@Deprecated
77-
public static final String ALLOWED_NAMESPACE_CHARACTERS_INCLUDING_DOT = ALLOWED_NAMESPACE_CHARACTERS_REGEX_INNER;
78-
7972
/**
8073
* The regex pattern for namespaces which validates that the namespace conforms the java package notation.
8174
*/
8275
public static final String NAMESPACE_REGEX = "(?<" + NAMESPACE_GROUP_NAME + ">|(?:" +
8376
"(?:" + ALLOWED_NAMESPACE_CHARACTERS_REGEX + ")" +
8477
"(?:" + ALLOWED_NAMESPACE_CHARACTERS_REGEX_INNER + ")*+))";
8578

86-
/**
87-
* Regex pattern that matches URL escapes. E.G. %3A for a colon (':').
88-
* @deprecated since 2.4.0
89-
*/
90-
@Deprecated
91-
public static final String URL_ESCAPES = "%\\p{XDigit}{2}";
92-
93-
/**
94-
* Adds the $ to allowed characters. Its defined as separate constant because names are not allowed to start
95-
* with $.
96-
* @deprecated since 2.4.0
97-
*/
98-
@Deprecated
99-
public static final String ALLOWED_CHARACTERS_IN_NAME_INCLUDING_DOLLAR = ALLOWED_CHARACTERS_IN_NAME + "$";
100-
101-
/**
102-
* First part of an entity name.
103-
* @deprecated since 2.4.0
104-
*/
105-
@Deprecated
106-
public static final String URI_PATH_SEGMENT = "(?:[" + ALLOWED_CHARACTERS_IN_NAME + "]|" + URL_ESCAPES + ")";
107-
108-
/**
109-
* Second part of an entity name: This part allows the $ symbol.
110-
* @deprecated since 2.4.0
111-
*/
112-
@Deprecated
113-
public static final String URI_PATH_SEGMENT_INCLUDING_DOLLAR =
114-
"(?:[" + ALLOWED_CHARACTERS_IN_NAME_INCLUDING_DOLLAR + "]|" + URL_ESCAPES + ")";
115-
11679
/**
11780
* The regex pattern for an Entity Name.
11881
*/

base/model/src/main/java/org/eclipse/ditto/base/model/exceptions/DittoHeaderInvalidException.java

-12
Original file line numberDiff line numberDiff line change
@@ -112,18 +112,6 @@ public static DittoHeaderInvalidException.Builder newInvalidTypeBuilder(final He
112112
return new DittoHeaderInvalidException.Builder(headerDefinition.getKey(), headerValue, headerType);
113113
}
114114

115-
/**
116-
* A mutable builder for a {@code DittoHeaderInvalidException} with a custom message.
117-
*
118-
* @param customMessage the custom message
119-
* @return the builder.
120-
* @deprecated as of Ditto 2.0 please use {@code newBuilder().message(String)}.
121-
*/
122-
@Deprecated
123-
public static DittoHeaderInvalidException.Builder newCustomMessageBuilder(final String customMessage) {
124-
return new DittoHeaderInvalidException.Builder(customMessage);
125-
}
126-
127115
/**
128116
* Returns a new mutable builder with a fluent API for creating a {@code DittoHeaderInvalidException}.
129117
* The returned builder is initialized with a default message and a default description.

base/model/src/main/java/org/eclipse/ditto/base/model/namespaces/signals/commands/PurgeNamespaceResponse.java

-30
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,9 @@
2020

2121
import org.eclipse.ditto.base.model.common.HttpStatus;
2222
import org.eclipse.ditto.base.model.headers.DittoHeaders;
23-
import org.eclipse.ditto.base.model.json.FieldType;
2423
import org.eclipse.ditto.base.model.json.JsonParsableCommandResponse;
25-
import org.eclipse.ditto.base.model.json.JsonSchemaVersion;
2624
import org.eclipse.ditto.base.model.signals.commands.CommandResponseHttpStatusValidator;
2725
import org.eclipse.ditto.base.model.signals.commands.CommandResponseJsonDeserializer;
28-
import org.eclipse.ditto.json.JsonFieldDefinition;
2926
import org.eclipse.ditto.json.JsonObject;
3027

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

170-
/**
171-
* This class contains definitions for all specific fields of a {@code PurgeNamespaceResponse}'s JSON
172-
* representation.
173-
*
174-
* @deprecated as of 2.3.0 there are no additional JSON fields for {@code PurgeNamespaceResponse}.
175-
*/
176-
@Deprecated
177-
@Immutable
178-
public static final class JsonFields extends NamespaceCommandResponse.JsonFields {
179-
180-
/**
181-
* This JSON field indicates whether the namespace was purged successfully.
182-
*
183-
* @deprecated as of 2.3.0 this field is not used anymore as the success
184-
* status is derived from HTTP status code.
185-
*/
186-
@Deprecated
187-
public static final JsonFieldDefinition<Boolean> SUCCESSFUL =
188-
JsonFieldDefinition.ofBoolean("successful", FieldType.REGULAR, JsonSchemaVersion.V_2);
189-
190-
private JsonFields() {
191-
throw new AssertionError();
192-
}
193-
194-
}
195-
196166
}

base/model/src/main/java/org/eclipse/ditto/base/model/signals/commands/CommandResponseJsonDeserializer.java

+2-81
Original file line numberDiff line numberDiff line change
@@ -29,60 +29,26 @@
2929

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

38-
@Nullable private final JsonObject jsonObject;
3936
private final String expectedCommandResponseType;
4037
private final DeserializationFunction<T> deserializationFunction;
4138

4239
private CommandResponseJsonDeserializer(final CharSequence type,
43-
@Nullable final JsonObject jsonObject,
4440
final DeserializationFunction<T> deserializationFunction) {
4541

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

53-
/**
54-
* Constructs a new {@code CommandResponseJsonDeserializer} object.
55-
*
56-
* @param type the type of the command response.
57-
* @param jsonObject the JSON object to deserialize.
58-
* @throws NullPointerException if any argument is {@code null}.
59-
* @throws IllegalArgumentException if {@code type} is empty or blank.
60-
* @deprecated as of 2.3.0 please use {@link #newInstance(CharSequence, DeserializationFunction)} instead.
61-
*/
62-
@Deprecated
63-
public CommandResponseJsonDeserializer(final String type, final JsonObject jsonObject) {
64-
this(type, checkJsonObjectNotNull(jsonObject), null);
65-
}
66-
6748
private static JsonObject checkJsonObjectNotNull(@Nullable final JsonObject jsonObject) {
6849
return checkNotNull(jsonObject, "jsonObject");
6950
}
7051

71-
/**
72-
* Constructs a new {@code CommandResponseJsonDeserializer} object.
73-
*
74-
* @param type the type of the target command response of deserialization.
75-
* @param jsonString the JSON string to be deserialized.
76-
* @throws NullPointerException if any argument is {@code null}.
77-
* @throws IllegalArgumentException if {@code type} is empty or blank or if {@code jsonString} is empty.
78-
* @throws org.eclipse.ditto.json.JsonParseException if {@code jsonString} does not contain a valid JSON object.
79-
* @deprecated as of 2.3.0 please use {@link #newInstance(CharSequence, DeserializationFunction)} instead.
80-
*/
81-
@Deprecated
82-
public CommandResponseJsonDeserializer(final String type, final String jsonString) {
83-
this(type, JsonObject.of(jsonString));
84-
}
85-
8652
/**
8753
* Returns a new instance of {@code CommandResponseJsonDeserializer}.
8854
*
@@ -99,33 +65,10 @@ public CommandResponseJsonDeserializer(final String type, final String jsonStrin
9965
public static <T extends CommandResponse<?>> CommandResponseJsonDeserializer<T> newInstance(final CharSequence type,
10066
final DeserializationFunction<T> deserializationFunction) {
10167

102-
return new CommandResponseJsonDeserializer(type,
103-
null,
68+
return new CommandResponseJsonDeserializer<>(type,
10469
checkNotNull(deserializationFunction, "deserializationFunction"));
10570
}
10671

107-
/**
108-
* Partly deserializes the JSON which was given to this object's constructor. The factory method function which is
109-
* given to this method is responsible for creating the actual {@code CommandResponseType}. This method receives
110-
* the partly deserialized values which can be completed by implementors if further values are required.
111-
*
112-
* @param factoryMethodFunction creates the actual {@code CommandResponseType} object.
113-
* @return the command response.
114-
* @throws NullPointerException if {@code factoryMethodFunction} is {@code null}.
115-
* @throws org.eclipse.ditto.json.JsonParseException if the JSON is invalid or if the command response type
116-
* differs from the expected one.
117-
* @deprecated as of 2.3.0 please use {@link #deserialize(JsonObject, DittoHeaders)} instead.
118-
*/
119-
@Deprecated
120-
public T deserialize(final FactoryMethodFunction<T> factoryMethodFunction) {
121-
final CommandResponseJsonDeserializer<T> deserializer =
122-
new CommandResponseJsonDeserializer<>(expectedCommandResponseType,
123-
checkJsonObjectNotNull(jsonObject),
124-
context -> factoryMethodFunction.create(context.getDeserializedHttpStatus()));
125-
126-
return deserializer.deserialize(jsonObject, DittoHeaders.empty());
127-
}
128-
12972
/**
13073
* Deserializes the specified {@code JsonObject} argument to an instance of {@code CommandResponse}.
13174
* Any exception that is thrown during deserialization will be subsumed as cause of a {@code JsonParseException}.
@@ -177,28 +120,6 @@ private JsonParseException newJsonParseException(final Exception cause) {
177120
.build();
178121
}
179122

180-
/**
181-
* Represents a function that accepts three arguments to produce a {@code CommandResponse}. The arguments were
182-
* extracted from a given JSON beforehand.
183-
*
184-
* @param <T> the type of the result of the function.
185-
* @deprecated as of 2.3.0 please use {@link DeserializationFunction} instead.
186-
*/
187-
@Deprecated
188-
@FunctionalInterface
189-
public interface FactoryMethodFunction<T extends CommandResponse<?>> {
190-
191-
/**
192-
* Creates a {@code CommandResponse} with the help of the given arguments.
193-
*
194-
* @param httpStatus the HTTP status of the response.
195-
* @return the command response.
196-
* @since 2.0.0
197-
*/
198-
T create(HttpStatus httpStatus);
199-
200-
}
201-
202123
/**
203124
* Function that actually deserializes a {@code CommandResponse} from a provided {@link DeserializationContext}.
204125
*

connectivity/model/pom.xml

+14
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,20 @@
125125
<excludes>
126126
<!-- Don't add excludes here before checking with the whole Ditto team -->
127127
<!--<exclude></exclude>-->
128+
<exclude>org.eclipse.ditto.connectivity.model.AddressMetric$JsonFields</exclude>
129+
<exclude>org.eclipse.ditto.connectivity.model.Connection#getUsername()</exclude>
130+
<exclude>org.eclipse.ditto.connectivity.model.Connection#getPassword()</exclude>
131+
<exclude>org.eclipse.ditto.connectivity.model.Connection$JsonFields#SCHEMA_VERSION</exclude>
132+
<exclude>org.eclipse.ditto.connectivity.model.ConnectivityModelFactory#newClientStatus(java.lang.String,org.eclipse.ditto.connectivity.model.ConnectivityStatus,java.lang.String,java.time.Instant)</exclude>
133+
<exclude>org.eclipse.ditto.connectivity.model.LogEntry#getThingId()</exclude>
134+
<exclude>org.eclipse.ditto.connectivity.model.LogEntry$JsonFields#THING_ID</exclude>
135+
<exclude>org.eclipse.ditto.connectivity.model.LogEntryBuilder#thingId(org.eclipse.ditto.things.model.ThingId)</exclude>
136+
<exclude>org.eclipse.ditto.connectivity.model.ResourceStatus$JsonFields#SCHEMA_VERSION</exclude>
137+
<exclude>org.eclipse.ditto.connectivity.model.Source$JsonFields#SCHEMA_VERSION</exclude>
138+
<exclude>org.eclipse.ditto.connectivity.model.SourceMetrics$JsonFields#SCHEMA_VERSION</exclude>
139+
<exclude>org.eclipse.ditto.connectivity.model.SshTunnel$JsonFields#SCHEMA_VERSION</exclude>
140+
<exclude>org.eclipse.ditto.connectivity.model.Target$JsonFields#SCHEMA_VERSION</exclude>
141+
<exclude>org.eclipse.ditto.connectivity.model.TargetMetrics$JsonFields#SCHEMA_VERSION</exclude>
128142
</excludes>
129143
</parameter>
130144
</configuration>

connectivity/model/src/main/java/org/eclipse/ditto/connectivity/model/AddressMetric.java

-35
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,10 @@
1414

1515
import java.util.Set;
1616

17-
import javax.annotation.concurrent.Immutable;
18-
1917
import org.eclipse.ditto.base.model.json.FieldType;
2018
import org.eclipse.ditto.base.model.json.JsonSchemaVersion;
2119
import org.eclipse.ditto.base.model.json.Jsonifiable;
22-
import org.eclipse.ditto.json.JsonFactory;
2320
import org.eclipse.ditto.json.JsonField;
24-
import org.eclipse.ditto.json.JsonFieldDefinition;
2521
import org.eclipse.ditto.json.JsonFieldSelector;
2622
import org.eclipse.ditto.json.JsonObject;
2723

@@ -50,35 +46,4 @@ default JsonObject toJson(final JsonSchemaVersion schemaVersion, final JsonField
5046
return toJson(schemaVersion, FieldType.notHidden()).get(fieldSelector);
5147
}
5248

53-
/**
54-
* An enumeration of the known {@code JsonField}s of an {@code AddressMetric}.
55-
*/
56-
@Immutable
57-
final class JsonFields {
58-
59-
/**
60-
* JSON field containing the {@code JsonSchemaVersion}.
61-
*
62-
* @deprecated as of 2.3.0 this field definition is not used anymore.
63-
*/
64-
@Deprecated
65-
public static final JsonFieldDefinition<Integer> SCHEMA_VERSION = JsonFactory.newIntFieldDefinition(
66-
JsonSchemaVersion.getJsonKey(),
67-
FieldType.SPECIAL,
68-
FieldType.HIDDEN,
69-
JsonSchemaVersion.V_2
70-
);
71-
72-
/**
73-
* JSON field containing the timestamp when the last message was consumed/published.
74-
*/
75-
public static final JsonFieldDefinition<String> LAST_MESSAGE_AT =
76-
JsonFactory.newStringFieldDefinition("lastMessageAt", FieldType.REGULAR,
77-
JsonSchemaVersion.V_2);
78-
79-
private JsonFields() {
80-
throw new AssertionError();
81-
}
82-
83-
}
8449
}

connectivity/model/src/main/java/org/eclipse/ditto/connectivity/model/Connection.java

-30
Original file line numberDiff line numberDiff line change
@@ -131,15 +131,6 @@ public interface Connection extends Jsonifiable.WithFieldSelectorAndPredicate<Js
131131
*/
132132
String getProtocol();
133133

134-
135-
/**
136-
* Returns the username part of the URI of this {@code Connection}.
137-
*
138-
* @return the username.
139-
* @deprecated since 2.4.0 use {@link #getUsername(boolean)} instead.
140-
*/
141-
Optional<String> getUsername();
142-
143134
/**
144135
* Returns the username part of the URI of this {@code Connection}.
145136
*
@@ -148,14 +139,6 @@ public interface Connection extends Jsonifiable.WithFieldSelectorAndPredicate<Js
148139
*/
149140
Optional<String> getUsername(boolean shouldUriDecode);
150141

151-
/**
152-
* Returns the password part of the URI of this {@code Connection}.
153-
*
154-
* @return the password.
155-
* @deprecated since 2.4.0 use {@link #getPassword(boolean)} instead.
156-
*/
157-
Optional<String> getPassword();
158-
159142
/**
160143
* Returns the password part of the URI of this {@code Connection}.
161144
*
@@ -270,19 +253,6 @@ default JsonObject toJson(final JsonSchemaVersion schemaVersion, final JsonField
270253
@Immutable
271254
final class JsonFields {
272255

273-
/**
274-
* JSON field containing the {@code JsonSchemaVersion}.
275-
*
276-
* @deprecated as of 2.3.0 this field definition is not used anymore.
277-
*/
278-
@Deprecated
279-
public static final JsonFieldDefinition<Integer> SCHEMA_VERSION = JsonFactory.newIntFieldDefinition(
280-
JsonSchemaVersion.getJsonKey(),
281-
FieldType.SPECIAL,
282-
FieldType.HIDDEN,
283-
JsonSchemaVersion.V_2
284-
);
285-
286256
/**
287257
* JSON field containing the Connection's lifecycle.
288258
*/

0 commit comments

Comments
 (0)