Example usage for javax.jms ObjectMessage getBooleanProperty

List of usage examples for javax.jms ObjectMessage getBooleanProperty

Introduction

In this page you can find the example usage for javax.jms ObjectMessage getBooleanProperty.

Prototype


boolean getBooleanProperty(String name) throws JMSException;

Source Link

Document

Returns the value of the boolean property with the specified name.

Usage

From source file:com.alliander.osgp.adapter.protocol.iec61850.infra.messaging.processors.CommonStopDeviceTestRequestMessageProcessor.java

@Override
public void processMessage(final ObjectMessage message) throws JMSException {
    LOGGER.debug("Processing common stop device test request message");

    String correlationUid = null;
    String domain = null;//from  w w  w.j  a  v a2s . c om
    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;
    }

    LOGGER.info("Calling DeviceService function: {} for domain: {} {}", messageType, domain, domainVersion);

    final RequestMessageData requestMessageData = new RequestMessageData(null, domain, domainVersion,
            messageType, retryCount, isScheduled, correlationUid, organisationIdentification,
            deviceIdentification);

    final DeviceResponseHandler deviceResponseHandler = new DeviceResponseHandler() {

        @Override
        public void handleResponse(final DeviceResponse deviceResponse) {
            CommonStopDeviceTestRequestMessageProcessor.this.handleEmptyDeviceResponse(deviceResponse,
                    CommonStopDeviceTestRequestMessageProcessor.this.responseMessageSender,
                    requestMessageData.getDomain(), requestMessageData.getDomainVersion(),
                    requestMessageData.getMessageType(), requestMessageData.getRetryCount());
        }

        @Override
        public void handleException(final Throwable t, final DeviceResponse deviceResponse,
                final boolean expected) {

            if (expected) {
                CommonStopDeviceTestRequestMessageProcessor.this.handleExpectedError(
                        new ConnectionFailureException(ComponentType.PROTOCOL_IEC61850, t.getMessage()),
                        requestMessageData.getCorrelationUid(),
                        requestMessageData.getOrganisationIdentification(),
                        requestMessageData.getDeviceIdentification(), requestMessageData.getDomain(),
                        requestMessageData.getDomainVersion(), requestMessageData.getMessageType());
            } else {
                CommonStopDeviceTestRequestMessageProcessor.this.handleUnExpectedError(deviceResponse, t,
                        requestMessageData.getMessageData(), requestMessageData.getDomain(),
                        requestMessageData.getDomainVersion(), requestMessageData.getMessageType(),
                        requestMessageData.isScheduled(), requestMessageData.getRetryCount());
            }
        }
    };

    LOGGER.info("Calling DeviceService function: {} for domain: {} {}", messageType, domain, domainVersion);

    final DeviceRequest deviceRequest = new DeviceRequest(organisationIdentification, deviceIdentification,
            correlationUid, domain, domainVersion, messageType, ipAddress, retryCount, isScheduled);

    // This is a stop selftest, so startOfTest == false
    this.deviceService.runSelfTest(deviceRequest, deviceResponseHandler, false);
}

From source file:com.alliander.osgp.adapter.protocol.iec61850.infra.messaging.processors.CommonGetConfigurationRequestMessageProcessor.java

