+ }
+
+ /**
+ * Create and send service handler notification.
+ * @param notification RendererRpcResultSp
+ * @param type ServiceNotificationTypes
+ */
+ private void sendServiceHandlerNotification(RendererRpcResultSp notification, ServiceNotificationTypes type) {
+ try {
+ ServiceRpcResultSh serviceHandlerNotification = new ServiceRpcResultShBuilder()
+ .setAToZDirection(notification.getAToZDirection())
+ .setZToADirection(notification.getZToADirection())
+ .setServiceName(notification.getServiceName())
+ .setStatus(notification.getStatus())
+ .setStatusMessage(notification.getStatusMessage())
+ .setNotificationType(type)
+ .build();
+ LOG.debug("Service update in datastore OK, sending notification {}", serviceHandlerNotification);
+ notificationPublishService.putNotification(
+ serviceHandlerNotification);
+ } catch (InterruptedException e) {
+ LOG.warn("Something went wrong while sending notification for service {}",
+ serviceRpcResultSp.getServiceName(), e);
+ Thread.currentThread().interrupt();
+ }
+ }
+
+ /**
+ * Process failed service implementation for serviceName.
+ * @param serviceName String
+ */
+ private void onFailedServiceImplementation(String serviceName) {
+ LOG.error("Renderer implementation failed !");
+ Services service = serviceDataStoreOperations.getService(input.getServiceName()).get();
+ sendNbiNotification(new PublishNotificationProcessServiceBuilder()
+ .setServiceName(service.getServiceName())
+ .setServiceAEnd(new ServiceAEndBuilder(service.getServiceAEnd()).build())
+ .setServiceZEnd(new ServiceZEndBuilder(service.getServiceZEnd()).build())
+ .setCommonId(service.getCommonId())
+ .setConnectionType(service.getConnectionType())
+ .setResponseFailed("Renderer implementation failed !")
+ .setMessage("ServiceCreate request failed ...")
+ .setOperationalState(service.getOperationalState())
+ .setPublisherName(PUBLISHER)
+ .build());
+ OperationResult deleteServicePathOperationResult =
+ this.serviceDataStoreOperations.deleteServicePath(serviceName);
+ if (!deleteServicePathOperationResult.isSuccess()) {
+ LOG.warn("Service path was not removed from datastore!");
+ }
+ OperationResult deleteServiceOperationResult;
+ String serviceType = "";
+ if (tempService) {
+ deleteServiceOperationResult = this.serviceDataStoreOperations.deleteTempService(serviceName);
+ serviceType = "Temp ";
+ } else {
+ deleteServiceOperationResult = this.serviceDataStoreOperations.deleteService(serviceName);
+ }
+ if (deleteServiceOperationResult.isSuccess()) {
+ LOG.warn("{}Service was not removed from datastore!", serviceType);
+ }
+ }
+
+ @SuppressFBWarnings(
+ value = "ES_COMPARING_STRINGS_WITH_EQ",
+ justification = "false positives, not strings but real object references comparisons")
+ private Boolean compareServiceRpcResultSp(RendererRpcResultSp notification) {
+ if (serviceRpcResultSp == null
+ || serviceRpcResultSp.getNotificationType() != notification.getNotificationType()
+ || serviceRpcResultSp.getServiceName() != notification.getServiceName()
+ || serviceRpcResultSp.getStatus() != notification.getStatus()
+ || serviceRpcResultSp.getStatusMessage() != notification.getStatusMessage()) {
+ return false;
+ }
+ return true;