Search in sources :

Example 1 with UnsignedOslpEnvelopeDto

use of org.opensmartgridplatform.oslp.UnsignedOslpEnvelopeDto in project open-smart-grid-platform 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 int messagePriority = objectMessage.getJMSPriority();
        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);
        LOGGER.debug("-----------------------------------------------------------------------------");
        LOGGER.debug("messagePriority: {}", messagePriority);
        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.getMessagePriority() : {}", unsignedOslpEnvelopeDto.getMessagePriority());
        LOGGER.debug("unsignedOslpEnvelopeDto.getOrganisationIdentification() : {}", unsignedOslpEnvelopeDto.getOrganisationIdentification());
        LOGGER.debug("unsignedOslpEnvelopeDto.getPayloadMessage() : {}", unsignedOslpEnvelopeDto.getPayloadMessage());
        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(org.opensmartgridplatform.oslp.UnsignedOslpEnvelopeDto) ObjectMessage(javax.jms.ObjectMessage) RequestMessage(org.opensmartgridplatform.shared.infra.jms.RequestMessage) JMSException(javax.jms.JMSException)

Example 2 with UnsignedOslpEnvelopeDto

use of org.opensmartgridplatform.oslp.UnsignedOslpEnvelopeDto in project open-smart-grid-platform by OSGP.

the class PublicLightingResumeScheduleRequestMessageProcessor 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 int messagePriority = unsignedOslpEnvelopeDto.getMessagePriority();
    final String ipAddress = unsignedOslpEnvelopeDto.getIpAddress();
    final int retryCount = unsignedOslpEnvelopeDto.getRetryCount();
    final boolean isScheduled = unsignedOslpEnvelopeDto.isScheduled();
    final DeviceResponseHandler deviceResponseHandler = this.createResumeScheduleDeviceResponseHandler(domain, domainVersion, messageType, retryCount, isScheduled);
    final ResumeScheduleMessageDataContainerDto resumeScheduleMessageDataContainer = (ResumeScheduleMessageDataContainerDto) unsignedOslpEnvelopeDto.getExtraData();
    final ResumeScheduleDeviceRequest deviceRequest = new ResumeScheduleDeviceRequest(organisationIdentification, deviceIdentification, correlationUid, messagePriority, resumeScheduleMessageDataContainer);
    try {
        this.deviceService.doResumeSchedule(oslpEnvelope, deviceRequest, deviceResponseHandler, ipAddress);
    } catch (final IOException e) {
        this.handleError(e, correlationUid, organisationIdentification, deviceIdentification, domain, domainVersion, messageType, messagePriority, retryCount);
    }
}
Also used : UnsignedOslpEnvelopeDto(org.opensmartgridplatform.oslp.UnsignedOslpEnvelopeDto) DeviceResponseHandler(org.opensmartgridplatform.adapter.protocol.oslp.elster.device.DeviceResponseHandler) IOException(java.io.IOException) ResumeScheduleMessageDataContainerDto(org.opensmartgridplatform.dto.valueobjects.ResumeScheduleMessageDataContainerDto) ResumeScheduleDeviceRequest(org.opensmartgridplatform.adapter.protocol.oslp.elster.device.requests.ResumeScheduleDeviceRequest) OslpEnvelope(org.opensmartgridplatform.oslp.OslpEnvelope)

Example 3 with UnsignedOslpEnvelopeDto

use of org.opensmartgridplatform.oslp.UnsignedOslpEnvelopeDto in project open-smart-grid-platform by OSGP.

