use of com.alliander.osgp.dto.valueobjects.ConfigurationDto in project Protocol-Adapter-OSLP by OSGP.
the class OslpDeviceService method buildDeviceResponseGetConfiguration.
private DeviceResponse buildDeviceResponseGetConfiguration(final DeviceRequest deviceRequest, final OslpEnvelope oslpResponse) {
ConfigurationDto configuration = null;
DeviceMessageStatus status = null;
if (oslpResponse.getPayloadMessage().hasGetConfigurationResponse()) {
final Oslp.GetConfigurationResponse getConfigurationResponse = oslpResponse.getPayloadMessage().getGetConfigurationResponse();
configuration = this.mapper.map(getConfigurationResponse, ConfigurationDto.class);
status = this.mapper.map(getConfigurationResponse.getStatus(), DeviceMessageStatus.class);
} else {
status = DeviceMessageStatus.FAILURE;
}
return new GetConfigurationDeviceResponse(deviceRequest.getOrganisationIdentification(), deviceRequest.getDeviceIdentification(), deviceRequest.getCorrelationUid(), status, configuration);
}
use of com.alliander.osgp.dto.valueobjects.ConfigurationDto in project Protocol-Adapter-IEC61850 by OSGP.
the class CommonSetConfigurationRequestMessageProcessor method processMessage.
@Override
public void processMessage(final ObjectMessage message) throws JMSException {
LOGGER.debug("Processing common set configuration 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;
ConfigurationDto configuration = 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);
configuration = (ConfigurationDto) 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(null, domain, domainVersion, messageType, retryCount, isScheduled, correlationUid, organisationIdentification, deviceIdentification);
this.printDomainInfo(messageType, domain, domainVersion);
final Iec61850DeviceResponseHandler iec61850DeviceResponseHandler = this.createIec61850DeviceResponseHandler(requestMessageData, message);
final SetConfigurationDeviceRequest deviceRequest = new SetConfigurationDeviceRequest(organisationIdentification, deviceIdentification, correlationUid, configuration, domain, domainVersion, messageType, ipAddress, retryCount, isScheduled);
this.deviceService.setConfiguration(deviceRequest, iec61850DeviceResponseHandler);
}
use of com.alliander.osgp.dto.valueobjects.ConfigurationDto in project Protocol-Adapter-IEC61850 by OSGP.
the class Iec61850SsldDeviceService method getConfiguration.
@Override
public void getConfiguration(final DeviceRequest deviceRequest, final DeviceResponseHandler deviceResponseHandler) throws JMSException {
DeviceConnection deviceConnection = null;
try {
deviceConnection = this.connectToDevice(deviceRequest);
// Getting the SSLD for the device output-settings.
final Ssld ssld = this.ssldDataService.findDevice(deviceRequest.getDeviceIdentification());
final ConfigurationDto configuration = new Iec61850GetConfigurationCommand().getConfigurationFromDevice(this.iec61850Client, deviceConnection, ssld, this.mapper);
final GetConfigurationDeviceResponse response = new GetConfigurationDeviceResponse(deviceRequest.getOrganisationIdentification(), deviceRequest.getDeviceIdentification(), deviceRequest.getCorrelationUid(), DeviceMessageStatus.OK, configuration);
deviceResponseHandler.handleResponse(response);
} catch (final ConnectionFailureException se) {
this.handleConnectionFailureException(deviceRequest, deviceResponseHandler, se);
} catch (final Exception e) {
this.handleException(deviceRequest, deviceResponseHandler, e);
}
this.iec61850DeviceConnectionService.disconnect(deviceConnection, deviceRequest);
}
Aggregations