@Override
public void processMessage(final ObjectMessage message) {
    LOGGER.debug("Processing common get configuration message");

    String correlationUid = null;
    String domain = null;/*  w  w  w. jav  a  2  s . co m*/
    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);

    LOGGER.info("Calling DeviceService function: {} for domain: {} {}", messageType, domain, domainVersion);

    final DeviceResponseHandler deviceResponseHandler = new DeviceResponseHandler() {

        @Override
        public void handleResponse(final DeviceResponse deviceResponse) {
            CommonGetConfigurationRequestMessageProcessor.this.handleGetConfigurationDeviceResponse(
                    deviceResponse, CommonGetConfigurationRequestMessageProcessor.this.responseMessageSender,
                    requestMessageData.getDomain(), requestMessageData.getDomainVersion(),
                    requestMessageData.getMessageType(), requestMessageData.getRetryCount());
        }

        @Override
        public void handleException(final Throwable t, final DeviceResponse deviceResponse,
                final boolean expected) {
            if (expected) {
                CommonGetConfigurationRequestMessageProcessor.this.handleExpectedError(
                        new ConnectionFailureException(ComponentType.PROTOCOL_IEC61850, t.getMessage()),
                        requestMessageData.getCorrelationUid(),
                        requestMessageData.getOrganisationIdentification(),
                        requestMessageData.getDeviceIdentification(), requestMessageData.getDomain(),
                        requestMessageData.getDomainVersion(), requestMessageData.getMessageType());
            } else {
                CommonGetConfigurationRequestMessageProcessor.this.handleUnExpectedError(deviceResponse, t,
                        requestMessageData.getMessageData(), requestMessageData.getDomain(),
                        requestMessageData.getDomainVersion(), requestMessageData.getMessageType(),
                        requestMessageData.isScheduled(), requestMessageData.getRetryCount());
            }
        }

    };

    final DeviceRequest deviceRequest = new DeviceRequest(organisationIdentification, deviceIdentification,
            correlationUid, domain, domainVersion, messageType, ipAddress, retryCount, isScheduled);

    this.deviceService.getConfiguration(deviceRequest, deviceResponseHandler);
}

From source file:com.alliander.osgp.adapter.protocol.oslp.infra.messaging.processors.PublicLightingGetActualPowerUsageRequestMessageProcessor.java

@Override
public void processMessage(final ObjectMessage message) {
    LOGGER.debug("Processing public lighting get actual power usage request message");

    String correlationUid = null;
    String domain = null;/*from  w  ww .  j a v a2s  . c  o  m*/
    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;
    }

    LOGGER.info("Calling DeviceService function: {} for domain: {} {}", messageType, domain, domainVersion);

    final DeviceRequest deviceRequest = new DeviceRequest(organisationIdentification, deviceIdentification,
            correlationUid, domain, domainVersion, messageType, ipAddress, retryCount, isScheduled);

    this.deviceService.getActualPowerUsage(deviceRequest);
}

From source file:com.alliander.osgp.adapter.protocol.oslp.elster.infra.messaging.processors.CommonSetDeviceVerificationKeyRequestMessageProcessor.java

@Override
public void processMessage(final ObjectMessage message) {
    LOGGER.debug("Processing common Set device verification key message");

    String correlationUid = null;
    String domain = null;/* w  w  w  .j av  a  2 s.c  o  m*/
    String domainVersion = null;
    String messageType = null;
    String organisationIdentification = null;
    String deviceIdentification = null;
    String ipAddress = null;
    int retryCount = 0;
    boolean isScheduled = false;
    String verificationKey = 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;
        verificationKey = (String) 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;
    }

    LOGGER.info("Calling DeviceService function: {} for domain: {} {}", messageType, domain, domainVersion);

    final SetDeviceVerificationKeyDeviceRequest deviceRequest = new SetDeviceVerificationKeyDeviceRequest(
            organisationIdentification, deviceIdentification, correlationUid, verificationKey, domain,
            domainVersion, messageType, ipAddress, retryCount, isScheduled);

    this.deviceService.setDeviceVerificationKey(deviceRequest);
}

From source file:com.alliander.osgp.adapter.protocol.iec61850.infra.messaging.processors.CommonGetFirmwareRequestMessageProcessor.java

