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.oslp.elster.infra.messaging.processors.CommonSetConfigurationRequestMessageProcessor.java

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

    String correlationUid = null;
    String domain = null;/*from w  w  w.ja  v a2  s.  c o  m*/
    String domainVersion = null;
    String messageType = null;
    String organisationIdentification = null;
    String deviceIdentification = null;
    String ipAddress = null;
    Boolean isScheduled = null;
    int retryCount = 0;

    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);
    } 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;
    }

    try {
        final com.alliander.osgp.dto.valueobjects.ConfigurationDto configuration = (com.alliander.osgp.dto.valueobjects.ConfigurationDto) message
                .getObject();

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

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

        this.deviceService.setConfiguration(deviceRequest);
    } catch (final Exception e) {
        this.handleError(e, correlationUid, organisationIdentification, deviceIdentification, domain,
                domainVersion, messageType, retryCount);
    }
}

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

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

    String correlationUid = null;
    String domain = null;/*from   w  ww .j  a  va2s. co m*/
    String domainVersion = null;
    String messageType = null;
    String organisationIdentification = null;
    String deviceIdentification = null;
    String ipAddress = null;
    Boolean isScheduled = null;
    int retryCount = 0;

    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);
    } 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;
    }

    try {
        final ScheduleMessageDataContainerDto scheduleMessageDataContainer = (ScheduleMessageDataContainerDto) message
                .getObject();

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

        final SetScheduleDeviceRequest deviceRequest = new SetScheduleDeviceRequest(organisationIdentification,
                deviceIdentification, correlationUid, scheduleMessageDataContainer, RelayTypeDto.LIGHT, domain,
                domainVersion, messageType, ipAddress, retryCount, isScheduled);

        this.deviceService.setSchedule(deviceRequest);
    } catch (final Exception e) {
        this.handleError(e, correlationUid, organisationIdentification, deviceIdentification, domain,
                domainVersion, messageType, retryCount);
    }
}

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

