use of com.alliander.osgp.shared.infra.jms.RequestMessage in project Protocol-Adapter-IEC61850 by OSGP.
the class OsgpRequestMessageSender method send.
public void send(final RequestMessage requestMessage, final String messageType) {
LOGGER.info("Sending request message to OSGP.");
this.iec61850RequestsJmsTemplate.send(new MessageCreator() {
@Override
public Message createMessage(final Session session) throws JMSException {
final ObjectMessage objectMessage = session.createObjectMessage(requestMessage);
objectMessage.setJMSType(messageType);
objectMessage.setStringProperty(Constants.ORGANISATION_IDENTIFICATION, requestMessage.getOrganisationIdentification());
objectMessage.setStringProperty(Constants.DEVICE_IDENTIFICATION, requestMessage.getDeviceIdentification());
return objectMessage;
}
});
}
use of com.alliander.osgp.shared.infra.jms.RequestMessage in project Protocol-Adapter-IEC61850 by OSGP.
the class Iec61850ChannelHandlerServer method processRegistrationMessage.
private void processRegistrationMessage(final RegisterDeviceRequest message, final String correlationId) {
this.logMessage(message);
String deviceIdentification = message.getDeviceIdentification();
String deviceType = Ssld.SSLD_TYPE;
final IED ied = IED.FLEX_OVL;
String ipAddress = message.getIpAddress();
// set, the values will be used to set an IP address for a device.
if (this.testDeviceId != null && this.testDeviceId.equals(deviceIdentification) && this.testDeviceIp != null) {
LOGGER.info("Using testDeviceId: {} and testDeviceIp: {}", this.testDeviceId, this.testDeviceIp);
deviceIdentification = this.testDeviceId;
deviceType = Ssld.SSLD_TYPE;
ipAddress = this.testDeviceIp;
}
final DeviceRegistrationDataDto deviceRegistrationData = new DeviceRegistrationDataDto(ipAddress, deviceType, true);
final RequestMessage requestMessage = new RequestMessage(correlationId, "no-organisation", deviceIdentification, ipAddress, deviceRegistrationData);
LOGGER.info("Sending register device request to OSGP with correlation ID: " + correlationId);
this.osgpRequestMessageSender.send(requestMessage, DeviceFunctionDto.REGISTER_DEVICE.name());
try {
this.deviceRegistrationService.disableRegistration(deviceIdentification, InetAddress.getByName(ipAddress), ied, ied.getDescription());
LOGGER.info("Disabled registration for device: {}, at IP address: {}", deviceIdentification, ipAddress);
} catch (final Exception e) {
LOGGER.error("Failed to disable registration for device: {}, at IP address: {}", deviceIdentification, ipAddress, e);
}
}
use of com.alliander.osgp.shared.infra.jms.RequestMessage in project Protocol-Adapter-IEC61850 by OSGP.
the class DeviceManagementService method addEventNotifications.
/**
* Send an event notification to OSGP Core.
*
* @param deviceIdentification
* The identification of the device.
* @param eventNotifications
* The event notifications.
*
* @throws ProtocolAdapterException
* In case the device can not be found in the database.
*/
public void addEventNotifications(final String deviceIdentification, final List<EventNotificationDto> eventNotifications) throws ProtocolAdapterException {
final Ssld ssldDevice = this.ssldDataRepository.findByDeviceIdentification(deviceIdentification);
if (ssldDevice == null) {
throw new ProtocolAdapterException("Unable to find device using deviceIdentification: " + deviceIdentification);
}
LOGGER.info("addEventNotifications called for device {}: {}", deviceIdentification, eventNotifications);
final RequestMessage requestMessage = new RequestMessage("no-correlationUid", "no-organisation", deviceIdentification, new ArrayList<>(eventNotifications));
this.osgpRequestMessageSender.send(requestMessage, DeviceFunctionDto.ADD_EVENT_NOTIFICATION.name());
}
use of com.alliander.osgp.shared.infra.jms.RequestMessage in project Protocol-Adapter-OSLP by OSGP.
the class DeviceRegistrationService method sendDeviceRegisterRequest.
public void sendDeviceRegisterRequest(final InetAddress inetAddress, final String deviceType, final boolean hasSchedule, final String deviceIdentification) {
final DeviceRegistrationDataDto deviceRegistrationData = new DeviceRegistrationDataDto(inetAddress.getHostAddress().toString(), deviceType, hasSchedule);
final RequestMessage requestMessage = new RequestMessage("no-correlationUid", "no-organisation", deviceIdentification, deviceRegistrationData);
this.osgpRequestMessageSender.send(requestMessage, "REGISTER_DEVICE");
}
use of com.alliander.osgp.shared.infra.jms.RequestMessage in project Protocol-Adapter-OSLP by OSGP.
the class OsgpRequestMessageSender method send.
public void send(final RequestMessage requestMessage, final String messageType) {
LOGGER.info("Sending request message to OSGP.");
this.osgpRequestsJmsTemplate.send(new MessageCreator() {
@Override
public Message createMessage(final Session session) throws JMSException {
final ObjectMessage objectMessage = session.createObjectMessage(requestMessage);
objectMessage.setJMSType(messageType);
objectMessage.setStringProperty(Constants.ORGANISATION_IDENTIFICATION, requestMessage.getOrganisationIdentification());
objectMessage.setStringProperty(Constants.DEVICE_IDENTIFICATION, requestMessage.getDeviceIdentification());
return objectMessage;
}
});
}
Aggregations