Search in sources :

Example 1 with DeviceRequest

use of com.alliander.osgp.adapter.protocol.iec61850.device.DeviceRequest in project Protocol-Adapter-IEC61850 by OSGP.

the class PublicLightingGetStatusRequestMessageProcessor method processMessage.

@Override
public void processMessage(final ObjectMessage message) throws JMSException {
    LOGGER.debug("Processing public lighting 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 2 with DeviceRequest

use of com.alliander.osgp.adapter.protocol.iec61850.device.DeviceRequest in project Protocol-Adapter-IEC61850 by OSGP.

the class CommonUpdateDeviceSslCertificationRequestMessageProcessor method processMessage.

@Override
public void processMessage(final ObjectMessage message) throws JMSException {
    LOGGER.debug("Processing common update device ssl certification 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;
    CertificationDto certification = 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);
        certification = (CertificationDto) 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(null, domain, domainVersion, messageType, retryCount, isScheduled, correlationUid, organisationIdentification, deviceIdentification);
    this.printDomainInfo(messageType, domain, domainVersion);
    final Iec61850DeviceResponseHandler iec61850DeviceResponseHandler = this.createIec61850DeviceResponseHandler(requestMessageData, message);
    final UpdateDeviceSslCertificationDeviceRequest deviceRequest = new UpdateDeviceSslCertificationDeviceRequest(organisationIdentification, deviceIdentification, correlationUid, certification, domain, domainVersion, messageType, ipAddress, retryCount, isScheduled);
    this.deviceService.updateDeviceSslCertification(deviceRequest, iec61850DeviceResponseHandler);
}
Also used : CertificationDto(com.alliander.osgp.dto.valueobjects.CertificationDto) Iec61850DeviceResponseHandler(com.alliander.osgp.adapter.protocol.iec61850.infra.networking.services.Iec61850DeviceResponseHandler) UpdateDeviceSslCertificationDeviceRequest(com.alliander.osgp.adapter.protocol.iec61850.device.ssld.requests.UpdateDeviceSslCertificationDeviceRequest) JMSException(javax.jms.JMSException) RequestMessageData(com.alliander.osgp.adapter.protocol.iec61850.infra.networking.helper.RequestMessageData)

Example 3 with DeviceRequest

use of com.alliander.osgp.adapter.protocol.iec61850.device.DeviceRequest in project Protocol-Adapter-IEC61850 by OSGP.

the class MicrogridsSetDataRequestMessageProcessor method processMessage.

@Override
public void processMessage(final ObjectMessage message) throws JMSException {
    LOGGER.info("Processing microgrids set data 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;
    SetDataRequestDto setDataRequest = 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);
        retryCount = message.getIntProperty(Constants.RETRY_COUNT);
        if (message.propertyExists(Constants.IS_SCHEDULED)) {
            isScheduled = message.getBooleanProperty(Constants.IS_SCHEDULED);
        } else {
            isScheduled = false;
        }
        setDataRequest = (SetDataRequestDto) 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);
        return;
    }
    final RequestMessageData requestMessageData = new RequestMessageData(null, domain, domainVersion, messageType, retryCount, isScheduled, correlationUid, organisationIdentification, deviceIdentification);
    LOGGER.info("Calling DeviceService function: {} for domain: {} {}", messageType, domain, domainVersion);
    final Iec61850DeviceResponseHandler iec61850DeviceResponseHandler = this.createIec61850DeviceResponseHandler(requestMessageData, message);
    final SetDataDeviceRequest deviceRequest = new SetDataDeviceRequest(organisationIdentification, deviceIdentification, correlationUid, setDataRequest, domain, domainVersion, messageType, ipAddress, retryCount, isScheduled);
    this.deviceService.setData(deviceRequest, iec61850DeviceResponseHandler);
}
Also used : Iec61850DeviceResponseHandler(com.alliander.osgp.adapter.protocol.iec61850.infra.networking.services.Iec61850DeviceResponseHandler) SetDataRequestDto(com.alliander.osgp.dto.valueobjects.microgrids.SetDataRequestDto) SetDataDeviceRequest(com.alliander.osgp.adapter.protocol.iec61850.device.rtu.requests.SetDataDeviceRequest) JMSException(javax.jms.JMSException) RequestMessageData(com.alliander.osgp.adapter.protocol.iec61850.infra.networking.helper.RequestMessageData)

Example 4 with DeviceRequest

use of com.alliander.osgp.adapter.protocol.iec61850.device.DeviceRequest in project Protocol-Adapter-IEC61850 by OSGP.

the class DaRtuDeviceRequestMessageProcessor method processMessage.

