Search in sources :

Example 26 with UnsignedOslpEnvelopeDto

use of com.alliander.osgp.oslp.UnsignedOslpEnvelopeDto in project Protocol-Adapter-OSLP by OSGP.

the class TariffSwitchingSetScheduleRequestMessageProcessor method processSignedOslpEnvelope.

@Override
public void processSignedOslpEnvelope(final String deviceIdentification, final SignedOslpEnvelopeDto signedOslpEnvelopeDto) {
    final UnsignedOslpEnvelopeDto unsignedOslpEnvelopeDto = signedOslpEnvelopeDto.getUnsignedOslpEnvelopeDto();
    final OslpEnvelope oslpEnvelope = signedOslpEnvelopeDto.getOslpEnvelope();
    final String correlationUid = unsignedOslpEnvelopeDto.getCorrelationUid();
    final String organisationIdentification = unsignedOslpEnvelopeDto.getOrganisationIdentification();
    final String domain = unsignedOslpEnvelopeDto.getDomain();
    final String domainVersion = unsignedOslpEnvelopeDto.getDomainVersion();
    final String messageType = unsignedOslpEnvelopeDto.getMessageType();
    final String ipAddress = unsignedOslpEnvelopeDto.getIpAddress();
    final int retryCount = unsignedOslpEnvelopeDto.getRetryCount();
    final boolean isScheduled = unsignedOslpEnvelopeDto.isScheduled();
    final ScheduleMessageDataContainerDto scheduleMessageDataContainer = (ScheduleMessageDataContainerDto) unsignedOslpEnvelopeDto.getExtraData();
    final DeviceResponseHandler deviceResponseHandler = new DeviceResponseHandler() {

        @Override
        public void handleResponse(final DeviceResponse deviceResponse) {
            TariffSwitchingSetScheduleRequestMessageProcessor.this.handleEmptyDeviceResponse(deviceResponse, TariffSwitchingSetScheduleRequestMessageProcessor.this.responseMessageSender, domain, domainVersion, messageType, retryCount);
        }

        @Override
        public void handleException(final Throwable t, final DeviceResponse deviceResponse) {
            TariffSwitchingSetScheduleRequestMessageProcessor.this.handleUnableToConnectDeviceResponse(deviceResponse, t, unsignedOslpEnvelopeDto.getExtraData(), TariffSwitchingSetScheduleRequestMessageProcessor.this.responseMessageSender, deviceResponse, domain, domainVersion, messageType, isScheduled, retryCount);
        }
    };
    final SetScheduleDeviceRequest deviceRequest = new SetScheduleDeviceRequest(organisationIdentification, deviceIdentification, correlationUid, scheduleMessageDataContainer, RelayTypeDto.TARIFF, domain, domainVersion, messageType, ipAddress, retryCount, isScheduled);
    try {
        this.deviceService.doSetSchedule(oslpEnvelope, deviceRequest, deviceResponseHandler, ipAddress, domain, domainVersion, messageType, retryCount, isScheduled, scheduleMessageDataContainer.getPageInfo());
    } catch (final IOException e) {
        this.handleError(e, correlationUid, organisationIdentification, deviceIdentification, domain, domainVersion, messageType, retryCount);
    }
}
Also used : UnsignedOslpEnvelopeDto(com.alliander.osgp.oslp.UnsignedOslpEnvelopeDto) ScheduleMessageDataContainerDto(com.alliander.osgp.dto.valueobjects.ScheduleMessageDataContainerDto) DeviceResponse(com.alliander.osgp.adapter.protocol.oslp.elster.device.DeviceResponse) DeviceResponseHandler(com.alliander.osgp.adapter.protocol.oslp.elster.device.DeviceResponseHandler) SetScheduleDeviceRequest(com.alliander.osgp.adapter.protocol.oslp.elster.device.requests.SetScheduleDeviceRequest) IOException(java.io.IOException) OslpEnvelope(com.alliander.osgp.oslp.OslpEnvelope)

Example 27 with UnsignedOslpEnvelopeDto

use of com.alliander.osgp.oslp.UnsignedOslpEnvelopeDto in project Protocol-Adapter-OSLP by OSGP.

the class SigningServerRequestMessageListener method onMessage.

