Skip to content

Commit 2a27afe

Browse files
authored
Merge pull request #1140 from OSGP/feature/SMHE-1748_SF_JasperW_to_shared
SMHE-1748 SF jasper wireless to shared
2 parents b7d8ec9 + 0cb58a0 commit 2a27afe

File tree

23 files changed

+126
-41
lines changed

23 files changed

+126
-41
lines changed

osgp/protocol-adapter-dlms/osgp-jasper-interface/pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,10 @@ SPDX-License-Identifier: Apache-2.0
172172
<groupId>org.opensmartgridplatform</groupId>
173173
<artifactId>shared</artifactId>
174174
</dependency>
175+
<dependency>
176+
<groupId>org.opensmartgridplatform</groupId>
177+
<artifactId>osgp-jasper-shared</artifactId>
178+
</dependency>
175179

176180
<dependency>
177181
<groupId>org.postgresql</groupId>

osgp/protocol-adapter-dlms/osgp-jasper-interface/src/main/java/org/opensmartgridplatform/adapter/protocol/jasper/client/JasperWirelessSmsClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
package org.opensmartgridplatform.adapter.protocol.jasper.client;
66

7-
import org.opensmartgridplatform.adapter.protocol.jasper.exceptions.OsgpJasperException;
87
import org.opensmartgridplatform.adapter.protocol.jasper.response.SendSMSResponse;
8+
import org.opensmartgridplatform.jasper.exceptions.OsgpJasperException;
99

