Search in sources :

Example 6 with RequestMessageData

use of org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.helper.RequestMessageData in project Protocol-Adapter-IEC61850 by OSGP.

the class TariffSwitchingGetStatusRequestMessageProcessor method processMessage.

@Override
public void processMessage(final ObjectMessage message) throws JMSException {
    LOGGER.debug("Processing tariff switching get status request message");
    String correlationUid = null;
    String domain = null;
    String domainVersion = null;
    String messageType = null;
    String organisationIdentification = null;
    String deviceIdentification = null;
    String ipAddress = null;
    int retryCount = 0;
    boolean isScheduled = false;
    try {
        correlationUid = message.getJMSCorrelationID();
        domain = message.getStringProperty(Constants.DOMAIN);
        domainVersion = message.getStringProperty(Constants.DOMAIN_VERSION);
        messageType = message.getJMSType();
        organisationIdentification = message.getStringProperty(Constants.ORGANISATION_IDENTIFICATION);
        deviceIdentification = message.getStringProperty(Constants.DEVICE_IDENTIFICATION);
        ipAddress = message.getStringProperty(Constants.IP_ADDRESS);
        retryCount = message.getIntProperty(Constants.RETRY_COUNT);
        isScheduled = message.propertyExists(Constants.IS_SCHEDULED) ? message.getBooleanProperty(Constants.IS_SCHEDULED) : false;
    } catch (final JMSException e) {
        LOGGER.error("UNRECOVERABLE ERROR, unable to read ObjectMessage instance, giving up.", e);
        LOGGER.debug("correlationUid: {}", correlationUid);
        LOGGER.debug("domain: {}", domain);
        LOGGER.debug("domainVersion: {}", domainVersion);
        LOGGER.debug("messageType: {}", messageType);
        LOGGER.debug("organisationIdentification: {}", organisationIdentification);
        LOGGER.debug("deviceIdentification: {}", deviceIdentification);
        LOGGER.debug("ipAddress: {}", ipAddress);
        return;
    }
    final RequestMessageData requestMessageData = new RequestMessageData(null, domain, domainVersion, messageType, retryCount, isScheduled, correlationUid, organisationIdentification, deviceIdentification);
    this.printDomainInfo(messageType, domain, domainVersion);
    final Iec61850DeviceResponseHandler iec61850DeviceResponseHandler = this.createIec61850DeviceResponseHandler(requestMessageData, message);
    final DeviceRequest deviceRequest = new DeviceRequest(organisationIdentification, deviceIdentification, correlationUid, domain, domainVersion, messageType, ipAddress, retryCount, isScheduled);
    this.deviceService.getStatus(deviceRequest, iec61850DeviceResponseHandler);
}
Also used : Iec61850DeviceResponseHandler(com.alliander.osgp.adapter.protocol.iec61850.infra.networking.services.Iec61850DeviceResponseHandler) JMSException(javax.jms.JMSException) DeviceRequest(com.alliander.osgp.adapter.protocol.iec61850.device.DeviceRequest) RequestMessageData(com.alliander.osgp.adapter.protocol.iec61850.infra.networking.helper.RequestMessageData)

Example 7 with RequestMessageData

use of org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.helper.RequestMessageData in project Protocol-Adapter-IEC61850 by OSGP.

the class TariffSwitchingSetScheduleRequestMessageProcessor method processMessage.