@Override
public void processMessage(final ObjectMessage message) {
    LOGGER.debug("Processing tariff switching set schedule request message");

    String correlationUid = null;
    String domain = null;/*from w ww.  j  av  a 2  s. co  m*/
    String domainVersion = null;
    String messageType = null;
    String organisationIdentification = null;
    String deviceIdentification = null;
    String ipAddress = null;
    Boolean isScheduled = null;
    int retryCount = 0;

    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);
    } 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;
    }

    try {
        final ScheduleMessageDataContainerDto scheduleMessageDataContainer = (ScheduleMessageDataContainerDto) message
                .getObject();

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

        final SetScheduleDeviceRequest deviceRequest = new SetScheduleDeviceRequest(organisationIdentification,
                deviceIdentification, correlationUid, scheduleMessageDataContainer, RelayTypeDto.TARIFF, domain,
                domainVersion, messageType, ipAddress, retryCount, isScheduled);

        this.deviceService.setSchedule(deviceRequest);
    } catch (final Exception e) {
        this.handleError(e, correlationUid, organisationIdentification, deviceIdentification, domain,
                domainVersion, messageType, retryCount);
    }
}

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

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

    String correlationUid = null;
    String domain = null;//  www  .  ja  v a2 s.  c o  m
    String domainVersion = null;
    String messageType = null;
    String organisationIdentification = null;
    String deviceIdentification = null;
    String ipAddress = null;
    Boolean isScheduled = null;
    int retryCount = 0;

    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);
    } 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;
    }

    try {
        final String firmwareIdentification = (String) message.getObject();

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

        final UpdateFirmwareDeviceRequest deviceRequest = new UpdateFirmwareDeviceRequest(
                organisationIdentification, deviceIdentification, correlationUid,
                this.firmwareLocation.getDomain(), this.firmwareLocation.getFullPath(firmwareIdentification),
                domain, domainVersion, messageType, ipAddress, retryCount, isScheduled);

        this.deviceService.updateFirmware(deviceRequest);
    } catch (final Exception e) {
        this.handleError(e, correlationUid, organisationIdentification, deviceIdentification, domain,
                domainVersion, messageType, retryCount);
    }
}

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

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

    String correlationUid = null;
    String domain = null;/*from ww  w.j  a v  a2s . c  o m*/
    String domainVersion = null;
    String messageType = null;
    String organisationIdentification = null;
    String deviceIdentification = null;
    String ipAddress = null;
    Boolean isScheduled = null;
    int retryCount = 0;
    ConfigurationDto configuration = 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);
        configuration = (ConfigurationDto) 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);

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

    final DeviceResponseHandler deviceResponseHandler = new DeviceResponseHandler() {

        @Override
        public void handleResponse(final DeviceResponse deviceResponse) {
            CommonSetConfigurationRequestMessageProcessor.this.handleEmptyDeviceResponse(deviceResponse,
                    CommonSetConfigurationRequestMessageProcessor.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) {
                CommonSetConfigurationRequestMessageProcessor.this.handleExpectedError(
                        new ConnectionFailureException(ComponentType.PROTOCOL_IEC61850, t.getMessage()),
                        requestMessageData.getCorrelationUid(),
                        requestMessageData.getOrganisationIdentification(),
                        requestMessageData.getDeviceIdentification(), requestMessageData.getDomain(),
                        requestMessageData.getDomainVersion(), requestMessageData.getMessageType());
            } else {
                CommonSetConfigurationRequestMessageProcessor.this.handleUnExpectedError(deviceResponse, t,
                        requestMessageData.getMessageData(), requestMessageData.getDomain(),
                        requestMessageData.getDomainVersion(), requestMessageData.getMessageType(),
                        requestMessageData.isScheduled(), requestMessageData.getRetryCount());
            }
        }

    };

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

    this.deviceService.setConfiguration(deviceRequest, deviceResponseHandler);

}

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

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

    String correlationUid = null;
    String domain = null;//from  www. j a  v  a  2 s . com
    String domainVersion = null;
    String messageType = null;
    String organisationIdentification = null;
    String deviceIdentification = null;
    String ipAddress = null;
    Boolean isScheduled = null;
    int retryCount = 0;
    String firmwareIdentification = 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);
        firmwareIdentification = (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);
        LOGGER.debug("scheduled: {}", isScheduled);
        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) {
            CommonUpdateFirmwareRequestMessageProcessor.this.handleEmptyDeviceResponse(deviceResponse,
                    CommonUpdateFirmwareRequestMessageProcessor.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) {
                CommonUpdateFirmwareRequestMessageProcessor.this.handleExpectedError(
                        new ConnectionFailureException(ComponentType.PROTOCOL_IEC61850, t.getMessage()),
                        requestMessageData.getCorrelationUid(),
                        requestMessageData.getOrganisationIdentification(),
                        requestMessageData.getDeviceIdentification(), requestMessageData.getDomain(),
                        requestMessageData.getDomainVersion(), requestMessageData.getMessageType());
            } else {
                CommonUpdateFirmwareRequestMessageProcessor.this.handleUnExpectedError(deviceResponse, t,
                        requestMessageData.getMessageData(), requestMessageData.getDomain(),
                        requestMessageData.getDomainVersion(), requestMessageData.getMessageType(),
                        requestMessageData.isScheduled(), requestMessageData.getRetryCount());
            }
        }

    };

    final UpdateFirmwareDeviceRequest deviceRequest = new UpdateFirmwareDeviceRequest(
            organisationIdentification, deviceIdentification, correlationUid, this.firmwareLocation.getDomain(),
            this.firmwareLocation.getFullPath(firmwareIdentification), domain, domainVersion, messageType,
            ipAddress, retryCount, isScheduled);

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

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

