use of org.opensmartgridplatform.shared.exceptionhandling.ProtocolAdapterException in project open-smart-grid-platform by OSGP.
the class GetHealthStatusRequestMessageProcessor method process.
@Override
public void process(final ClientConnection deviceConnection, final RequestMetadata requestMetadata) throws ProtocolAdapterException {
final String deviceIdentification = requestMetadata.getDeviceIdentification();
final String organisationIdentification = requestMetadata.getOrganisationIdentification();
LOGGER.info("getHealthStatus for IEC60870 device {} for organisation {}", deviceIdentification, organisationIdentification);
try {
this.generalInterrogationService.sendGeneralInterrogation(deviceConnection, requestMetadata);
} catch (final IOException | RuntimeException e) {
final String message = String.format("Requesting the health status for device %s failed", deviceIdentification);
throw new ProtocolAdapterException(ComponentType.PROTOCOL_IEC60870, message, e);
}
}
use of org.opensmartgridplatform.shared.exceptionhandling.ProtocolAdapterException in project open-smart-grid-platform by OSGP.
the class GetLightSensorStatusRequestMessageProcessor method process.
@Override
public void process(final ClientConnection deviceConnection, final RequestMetadata requestMetadata) throws ProtocolAdapterException {
final String deviceIdentification = requestMetadata.getDeviceIdentification();
final String organisationIdentification = requestMetadata.getOrganisationIdentification();
LOGGER.info("Get light sensor status request for IEC60870 device {} for organisation {}", deviceIdentification, organisationIdentification);
try {
this.generalInterrogationService.sendGeneralInterrogation(deviceConnection, requestMetadata);
} catch (final IOException | RuntimeException e) {
final String message = String.format("Requesting the light sensor status for device %s failed", deviceIdentification);
throw new ProtocolAdapterException(ComponentType.PROTOCOL_IEC60870, message, e);
}
}
use of org.opensmartgridplatform.shared.exceptionhandling.ProtocolAdapterException in project open-smart-grid-platform by OSGP.
the class ConnectRequestMessageProcessor method process.
@Override
public void process(final ClientConnection deviceConnection, final RequestMetadata requestMetadata) throws ProtocolAdapterException {
final String deviceIdentification = requestMetadata.getDeviceIdentification();
final String organisationIdentification = requestMetadata.getOrganisationIdentification();
LOGGER.info("Connect request for IEC60870 device {} for organisation {}", deviceIdentification, organisationIdentification);
LOGGER.info("Starting general interrogation for IEC60870 device {}", deviceIdentification);
try {
this.generalInterrogationService.sendGeneralInterrogation(deviceConnection, requestMetadata);
} catch (final IOException | RuntimeException e) {
final String message = String.format("Interrogation after connect request for device %s failed.", deviceIdentification);
throw new ProtocolAdapterException(ComponentType.PROTOCOL_IEC60870, message, e);
}
}
use of org.opensmartgridplatform.shared.exceptionhandling.ProtocolAdapterException in project open-smart-grid-platform by OSGP.
the class AbstractMessageProcessor method processMessage.
@Override
public void processMessage(final ObjectMessage message) {
LOGGER.info("Processing message.");
MessageMetadata messageMetadata = null;
try {
messageMetadata = MessageMetadata.fromMessage(message);
final RequestMetadata requestMetadata = RequestMetadata.newBuilder().messageMetadata(messageMetadata).build();
final ClientConnection deviceConnection = this.iec60870DeviceConnectionService.getConnection(requestMetadata);
this.process(deviceConnection, requestMetadata);
} catch (final ProtocolAdapterException e) {
this.handleError(messageMetadata, e);
} catch (final Exception e) {
LOGGER.error("UNRECOVERABLE ERROR, unable to read ObjectMessage instance, giving up.", e);
}
}
Aggregations