@Override
public void processMessage(final ObjectMessage message) {
    LOGGER.debug("Processing common get firmware request message");

    String correlationUid = null;
    String domain = null;//w w  w.j  a  v a  2  s.  c o m
    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);

    LOGGER.info("Calling DeviceService function: {} for domain: {} {}", messageType, domain, domainVersion);

    final DeviceResponseHandler deviceResponseHandler = new DeviceResponseHandler() {

        @Override
        public void handleResponse(final DeviceResponse deviceResponse) {
            CommonGetFirmwareRequestMessageProcessor.this.handleGetFirmwareVersionDeviceResponse(deviceResponse,
                    CommonGetFirmwareRequestMessageProcessor.this.responseMessageSender,
                    requestMessageData.getDomain(), requestMessageData.getDomainVersion(),
                    requestMessageData.getMessageType(), requestMessageData.getRetryCount());
        }

        @Override
        public void handleException(final Throwable t, final DeviceResponse deviceResponse,
                final boolean expected) {
            if (expected) {
                CommonGetFirmwareRequestMessageProcessor.this.handleExpectedError(
                        new ConnectionFailureException(ComponentType.PROTOCOL_IEC61850, t.getMessage()),
                        requestMessageData.getCorrelationUid(),
                        requestMessageData.getOrganisationIdentification(),
                        requestMessageData.getDeviceIdentification(), requestMessageData.getDomain(),
                        requestMessageData.getDomainVersion(), requestMessageData.getMessageType());
            } else {
                CommonGetFirmwareRequestMessageProcessor.this.handleUnExpectedError(deviceResponse, t,
                        requestMessageData.getMessageData(), requestMessageData.getDomain(),
                        requestMessageData.getDomainVersion(), requestMessageData.getMessageType(),
                        requestMessageData.isScheduled(), requestMessageData.getRetryCount());
            }
        }

    };

    final DeviceRequest deviceRequest = new DeviceRequest(organisationIdentification, deviceIdentification,
            correlationUid, domain, domainVersion, messageType, ipAddress, retryCount, isScheduled);

    this.deviceService.getFirmwareVersion(deviceRequest, deviceResponseHandler);
}

From source file:com.alliander.osgp.adapter.protocol.iec61850.infra.messaging.processors.MicrogridsSetSetPointsRequestMessageProcessor.java

@Override
public void processMessage(final ObjectMessage message) {
    LOGGER.info("Processing microgrids get data request message");

    String correlationUid = null;
    String domain = null;/* w ww .j a v a2 s.com*/
    String domainVersion = null;
    String messageType = null;
    String organisationIdentification = null;
    String deviceIdentification = null;
    String ipAddress = null;
    int retryCount = 0;
    boolean isScheduled = false;
    SetPointsRequestDto setSetPointsRequest = 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;
        setSetPointsRequest = (SetPointsRequestDto) 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 DeviceResponseHandler deviceResponseHandler = new DeviceResponseHandler() {

        @Override
        public void handleResponse(final DeviceResponse deviceResponse) {
            MicrogridsSetSetPointsRequestMessageProcessor.this.handleEmptyDeviceResponse(deviceResponse,
                    MicrogridsSetSetPointsRequestMessageProcessor.this.responseMessageSender,
                    requestMessageData.getDomain(), requestMessageData.getDomainVersion(),
                    requestMessageData.getMessageType(), requestMessageData.getRetryCount());
        }

        @Override
        public void handleException(final Throwable t, final DeviceResponse deviceResponse,
                final boolean expected) {
            if (expected) {
                MicrogridsSetSetPointsRequestMessageProcessor.this.handleExpectedError(
                        new ConnectionFailureException(ComponentType.PROTOCOL_IEC61850, t.getMessage()),
                        requestMessageData.getCorrelationUid(),
                        requestMessageData.getOrganisationIdentification(),
                        requestMessageData.getDeviceIdentification(), requestMessageData.getDomain(),
                        requestMessageData.getDomainVersion(), requestMessageData.getMessageType());
            } else {
                MicrogridsSetSetPointsRequestMessageProcessor.this.handleUnExpectedError(deviceResponse, t,
                        requestMessageData.getMessageData(), requestMessageData.getDomain(),
                        requestMessageData.getDomainVersion(), requestMessageData.getMessageType(),
                        requestMessageData.isScheduled(), requestMessageData.getRetryCount());
            }
        }

    };

    final SetSetPointsDeviceRequest deviceRequest = new SetSetPointsDeviceRequest(organisationIdentification,
            deviceIdentification, correlationUid, setSetPointsRequest, domain, domainVersion, messageType,
            ipAddress, retryCount, isScheduled);

    this.deviceService.setSetPoints(deviceRequest, deviceResponseHandler);
}