@Override
public void processMessage(final ObjectMessage message) {
    LOGGER.debug("Processing common update device ssl certification message");

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

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

    final DeviceResponseHandler deviceResponseHandler = new DeviceResponseHandler() {

        @Override
        public void handleResponse(final DeviceResponse deviceResponse) {
            CommonUpdateDeviceSslCertificationRequestMessageProcessor.this.handleEmptyDeviceResponse(
                    deviceResponse,
                    CommonUpdateDeviceSslCertificationRequestMessageProcessor.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) {
                CommonUpdateDeviceSslCertificationRequestMessageProcessor.this.handleExpectedError(
                        new ConnectionFailureException(ComponentType.PROTOCOL_IEC61850, t.getMessage()),
                        requestMessageData.getCorrelationUid(),
                        requestMessageData.getOrganisationIdentification(),
                        requestMessageData.getDeviceIdentification(), requestMessageData.getDomain(),
                        requestMessageData.getDomainVersion(), requestMessageData.getMessageType());
            } else {
                CommonUpdateDeviceSslCertificationRequestMessageProcessor.this.handleUnExpectedError(
                        deviceResponse, t, requestMessageData.getMessageData(), requestMessageData.getDomain(),
                        requestMessageData.getDomainVersion(), requestMessageData.getMessageType(),
                        requestMessageData.isScheduled(), requestMessageData.getRetryCount());
            }
        }
    };

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

    this.deviceService.updateDeviceSslCertification(deviceRequest, deviceResponseHandler);

}

From source file:com.alliander.osgp.adapter.protocol.oslp.elster.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  w  ww. j a v  a  2s. com*/
    String domainVersion = null;
    String messageType = null;
    String organisationIdentification = null;
    String deviceIdentification = null;
    String ipAddress = null;
    Boolean isScheduled = null;
    int retryCount = 0;

    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);
    } 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;
    }

    try {
        final PowerUsageHistoryMessageDataContainerDto powerUsageHistoryMessageDataContainerDto = (PowerUsageHistoryMessageDataContainerDto) message
                .getObject();

        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);
    } catch (final Exception e) {
        this.handleError(e, correlationUid, organisationIdentification, deviceIdentification, domain,
                domainVersion, messageType, retryCount);
    }
}

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

@Override
public void processMessage(final ObjectMessage message) {
    LOGGER.debug("Processing common update device ssl certification message");

    String correlationUid = null;
    String domain = null;//from ww w  . ja v  a2 s  . c  om
    String domainVersion = null;
    String messageType = null;
    String organisationIdentification = null;
    String deviceIdentification = null;
    String ipAddress = null;
    Boolean isScheduled = null;
    int retryCount = 0;

    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.propertyExists(Constants.IS_SCHEDULED)
                ? message.getBooleanProperty(Constants.IS_SCHEDULED)
                : false;
        retryCount = message.getIntProperty(Constants.RETRY_COUNT);
    } 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;
    }

    try {
        final com.alliander.osgp.dto.valueobjects.CertificationDto certification = (com.alliander.osgp.dto.valueobjects.CertificationDto) message
                .getObject();

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

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

        this.deviceService.updateDeviceSslCertification(deviceRequest);

    } catch (final Exception e) {
        this.handleError(e, correlationUid, organisationIdentification, deviceIdentification, domain,
                domainVersion, messageType, retryCount);
    }
}

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

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

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

    final DeviceResponseHandler deviceResponseHandler = new DeviceResponseHandler() {

        @Override
        public void handleResponse(final DeviceResponse deviceResponse) {
            PublicLightingSetScheduleRequestMessageProcessor.this.handleEmptyDeviceResponse(deviceResponse,
                    PublicLightingSetScheduleRequestMessageProcessor.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) {
                PublicLightingSetScheduleRequestMessageProcessor.this.handleExpectedError(
                        new ConnectionFailureException(ComponentType.PROTOCOL_IEC61850, t.getMessage()),
                        requestMessageData.getCorrelationUid(),
                        requestMessageData.getOrganisationIdentification(),
                        requestMessageData.getDeviceIdentification(), requestMessageData.getDomain(),
                        requestMessageData.getDomainVersion(), requestMessageData.getMessageType());
            } else {
                PublicLightingSetScheduleRequestMessageProcessor.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 SetScheduleDeviceRequest deviceRequest = new SetScheduleDeviceRequest(organisationIdentification,
            deviceIdentification, correlationUid, scheduleMessageDataContainer, RelayTypeDto.LIGHT, domain,
            domainVersion, messageType, ipAddress, retryCount, isScheduled);

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