X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=renderer%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Ftransportpce%2Frenderer%2FRendererProvider.java;h=0441251cffa9c010442c1f39566c52f27c730072;hb=4378fca1d31d1f75c0480c752aa711fb885e6135;hp=2f6ede4126a7c36d9417fdea7a33f41a981a7797;hpb=c90116eb48dcad47f42b5444ade3c940effead1b;p=transportpce.git diff --git a/renderer/src/main/java/org/opendaylight/transportpce/renderer/RendererProvider.java b/renderer/src/main/java/org/opendaylight/transportpce/renderer/RendererProvider.java index 2f6ede412..0441251cf 100644 --- a/renderer/src/main/java/org/opendaylight/transportpce/renderer/RendererProvider.java +++ b/renderer/src/main/java/org/opendaylight/transportpce/renderer/RendererProvider.java @@ -5,40 +5,32 @@ * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ - package org.opendaylight.transportpce.renderer; -import java.util.HashSet; -import java.util.Set; - -import org.opendaylight.controller.md.sal.binding.api.DataBroker; -import org.opendaylight.controller.md.sal.binding.api.MountPointService; -import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RpcRegistration; -import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry; -import org.opendaylight.transportpce.renderer.provisiondevice.DeviceRenderer; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.renderer.rev170228.RendererService; +import org.opendaylight.mdsal.binding.api.RpcProviderService; +import org.opendaylight.transportpce.renderer.provisiondevice.RendererServiceOperations; +import org.opendaylight.transportpce.renderer.rpcs.DeviceRendererRPCImpl; +import org.opendaylight.transportpce.renderer.rpcs.TransportPCEServicePathRPCImpl; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.device.rev200128.TransportpceDeviceRendererService; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev171017.TransportpceRendererService; +import org.opendaylight.yangtools.concepts.ObjectRegistration; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class RendererProvider { private static final Logger LOG = LoggerFactory.getLogger(RendererProvider.class); - private final DataBroker dataBroker; - private final MountPointService mountPointService; - private final RpcProviderRegistry rpcProviderRegistry; - private RendererNotificationsImpl rendererNotificationImpl; - private RpcRegistration deviceRendererRegistration; - private final Set currentMountedDevice; - - public RendererProvider(final DataBroker dataBroker, final MountPointService mountPointService, - final RpcProviderRegistry rpcProviderRegistry) { - this.dataBroker = dataBroker; - this.mountPointService = mountPointService; - this.rpcProviderRegistry = rpcProviderRegistry; - this.currentMountedDevice = new HashSet<>(); - if (mountPointService == null) { - LOG.error("Mount service is null"); - } + private final RpcProviderService rpcProviderService; + private DeviceRendererRPCImpl deviceRendererRPCImpl; + private ObjectRegistration deviceRendererRegistration; + private ObjectRegistration tpceServiceRegistry; + private RendererServiceOperations rendererServiceOperations; + + public RendererProvider(RpcProviderService rpcProviderService, DeviceRendererRPCImpl deviceRendererRPCImpl, + RendererServiceOperations rendererServiceOperations) { + this.rpcProviderService = rpcProviderService; + this.deviceRendererRPCImpl = deviceRendererRPCImpl; + this.rendererServiceOperations = rendererServiceOperations; } /** @@ -46,12 +38,12 @@ public class RendererProvider { */ public void init() { LOG.info("RendererProvider Session Initiated"); - // Initializing Notification module - rendererNotificationImpl = new RendererNotificationsImpl(dataBroker, mountPointService, - currentMountedDevice); - //Register REST API RPC implementation for Renderer Service - deviceRendererRegistration = rpcProviderRegistry.addRpcImplementation(RendererService.class, new DeviceRenderer( - dataBroker, mountPointService, currentMountedDevice)); + TransportPCEServicePathRPCImpl transportPCEServicePathRPCImpl = + new TransportPCEServicePathRPCImpl(this.rendererServiceOperations); + this.deviceRendererRegistration = this.rpcProviderService + .registerRpcImplementation(TransportpceDeviceRendererService.class, deviceRendererRPCImpl); + this.tpceServiceRegistry = this.rpcProviderService + .registerRpcImplementation(TransportpceRendererService.class, transportPCEServicePathRPCImpl); } /** @@ -59,13 +51,12 @@ public class RendererProvider { */ public void close() { LOG.info("RendererProvider Closed"); - // Clean up the RPC service registration - if (deviceRendererRegistration != null) { - deviceRendererRegistration.close(); + if (this.deviceRendererRegistration != null) { + this.deviceRendererRegistration.close(); } - // Clean up the RendererNotificationsImpl - if (rendererNotificationImpl != null) { - rendererNotificationImpl.close(); + if (this.tpceServiceRegistry != null) { + this.tpceServiceRegistry.close(); } } -} \ No newline at end of file + +}