Skip to content
This repository was archived by the owner on Jun 13, 2025. It is now read-only.

Commit f7fd83d

Browse files
author
Tim Berthold
authored
release: v4.3.0 (#274)
* feat: throw exception and log error if no private key for alias found (#264) * feat: throw exception and log error if no private key for alias found * refactor: add used keyalias to printed logs * feat: check incoming payload for valid json and securityProfile attr (#266) * feat: check incoming payload for valid json and securityProfile attr * docs: update changelog * feat: enable or disable infomodel compatibility check (#267) * feat: enable or disable infomodel compatibility check via application properties * chore: fix checkstyle error * refactor: logs message reason formats (#269) * build(deps): bump infomodel-artifacts from 4.2.0 to 4.2.1 (#270) * build(deps): bump infomodel-artifacts from 4.2.0 to 4.2.1 * docs: update readme * chore: minor javadoc refactoring * docs: add missing throws to IDSBrokerService javadoc * refactor: minor log adjustments * docs: prepare release v4.3.0
1 parent 017d94e commit f7fd83d

File tree

47 files changed

+354
-111
lines changed

Some content is hidden

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

47 files changed

+354
-111
lines changed

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,23 @@
99
# Changelog
1010
All notable changes to this project will be documented in this file.
1111

12+
## Version [4.3.0] 2021-08-31
13+
14+
### Minor Change: Incoming message infomodel compatibility check
15+
- The check whether an incoming message is compatible with its ModelVersion to the inbound ModelVersions of the Connector can be switched on or off via application.properties (infomodel.compatibility.validation=true/false). The default value if not set is true (switched on).
16+
17+
### Patch Change: Infomodel Maintenance
18+
- Used Dependency Version: 4.2.1 (released 2021-08-30)
19+
- Used Artifacts: java, infomodel-serializer, interaction
20+
21+
### Patch Change: Enhancements
22+
- If no private key can be found for a given alias within a keystore, a KeyStoreException is now thrown and an error is logged, preventing an otherwise possible NullpointerException (KeystoreManager getPrivateKeyFromKeyStore).
23+
- The payload of incoming messages is now first validated for valid JSON and whether the securityProfile attribute is present, if not, this check is skipped instead of issuing an error message in the logs (IdsHttpService checkDatFromResponse).
24+
- For log error messages and others important logs with dynamic content, the e.g. exception reason is now highlighted to distinguish it from the rest of the log message. Format: [exception=(...)].
25+
26+
### Patch Change: Miscellaneous
27+
- Other minor enhancements to existing Javadoc and log messages.
28+
1229
## Version [4.2.2] 2021-08-26
1330

1431
### Patch Change: Miscellaneous

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ The following IDS-Infomodel-Artifacts are used as dependencies.
2525

2626
| Group | Artifact | Version |
2727
| ------ | ------ | ------ |
28-
| de.fraunhofer.iais.eis.ids.infomodel | java | 4.2.0 |
29-
| de.fraunhofer.iais.eis.ids | infomodel-serializer | 4.2.0 |
30-
| de.fraunhofer.iais.eis.ids | interaction | 4.2.0 |
28+
| de.fraunhofer.iais.eis.ids.infomodel | java | 4.2.1 |
29+
| de.fraunhofer.iais.eis.ids | infomodel-serializer | 4.2.1 |
30+
| de.fraunhofer.iais.eis.ids | interaction | 4.2.1 |
3131

3232
## Overview: Supported IDS-Message protocols
3333

broker/src/main/java/de/fraunhofer/ids/messaging/broker/BrokerService.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@
5050

5151
@Slf4j
5252
@Component
53-
public class BrokerService extends InfrastructureService
54-
implements IDSBrokerService {
53+
public class BrokerService extends InfrastructureService implements IDSBrokerService {
5554

5655
/**
5756
* Default item limit for the query.
@@ -85,6 +84,7 @@ public class BrokerService extends InfrastructureService
8584

8685
/**
8786
* BrokerService constructor.
87+
*
8888
* @param container The ConfigContainer.
8989
* @param tokenProvider The DapsTokenProvider.
9090
* @param messageService The MessageService.
@@ -177,7 +177,9 @@ public MessageContainer<?> unregisterAtBroker(@NonNull final URI brokerURI)
177177
SerializeException,
178178
UnknownResponseException,
179179
SendMessageException,
180-
DeserializeException, RejectionException, UnexpectedPayloadException {
180+
DeserializeException,
181+
RejectionException,
182+
UnexpectedPayloadException {
181183
logBuildingHeader();
182184
return idsRequestBuilderService.newRequest()
183185
.subjectConnector()
@@ -199,7 +201,9 @@ public MessageContainer<?> updateSelfDescriptionAtBroker(@NonNull final URI brok
199201
SerializeException,
200202
UnknownResponseException,
201203
SendMessageException,
202-
DeserializeException, RejectionException, UnexpectedPayloadException {
204+
DeserializeException,
205+
RejectionException,
206+
UnexpectedPayloadException {
203207
logBuildingHeader();
204208
return idsRequestBuilderService.newRequest()
205209
.withPayload(container.getConnector())

broker/src/main/java/de/fraunhofer/ids/messaging/broker/IDSBrokerService.java

Lines changed: 77 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,18 @@ public interface IDSBrokerService {
4545
* @param brokerURI URI of the broker the connector will try to unregister the resource at.
4646
* @param resource The resource that will be unregistered at the broker.
4747
* @return The ResponseMessage of the Broker.
48-
* @throws IOException If the built message could not be serialized.
48+
* @throws DapsTokenManagerException If no DAT for sending the message could be received.
49+
* @throws ClaimsException If DAT of incoming message could not be validated.
50+
* @throws MultipartParseException If response could not be parsed to header and payload.
51+
* @throws IOException Other errors, which were not categorized.
52+
* @throws ShaclValidatorException If the message does not pass the SHACL validation test.
53+
* @throws SerializeException If there are problems with serializing.
54+
* @throws UnknownResponseException If the format of the answer is not known.
55+
* @throws SendMessageException If there is an error when sending the request.
56+
* @throws DeserializeException If the deserialization of the received message fails.
57+
* @throws RejectionException When a RejectionMessage arrives unexpectedly.
58+
* @throws UnexpectedPayloadException When the payload cannot be used.
59+
* @throws NoTemplateProvidedException If no internal template can be found for the message.
4960
*/
5061
MessageContainer<?> removeResourceFromBroker(URI brokerURI, Resource resource)
5162
throws
@@ -70,7 +81,18 @@ MessageContainer<?> removeResourceFromBroker(URI brokerURI, Resource resource)
7081
* @param brokerURI URI of the broker the connector will try to unregister the resource at.
7182
* @param resource The resource that will be unregistered at the broker.
7283
* @return The ResponseMessage of the Broker.
73-
* @throws IOException If the built message could not be serialized.
84+
* @throws DapsTokenManagerException If no DAT for sending the message could be received.
85+
* @throws ClaimsException If DAT of incoming message could not be validated.
86+
* @throws MultipartParseException If response could not be parsed to header and payload.
87+
* @throws IOException Other errors, which were not categorized.
88+
* @throws ShaclValidatorException If the message does not pass the SHACL validation test.
89+
* @throws SerializeException If there are problems with serializing.
90+
* @throws UnknownResponseException If the format of the answer is not known.
91+
* @throws SendMessageException If there is an error when sending the request.
92+
* @throws DeserializeException If the deserialization of the received message fails.
93+
* @throws RejectionException When a RejectionMessage arrives unexpectedly.
94+
* @throws UnexpectedPayloadException When the payload cannot be used.
95+
* @throws NoTemplateProvidedException If no internal template can be found for the message.
7496
*/
7597
MessageContainer<?> updateResourceAtBroker(URI brokerURI, Resource resource)
7698
throws
@@ -95,7 +117,18 @@ MessageContainer<?> updateResourceAtBroker(URI brokerURI, Resource resource)
95117
* @param brokerURI URI of the broker the connector will try to unregister at.
96118
* @return The ResponseMessage of the Broker (NotificationMessage
97119
* if it worked, RejectionMessage if not).
98-
* @throws IOException If the message could not be serialized.
120+
* @throws DapsTokenManagerException If no DAT for sending the message could be received.
121+
* @throws ClaimsException If DAT of incoming message could not be validated.
122+
* @throws MultipartParseException If response could not be parsed to header and payload.
123+
* @throws IOException Other errors, which were not categorized.
124+
* @throws ShaclValidatorException If the message does not pass the SHACL validation test.
125+
* @throws SerializeException If there are problems with serializing.
126+
* @throws UnknownResponseException If the format of the answer is not known.
127+
* @throws SendMessageException If there is an error when sending the request.
128+
* @throws DeserializeException If the deserialization of the received message fails.
129+
* @throws RejectionException When a RejectionMessage arrives unexpectedly.
130+
* @throws UnexpectedPayloadException When the payload cannot be used.
131+
* @throws NoTemplateProvidedException If no internal template can be found for the message.
99132
*/
100133
MessageContainer<?> unregisterAtBroker(URI brokerURI)
101134
throws IOException,
@@ -122,7 +155,18 @@ MessageContainer<?> unregisterAtBroker(URI brokerURI)
122155
* @param brokerURI URI of the broker the connector will try to update its information at.
123156
* @return The ResponseMessage of the Broker (NotificationMessage if it worked,
124157
* RejectionMessage if not).
125-
* @throws IOException If the built message could not be serialized.
158+
* @throws DapsTokenManagerException If no DAT for sending the message could be received.
159+
* @throws ClaimsException If DAT of incoming message could not be validated.
160+
* @throws MultipartParseException If response could not be parsed to header and payload.
161+
* @throws IOException Other errors, which were not categorized.
162+
* @throws ShaclValidatorException If the message does not pass the SHACL validation test.
163+
* @throws SerializeException If there are problems with serializing.
164+
* @throws UnknownResponseException If the format of the answer is not known.
165+
* @throws SendMessageException If there is an error when sending the request.
166+
* @throws DeserializeException If the deserialization of the received message fails.
167+
* @throws RejectionException When a RejectionMessage arrives unexpectedly.
168+
* @throws UnexpectedPayloadException When the payload cannot be used.
169+
* @throws NoTemplateProvidedException If no internal template can be found for the message.
126170
*/
127171
MessageContainer<?> updateSelfDescriptionAtBroker(URI brokerURI)
128172
throws IOException,
@@ -150,7 +194,18 @@ MessageContainer<?> updateSelfDescriptionAtBroker(URI brokerURI)
150194
* INACTIVE connectors). See {@link QueryScope}.
151195
* @param queryTarget The type of IDS Components that are queried. See {@link QueryTarget}.
152196
* @return The brokers response to the query request.
153-
* @throws IOException If the built message could not be serialized.
197+
* @throws DapsTokenManagerException If no DAT for sending the message could be received.
198+
* @throws ClaimsException If DAT of incoming message could not be validated.
199+
* @throws MultipartParseException If response could not be parsed to header and payload.
200+
* @throws IOException Other errors, which were not categorized.
201+
* @throws ShaclValidatorException If the message does not pass the SHACL validation test.
202+
* @throws SerializeException If there are problems with serializing.
203+
* @throws UnknownResponseException If the format of the answer is not known.
204+
* @throws SendMessageException If there is an error when sending the request.
205+
* @throws DeserializeException If the deserialization of the received message fails.
206+
* @throws RejectionException When a RejectionMessage arrives unexpectedly.
207+
* @throws UnexpectedPayloadException When the payload cannot be used.
208+
* @throws NoTemplateProvidedException If no internal template can be found for the message.
154209
*/
155210
MessageContainer<String> queryBroker(URI brokerURI,
156211
String query,
@@ -178,18 +233,18 @@ MessageContainer<String> queryBroker(URI brokerURI,
178233
* @param queryScope The Scope of the query.
179234
* @param queryTarget The target of the query.
180235
* @return The query result from the Broker.
181-
* @throws DapsTokenManagerException
182-
* @throws IOException Exception while getting DAT from DAPS.
183-
* @throws MultipartParseException Exception while parsing the response.
184-
* @throws ClaimsException Exception while validating
185-
* @throws NoTemplateProvidedException If there is no template for the message type to be used.
236+
* @throws DapsTokenManagerException If no DAT for sending the message could be received.
237+
* @throws ClaimsException If DAT of incoming message could not be validated.
238+
* @throws MultipartParseException If response could not be parsed to header and payload.
239+
* @throws IOException Other errors, which were not categorized.
186240
* @throws ShaclValidatorException If the message does not pass the SHACL validation test.
187241
* @throws SerializeException If there are problems with serializing.
188242
* @throws UnknownResponseException If the format of the answer is not known.
189243
* @throws SendMessageException If there is an error when sending the request.
190244
* @throws DeserializeException If the deserialization of the received message fails.
191245
* @throws RejectionException When a RejectionMessage arrives unexpectedly.
192246
* @throws UnexpectedPayloadException When the payload cannot be used.
247+
* @throws NoTemplateProvidedException If no internal template can be found for the message.
193248
*/
194249
MessageContainer<String> fullTextSearchBroker(URI brokerURI,
195250
String searchTerm,
@@ -219,10 +274,18 @@ MessageContainer<String> fullTextSearchBroker(URI brokerURI,
219274
* @param limit Custom limit used in the query.
220275
* @param offset Custom offset used in the query.
221276
* @return The query result from the Broker.
222-
* @throws IOException Exception while getting DAT from DAPS.
223-
* @throws MultipartParseException Exception while parsing the response.
224-
* @throws ClaimsException Exception while validating
225-
* the DAT from the Broker Response.
277+
* @throws DapsTokenManagerException If no DAT for sending the message could be received.
278+
* @throws ClaimsException If DAT of incoming message could not be validated.
279+
* @throws MultipartParseException If response could not be parsed to header and payload.
280+
* @throws IOException Other errors, which were not categorized.
281+
* @throws ShaclValidatorException If the message does not pass the SHACL validation test.
282+
* @throws SerializeException If there are problems with serializing.
283+
* @throws UnknownResponseException If the format of the answer is not known.
284+
* @throws SendMessageException If there is an error when sending the request.
285+
* @throws DeserializeException If the deserialization of the received message fails.
286+
* @throws RejectionException When a RejectionMessage arrives unexpectedly.
287+
* @throws UnexpectedPayloadException When the payload cannot be used.
288+
* @throws NoTemplateProvidedException If no internal template can be found for the message.
226289
*/
227290
MessageContainer<String> fullTextSearchBroker(URI brokerURI,
228291
String searchTerm,

clearinghouse/src/main/java/de/fraunhofer/ids/messaging/clearinghouse/ClearingHouseService.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ public class ClearingHouseService extends InfrastructureService
110110

111111
/**
112112
* Constructor for the ClearingHouseService.
113+
*
113114
* @param container The ConfigContainer.
114115
* @param tokenProvider The DapsTokenProvider.
115116
* @param messageService The MessageService.

core/src/main/java/de/fraunhofer/ids/messaging/core/config/ClientProvider.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -159,15 +159,16 @@ public List<Proxy> select(final URI uri) {
159159

160160
if (proxyConfiguration.getNoProxy().contains(uri)) {
161161
if (log.isDebugEnabled()) {
162-
log.debug("URI {} is in NoProxy List, no proxy is used", uri.toString());
162+
log.debug("URI is in NoProxy List, no proxy is used. [uri=({})]",
163+
uri.toString());
163164
}
164165

165166
//if the called uri is in the Exceptions of the
166167
//Connectors ProxyConfiguration use no proxy
167168
proxyList.add(Proxy.NO_PROXY);
168169
} else {
169170
if (log.isDebugEnabled()) {
170-
log.debug("URI {} is not in NoProxy List, use configured Proxy",
171+
log.debug("URI is not in NoProxy List, use configured Proxy [uri=({})]",
171172
uri.toString());
172173
}
173174

@@ -177,7 +178,7 @@ public List<Proxy> select(final URI uri) {
177178
final int proxyPort = proxyAddress.getPort();
178179

179180
if (log.isDebugEnabled()) {
180-
log.debug("Address: {}, Port: {}", proxyHost, proxyPort);
181+
log.debug("Address: [host=({})], Port: [port=({})]", proxyHost, proxyPort);
181182
}
182183
proxyList.add(new Proxy(Proxy.Type.HTTP,
183184
new InetSocketAddress(proxyHost, proxyPort)));
@@ -373,7 +374,7 @@ public OkHttpClient getClientWithTimeouts(final Duration connectTimeout,
373374
callTimeout);
374375

375376
if (log.isDebugEnabled()) {
376-
log.debug("Ok Http Client Protocols: {}", withTimeout.protocols());
377+
log.debug("Ok Http Client Protocols: [protocols=({})]", withTimeout.protocols());
377378
}
378379
return withTimeout;
379380
}
@@ -400,25 +401,25 @@ private OkHttpClient rebuildClientWithTimeouts(final OkHttpClient client,
400401

401402
if (connectTimeout != null) {
402403
if (log.isDebugEnabled()) {
403-
log.debug("Setting connect timeout: {}", connectTimeout.toString());
404+
log.debug("Setting connect timeout: [timeout=({})]", connectTimeout.toString());
404405
}
405406
builder.connectTimeout(connectTimeout);
406407
}
407408
if (readTimeout != null) {
408409
if (log.isDebugEnabled()) {
409-
log.debug("Setting read timeout: {}", readTimeout.toString());
410+
log.debug("Setting read timeout: [timeout=({})]", readTimeout.toString());
410411
}
411412
builder.readTimeout(readTimeout);
412413
}
413414
if (writeTimeout != null) {
414415
if (log.isDebugEnabled()) {
415-
log.debug("Setting write timeout: {}", writeTimeout.toString());
416+
log.debug("Setting write timeout: [timeout=({})]", writeTimeout.toString());
416417
}
417418
builder.writeTimeout(writeTimeout);
418419
}
419420
if (callTimeout != null) {
420421
if (log.isDebugEnabled()) {
421-
log.debug("Setting call timeout: {}", callTimeout.toString());
422+
log.debug("Setting call timeout: [timeout=({})]", callTimeout.toString());
422423
}
423424
builder.callTimeout(callTimeout);
424425
}
@@ -430,7 +431,7 @@ private OkHttpClient rebuildClientWithTimeouts(final OkHttpClient client,
430431
final var okHttpClient = builder.build();
431432

432433
if (log.isDebugEnabled()) {
433-
log.debug("Ok Http Client Protocols {}", okHttpClient.protocols());
434+
log.debug("Ok Http Client Protocols [protocols=({})]", okHttpClient.protocols());
434435
}
435436

436437
return okHttpClient;

core/src/main/java/de/fraunhofer/ids/messaging/core/config/ConfigContainer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,14 +102,14 @@ public void updateConfiguration(final ConfigurationModel configurationModel)
102102
} catch (KeyStoreManagerInitializationException e) {
103103
if (log.isErrorEnabled()) {
104104
log.error("Configuration could not be updated!"
105-
+ " Keeping old configuration! {}", e.getMessage());
105+
+ " Keeping old configuration! [exception=({})]", e.getMessage());
106106
}
107107

108108
throw new ConfigUpdateException(e.getMessage(), e.getCause());
109109
} catch (NoSuchAlgorithmException | KeyManagementException e) {
110110
if (log.isErrorEnabled()) {
111111
log.error("New Key- or Truststore could not be initialized!"
112-
+ " Keeping old configuration! {}", e.getMessage());
112+
+ " Keeping old configuration! [exception=({})]", e.getMessage());
113113
}
114114
throw new ConfigUpdateException(e.getMessage(), e.getCause());
115115
}

0 commit comments

Comments
 (0)