From source file:com.alliander.osgp.adapter.protocol.iec61850.infra.messaging.processors.MicrogridsGetDataRequestMessageProcessor.java

@Override
public void processMessage(final ObjectMessage message) {
    LOGGER.info("Processing microgrids get data request message");

    String correlationUid = null;
    String domain = null;/*from w w  w.jav a2 s . c o m*/
    String domainVersion = null;
    String messageType = null;
    String organisationIdentification = null;
    String deviceIdentification = null;
    String ipAddress = null;
    int retryCount = 0;
    boolean isScheduled = false;
    DataRequestDto getDataRequest = 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;
        getDataRequest = (DataRequestDto) 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 DeviceResponseHandler deviceResponseHandler = new DeviceResponseHandler() {

        @Override
        public void handleResponse(final DeviceResponse deviceResponse) {
            MicrogridsGetDataRequestMessageProcessor.this.handleGetDataDeviceResponse(deviceResponse,
                    MicrogridsGetDataRequestMessageProcessor.this.responseMessageSender,
                    requestMessageData.getDomain(), requestMessageData.getDomainVersion(),
                    requestMessageData.getMessageType(), requestMessageData.getRetryCount());
        }

        @Override
        public void handleException(final Throwable t, final DeviceResponse deviceResponse,
                final boolean expected) {
            if (expected) {
                MicrogridsGetDataRequestMessageProcessor.this.handleExpectedError(
                        new ConnectionFailureException(ComponentType.PROTOCOL_IEC61850, t.getMessage()),
                        requestMessageData.getCorrelationUid(),
                        requestMessageData.getOrganisationIdentification(),
                        requestMessageData.getDeviceIdentification(), requestMessageData.getDomain(),
                        requestMessageData.getDomainVersion(), requestMessageData.getMessageType());
            } else {
                MicrogridsGetDataRequestMessageProcessor.this.handleUnExpectedError(deviceResponse, t,
                        requestMessageData.getMessageData(), requestMessageData.getDomain(),
                        requestMessageData.getDomainVersion(), requestMessageData.getMessageType(),
                        requestMessageData.isScheduled(), requestMessageData.getRetryCount());
            }
        }

    };

    final GetDataDeviceRequest deviceRequest = new GetDataDeviceRequest(organisationIdentification,
            deviceIdentification, correlationUid, getDataRequest, domain, domainVersion, messageType, ipAddress,
            retryCount, isScheduled);

    this.deviceService.getData(deviceRequest, deviceResponseHandler);
}

From source file:com.alliander.osgp.adapter.protocol.iec61850.infra.messaging.processors.PublicLightingSetLightRequestMessageProcessor.java

