use of org.opensmartgridplatform.dto.da.GetPQValuesResponseDto in project open-smart-grid-platform by OSGP.
the class GetPQValuesResponseMessageProcessor method processMessage.
@Override
public void processMessage(final ObjectMessage message) throws JMSException {
LOGGER.debug("Processing DA Power Quality response message");
String correlationUid = null;
String messageType = null;
String organisationIdentification = null;
String deviceIdentification = null;
ResponseMessage responseMessage = null;
ResponseMessageResultType responseMessageResultType = null;
OsgpException osgpException = null;
Object dataObject = null;
try {
correlationUid = message.getJMSCorrelationID();
messageType = message.getJMSType();
organisationIdentification = message.getStringProperty(Constants.ORGANISATION_IDENTIFICATION);
deviceIdentification = message.getStringProperty(Constants.DEVICE_IDENTIFICATION);
responseMessage = (ResponseMessage) message.getObject();
responseMessageResultType = responseMessage.getResult();
osgpException = responseMessage.getOsgpException();
dataObject = responseMessage.getDataObject();
} catch (final JMSException e) {
LOGGER.error("UNRECOVERABLE ERROR, unable to read ObjectMessage instance, giving up.", e);
LOGGER.debug("correlationUid: {}", correlationUid);
LOGGER.debug("messageType: {}", messageType);
LOGGER.debug("organisationIdentification: {}", organisationIdentification);
LOGGER.debug("deviceIdentification: {}", deviceIdentification);
LOGGER.debug("responseMessageResultType: {}", responseMessageResultType);
LOGGER.debug("deviceIdentification: {}", deviceIdentification);
LOGGER.debug("osgpException", osgpException);
return;
}
try {
LOGGER.info("Calling application service function to handle response: {}", messageType);
final GetPQValuesResponseDto dataResponse = (GetPQValuesResponseDto) dataObject;
final CorrelationIds ids = new CorrelationIds(organisationIdentification, deviceIdentification, correlationUid);
this.monitoringService.handleGetPQValuesResponse(dataResponse, ids, messageType, responseMessageResultType, osgpException);
} catch (final Exception e) {
this.handleError(e, correlationUid, organisationIdentification, deviceIdentification, messageType);
}
}
use of org.opensmartgridplatform.dto.da.GetPQValuesResponseDto in project open-smart-grid-platform by OSGP.
the class Iec61850ClientDaRTUEventListener method processReport.
private void processReport(final Report report, final String reportDescription) throws ProtocolAdapterException {
final List<FcModelNode> dataSetMembers = report.getValues();
final List<LogicalDevice> logicalDevices = new ArrayList<>();
if (CollectionUtils.isEmpty(dataSetMembers)) {
this.logger.warn("No dataSet members available for {}", reportDescription);
return;
}
for (final FcModelNode member : dataSetMembers) {
// we are only interested in measurements
if (member.getFc() == Fc.MX) {
this.processMeasurementNode(logicalDevices, member);
}
}
final List<LogicalDeviceDto> logicalDevicesDtos = new ArrayList<>();
for (final LogicalDevice logicalDevice : logicalDevices) {
final List<LogicalNodeDto> logicalNodeDtos = new ArrayList<>();
for (final LogicalNode logicalNode : logicalDevice.getLogicalNodes()) {
final LogicalNodeDto logicalNodeDto = new LogicalNodeDto(logicalNode.getName(), logicalNode.getDataSamples());
logicalNodeDtos.add(logicalNodeDto);
}
final LogicalDeviceDto logicalDeviceDto = new LogicalDeviceDto(logicalDevice.getName(), logicalNodeDtos);
logicalDevicesDtos.add(logicalDeviceDto);
}
final GetPQValuesResponseDto response = new GetPQValuesResponseDto(logicalDevicesDtos);
this.deviceManagementService.sendPqValues(this.deviceIdentification, report.getRptId(), response);
}
use of org.opensmartgridplatform.dto.da.GetPQValuesResponseDto in project open-smart-grid-platform by OSGP.
the class GetPQValuesPeriodicResponseMessageProcessor method processMessage.
@Override
public void processMessage(final ObjectMessage message) throws JMSException {
LOGGER.debug("Processing DA Power Quality Periodic response message");
String correlationUid = null;
String messageType = null;
String organisationIdentification = null;
String deviceIdentification = null;
ResponseMessage responseMessage = null;
ResponseMessageResultType responseMessageResultType = null;
OsgpException osgpException = null;
Object dataObject = null;
try {
correlationUid = message.getJMSCorrelationID();
messageType = message.getJMSType();
organisationIdentification = message.getStringProperty(Constants.ORGANISATION_IDENTIFICATION);
deviceIdentification = message.getStringProperty(Constants.DEVICE_IDENTIFICATION);
responseMessage = (ResponseMessage) message.getObject();
responseMessageResultType = responseMessage.getResult();
osgpException = responseMessage.getOsgpException();
dataObject = responseMessage.getDataObject();
} catch (final JMSException e) {
LOGGER.error("UNRECOVERABLE ERROR, unable to read ObjectMessage instance, giving up.", e);
LOGGER.debug("correlationUid: {}", correlationUid);
LOGGER.debug("messageType: {}", messageType);
LOGGER.debug("organisationIdentification: {}", organisationIdentification);
LOGGER.debug("deviceIdentification: {}", deviceIdentification);
LOGGER.debug("responseMessageResultType: {}", responseMessageResultType);
LOGGER.debug("deviceIdentification: {}", deviceIdentification);
LOGGER.debug("osgpException", osgpException);
return;
}
try {
LOGGER.info("Calling application service function to handle response: {}", messageType);
final GetPQValuesResponseDto dataResponse = (GetPQValuesResponseDto) dataObject;
final CorrelationIds ids = new CorrelationIds(organisationIdentification, deviceIdentification, correlationUid);
this.monitoringService.handleGetPQValuesResponse(dataResponse, ids, messageType, responseMessageResultType, osgpException);
} catch (final Exception e) {
this.handleError(e, correlationUid, organisationIdentification, deviceIdentification, messageType);
}
}
Aggregations