the class PublicLightingSetScheduleRequestMessageProcessor 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 int messagePriority = unsignedOslpEnvelopeDto.getMessagePriority();
    final String ipAddress = unsignedOslpEnvelopeDto.getIpAddress();
    final int retryCount = unsignedOslpEnvelopeDto.getRetryCount();
    final boolean isScheduled = unsignedOslpEnvelopeDto.isScheduled();
    final ScheduleMessageDataContainerDto dataContainer = (ScheduleMessageDataContainerDto) unsignedOslpEnvelopeDto.getExtraData();
    final DeviceRequest.Builder builder = DeviceRequest.newBuilder().organisationIdentification(organisationIdentification).deviceIdentification(deviceIdentification).correlationUid(correlationUid).domain(domain).domainVersion(domainVersion).messageType(messageType).messagePriority(messagePriority).ipAddress(ipAddress).retryCount(retryCount).isScheduled(isScheduled);
    final SetScheduleDeviceRequest deviceRequest = new SetScheduleDeviceRequest(builder, dataContainer, RelayTypeDto.LIGHT);
    final DeviceResponseHandler deviceResponseHandler = new DeviceResponseHandler() {

        @Override
        public void handleResponse(final DeviceResponse deviceResponse) {
            PublicLightingSetScheduleRequestMessageProcessor.this.handleResponse(deviceResponse, deviceRequest);
        }

        @Override
        public void handleException(final Throwable t, final DeviceResponse deviceResponse) {
            PublicLightingSetScheduleRequestMessageProcessor.this.handleUnableToConnectDeviceResponse(deviceResponse, t, domain, domainVersion, messageType, isScheduled, retryCount);
        }
    };
    try {
        this.deviceService.doSetSchedule(oslpEnvelope, deviceRequest, deviceResponseHandler, ipAddress, domain, domainVersion, messageType, messagePriority, retryCount, isScheduled, dataContainer.getPageInfo());
    } catch (final IOException e) {
        this.handleError(e, correlationUid, organisationIdentification, deviceIdentification, domain, domainVersion, messageType, messagePriority, retryCount);
    }
}
Also used : UnsignedOslpEnvelopeDto(org.opensmartgridplatform.oslp.UnsignedOslpEnvelopeDto) ScheduleMessageDataContainerDto(org.opensmartgridplatform.dto.valueobjects.ScheduleMessageDataContainerDto) IOException(java.io.IOException) OslpEnvelope(org.opensmartgridplatform.oslp.OslpEnvelope) GetConfigurationDeviceResponse(org.opensmartgridplatform.adapter.protocol.oslp.elster.device.responses.GetConfigurationDeviceResponse) DeviceResponse(org.opensmartgridplatform.adapter.protocol.oslp.elster.device.DeviceResponse) DeviceResponseHandler(org.opensmartgridplatform.adapter.protocol.oslp.elster.device.DeviceResponseHandler) SetScheduleDeviceRequest(org.opensmartgridplatform.adapter.protocol.oslp.elster.device.requests.SetScheduleDeviceRequest) SetScheduleDeviceRequest(org.opensmartgridplatform.adapter.protocol.oslp.elster.device.requests.SetScheduleDeviceRequest) DeviceRequest(org.opensmartgridplatform.adapter.protocol.oslp.elster.device.DeviceRequest)

Example 4 with UnsignedOslpEnvelopeDto

use of org.opensmartgridplatform.oslp.UnsignedOslpEnvelopeDto in project open-smart-grid-platform by OSGP.

the class TariffSwitchingGetStatusRequestMessageProcessor 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 int messagePriority = unsignedOslpEnvelopeDto.getMessagePriority();
    final String ipAddress = unsignedOslpEnvelopeDto.getIpAddress();
    final int retryCount = unsignedOslpEnvelopeDto.getRetryCount();
    final boolean isScheduled = unsignedOslpEnvelopeDto.isScheduled();
    final DeviceResponseHandler deviceResponseHandler = new DeviceResponseHandler() {

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

        @Override
        public void handleException(final Throwable t, final DeviceResponse deviceResponse) {
            TariffSwitchingGetStatusRequestMessageProcessor.this.handleUnableToConnectDeviceResponse(deviceResponse, t, domain, domainVersion, messageType, isScheduled, retryCount);
        }
    };
    final DeviceRequest deviceRequest = new DeviceRequest(organisationIdentification, deviceIdentification, correlationUid, messagePriority);
    try {
        this.deviceService.doGetStatus(oslpEnvelope, deviceRequest, deviceResponseHandler, ipAddress);
    } catch (final IOException e) {
        this.handleError(e, correlationUid, organisationIdentification, deviceIdentification, domain, domainVersion, messageType, messagePriority, retryCount);
    }
}
Also used : UnsignedOslpEnvelopeDto(org.opensmartgridplatform.oslp.UnsignedOslpEnvelopeDto) GetStatusDeviceResponse(org.opensmartgridplatform.adapter.protocol.oslp.elster.device.responses.GetStatusDeviceResponse) DeviceResponse(org.opensmartgridplatform.adapter.protocol.oslp.elster.device.DeviceResponse) DeviceResponseHandler(org.opensmartgridplatform.adapter.protocol.oslp.elster.device.DeviceResponseHandler) GetStatusDeviceRequest(org.opensmartgridplatform.adapter.protocol.oslp.elster.device.requests.GetStatusDeviceRequest) DeviceRequest(org.opensmartgridplatform.adapter.protocol.oslp.elster.device.DeviceRequest) IOException(java.io.IOException) OslpEnvelope(org.opensmartgridplatform.oslp.OslpEnvelope)

Example 5 with UnsignedOslpEnvelopeDto

