Search in sources :

Example 36 with Iec61850DeviceResponseHandler

use of org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.services.Iec61850DeviceResponseHandler in project open-smart-grid-platform by OSGP.

the class MicrogridsSetDataRequestMessageProcessor method processMessage.

@Override
public void processMessage(final ObjectMessage message) throws JMSException {
    LOGGER.info("Processing microgrids set data request message");
    MessageMetadata messageMetadata;
    SetDataRequestDto setDataRequest;
    try {
        messageMetadata = MessageMetadata.fromMessage(message);
        setDataRequest = (SetDataRequestDto) 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.setData(new SetDataDeviceRequest(deviceRequestBuilder, setDataRequest), iec61850DeviceResponseHandler);
}
Also used : Iec61850DeviceResponseHandler(org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.services.Iec61850DeviceResponseHandler) MessageMetadata(org.opensmartgridplatform.shared.infra.jms.MessageMetadata) SetDataRequestDto(org.opensmartgridplatform.dto.valueobjects.microgrids.SetDataRequestDto) SetDataDeviceRequest(org.opensmartgridplatform.adapter.protocol.iec61850.device.rtu.requests.SetDataDeviceRequest) JMSException(javax.jms.JMSException) DeviceRequest(org.opensmartgridplatform.adapter.protocol.iec61850.device.DeviceRequest) SetDataDeviceRequest(org.opensmartgridplatform.adapter.protocol.iec61850.device.rtu.requests.SetDataDeviceRequest) RequestMessageData(org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.helper.RequestMessageData)

Example 37 with Iec61850DeviceResponseHandler

use of org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.services.Iec61850DeviceResponseHandler in project open-smart-grid-platform by OSGP.

the class CommonGetFirmwareRequestMessageProcessor method processMessage.

@Override
public void processMessage(final ObjectMessage message) throws JMSException {
    LOGGER.debug("Processing common get firmware request message");
    final MessageMetadata messageMetadata;
    try {
        messageMetadata = MessageMetadata.fromMessage(message);
    } 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 deviceRequest = DeviceRequest.newBuilder().messageMetaData(messageMetadata).build();
    this.deviceService.getFirmwareVersion(deviceRequest, iec61850DeviceResponseHandler);
}
Also used : Iec61850DeviceResponseHandler(org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.services.Iec61850DeviceResponseHandler) MessageMetadata(org.opensmartgridplatform.shared.infra.jms.MessageMetadata) JMSException(javax.jms.JMSException) DeviceRequest(org.opensmartgridplatform.adapter.protocol.iec61850.device.DeviceRequest) RequestMessageData(org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.helper.RequestMessageData)

Example 38 with Iec61850DeviceResponseHandler

use of org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.services.Iec61850DeviceResponseHandler in project open-smart-grid-platform by OSGP.

the class CommonSetEventNotificationsRequestMessageProcessor method processMessage.

@Override
public void processMessage(final ObjectMessage message) throws JMSException {
    LOGGER.debug("Processing common set event notifications request message");
    MessageMetadata messageMetadata;
    EventNotificationMessageDataContainerDto eventNotificationsContainer;
    try {
        messageMetadata = MessageMetadata.fromMessage(message);
        eventNotificationsContainer = (EventNotificationMessageDataContainerDto) 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.setEventNotifications(new SetEventNotificationsDeviceRequest(deviceRequestBuilder, eventNotificationsContainer), iec61850DeviceResponseHandler);
}
Also used : Iec61850DeviceResponseHandler(org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.services.Iec61850DeviceResponseHandler) MessageMetadata(org.opensmartgridplatform.shared.infra.jms.MessageMetadata) SetEventNotificationsDeviceRequest(org.opensmartgridplatform.adapter.protocol.iec61850.device.ssld.requests.SetEventNotificationsDeviceRequest) JMSException(javax.jms.JMSException) SetEventNotificationsDeviceRequest(org.opensmartgridplatform.adapter.protocol.iec61850.device.ssld.requests.SetEventNotificationsDeviceRequest) DeviceRequest(org.opensmartgridplatform.adapter.protocol.iec61850.device.DeviceRequest) EventNotificationMessageDataContainerDto(org.opensmartgridplatform.dto.valueobjects.EventNotificationMessageDataContainerDto) RequestMessageData(org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.helper.RequestMessageData)

Example 39 with Iec61850DeviceResponseHandler

use of org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.services.Iec61850DeviceResponseHandler in project open-smart-grid-platform by OSGP.

the class CommonStopDeviceTestRequestMessageProcessor method processMessage.

@Override
public void processMessage(final ObjectMessage message) throws JMSException {
    LOGGER.debug("Processing common stop device test request message");
    MessageMetadata messageMetadata;
    try {
        messageMetadata = MessageMetadata.fromMessage(message);
    } 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 deviceRequest = DeviceRequest.newBuilder().messageMetaData(messageMetadata).build();
    // This is a stop self-test, so startOfTest == false.
    this.deviceService.runSelfTest(deviceRequest, iec61850DeviceResponseHandler, false);
}
Also used : Iec61850DeviceResponseHandler(org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.services.Iec61850DeviceResponseHandler) MessageMetadata(org.opensmartgridplatform.shared.infra.jms.MessageMetadata) JMSException(javax.jms.JMSException) DeviceRequest(org.opensmartgridplatform.adapter.protocol.iec61850.device.DeviceRequest) RequestMessageData(org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.helper.RequestMessageData)

Example 40 with Iec61850DeviceResponseHandler

use of org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.services.Iec61850DeviceResponseHandler 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);
}
Also used : UpdateFirmwareDeviceRequest(org.opensmartgridplatform.adapter.protocol.iec61850.device.ssld.requests.UpdateFirmwareDeviceRequest) Iec61850DeviceResponseHandler(org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.services.Iec61850DeviceResponseHandler) MessageMetadata(org.opensmartgridplatform.shared.infra.jms.MessageMetadata) FirmwareUpdateMessageDataContainer(org.opensmartgridplatform.dto.valueobjects.FirmwareUpdateMessageDataContainer) JMSException(javax.jms.JMSException) DeviceRequest(org.opensmartgridplatform.adapter.protocol.iec61850.device.DeviceRequest) UpdateFirmwareDeviceRequest(org.opensmartgridplatform.adapter.protocol.iec61850.device.ssld.requests.UpdateFirmwareDeviceRequest) RequestMessageData(org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.helper.RequestMessageData)

