use of org.opensmartgridplatform.adapter.protocol.oslp.elster.device.requests.UpdateFirmwareDeviceRequest in project open-smart-grid-platform by OSGP.
the class CommonUpdateFirmwareRequestMessageProcessor method processMessage.
// IDEA: the FirmwareLocation class in domain and dto can/must be deleted!
// Or, this
// setup has to be changed in order to reuse the FirmwareLocation class in
// the domain!!
@Override
public void processMessage(final ObjectMessage message) {
LOGGER.debug("Processing common update firmware request message");
MessageMetadata messageMetadata;
FirmwareUpdateMessageDataContainer firmwareUpdateMessageDataContainer;
try {
messageMetadata = MessageMetadata.fromMessage(message);
firmwareUpdateMessageDataContainer = (FirmwareUpdateMessageDataContainer) message.getObject();
} catch (final JMSException e) {
LOGGER.error("UNRECOVERABLE ERROR, unable to read ObjectMessage instance, giving up.", e);
return;
}
try {
final String firmwareIdentification = firmwareUpdateMessageDataContainer.getFirmwareUrl();
this.printDomainInfo(messageMetadata.getMessageType(), messageMetadata.getDomain(), messageMetadata.getDomainVersion());
final UpdateFirmwareDeviceRequest deviceRequest = new UpdateFirmwareDeviceRequest(DeviceRequest.newBuilder().messageMetaData(messageMetadata), this.firmwareLocation.getDomain(), this.firmwareLocation.getFullPath(firmwareIdentification));
this.deviceService.updateFirmware(deviceRequest);
} catch (final RuntimeException e) {
this.handleError(e, messageMetadata);
}
}
Aggregations