use of org.opensmartgridplatform.shared.infra.jms.ProtocolResponseMessage in project open-smart-grid-platform by OSGP.
the class DeviceRequestMessageListener method sendNotSupportedException.
private void sendNotSupportedException(final ObjectMessage objectMessage, final MessageMetadata messageMetadata) {
try {
final Exception exception = new NotSupportedException(ComponentType.PROTOCOL_IEC60870, messageMetadata.getMessageType());
final FunctionalException osgpException = new FunctionalException(FunctionalExceptionType.UNSUPPORTED_DEVICE_ACTION, ComponentType.PROTOCOL_IEC60870, exception);
final ProtocolResponseMessage protocolResponseMessage = ProtocolResponseMessage.newBuilder().messageMetadata(messageMetadata.builder().withScheduled(false).build()).result(ResponseMessageResultType.NOT_OK).osgpException(osgpException).dataObject(objectMessage.getObject()).build();
this.deviceResponseMessageSender.send(protocolResponseMessage);
} catch (final Exception e) {
LOGGER.error("Unexpected error during sendException(ObjectMessage, Exception)", e);
}
}
use of org.opensmartgridplatform.shared.infra.jms.ProtocolResponseMessage in project open-smart-grid-platform by OSGP.
the class Iec60870ConnectResponseService method sendConnectResponse.
private void sendConnectResponse(final ResponseMetadata responseMetadata) {
final ProtocolResponseMessage responseMessage = ProtocolResponseMessage.newBuilder().messageMetadata(responseMetadata.asMessageMetadata()).result(ResponseMessageResultType.OK).build();
this.deviceResponseMessageSender.send(responseMessage);
}
use of org.opensmartgridplatform.shared.infra.jms.ProtocolResponseMessage in project open-smart-grid-platform by OSGP.
the class Iec60870LightMeasurementService method sendSensorStatus.
@Override
public void sendSensorStatus(final LightSensorStatusDto lightSensorSatusDto, final ResponseMetadata responseMetadata) {
final ProtocolResponseMessage responseMessage = ProtocolResponseMessage.newBuilder().messageMetadata(responseMetadata.asMessageMetadata()).dataObject(lightSensorSatusDto).result(ResponseMessageResultType.OK).build();
this.deviceResponseMessageSender.send(responseMessage);
}
use of org.opensmartgridplatform.shared.infra.jms.ProtocolResponseMessage in project open-smart-grid-platform by OSGP.
the class Iec60870MeasurementReportingService method send.
@Override
public void send(final MeasurementReportDto measurementReportDto, final ResponseMetadata responseMetadata) {
final ProtocolResponseMessage responseMessage = ProtocolResponseMessage.newBuilder().messageMetadata(responseMetadata.asMessageMetadata().builder().withMessageType(MESSAGE_TYPE).withDomain(responseMetadata.getDomainInfo().getDomain()).withDomainVersion(responseMetadata.getDomainInfo().getDomainVersion()).build()).dataObject(measurementReportDto).result(ResponseMessageResultType.OK).build();
this.deviceResponseMessageSender.send(responseMessage);
}
use of org.opensmartgridplatform.shared.infra.jms.ProtocolResponseMessage in project open-smart-grid-platform by OSGP.
the class CommonGetConfigurationRequestMessageProcessor method handleGetConfigurationDeviceResponse.
private void handleGetConfigurationDeviceResponse(final DeviceResponse deviceResponse, final ResponseMessageSender responseMessageSender, final DomainInformation domainInformation, final String messageType, final int retryCount, final boolean isScheduled) {
ResponseMessageResultType result = ResponseMessageResultType.OK;
OsgpException osgpException = null;
ConfigurationDto configuration = null;
try {
final GetConfigurationDeviceResponse response = (GetConfigurationDeviceResponse) deviceResponse;
configuration = response.getConfiguration();
} catch (final Exception e) {
LOGGER.error("Device Response Exception", e);
result = ResponseMessageResultType.NOT_OK;
osgpException = new TechnicalException(ComponentType.PROTOCOL_IEC61850, "Unexpected exception while retrieving response message", e);
}
final MessageMetadata messageMetadata = MessageMetadata.newBuilder().withDeviceIdentification(deviceResponse.getDeviceIdentification()).withOrganisationIdentification(deviceResponse.getOrganisationIdentification()).withCorrelationUid(deviceResponse.getCorrelationUid()).withMessageType(messageType).withDomain(domainInformation.getDomain()).withDomainVersion(domainInformation.getDomainVersion()).withMessagePriority(deviceResponse.getMessagePriority()).withScheduled(isScheduled).withRetryCount(retryCount).build();
final ProtocolResponseMessage responseMessage = ProtocolResponseMessage.newBuilder().messageMetadata(messageMetadata).result(result).osgpException(osgpException).dataObject(configuration).build();
responseMessageSender.send(responseMessage);
}
Aggregations