@Override
public void processMessage(final ObjectMessage message) throws JMSException {
    LOGGER.debug("Processing distribution automation 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;
    Serializable request = 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);
        retryCount = message.getIntProperty(Constants.RETRY_COUNT);
        isScheduled = message.propertyExists(Constants.IS_SCHEDULED) ? message.getBooleanProperty(Constants.IS_SCHEDULED) : false;
        request = 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);
        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 DaDeviceRequest deviceRequest = new DaDeviceRequest(organisationIdentification, deviceIdentification, correlationUid, request, domain, domainVersion, messageType, ipAddress, retryCount, isScheduled);
    this.deviceService.getData(deviceRequest, iec61850DeviceResponseHandler, this);
}
Also used : Iec61850DeviceResponseHandler(com.alliander.osgp.adapter.protocol.iec61850.infra.networking.services.Iec61850DeviceResponseHandler) Serializable(java.io.Serializable) DaDeviceRequest(com.alliander.osgp.adapter.protocol.iec61850.device.da.rtu.DaDeviceRequest) JMSException(javax.jms.JMSException) RequestMessageData(com.alliander.osgp.adapter.protocol.iec61850.infra.networking.helper.RequestMessageData)

Example 5 with DeviceRequest

use of com.alliander.osgp.adapter.protocol.iec61850.device.DeviceRequest in project Protocol-Adapter-IEC61850 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");
    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;
    TransitionMessageDataContainerDto transitionMessageDataContainer = 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);
        retryCount = message.getIntProperty(Constants.RETRY_COUNT);
        isScheduled = message.propertyExists(Constants.IS_SCHEDULED) ? message.getBooleanProperty(Constants.IS_SCHEDULED) : false;
        transitionMessageDataContainer = (TransitionMessageDataContainerDto) 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);
        return;
    }
    final RequestMessageData requestMessageData = new RequestMessageData(transitionMessageDataContainer, domain, domainVersion, messageType, retryCount, isScheduled, correlationUid, organisationIdentification, deviceIdentification);
    this.printDomainInfo(messageType, domain, domainVersion);
    final Iec61850DeviceResponseHandler iec61850DeviceResponseHandler = this.createIec61850DeviceResponseHandler(requestMessageData, message);
    final SetTransitionDeviceRequest deviceRequest = new SetTransitionDeviceRequest(organisationIdentification, deviceIdentification, correlationUid, transitionMessageDataContainer, domain, domainVersion, messageType, ipAddress, retryCount, isScheduled);
    this.deviceService.setTransition(deviceRequest, iec61850DeviceResponseHandler);
}
Also used : Iec61850DeviceResponseHandler(com.alliander.osgp.adapter.protocol.iec61850.infra.networking.services.Iec61850DeviceResponseHandler) TransitionMessageDataContainerDto(com.alliander.osgp.dto.valueobjects.TransitionMessageDataContainerDto) SetTransitionDeviceRequest(com.alliander.osgp.adapter.protocol.iec61850.device.ssld.requests.SetTransitionDeviceRequest) JMSException(javax.jms.JMSException) RequestMessageData(com.alliander.osgp.adapter.protocol.iec61850.infra.networking.helper.RequestMessageData)

Aggregations

JMSException (javax.jms.JMSException)36 RequestMessageData (com.alliander.osgp.adapter.protocol.iec61850.infra.networking.helper.RequestMessageData)20 Iec61850DeviceResponseHandler (com.alliander.osgp.adapter.protocol.iec61850.infra.networking.services.Iec61850DeviceResponseHandler)20 ProtocolAdapterException (com.alliander.osgp.adapter.protocol.iec61850.exceptions.ProtocolAdapterException)17 ConnectionFailureException (com.alliander.osgp.adapter.protocol.iec61850.exceptions.ConnectionFailureException)16 DeviceConnection (com.alliander.osgp.adapter.protocol.iec61850.infra.networking.helper.DeviceConnection)16 NodeWriteException (com.alliander.osgp.adapter.protocol.iec61850.exceptions.NodeWriteException)13 FunctionalException (com.alliander.osgp.shared.exceptionhandling.FunctionalException)13 TechnicalException (com.alliander.osgp.shared.exceptionhandling.TechnicalException)13 DeviceRequest (com.alliander.osgp.adapter.protocol.iec61850.device.DeviceRequest)8 EmptyDeviceResponse (com.alliander.osgp.adapter.protocol.iec61850.device.ssld.responses.EmptyDeviceResponse)7 Ssld (com.alliander.osgp.core.db.api.iec61850.entities.Ssld)6 Iec61850ClientAssociation (com.alliander.osgp.adapter.protocol.iec61850.infra.networking.Iec61850ClientAssociation)3 Iec61850Connection (com.alliander.osgp.adapter.protocol.iec61850.infra.networking.Iec61850Connection)3 DeviceOutputSetting (com.alliander.osgp.core.db.api.iec61850.entities.DeviceOutputSetting)3 ClientAssociation (org.openmuc.openiec61850.ClientAssociation)3 ServerModel (org.openmuc.openiec61850.ServerModel)3 SetScheduleDeviceRequest (com.alliander.osgp.adapter.protocol.iec61850.device.ssld.requests.SetScheduleDeviceRequest)2 DeviceMessageLog (com.alliander.osgp.adapter.protocol.iec61850.domain.valueobjects.DeviceMessageLog)2 SystemService (com.alliander.osgp.adapter.protocol.iec61850.infra.networking.SystemService)2