@Override
public void processMessage(final ObjectMessage message) {
    LOGGER.debug("Processing public lighting set light request message");

    String correlationUid = null;
    String domain = null;//  ww  w .  j ava  2s.  c o  m
    String domainVersion = null;
    String messageType = null;
    String organisationIdentification = null;
    String deviceIdentification = null;
    String ipAddress = null;
    int retryCount = 0;
    boolean isScheduled = false;
    LightValueMessageDataContainerDto lightValueMessageDataContainer = 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;

        lightValueMessageDataContainer = (LightValueMessageDataContainerDto) 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(lightValueMessageDataContainer, domain,
            domainVersion, messageType, retryCount, isScheduled, correlationUid, organisationIdentification,
            deviceIdentification);

    final DeviceResponseHandler deviceResponseHandler = new DeviceResponseHandler() {

        @Override
        public void handleResponse(final DeviceResponse deviceResponse) {
            PublicLightingSetLightRequestMessageProcessor.this.handleEmptyDeviceResponse(deviceResponse,
                    PublicLightingSetLightRequestMessageProcessor.this.responseMessageSender,
                    requestMessageData.getDomain(), requestMessageData.getDomainVersion(),
                    requestMessageData.getMessageType(), requestMessageData.getRetryCount());
        }

        @Override
        public void handleException(final Throwable t, final DeviceResponse deviceResponse,
                final boolean expected) {

            if (expected) {
                PublicLightingSetLightRequestMessageProcessor.this.handleExpectedError(
                        new ConnectionFailureException(ComponentType.PROTOCOL_IEC61850, t.getMessage()),
                        requestMessageData.getCorrelationUid(),
                        requestMessageData.getOrganisationIdentification(),
                        requestMessageData.getDeviceIdentification(), requestMessageData.getDomain(),
                        requestMessageData.getDomainVersion(), requestMessageData.getMessageType());
            } else {
                PublicLightingSetLightRequestMessageProcessor.this.handleUnExpectedError(deviceResponse, t,
                        requestMessageData.getMessageData(), requestMessageData.getDomain(),
                        requestMessageData.getDomainVersion(), requestMessageData.getMessageType(),
                        requestMessageData.isScheduled(), requestMessageData.getRetryCount());
            }
        }
    };

    LOGGER.info("Calling DeviceService function: {} for domain: {} {}", messageType, domain, domainVersion);

    final SetLightDeviceRequest deviceRequest = new SetLightDeviceRequest(organisationIdentification,
            deviceIdentification, correlationUid, lightValueMessageDataContainer, domain, domainVersion,
            messageType, ipAddress, retryCount, isScheduled);

    this.deviceService.setLight(deviceRequest, deviceResponseHandler);
}

From source file:com.alliander.osgp.adapter.protocol.iec61850.infra.messaging.processors.PublicLightingSetTransitionRequestMessageProcessor.java

@Override
public void processMessage(final ObjectMessage message) {
    LOGGER.debug("Processing public lighting set transition request message");

    String correlationUid = null;
    String domain = null;/* ww w . j  a  v  a  2  s . c o m*/
    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);

    final DeviceResponseHandler deviceResponseHandler = new DeviceResponseHandler() {

        @Override
        public void handleResponse(final DeviceResponse deviceResponse) {
            PublicLightingSetTransitionRequestMessageProcessor.this.handleEmptyDeviceResponse(deviceResponse,
                    PublicLightingSetTransitionRequestMessageProcessor.this.responseMessageSender,
                    requestMessageData.getDomain(), requestMessageData.getDomainVersion(),
                    requestMessageData.getMessageType(), requestMessageData.getRetryCount());
        }

        @Override
        public void handleException(final Throwable t, final DeviceResponse deviceResponse,
                final boolean expected) {

            if (expected) {
                PublicLightingSetTransitionRequestMessageProcessor.this.handleExpectedError(
                        new ConnectionFailureException(ComponentType.PROTOCOL_IEC61850, t.getMessage()),
                        requestMessageData.getCorrelationUid(),
                        requestMessageData.getOrganisationIdentification(),
                        requestMessageData.getDeviceIdentification(), requestMessageData.getDomain(),
                        requestMessageData.getDomainVersion(), requestMessageData.getMessageType());
            } else {
                PublicLightingSetTransitionRequestMessageProcessor.this.handleUnExpectedError(deviceResponse, t,
                        requestMessageData.getMessageData(), requestMessageData.getDomain(),
                        requestMessageData.getDomainVersion(), requestMessageData.getMessageType(),
                        requestMessageData.isScheduled(), requestMessageData.getRetryCount());
            }
        }
    };

    LOGGER.info("Calling DeviceService function: {} for domain: {} {}", messageType, domain, domainVersion);

    final SetTransitionDeviceRequest deviceRequest = new SetTransitionDeviceRequest(organisationIdentification,
            deviceIdentification, correlationUid, transitionMessageDataContainer, domain, domainVersion,
            messageType, ipAddress, retryCount, isScheduled);

    this.deviceService.setTransition(deviceRequest, deviceResponseHandler);
}

