use of org.opensmartgridplatform.dto.valueobjects.FirmwareUpdateMessageDataContainer 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);
}
}
use of org.opensmartgridplatform.dto.valueobjects.FirmwareUpdateMessageDataContainer in project open-smart-grid-platform by OSGP.
the class CommonUpdateFirmwareRequestMessageProcessor method processMessage.
@Override
public void processMessage(final ObjectMessage message) throws JMSException {
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;
}
final RequestMessageData requestMessageData = RequestMessageData.newBuilder().messageMetadata(messageMetadata).build();
this.printDomainInfo(requestMessageData);
final Iec61850DeviceResponseHandler iec61850DeviceResponseHandler = this.createIec61850DeviceResponseHandler(requestMessageData, message);
final DeviceRequest.Builder deviceRequestBuilder = DeviceRequest.newBuilder().messageMetaData(messageMetadata);
this.deviceService.updateFirmware(new UpdateFirmwareDeviceRequest(deviceRequestBuilder, this.firmwareLocation.getDomain(), this.firmwareLocation.getFullPath(firmwareUpdateMessageDataContainer.getFirmwareUrl()), firmwareUpdateMessageDataContainer.getFirmwareModuleData()), iec61850DeviceResponseHandler);
}
Aggregations