Aggregations

JMSException (javax.jms.JMSException)40 RequestMessageData (com.alliander.osgp.adapter.protocol.iec61850.infra.networking.helper.RequestMessageData)20 Iec61850DeviceResponseHandler (com.alliander.osgp.adapter.protocol.iec61850.infra.networking.services.Iec61850DeviceResponseHandler)20 DeviceRequest (org.opensmartgridplatform.adapter.protocol.iec61850.device.DeviceRequest)20 RequestMessageData (org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.helper.RequestMessageData)20 Iec61850DeviceResponseHandler (org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.services.Iec61850DeviceResponseHandler)20 MessageMetadata (org.opensmartgridplatform.shared.infra.jms.MessageMetadata)20 DeviceRequest (com.alliander.osgp.adapter.protocol.iec61850.device.DeviceRequest)8 SetScheduleDeviceRequest (com.alliander.osgp.adapter.protocol.iec61850.device.ssld.requests.SetScheduleDeviceRequest)2 ScheduleMessageDataContainerDto (com.alliander.osgp.dto.valueobjects.ScheduleMessageDataContainerDto)2 Serializable (java.io.Serializable)2 SetScheduleDeviceRequest (org.opensmartgridplatform.adapter.protocol.iec61850.device.ssld.requests.SetScheduleDeviceRequest)2 ScheduleDto (org.opensmartgridplatform.dto.valueobjects.ScheduleDto)2 DaDeviceRequest (com.alliander.osgp.adapter.protocol.iec61850.device.da.rtu.DaDeviceRequest)1 GetDataDeviceRequest (com.alliander.osgp.adapter.protocol.iec61850.device.rtu.requests.GetDataDeviceRequest)1 SetDataDeviceRequest (com.alliander.osgp.adapter.protocol.iec61850.device.rtu.requests.SetDataDeviceRequest)1 GetPowerUsageHistoryDeviceRequest (com.alliander.osgp.adapter.protocol.iec61850.device.ssld.requests.GetPowerUsageHistoryDeviceRequest)1 SetConfigurationDeviceRequest (com.alliander.osgp.adapter.protocol.iec61850.device.ssld.requests.SetConfigurationDeviceRequest)1 SetEventNotificationsDeviceRequest (com.alliander.osgp.adapter.protocol.iec61850.device.ssld.requests.SetEventNotificationsDeviceRequest)1 SetLightDeviceRequest (com.alliander.osgp.adapter.protocol.iec61850.device.ssld.requests.SetLightDeviceRequest)1