Search in sources :

Example 1 with ConnectionFailureException

use of com.alliander.osgp.shared.exceptionhandling.ConnectionFailureException in project Protocol-Adapter-OSLP by OSGP.

the class OslpDeviceService method handleException.

protected void handleException(final Throwable t, final DeviceRequest deviceRequest, final DeviceResponseHandler deviceResponseHandler) {
    final DeviceResponse deviceResponse = new DeviceResponse(deviceRequest.getOrganisationIdentification(), deviceRequest.getDeviceIdentification(), deviceRequest.getCorrelationUid());
    if (t instanceof IOException) {
        // Replace t by an OSGP Exception
        final ConnectionFailureException ex = new ConnectionFailureException(ComponentType.PROTOCOL_OSLP, "Connection failure");
        deviceResponseHandler.handleException(ex, deviceResponse);
    } else {
        deviceResponseHandler.handleException(t, deviceResponse);
    }
}
Also used : EmptyDeviceResponse(com.alliander.osgp.adapter.protocol.oslp.elster.device.responses.EmptyDeviceResponse) GetConfigurationDeviceResponse(com.alliander.osgp.adapter.protocol.oslp.elster.device.responses.GetConfigurationDeviceResponse) GetStatusDeviceResponse(com.alliander.osgp.adapter.protocol.oslp.elster.device.responses.GetStatusDeviceResponse) GetFirmwareVersionDeviceResponse(com.alliander.osgp.adapter.protocol.oslp.elster.device.responses.GetFirmwareVersionDeviceResponse) GetPowerUsageHistoryDeviceResponse(com.alliander.osgp.adapter.protocol.oslp.elster.device.responses.GetPowerUsageHistoryDeviceResponse) GetActualPowerUsageDeviceResponse(com.alliander.osgp.adapter.protocol.oslp.elster.device.responses.GetActualPowerUsageDeviceResponse) DeviceResponse(com.alliander.osgp.adapter.protocol.oslp.elster.device.DeviceResponse) ConnectionFailureException(com.alliander.osgp.shared.exceptionhandling.ConnectionFailureException) IOException(java.io.IOException)

Example 2 with ConnectionFailureException

use of com.alliander.osgp.shared.exceptionhandling.ConnectionFailureException in project Protocol-Adapter-IEC61850 by OSGP.

the class Iec61850DeviceResponseHandler method handleConnectionFailure.

/*
     * (non-Javadoc)
     * 
     * @see
     * com.alliander.osgp.adapter.protocol.iec61850.device.DeviceResponseHandler
     * #handleConnectionFailure(java.lang.Throwable,
     * com.alliander.osgp.adapter.protocol.iec61850.device.DeviceResponse)
     */
@Override
public void handleConnectionFailure(final Throwable t, final DeviceResponse deviceResponse) throws JMSException {
    Objects.requireNonNull(t, "handleConnectionFailure() Throwable t may not be null");
    final ConnectionFailureException connectionFailureException = new ConnectionFailureException(ComponentType.PROTOCOL_IEC61850, t.getMessage());
    this.messageProcessor.checkForRedelivery(this.deviceMessageMetadata, connectionFailureException, this.domainInformation.getDomain(), this.domainInformation.getDomainVersion(), this.jmsxDeliveryCount);
}
Also used : ConnectionFailureException(com.alliander.osgp.shared.exceptionhandling.ConnectionFailureException)

Aggregations

ConnectionFailureException (com.alliander.osgp.shared.exceptionhandling.ConnectionFailureException)2 DeviceResponse (com.alliander.osgp.adapter.protocol.oslp.elster.device.DeviceResponse)1 EmptyDeviceResponse (com.alliander.osgp.adapter.protocol.oslp.elster.device.responses.EmptyDeviceResponse)1 GetActualPowerUsageDeviceResponse (com.alliander.osgp.adapter.protocol.oslp.elster.device.responses.GetActualPowerUsageDeviceResponse)1 GetConfigurationDeviceResponse (com.alliander.osgp.adapter.protocol.oslp.elster.device.responses.GetConfigurationDeviceResponse)1 GetFirmwareVersionDeviceResponse (com.alliander.osgp.adapter.protocol.oslp.elster.device.responses.GetFirmwareVersionDeviceResponse)1 GetPowerUsageHistoryDeviceResponse (com.alliander.osgp.adapter.protocol.oslp.elster.device.responses.GetPowerUsageHistoryDeviceResponse)1 GetStatusDeviceResponse (com.alliander.osgp.adapter.protocol.oslp.elster.device.responses.GetStatusDeviceResponse)1 IOException (java.io.IOException)1