+ SendingRendererRPCs sendingRenderer = new SendingRendererRPCs(executor);
+ FutureCallback<Boolean> rendererCallback =
+ new FutureCallback<Boolean>() {
+ String message = "";
+ ServiceRpcResultSp notification = null;
+
+ @Override
+ public void onFailure(Throwable arg0) {
+ LOG.error("Failure message : {}", arg0.toString());
+ LOG.error("Service implementation failed !");
+ notification = new ServiceRpcResultSpBuilder()
+ .setNotificationType(ServicePathNotificationTypes.ServiceImplementationRequest)
+ .setServiceName(input.getServiceName()).setStatus(RpcStatusEx.Failed)
+ .setStatusMessage("PCR Request failed : {}" + arg0.getMessage()).build();
+ try {
+ notificationPublishService.putNotification(notification);
+ } catch (InterruptedException e) {
+ LOG.info("notification offer rejected : {}", e);
+ }
+ }
+
+ @Override
+ public void onSuccess(Boolean response) {
+ LOG.info("response : {}", response);
+ if (response) {
+ message = "Service implemented !";
+ TopologyBuilder topo = sendingRenderer.getTopology();
+ ServiceRpcResultSpBuilder tmp = new ServiceRpcResultSpBuilder()
+ .setNotificationType(ServicePathNotificationTypes.ServiceImplementationRequest)
+ .setServiceName(input.getServiceName())
+ .setStatus(RpcStatusEx.Successful)
+ .setStatusMessage(message);
+ if (topo != null) {
+ PathTopology value = new PathTopologyBuilder()
+ .setAToZ(topo.getAToZ())
+ .setZToA(topo.getZToA())
+ .build();
+ tmp.setPathTopology(value);
+ }
+ notification = tmp.build();
+ } else {
+ message = "Service implementation failed : " + sendingRenderer.getError();
+ notification = new ServiceRpcResultSpBuilder()
+ .setNotificationType(ServicePathNotificationTypes.ServiceImplementationRequest)
+ .setServiceName("")
+ .setStatus(RpcStatusEx.Failed).setStatusMessage(message)
+ .build();
+ }
+ LOG.info(notification.toString());
+ try {
+ notificationPublishService.putNotification(notification);
+ } catch (InterruptedException e) {
+ LOG.info("notification offer rejected : {}", e);
+ }
+ LOG.info(message);
+ }
+ };
+ ListenableFuture<Boolean> renderer = sendingRenderer.serviceImplementation();
+ Futures.addCallback(renderer, rendererCallback, executor);
+ LOG.info("Service implmentation Request in progress ");
+ configurationResponseCommon = new ConfigurationResponseCommonBuilder()
+ .setAckFinalIndicator("Yes")
+ .setRequestId(input.getServiceHandlerHeader().getRequestId())
+ .setResponseCode("200")
+ .setResponseMessage("Service implementation Request in progress ");
+
+ ServiceImplementationRequestOutput output = new ServiceImplementationRequestOutputBuilder()
+ .setConfigurationResponseCommon(configurationResponseCommon.build())
+ .build();
+ return RpcResultBuilder.success(output).buildFuture();