1010
public interface JasperWirelessSmsClient {
1111

osgp/protocol-adapter-dlms/osgp-jasper-interface/src/main/java/org/opensmartgridplatform/adapter/protocol/jasper/client/JasperWirelessTerminalClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
package org.opensmartgridplatform.adapter.protocol.jasper.client;
66

7-
import org.opensmartgridplatform.adapter.protocol.jasper.exceptions.OsgpJasperException;
87
import org.opensmartgridplatform.adapter.protocol.jasper.response.GetSessionInfoResponse;
8+
import org.opensmartgridplatform.jasper.exceptions.OsgpJasperException;
99

1010
public interface JasperWirelessTerminalClient {
1111

osgp/protocol-adapter-dlms/osgp-jasper-interface/src/main/java/org/opensmartgridplatform/adapter/protocol/jasper/config/JasperWirelessConfig.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import javax.xml.soap.SOAPException;
1313
import org.opensmartgridplatform.adapter.protocol.jasper.client.JasperWirelessSmsClient;
1414
import org.opensmartgridplatform.adapter.protocol.jasper.client.JasperWirelessTerminalClient;
15-
import org.opensmartgridplatform.adapter.protocol.jasper.exceptions.OsgpJasperException;
1615
import org.opensmartgridplatform.adapter.protocol.jasper.infra.ws.CorrelationIdProviderService;
1716
import org.opensmartgridplatform.adapter.protocol.jasper.infra.ws.JasperWirelessSmsSoapClient;
1817
import org.opensmartgridplatform.adapter.protocol.jasper.infra.ws.JasperWirelessTerminalSoapClient;
@@ -23,6 +22,8 @@
2322
import org.opensmartgridplatform.adapter.protocol.jasper.sessionproviders.SessionProviderKpnPollJasper;
2423
import org.opensmartgridplatform.adapter.protocol.jasper.sessionproviders.SessionProviderKpnPushAlarm;
2524
import org.opensmartgridplatform.adapter.protocol.jasper.sessionproviders.SessionProviderMap;
25+
import org.opensmartgridplatform.jasper.config.JasperWirelessAccess;
26+
import org.opensmartgridplatform.jasper.exceptions.OsgpJasperException;
2627
import org.opensmartgridplatform.shared.application.config.AbstractConfig;
2728
import org.slf4j.Logger;
2829
import org.slf4j.LoggerFactory;

osgp/protocol-adapter-dlms/osgp-jasper-interface/src/main/java/org/opensmartgridplatform/adapter/protocol/jasper/infra/ws/JasperWirelessSmsSoapClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import java.util.List;
1313
import org.apache.ws.security.WSConstants;
1414
import org.opensmartgridplatform.adapter.protocol.jasper.client.JasperWirelessSmsClient;
15-
import org.opensmartgridplatform.adapter.protocol.jasper.config.JasperWirelessAccess;
15+
import org.opensmartgridplatform.jasper.config.JasperWirelessAccess;
1616
import org.springframework.beans.factory.annotation.Autowired;
1717
import org.springframework.ws.client.core.WebServiceTemplate;
1818
import org.springframework.ws.client.support.interceptor.ClientInterceptor;

osgp/protocol-adapter-dlms/osgp-jasper-interface/src/main/java/org/opensmartgridplatform/adapter/protocol/jasper/infra/ws/JasperWirelessTerminalSoapClient.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
import lombok.extern.slf4j.Slf4j;
1212
import org.apache.ws.security.WSConstants;
1313
import org.opensmartgridplatform.adapter.protocol.jasper.client.JasperWirelessTerminalClient;
14-
import org.opensmartgridplatform.adapter.protocol.jasper.config.JasperWirelessAccess;
15-
import org.opensmartgridplatform.adapter.protocol.jasper.exceptions.OsgpJasperException;
14+
import org.opensmartgridplatform.jasper.config.JasperWirelessAccess;
15+
import org.opensmartgridplatform.jasper.exceptions.OsgpJasperException;
1616
import org.springframework.beans.factory.annotation.Autowired;
1717
import org.springframework.ws.client.core.WebServiceTemplate;
1818
import org.springframework.ws.client.support.interceptor.ClientInterceptor;

osgp/protocol-adapter-dlms/osgp-jasper-interface/src/main/java/org/opensmartgridplatform/adapter/protocol/jasper/rest/client/JasperWirelessSmsRestClient.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@
55
package org.opensmartgridplatform.adapter.protocol.jasper.rest.client;
66

77
import org.opensmartgridplatform.adapter.protocol.jasper.client.JasperWirelessSmsClient;
8-
import org.opensmartgridplatform.adapter.protocol.jasper.config.JasperWirelessAccess;
9-
import org.opensmartgridplatform.adapter.protocol.jasper.exceptions.OsgpJasperException;
108
import org.opensmartgridplatform.adapter.protocol.jasper.rest.json.SendSMSRequest;
119
import org.opensmartgridplatform.adapter.protocol.jasper.rest.json.SendSMSResponse;
10+
import org.opensmartgridplatform.jasper.client.JasperWirelessRestClient;
11+
import org.opensmartgridplatform.jasper.config.JasperWirelessAccess;
12+
import org.opensmartgridplatform.jasper.exceptions.OsgpJasperException;
1213
import org.springframework.beans.factory.annotation.Autowired;
1314
import org.springframework.http.HttpEntity;
1415
import org.springframework.http.HttpHeaders;

osgp/protocol-adapter-dlms/osgp-jasper-interface/src/main/java/org/opensmartgridplatform/adapter/protocol/jasper/rest/client/JasperWirelessTerminalRestClient.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55
package org.opensmartgridplatform.adapter.protocol.jasper.rest.client;
66

77
import org.opensmartgridplatform.adapter.protocol.jasper.client.JasperWirelessTerminalClient;
8-
import org.opensmartgridplatform.adapter.protocol.jasper.config.JasperWirelessAccess;
9-
import org.opensmartgridplatform.adapter.protocol.jasper.exceptions.OsgpJasperException;
108
import org.opensmartgridplatform.adapter.protocol.jasper.response.GetSessionInfoResponse;
9+
import org.opensmartgridplatform.jasper.client.JasperWirelessRestClient;
10+
import org.opensmartgridplatform.jasper.config.JasperWirelessAccess;
11+
import org.opensmartgridplatform.jasper.exceptions.OsgpJasperException;
1112
import org.springframework.beans.factory.annotation.Autowired;
1213
import org.springframework.http.HttpEntity;
1314
import org.springframework.http.HttpHeaders;
@@ -54,7 +55,10 @@ public GetSessionInfoResponse getSession(final String iccId) throws OsgpJasperEx
5455
this.jasperwirelessRestTemplate.exchange(
5556
url, HttpMethod.GET, entity, GetSessionInfoResponse.class);
5657

57-
getSessionInfoResponse = this.checkOnSessionValidity(getSessionInfoResponseEntity);
58+
if (getSessionInfoResponseEntity.getBody() != null) {
59+
getSessionInfoResponse =
60+
this.checkOnSessionValidity(getSessionInfoResponseEntity.getBody());
61+
}
5862

5963
} catch (final HttpClientErrorException | HttpServerErrorException e) {
6064
this.handleException(e);
@@ -65,15 +69,14 @@ public GetSessionInfoResponse getSession(final String iccId) throws OsgpJasperEx
6569
}
6670

6771
private GetSessionInfoResponse checkOnSessionValidity(
68-
final ResponseEntity<GetSessionInfoResponse> getSessionInfoResponseEntity) {
72+
final GetSessionInfoResponse getSessionInfoResponse) {
6973
// To simulated to same behaviour as the SOAP interface. Session info of an expired session is
7074
// removed form the response.
7175
// REST-interface returns information about the current or most recent data session for a given
7276
// device.
7377
// SOAP-interface returns the current session information (IP address and session start time)
7478
// for one or more devices. If the specified device is not in session, no information is
7579
// returned.
76-
final GetSessionInfoResponse getSessionInfoResponse = getSessionInfoResponseEntity.getBody();
7780
if (this.hasCurrentSession(getSessionInfoResponse)) {
7881
return getSessionInfoResponse;
7982
} else {

osgp/protocol-adapter-dlms/osgp-jasper-interface/src/main/java/org/opensmartgridplatform/adapter/protocol/jasper/sessionproviders/SessionProviderKpnPollJasper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
import javax.annotation.PostConstruct;
99
import org.opensmartgridplatform.adapter.protocol.jasper.client.JasperWirelessSmsClient;
1010
import org.opensmartgridplatform.adapter.protocol.jasper.client.JasperWirelessTerminalClient;
11-
import org.opensmartgridplatform.adapter.protocol.jasper.exceptions.OsgpJasperException;
1211
import org.opensmartgridplatform.adapter.protocol.jasper.response.GetSessionInfoResponse;
1312
import org.opensmartgridplatform.adapter.protocol.jasper.sessionproviders.exceptions.SessionProviderException;
13+
import org.opensmartgridplatform.jasper.exceptions.OsgpJasperException;
1414
import org.opensmartgridplatform.shared.exceptionhandling.ComponentType;
1515
import org.opensmartgridplatform.shared.exceptionhandling.FunctionalException;
1616
import org.opensmartgridplatform.shared.exceptionhandling.FunctionalExceptionType;

osgp/protocol-adapter-dlms/osgp-jasper-interface/src/main/java/org/opensmartgridplatform/adapter/protocol/jasper/sessionproviders/SessionProviderKpnPushAlarm.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
import javax.annotation.PostConstruct;
99
import org.opensmartgridplatform.adapter.protocol.jasper.client.JasperWirelessSmsClient;
1010
import org.opensmartgridplatform.adapter.protocol.jasper.client.JasperWirelessTerminalClient;
11-
import org.opensmartgridplatform.adapter.protocol.jasper.exceptions.OsgpJasperException;
1211
import org.opensmartgridplatform.adapter.protocol.jasper.response.GetSessionInfoResponse;
1312
import org.opensmartgridplatform.adapter.protocol.jasper.service.DeviceSessionService;
13+
import org.opensmartgridplatform.jasper.exceptions.OsgpJasperException;
1414
import org.opensmartgridplatform.shared.exceptionhandling.ComponentType;
1515
import org.opensmartgridplatform.shared.exceptionhandling.FunctionalException;
1616
import org.opensmartgridplatform.shared.exceptionhandling.FunctionalExceptionType;

0 commit comments

Comments
 (0)