use of org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.services.Iec61850DeviceResponseHandler in project open-smart-grid-platform by OSGP.
the class CommonRebootRequestMessageProcessor method processMessage.
@Override
public void processMessage(final ObjectMessage message) throws JMSException {
LOGGER.debug("Processing common reboot request message");
MessageMetadata messageMetadata;
messageMetadata = null;
try {
messageMetadata = MessageMetadata.fromMessage(message);
} catch (final JMSException e) {
LOGGER.error("UNRECOVERABLE ERROR, unable to read ObjectMessage instance, giving up.", e);
return;
}
final RequestMessageData requestMessageData = RequestMessageData.newBuilder().messageMetadata(messageMetadata).build();
this.printDomainInfo(requestMessageData);
final Iec61850DeviceResponseHandler iec61850DeviceResponseHandler = this.createIec61850DeviceResponseHandler(requestMessageData, message);
final DeviceRequest deviceRequest = DeviceRequest.newBuilder().messageMetaData(messageMetadata).build();
this.deviceService.setReboot(deviceRequest, iec61850DeviceResponseHandler);
}
use of org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.services.Iec61850DeviceResponseHandler in project open-smart-grid-platform by OSGP.
the class DaRtuDeviceRequestMessageProcessor method processMessage.
@Override
public void processMessage(final ObjectMessage message) throws JMSException {
LOGGER.debug("Processing distribution automation request message");
final MessageMetadata messageMetadata;
final Serializable request;
try {
messageMetadata = MessageMetadata.fromMessage(message);
request = message.getObject();
} catch (final JMSException e) {
LOGGER.error("UNRECOVERABLE ERROR, unable to read ObjectMessage instance, giving up.", e);
return;
}
final RequestMessageData requestMessageData = RequestMessageData.newBuilder().messageMetadata(messageMetadata).build();
this.printDomainInfo(requestMessageData);
final Iec61850DeviceResponseHandler iec61850DeviceResponseHandler = this.createIec61850DeviceResponseHandler(requestMessageData, message);
final DeviceRequest.Builder deviceRequestBuilder = DeviceRequest.newBuilder().messageMetaData(messageMetadata);
this.deviceService.getData(new DaDeviceRequest(deviceRequestBuilder, request), iec61850DeviceResponseHandler, this);
}
use of org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.services.Iec61850DeviceResponseHandler in project Protocol-Adapter-IEC61850 by OSGP.
the class PublicLightingSetScheduleRequestMessageProcessor method processMessage.
@Override
public void processMessage(final ObjectMessage message) throws JMSException {
LOGGER.debug("Processing public lighting set schedule request message");
String correlationUid = null;
String domain = null;
String domainVersion = null;
String messageType = null;
String organisationIdentification = null;
String deviceIdentification = null;
String ipAddress = null;
Boolean isScheduled = null;
int retryCount = 0;
ScheduleMessageDataContainerDto scheduleMessageDataContainer = null;
try {
correlationUid = message.getJMSCorrelationID();
domain = message.getStringProperty(Constants.DOMAIN);
domainVersion = message.getStringProperty(Constants.DOMAIN_VERSION);
messageType = message.getJMSType();
organisationIdentification = message.getStringProperty(Constants.ORGANISATION_IDENTIFICATION);
deviceIdentification = message.getStringProperty(Constants.DEVICE_IDENTIFICATION);
ipAddress = message.getStringProperty(Constants.IP_ADDRESS);
isScheduled = message.getBooleanProperty(Constants.IS_SCHEDULED);
retryCount = message.getIntProperty(Constants.RETRY_COUNT);
scheduleMessageDataContainer = (ScheduleMessageDataContainerDto) message.getObject();
} catch (final JMSException e) {
LOGGER.error("UNRECOVERABLE ERROR, unable to read ObjectMessage instance, giving up.", e);
LOGGER.debug("correlationUid: {}", correlationUid);
LOGGER.debug("domain: {}", domain);
LOGGER.debug("domainVersion: {}", domainVersion);
LOGGER.debug("messageType: {}", messageType);
LOGGER.debug("organisationIdentification: {}", organisationIdentification);
LOGGER.debug("deviceIdentification: {}", deviceIdentification);
LOGGER.debug("ipAddress: {}", ipAddress);
LOGGER.debug("scheduled: {}", isScheduled);
return;
}
final RequestMessageData requestMessageData = new RequestMessageData(scheduleMessageDataContainer, domain, domainVersion, messageType, retryCount, isScheduled, correlationUid, organisationIdentification, deviceIdentification);
this.printDomainInfo(messageType, domain, domainVersion);
final Iec61850DeviceResponseHandler iec61850DeviceResponseHandler = this.createIec61850DeviceResponseHandler(requestMessageData, message);
final SetScheduleDeviceRequest deviceRequest = new SetScheduleDeviceRequest(organisationIdentification, deviceIdentification, correlationUid, scheduleMessageDataContainer, RelayTypeDto.LIGHT, domain, domainVersion, messageType, ipAddress, retryCount, isScheduled);
this.deviceService.setSchedule(deviceRequest, iec61850DeviceResponseHandler);
}
use of org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.services.Iec61850DeviceResponseHandler in project Protocol-Adapter-IEC61850 by OSGP.
the class MicrogridsGetDataRequestMessageProcessor method processMessage.
@Override
public void processMessage(final ObjectMessage message) throws JMSException {
LOGGER.debug("Processing microgrids get data request message");
String correlationUid = null;
String domain = null;
String domainVersion = null;
String messageType = null;
String organisationIdentification = null;
String deviceIdentification = null;
String ipAddress = null;
int retryCount = 0;
boolean isScheduled = false;
GetDataRequestDto getDataRequest = null;
try {
correlationUid = message.getJMSCorrelationID();
domain = message.getStringProperty(Constants.DOMAIN);
domainVersion = message.getStringProperty(Constants.DOMAIN_VERSION);
messageType = message.getJMSType();
organisationIdentification = message.getStringProperty(Constants.ORGANISATION_IDENTIFICATION);
deviceIdentification = message.getStringProperty(Constants.DEVICE_IDENTIFICATION);
ipAddress = message.getStringProperty(Constants.IP_ADDRESS);
retryCount = message.getIntProperty(Constants.RETRY_COUNT);
isScheduled = message.propertyExists(Constants.IS_SCHEDULED) ? message.getBooleanProperty(Constants.IS_SCHEDULED) : false;
getDataRequest = (GetDataRequestDto) message.getObject();
} catch (final JMSException e) {
LOGGER.error("UNRECOVERABLE ERROR, unable to read ObjectMessage instance, giving up.", e);
LOGGER.debug("correlationUid: {}", correlationUid);
LOGGER.debug("domain: {}", domain);
LOGGER.debug("domainVersion: {}", domainVersion);
LOGGER.debug("messageType: {}", messageType);
LOGGER.debug("organisationIdentification: {}", organisationIdentification);
LOGGER.debug("deviceIdentification: {}", deviceIdentification);
LOGGER.debug("ipAddress: {}", ipAddress);
return;
}
final RequestMessageData requestMessageData = new RequestMessageData(null, domain, domainVersion, messageType, retryCount, isScheduled, correlationUid, organisationIdentification, deviceIdentification);
this.printDomainInfo(messageType, domain, domainVersion);
final Iec61850DeviceResponseHandler iec61850DeviceResponseHandler = this.createIec61850DeviceResponseHandler(requestMessageData, message);
final GetDataDeviceRequest deviceRequest = new GetDataDeviceRequest(organisationIdentification, deviceIdentification, correlationUid, getDataRequest, domain, domainVersion, messageType, ipAddress, retryCount, isScheduled);
this.deviceService.getData(deviceRequest, iec61850DeviceResponseHandler);
}
use of org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.services.Iec61850DeviceResponseHandler in project Protocol-Adapter-IEC61850 by OSGP.
the class PublicLightingGetPowerUsageHistoryRequestMessageProcessor method processMessage.
@Override
public void processMessage(final ObjectMessage message) throws JMSException {
LOGGER.debug("Processing public lighting get power usage history request message");
String correlationUid = null;
String domain = null;
String domainVersion = null;
String messageType = null;
String organisationIdentification = null;
String deviceIdentification = null;
String ipAddress = null;
Boolean isScheduled = null;
int retryCount = 0;
int messagePriority = 0;
Long scheduleTime = null;
PowerUsageHistoryMessageDataContainerDto powerUsageHistoryMessageDataContainerDto;
try {
correlationUid = message.getJMSCorrelationID();
domain = message.getStringProperty(Constants.DOMAIN);
domainVersion = message.getStringProperty(Constants.DOMAIN_VERSION);
messageType = message.getJMSType();
organisationIdentification = message.getStringProperty(Constants.ORGANISATION_IDENTIFICATION);
deviceIdentification = message.getStringProperty(Constants.DEVICE_IDENTIFICATION);
ipAddress = message.getStringProperty(Constants.IP_ADDRESS);
isScheduled = message.getBooleanProperty(Constants.IS_SCHEDULED);
retryCount = message.getIntProperty(Constants.RETRY_COUNT);
messagePriority = message.getJMSPriority();
scheduleTime = message.propertyExists(Constants.SCHEDULE_TIME) ? message.getLongProperty(Constants.SCHEDULE_TIME) : null;
powerUsageHistoryMessageDataContainerDto = (PowerUsageHistoryMessageDataContainerDto) message.getObject();
} catch (final JMSException e) {
LOGGER.error("UNRECOVERABLE ERROR, unable to read ObjectMessage instance, giving up.", e);
LOGGER.debug("correlationUid: {}", correlationUid);
LOGGER.debug("domain: {}", domain);
LOGGER.debug("domainVersion: {}", domainVersion);
LOGGER.debug("messageType: {}", messageType);
LOGGER.debug("organisationIdentification: {}", organisationIdentification);
LOGGER.debug("deviceIdentification: {}", deviceIdentification);
LOGGER.debug("ipAddress: {}", ipAddress);
LOGGER.debug("scheduled: {}", isScheduled);
LOGGER.debug("retryCount: {}", retryCount);
LOGGER.debug("messagePriority: {}", messagePriority);
LOGGER.debug("scheduleTime: {}", scheduleTime);
return;
}
final RequestMessageData requestMessageData = new RequestMessageData(powerUsageHistoryMessageDataContainerDto, domain, domainVersion, messageType, retryCount, isScheduled, correlationUid, organisationIdentification, deviceIdentification, ipAddress, messagePriority, scheduleTime);
this.printDomainInfo(messageType, domain, domainVersion);
final Iec61850DeviceResponseHandler iec61850DeviceResponseHandler = this.createIec61850DeviceResponseHandler(requestMessageData, message);
final GetPowerUsageHistoryDeviceRequest deviceRequest = new GetPowerUsageHistoryDeviceRequest(organisationIdentification, deviceIdentification, correlationUid, powerUsageHistoryMessageDataContainerDto, domain, domainVersion, messageType, ipAddress, retryCount, isScheduled);
this.deviceService.getPowerUsageHistory(deviceRequest, iec61850DeviceResponseHandler);
}
Aggregations