List of usage examples for javax.jms ObjectMessage getStringProperty
String getStringProperty(String name) throws JMSException;
From source file:com.alliander.osgp.adapter.protocol.oslp.elster.infra.messaging.processors.TariffSwitchingSetScheduleRequestMessageProcessor.java
@Override public void processMessage(final ObjectMessage message) { LOGGER.debug("Processing tariff switching set schedule request message"); String correlationUid = null; String domain = null;// www. j a v a 2 s .c o m String domainVersion = null; String messageType = null; String organisationIdentification = null; String deviceIdentification = null; String ipAddress = null; Boolean isScheduled = null; int retryCount = 0; 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); } 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; } try { final ScheduleMessageDataContainerDto scheduleMessageDataContainer = (ScheduleMessageDataContainerDto) message .getObject(); LOGGER.info("Calling DeviceService function: {} for domain: {} {}", messageType, domain, domainVersion); final SetScheduleDeviceRequest deviceRequest = new SetScheduleDeviceRequest(organisationIdentification, deviceIdentification, correlationUid, scheduleMessageDataContainer, RelayTypeDto.TARIFF, domain, domainVersion, messageType, ipAddress, retryCount, isScheduled); this.deviceService.setSchedule(deviceRequest); } catch (final Exception e) { this.handleError(e, correlationUid, organisationIdentification, deviceIdentification, domain, domainVersion, messageType, retryCount); } }
From source file:com.alliander.osgp.adapter.protocol.oslp.elster.infra.messaging.processors.CommonSetEventNotificationsRequestMessageProcessor.java
@Override public void processMessage(final ObjectMessage message) { LOGGER.debug("Processing common set event notifications request message"); String correlationUid = null; String domain = null;// ww w . ja va 2s. c om String domainVersion = null; String messageType = null; String organisationIdentification = null; String deviceIdentification = null; String ipAddress = null; int retryCount = 0; boolean isScheduled = false; 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; } 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; } try { final EventNotificationMessageDataContainerDto eventNotificationMessageDataContainer = (EventNotificationMessageDataContainerDto) message .getObject(); LOGGER.info("Calling DeviceService function: {} for domain: {} {}", messageType, domain, domainVersion); final SetEventNotificationsDeviceRequest deviceRequest = new SetEventNotificationsDeviceRequest( organisationIdentification, deviceIdentification, correlationUid, eventNotificationMessageDataContainer, domain, domainVersion, messageType, ipAddress, retryCount, isScheduled); this.deviceService.setEventNotifications(deviceRequest); } catch (final Exception e) { this.handleError(e, correlationUid, organisationIdentification, deviceIdentification, domain, domainVersion, messageType, retryCount); } }
From source file:com.alliander.osgp.adapter.protocol.oslp.elster.infra.messaging.processors.PublicLightingSetTransitionRequestMessageProcessor.java
@Override public void processMessage(final ObjectMessage message) { LOGGER.debug("Processing public lighting set transition request message"); String correlationUid = null; String domain = null;// w ww . j a va 2 s . c o m String domainVersion = null; String messageType = null; String organisationIdentification = null; String deviceIdentification = null; String ipAddress = null; int retryCount = 0; boolean isScheduled = false; 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; } 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; } try { final TransitionMessageDataContainerDto transitionMessageDataContainer = (TransitionMessageDataContainerDto) message .getObject(); LOGGER.info("Calling DeviceService function: {} for domain: {} {}", messageType, domain, domainVersion); final SetTransitionDeviceRequest deviceRequest = new SetTransitionDeviceRequest( organisationIdentification, deviceIdentification, correlationUid, transitionMessageDataContainer, domain, domainVersion, messageType, ipAddress, retryCount, isScheduled); this.deviceService.setTransition(deviceRequest); } catch (final Exception e) { this.handleError(e, correlationUid, organisationIdentification, deviceIdentification, domain, domainVersion, messageType, retryCount); } }
From source file:com.alliander.osgp.adapter.protocol.oslp.elster.infra.messaging.processors.CommonUpdateDeviceSslCertificationRequestMessageProcessor.java
@Override public void processMessage(final ObjectMessage message) { LOGGER.debug("Processing common update device ssl certification message"); String correlationUid = null; String domain = null;//from ww w . j a v a2 s. com String domainVersion = null; String messageType = null; String organisationIdentification = null; String deviceIdentification = null; String ipAddress = null; Boolean isScheduled = null; int retryCount = 0; 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.propertyExists(Constants.IS_SCHEDULED) ? message.getBooleanProperty(Constants.IS_SCHEDULED) : false; retryCount = message.getIntProperty(Constants.RETRY_COUNT); } 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; } try { final com.alliander.osgp.dto.valueobjects.CertificationDto certification = (com.alliander.osgp.dto.valueobjects.CertificationDto) message .getObject(); LOGGER.info("Calling DeviceService function: {} for domain: {} {}", messageType, domain, domainVersion); final UpdateDeviceSslCertificationDeviceRequest deviceRequest = new UpdateDeviceSslCertificationDeviceRequest( organisationIdentification, deviceIdentification, correlationUid, certification, domain, domainVersion, messageType, ipAddress, retryCount, isScheduled); this.deviceService.updateDeviceSslCertification(deviceRequest); } catch (final Exception e) { this.handleError(e, correlationUid, organisationIdentification, deviceIdentification, domain, domainVersion, messageType, retryCount); } }
From source file:com.alliander.osgp.adapter.protocol.oslp.elster.infra.messaging.processors.CommonUpdateFirmwareRequestMessageProcessor.java
@Override public void processMessage(final ObjectMessage message) { LOGGER.debug("Processing common update firmware request message"); String correlationUid = null; String domain = null;//from w w w.j av a2s . c o m String domainVersion = null; String messageType = null; String organisationIdentification = null; String deviceIdentification = null; String ipAddress = null; Boolean isScheduled = null; int retryCount = 0; 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); } 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; } try { final String firmwareIdentification = (String) message.getObject(); LOGGER.info("Calling DeviceService function: {} for domain: {} {}", messageType, domain, domainVersion); final UpdateFirmwareDeviceRequest deviceRequest = new UpdateFirmwareDeviceRequest( organisationIdentification, deviceIdentification, correlationUid, this.firmwareLocation.getDomain(), this.firmwareLocation.getFullPath(firmwareIdentification), domain, domainVersion, messageType, ipAddress, retryCount, isScheduled); this.deviceService.updateFirmware(deviceRequest); } catch (final Exception e) { this.handleError(e, correlationUid, organisationIdentification, deviceIdentification, domain, domainVersion, messageType, retryCount); } }
From source file:com.alliander.osgp.adapter.protocol.oslp.elster.infra.messaging.processors.PublicLightingResumeScheduleRequestMessageProcessor.java
@Override public void processMessage(final ObjectMessage message) { LOGGER.debug("Processing public lighting resume schedule request message"); String correlationUid = null; String domain = null;//from w w w . j a v a 2s .c o m String domainVersion = null; String messageType = null; String organisationIdentification = null; String deviceIdentification = null; String ipAddress = null; int retryCount = 0; boolean isScheduled = false; 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; } 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; } try { final ResumeScheduleMessageDataContainerDto resumeScheduleMessageDataContainer = (ResumeScheduleMessageDataContainerDto) message .getObject(); LOGGER.info("Calling DeviceService function: {} for domain: {} {}", messageType, domain, domainVersion); final ResumeScheduleDeviceRequest deviceRequest = new ResumeScheduleDeviceRequest( organisationIdentification, deviceIdentification, correlationUid, resumeScheduleMessageDataContainer, domain, domainVersion, messageType, ipAddress, retryCount, isScheduled); this.deviceService.resumeSchedule(deviceRequest); } catch (final Exception e) { this.handleError(e, correlationUid, organisationIdentification, deviceIdentification, domain, domainVersion, messageType, retryCount); } }
From source file:com.alliander.osgp.adapter.protocol.oslp.elster.infra.messaging.processors.PublicLightingSetLightRequestMessageProcessor.java
@Override public void processMessage(final ObjectMessage message) { LOGGER.debug("Processing public lighting set light request message"); String correlationUid = null; String domain = null;/*from w w w. j a v a2 s .c om*/ String domainVersion = null; String messageType = null; String organisationIdentification = null; String deviceIdentification = null; String ipAddress = null; int retryCount = 0; boolean isScheduled = false; 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; } 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; } try { final LightValueMessageDataContainerDto lightValueMessageDataContainer = (LightValueMessageDataContainerDto) message .getObject(); LOGGER.info("Calling DeviceService function: {} for domain: {} {}", messageType, domain, domainVersion); final SetLightDeviceRequest deviceRequest = new SetLightDeviceRequest(organisationIdentification, deviceIdentification, correlationUid, lightValueMessageDataContainer, domain, domainVersion, messageType, ipAddress, retryCount, isScheduled); this.deviceService.setLight(deviceRequest); } catch (final Exception e) { this.handleError(e, correlationUid, organisationIdentification, deviceIdentification, domain, domainVersion, messageType, retryCount); } }
From source file:com.alliander.osgp.adapter.protocol.oslp.elster.infra.messaging.processors.CommonGetFirmwareRequestMessageProcessor.java
@Override public void processMessage(final ObjectMessage message) { LOGGER.debug("Processing common get firmware request message"); String correlationUid = null; String domain = null;//from w w w . j a va2 s. c om String domainVersion = null; String messageType = null; String organisationIdentification = null; String deviceIdentification = null; String ipAddress = null; int retryCount = 0; boolean isScheduled = false; 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; } 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; } LOGGER.info("Calling DeviceService function: {} for domain: {} {}", messageType, domain, domainVersion); final DeviceRequest deviceRequest = new DeviceRequest(organisationIdentification, deviceIdentification, correlationUid, domain, domainVersion, messageType, ipAddress, retryCount, isScheduled); this.deviceService.getFirmwareVersion(deviceRequest); }
From source file:com.alliander.osgp.acceptancetests.devicemanagement.SetEventNotificationsSteps.java
@DomainStep("a set event notifications response message with correlationId (.*), deviceId (.*), qresult (.*) and qdescription (.*) is found in the queue (.*)") public void givenASetEventNotificationsResponseMessageIsFoundInTheQueue(final String correlationId, final String deviceId, final String qresult, final String qdescription, final Boolean isFound) { LOGGER.info(// w ww.j av a 2 s.co m "GIVEN: \"a set event notifications response message with correlationId {}, deviceId {}, qresult {} and qdescription {} is found {}\".", correlationId, deviceId, qresult, qdescription, isFound); if (isFound) { final ObjectMessage messageMock = mock(ObjectMessage.class); try { when(messageMock.getJMSCorrelationID()).thenReturn(correlationId); when(messageMock.getStringProperty("OrganisationIdentification")).thenReturn(ORGANISATION_ID_OWNER); when(messageMock.getStringProperty("DeviceIdentification")).thenReturn(deviceId); final ResponseMessageResultType result = ResponseMessageResultType.valueOf(qresult); Serializable dataObject = null; OsgpException exception = null; if (result.equals(ResponseMessageResultType.NOT_OK)) { dataObject = new FunctionalException(FunctionalExceptionType.VALIDATION_ERROR, ComponentType.UNKNOWN, new ValidationException()); exception = (OsgpException) dataObject; } final ResponseMessage message = new ResponseMessage(correlationId, ORGANISATION_ID_OWNER, deviceId, result, exception, dataObject); when(messageMock.getObject()).thenReturn(message); } catch (final JMSException e) { LOGGER.error("given a set event notifications response", e); } when(this.commonResponsesJmsTemplate.receiveSelected(any(String.class))).thenReturn(messageMock); } else { when(this.commonResponsesJmsTemplate.receiveSelected(any(String.class))).thenReturn(null); } }
From source file:com.alliander.osgp.adapter.protocol.oslp.elster.infra.messaging.processors.PublicLightingGetStatusRequestMessageProcessor.java
@Override public void processMessage(final ObjectMessage message) { LOGGER.info("Processing public lighting get status request message"); String correlationUid = null; String domain = null;//from w w w. jav a2 s . c om String domainVersion = null; String messageType = null; String organisationIdentification = null; String deviceIdentification = null; String ipAddress = null; int retryCount = 0; boolean isScheduled = false; 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; } 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; } LOGGER.info("Calling DeviceService function: {} for domain: {} {}", messageType, domain, domainVersion); final GetStatusDeviceRequest deviceRequest = new GetStatusDeviceRequest(organisationIdentification, deviceIdentification, correlationUid, DomainTypeDto.PUBLIC_LIGHTING, domain, domainVersion, messageType, ipAddress, retryCount, isScheduled); this.deviceService.getStatus(deviceRequest); }