@Override
public void onMessage(final Message message) {
    try {
        final ObjectMessage objectMessage = (ObjectMessage) message;
        final Destination replyToQueue = objectMessage.getJMSReplyTo();
        final RequestMessage requestMessage = (RequestMessage) objectMessage.getObject();
        final UnsignedOslpEnvelopeDto unsignedOslpEnvelopeDto = (UnsignedOslpEnvelopeDto) requestMessage.getRequest();
        final String correlationUid = objectMessage.getJMSCorrelationID();
        final String deviceIdentification = objectMessage.getStringProperty(Constants.DEVICE_IDENTIFICATION);
        LOGGER.info("Received message of type: {}, for device: {} with correlationId: {} and replyToQueue: {}", objectMessage.getJMSType(), deviceIdentification, correlationUid, replyToQueue.toString());
        LOGGER.debug("-----------------------------------------------------------------------------");
        LOGGER.debug("unsignedOslpEnvelopeDto.getCorrelationUid() : {}", unsignedOslpEnvelopeDto.getCorrelationUid());
        LOGGER.debug("unsignedOslpEnvelopeDto.getDeviceId() : {}", unsignedOslpEnvelopeDto.getDeviceId());
        LOGGER.debug("unsignedOslpEnvelopeDto.getDomain() : {}", unsignedOslpEnvelopeDto.getDomain());
        LOGGER.debug("unsignedOslpEnvelopeDto.getDomainVersion() : {}", unsignedOslpEnvelopeDto.getDomainVersion());
        LOGGER.debug("unsignedOslpEnvelopeDto.getIpAddress() : {}", unsignedOslpEnvelopeDto.getIpAddress());
        LOGGER.debug("unsignedOslpEnvelopeDto.getMessageType() : {}", unsignedOslpEnvelopeDto.getMessageType());
        LOGGER.debug("unsignedOslpEnvelopeDto.getOrganisationIdentification() : {}", unsignedOslpEnvelopeDto.getOrganisationIdentification());
        LOGGER.debug("unsignedOslpEnvelopeDto.getPayloadMessage() : {}", unsignedOslpEnvelopeDto.getPayloadMessage().toString());
        LOGGER.debug("unsignedOslpEnvelopeDto.getRetryCount() : {}", unsignedOslpEnvelopeDto.getRetryCount());
        LOGGER.debug("unsignedOslpEnvelopeDto.getSequenceNumber() : {}", unsignedOslpEnvelopeDto.getSequenceNumber());
        LOGGER.debug("unsignedOslpEnvelopeDto.isScheduled() : {}", unsignedOslpEnvelopeDto.isScheduled());
        LOGGER.debug("-----------------------------------------------------------------------------");
        this.signingService.sign(unsignedOslpEnvelopeDto, correlationUid, deviceIdentification, replyToQueue);
    } catch (final JMSException ex) {
        LOGGER.error("Exception: {} ", ex.getMessage(), ex);
    }
}
Also used : Destination(javax.jms.Destination) UnsignedOslpEnvelopeDto(com.alliander.osgp.oslp.UnsignedOslpEnvelopeDto) ObjectMessage(javax.jms.ObjectMessage) RequestMessage(com.alliander.osgp.shared.infra.jms.RequestMessage) JMSException(javax.jms.JMSException)

Aggregations

UnsignedOslpEnvelopeDto (com.alliander.osgp.oslp.UnsignedOslpEnvelopeDto)27 OslpEnvelope (com.alliander.osgp.oslp.OslpEnvelope)23 DeviceResponseHandler (com.alliander.osgp.adapter.protocol.oslp.elster.device.DeviceResponseHandler)21 IOException (java.io.IOException)21 DeviceResponse (com.alliander.osgp.adapter.protocol.oslp.elster.device.DeviceResponse)20 DeviceRequest (com.alliander.osgp.adapter.protocol.oslp.elster.device.DeviceRequest)15 GetStatusDeviceRequest (com.alliander.osgp.adapter.protocol.oslp.elster.device.requests.GetStatusDeviceRequest)4 GetStatusDeviceResponse (com.alliander.osgp.adapter.protocol.oslp.elster.device.responses.GetStatusDeviceResponse)3 RequestMessage (com.alliander.osgp.shared.infra.jms.RequestMessage)3 SetScheduleDeviceRequest (com.alliander.osgp.adapter.protocol.oslp.elster.device.requests.SetScheduleDeviceRequest)2 ScheduleMessageDataContainerDto (com.alliander.osgp.dto.valueobjects.ScheduleMessageDataContainerDto)2 GetPowerUsageHistoryDeviceRequest (com.alliander.osgp.adapter.protocol.oslp.elster.device.requests.GetPowerUsageHistoryDeviceRequest)1 ResumeScheduleDeviceRequest (com.alliander.osgp.adapter.protocol.oslp.elster.device.requests.ResumeScheduleDeviceRequest)1 SetConfigurationDeviceRequest (com.alliander.osgp.adapter.protocol.oslp.elster.device.requests.SetConfigurationDeviceRequest)1 SetDeviceVerificationKeyDeviceRequest (com.alliander.osgp.adapter.protocol.oslp.elster.device.requests.SetDeviceVerificationKeyDeviceRequest)1 SetEventNotificationsDeviceRequest (com.alliander.osgp.adapter.protocol.oslp.elster.device.requests.SetEventNotificationsDeviceRequest)1 SetLightDeviceRequest (com.alliander.osgp.adapter.protocol.oslp.elster.device.requests.SetLightDeviceRequest)1 SetTransitionDeviceRequest (com.alliander.osgp.adapter.protocol.oslp.elster.device.requests.SetTransitionDeviceRequest)1 SwitchFirmwareDeviceRequest (com.alliander.osgp.adapter.protocol.oslp.elster.device.requests.SwitchFirmwareDeviceRequest)1 UpdateDeviceSslCertificationDeviceRequest (com.alliander.osgp.adapter.protocol.oslp.elster.device.requests.UpdateDeviceSslCertificationDeviceRequest)1