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