use of org.opensmartgridplatform.oslp.UnsignedOslpEnvelopeDto in project open-smart-grid-platform by OSGP.

the class CommonSetDeviceVerificationKeyRequestMessageProcessor 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 int messagePriority = unsignedOslpEnvelopeDto.getMessagePriority();
    final String ipAddress = unsignedOslpEnvelopeDto.getIpAddress();
    final int retryCount = unsignedOslpEnvelopeDto.getRetryCount();
    final boolean isScheduled = unsignedOslpEnvelopeDto.isScheduled();
    final DeviceResponseHandler deviceResponseHandler = new DeviceResponseHandler() {

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

        @Override
        public void handleException(final Throwable t, final DeviceResponse deviceResponse) {
            CommonSetDeviceVerificationKeyRequestMessageProcessor.this.handleUnableToConnectDeviceResponse(deviceResponse, t, domain, domainVersion, messageType, isScheduled, retryCount);
        }
    };
    final DeviceRequest deviceRequest = new DeviceRequest(organisationIdentification, deviceIdentification, correlationUid, messagePriority);
    try {
        this.deviceService.doSetDeviceVerificationKey(oslpEnvelope, deviceRequest, deviceResponseHandler, ipAddress);
    } catch (final IOException e) {
        this.handleError(e, correlationUid, organisationIdentification, deviceIdentification, domain, domainVersion, messageType, messagePriority, retryCount);
    }
}
Also used : UnsignedOslpEnvelopeDto(org.opensmartgridplatform.oslp.UnsignedOslpEnvelopeDto) DeviceResponse(org.opensmartgridplatform.adapter.protocol.oslp.elster.device.DeviceResponse) DeviceResponseHandler(org.opensmartgridplatform.adapter.protocol.oslp.elster.device.DeviceResponseHandler) DeviceRequest(org.opensmartgridplatform.adapter.protocol.oslp.elster.device.DeviceRequest) SetDeviceVerificationKeyDeviceRequest(org.opensmartgridplatform.adapter.protocol.oslp.elster.device.requests.SetDeviceVerificationKeyDeviceRequest) IOException(java.io.IOException) OslpEnvelope(org.opensmartgridplatform.oslp.OslpEnvelope)

Aggregations

UnsignedOslpEnvelopeDto (org.opensmartgridplatform.oslp.UnsignedOslpEnvelopeDto)26 OslpEnvelope (org.opensmartgridplatform.oslp.OslpEnvelope)22 IOException (java.io.IOException)20 DeviceResponseHandler (org.opensmartgridplatform.adapter.protocol.oslp.elster.device.DeviceResponseHandler)20 DeviceResponse (org.opensmartgridplatform.adapter.protocol.oslp.elster.device.DeviceResponse)18 DeviceRequest (org.opensmartgridplatform.adapter.protocol.oslp.elster.device.DeviceRequest)17 GetStatusDeviceRequest (org.opensmartgridplatform.adapter.protocol.oslp.elster.device.requests.GetStatusDeviceRequest)3 GetStatusDeviceResponse (org.opensmartgridplatform.adapter.protocol.oslp.elster.device.responses.GetStatusDeviceResponse)3 RequestMessage (org.opensmartgridplatform.shared.infra.jms.RequestMessage)3 ResumeScheduleDeviceRequest (org.opensmartgridplatform.adapter.protocol.oslp.elster.device.requests.ResumeScheduleDeviceRequest)2 SetScheduleDeviceRequest (org.opensmartgridplatform.adapter.protocol.oslp.elster.device.requests.SetScheduleDeviceRequest)2 EmptyDeviceResponse (org.opensmartgridplatform.adapter.protocol.oslp.elster.device.responses.EmptyDeviceResponse)2 GetConfigurationDeviceResponse (org.opensmartgridplatform.adapter.protocol.oslp.elster.device.responses.GetConfigurationDeviceResponse)2 ResumeScheduleMessageDataContainerDto (org.opensmartgridplatform.dto.valueobjects.ResumeScheduleMessageDataContainerDto)2 ScheduleMessageDataContainerDto (org.opensmartgridplatform.dto.valueobjects.ScheduleMessageDataContainerDto)2 Destination (javax.jms.Destination)1 JMSException (javax.jms.JMSException)1 ObjectMessage (javax.jms.ObjectMessage)1 SetConfigurationDeviceRequest (org.opensmartgridplatform.adapter.protocol.oslp.elster.device.requests.SetConfigurationDeviceRequest)1 SetDeviceVerificationKeyDeviceRequest (org.opensmartgridplatform.adapter.protocol.oslp.elster.device.requests.SetDeviceVerificationKeyDeviceRequest)1