From source file:com.alliander.osgp.adapter.protocol.iec61850.infra.messaging.processors.PublicLightingGetPowerUsageHistoryRequestMessageProcessor.java

@Override
public void processMessage(final ObjectMessage message) {
    LOGGER.debug("Processing public lighting get power usage history request message");

    String correlationUid = null;
    String domain = null;/*from ww  w  .  ja  v a  2s  .  co m*/
    String domainVersion = null;
    String messageType = null;
    String organisationIdentification = null;
    String deviceIdentification = null;
    String ipAddress = null;
    Boolean isScheduled = null;
    int retryCount = 0;
    final int messagePriority;
    final Long scheduleTime;
    PowerUsageHistoryMessageDataContainerDto powerUsageHistoryMessageDataContainerDto;

    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);
        messagePriority = message.getJMSPriority();
        scheduleTime = message.propertyExists(Constants.SCHEDULE_TIME)
                ? message.getLongProperty(Constants.SCHEDULE_TIME)
                : null;
        powerUsageHistoryMessageDataContainerDto = (PowerUsageHistoryMessageDataContainerDto) 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(
            powerUsageHistoryMessageDataContainerDto, domain, domainVersion, messageType, retryCount,
            isScheduled, correlationUid, organisationIdentification, deviceIdentification);

    final DeviceResponseHandler deviceResponseHandler = new DeviceResponseHandler() {

        @Override
        public void handleResponse(final DeviceResponse deviceResponse) {
            PublicLightingGetPowerUsageHistoryRequestMessageProcessor.this
                    .handleGetPowerUsageHistoryDeviceResponse(
                            (GetPowerUsageHistoryDeviceResponse) deviceResponse,
                            PublicLightingGetPowerUsageHistoryRequestMessageProcessor.this.responseMessageSender,
                            requestMessageData.getDomain(), requestMessageData.getDomainVersion(),
                            requestMessageData.getMessageType(), requestMessageData.getRetryCount(),
                            messagePriority, scheduleTime);
        }

        @Override
        public void handleException(final Throwable t, final DeviceResponse deviceResponse,
                final boolean expected) {

            if (expected) {
                PublicLightingGetPowerUsageHistoryRequestMessageProcessor.this.handleExpectedError(
                        new ConnectionFailureException(ComponentType.PROTOCOL_IEC61850, t.getMessage()),
                        requestMessageData.getCorrelationUid(),
                        requestMessageData.getOrganisationIdentification(),
                        requestMessageData.getDeviceIdentification(), requestMessageData.getDomain(),
                        requestMessageData.getDomainVersion(), requestMessageData.getMessageType());
            } else {
                PublicLightingGetPowerUsageHistoryRequestMessageProcessor.this.handleUnExpectedError(
                        deviceResponse, t, requestMessageData.getMessageData(), requestMessageData.getDomain(),
                        requestMessageData.getDomainVersion(), requestMessageData.getMessageType(),
                        requestMessageData.isScheduled(), requestMessageData.getRetryCount());
            }
        }
    };

    LOGGER.info("Calling DeviceService function: {} for domain: {} {}", messageType, domain, domainVersion);

    final GetPowerUsageHistoryDeviceRequest deviceRequest = new GetPowerUsageHistoryDeviceRequest(
            organisationIdentification, deviceIdentification, correlationUid,
            powerUsageHistoryMessageDataContainerDto, domain, domainVersion, messageType, ipAddress, retryCount,
            isScheduled);

    this.deviceService.getPowerUsageHistory(deviceRequest, deviceResponseHandler);
}