use of com.alliander.osgp.adapter.protocol.iec61850.device.ssld.responses.EmptyDeviceResponse in project Protocol-Adapter-IEC61850 by OSGP.
the class Iec61850RtuDeviceService method getData.
@Override
public void getData(final GetDataDeviceRequest deviceRequest, final DeviceResponseHandler deviceResponseHandler) throws JMSException {
try {
final String serverName = this.getServerName(deviceRequest);
final ServerModel serverModel = this.connectAndRetrieveServerModel(deviceRequest, serverName);
final ClientAssociation clientAssociation = this.iec61850DeviceConnectionService.getClientAssociation(deviceRequest.getDeviceIdentification());
final GetDataResponseDto getDataResponse = this.handleGetData(new DeviceConnection(new Iec61850Connection(new Iec61850ClientAssociation(clientAssociation, null), serverModel), deviceRequest.getDeviceIdentification(), deviceRequest.getOrganisationIdentification(), serverName), deviceRequest);
final GetDataDeviceResponse deviceResponse = new GetDataDeviceResponse(deviceRequest.getOrganisationIdentification(), deviceRequest.getDeviceIdentification(), deviceRequest.getCorrelationUid(), DeviceMessageStatus.OK, getDataResponse);
deviceResponseHandler.handleResponse(deviceResponse);
} catch (final ConnectionFailureException se) {
LOGGER.error("Could not connect to device after all retries", se);
final EmptyDeviceResponse deviceResponse = new EmptyDeviceResponse(deviceRequest.getOrganisationIdentification(), deviceRequest.getDeviceIdentification(), deviceRequest.getCorrelationUid(), DeviceMessageStatus.FAILURE);
deviceResponseHandler.handleConnectionFailure(se, deviceResponse);
} catch (final Exception e) {
LOGGER.error("Unexpected exception during Get Data", e);
final EmptyDeviceResponse deviceResponse = new EmptyDeviceResponse(deviceRequest.getOrganisationIdentification(), deviceRequest.getDeviceIdentification(), deviceRequest.getCorrelationUid(), DeviceMessageStatus.FAILURE);
deviceResponseHandler.handleException(e, deviceResponse);
}
}
use of com.alliander.osgp.adapter.protocol.iec61850.device.ssld.responses.EmptyDeviceResponse in project Protocol-Adapter-IEC61850 by OSGP.
the class Iec61850SsldDeviceService method createSuccessfulDefaultResponse.
private void createSuccessfulDefaultResponse(final DeviceRequest deviceRequest, final DeviceResponseHandler deviceResponseHandler, final DeviceMessageStatus deviceMessageStatus) {
final EmptyDeviceResponse deviceResponse = this.createDefaultResponse(deviceRequest, deviceMessageStatus);
deviceResponseHandler.handleResponse(deviceResponse);
}
use of com.alliander.osgp.adapter.protocol.iec61850.device.ssld.responses.EmptyDeviceResponse in project Protocol-Adapter-IEC61850 by OSGP.
the class Iec61850SsldDeviceService method handleConnectionFailureException.
private void handleConnectionFailureException(final DeviceRequest deviceRequest, final DeviceResponseHandler deviceResponseHandler, final ConnectionFailureException connectionFailureException) throws JMSException {
LOGGER.error("Could not connect to device", connectionFailureException);
final EmptyDeviceResponse deviceResponse = this.createDefaultResponse(deviceRequest, DeviceMessageStatus.FAILURE);
deviceResponseHandler.handleConnectionFailure(connectionFailureException, deviceResponse);
}
Aggregations