@Override
public void processMessage(final ObjectMessage message) throws JMSException {
    LOGGER.debug("Processing tariff switching set schedule request message");
    String correlationUid = null;
    String domain = null;
    String domainVersion = null;
    String messageType = null;
    String organisationIdentification = null;
    String deviceIdentification = null;
    String ipAddress = null;
    Boolean isScheduled = null;
    int retryCount = 0;
    ScheduleMessageDataContainerDto scheduleMessageDataContainer = null;
    try {
        correlationUid = message.getJMSCorrelationID();
        domain = message.getStringProperty(Constants.DOMAIN);
        domainVersion = message.getStringProperty(Constants.DOMAIN_VERSION);
        messageType = message.getJMSType();
        organisationIdentification = message.getStringProperty(Constants.ORGANISATION_IDENTIFICATION);
        deviceIdentification = message.getStringProperty(Constants.DEVICE_IDENTIFICATION);
        ipAddress = message.getStringProperty(Constants.IP_ADDRESS);
        isScheduled = message.getBooleanProperty(Constants.IS_SCHEDULED);
        retryCount = message.getIntProperty(Constants.RETRY_COUNT);
        scheduleMessageDataContainer = (ScheduleMessageDataContainerDto) message.getObject();
    } catch (final JMSException e) {
        LOGGER.error("UNRECOVERABLE ERROR, unable to read ObjectMessage instance, giving up.", e);
        LOGGER.debug("correlationUid: {}", correlationUid);
        LOGGER.debug("domain: {}", domain);
        LOGGER.debug("domainVersion: {}", domainVersion);
        LOGGER.debug("messageType: {}", messageType);
        LOGGER.debug("organisationIdentification: {}", organisationIdentification);
        LOGGER.debug("deviceIdentification: {}", deviceIdentification);
        LOGGER.debug("ipAddress: {}", ipAddress);
        LOGGER.debug("scheduled: {}", isScheduled);
        return;
    }
    final RequestMessageData requestMessageData = new RequestMessageData(scheduleMessageDataContainer, domain, domainVersion, messageType, retryCount, isScheduled, correlationUid, organisationIdentification, deviceIdentification);
    this.printDomainInfo(messageType, domain, domainVersion);
    final Iec61850DeviceResponseHandler iec61850DeviceResponseHandler = this.createIec61850DeviceResponseHandler(requestMessageData, message);
    final SetScheduleDeviceRequest deviceRequest = new SetScheduleDeviceRequest(organisationIdentification, deviceIdentification, correlationUid, scheduleMessageDataContainer, RelayTypeDto.TARIFF, domain, domainVersion, messageType, ipAddress, retryCount, isScheduled);
    this.deviceService.setSchedule(deviceRequest, iec61850DeviceResponseHandler);
}
Also used : Iec61850DeviceResponseHandler(com.alliander.osgp.adapter.protocol.iec61850.infra.networking.services.Iec61850DeviceResponseHandler) ScheduleMessageDataContainerDto(com.alliander.osgp.dto.valueobjects.ScheduleMessageDataContainerDto) SetScheduleDeviceRequest(com.alliander.osgp.adapter.protocol.iec61850.device.ssld.requests.SetScheduleDeviceRequest) JMSException(javax.jms.JMSException) RequestMessageData(com.alliander.osgp.adapter.protocol.iec61850.infra.networking.helper.RequestMessageData)

Example 8 with RequestMessageData

use of org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.helper.RequestMessageData in project Protocol-Adapter-IEC61850 by OSGP.

the class CommonRebootRequestMessageProcessor method processMessage.

@Override
public void processMessage(final ObjectMessage message) throws JMSException {
    LOGGER.debug("Processing common reboot request message");
    String correlationUid = null;
    String domain = null;
    String domainVersion = null;
    String messageType = null;
    String organisationIdentification = null;
    String deviceIdentification = null;
    String ipAddress = null;
    int retryCount = 0;
    boolean isScheduled = false;
    try {
        correlationUid = message.getJMSCorrelationID();
        domain = message.getStringProperty(Constants.DOMAIN);
        domainVersion = message.getStringProperty(Constants.DOMAIN_VERSION);
        messageType = message.getJMSType();
        organisationIdentification = message.getStringProperty(Constants.ORGANISATION_IDENTIFICATION);
        deviceIdentification = message.getStringProperty(Constants.DEVICE_IDENTIFICATION);
        ipAddress = message.getStringProperty(Constants.IP_ADDRESS);
        retryCount = message.getIntProperty(Constants.RETRY_COUNT);
        isScheduled = message.propertyExists(Constants.IS_SCHEDULED) ? message.getBooleanProperty(Constants.IS_SCHEDULED) : false;
    } catch (final JMSException e) {
        LOGGER.error("UNRECOVERABLE ERROR, unable to read ObjectMessage instance, giving up.", e);
        LOGGER.debug("correlationUid: {}", correlationUid);
        LOGGER.debug("domain: {}", domain);
        LOGGER.debug("domainVersion: {}", domainVersion);
        LOGGER.debug("messageType: {}", messageType);
        LOGGER.debug("organisationIdentification: {}", organisationIdentification);
        LOGGER.debug("deviceIdentification: {}", deviceIdentification);
        LOGGER.debug("ipAddress: {}", ipAddress);
        return;
    }
    final RequestMessageData requestMessageData = new RequestMessageData(null, domain, domainVersion, messageType, retryCount, isScheduled, correlationUid, organisationIdentification, deviceIdentification);
    this.printDomainInfo(messageType, domain, domainVersion);
    final Iec61850DeviceResponseHandler iec61850DeviceResponseHandler = this.createIec61850DeviceResponseHandler(requestMessageData, message);
    final DeviceRequest deviceRequest = new DeviceRequest(organisationIdentification, deviceIdentification, correlationUid, domain, domainVersion, messageType, ipAddress, retryCount, isScheduled);
    this.deviceService.setReboot(deviceRequest, iec61850DeviceResponseHandler);
}
Also used : Iec61850DeviceResponseHandler(com.alliander.osgp.adapter.protocol.iec61850.infra.networking.services.Iec61850DeviceResponseHandler) JMSException(javax.jms.JMSException) DeviceRequest(com.alliander.osgp.adapter.protocol.iec61850.device.DeviceRequest) RequestMessageData(com.alliander.osgp.adapter.protocol.iec61850.infra.networking.helper.RequestMessageData)

Example 9 with RequestMessageData

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

the class MicrogridsGetDataRequestMessageProcessor method processMessage.

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

Example 10 with RequestMessageData

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

the class PublicLightingSetTransitionRequestMessageProcessor method processMessage.

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