2 * Copyright © 2017 AT&T and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.transportpce.renderer;
10 import org.opendaylight.mdsal.binding.api.RpcProviderService;
11 import org.opendaylight.transportpce.renderer.provisiondevice.DeviceRendererService;
12 import org.opendaylight.transportpce.renderer.provisiondevice.OtnDeviceRendererService;
13 import org.opendaylight.transportpce.renderer.provisiondevice.RendererServiceOperations;
14 import org.opendaylight.transportpce.renderer.rpcs.DeviceRendererRPCImpl;
15 import org.opendaylight.transportpce.renderer.rpcs.TransportPCEServicePathRPCImpl;
16 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev211004.TransportpceDeviceRendererService;
17 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.TransportpceRendererService;
18 import org.opendaylight.yangtools.concepts.ObjectRegistration;
19 import org.osgi.service.component.annotations.Activate;
20 import org.osgi.service.component.annotations.Component;
21 import org.osgi.service.component.annotations.Deactivate;
22 import org.osgi.service.component.annotations.Reference;
23 import org.slf4j.Logger;
24 import org.slf4j.LoggerFactory;
27 public class RendererProvider {
29 private static final Logger LOG = LoggerFactory.getLogger(RendererProvider.class);
30 private final RpcProviderService rpcProviderService;
31 private DeviceRendererRPCImpl deviceRendererRPCImpl;
32 private TransportPCEServicePathRPCImpl transportPCEServicePathRPCImpl;
33 private ObjectRegistration<DeviceRendererRPCImpl> deviceRendererRegistration;
34 private ObjectRegistration<TransportpceRendererService> tpceServiceRegistry;
37 public RendererProvider(@Reference RpcProviderService rpcProviderService,
38 @Reference DeviceRendererService deviceRenderer,
39 @Reference OtnDeviceRendererService otnDeviceRendererService,
40 @Reference RendererServiceOperations rendererServiceOperations) {
41 this.rpcProviderService = rpcProviderService;
42 this.deviceRendererRPCImpl = new DeviceRendererRPCImpl(deviceRenderer, otnDeviceRendererService);
43 this.transportPCEServicePathRPCImpl = new TransportPCEServicePathRPCImpl(rendererServiceOperations);
44 LOG.info("RendererProvider Session Initiated");
45 this.deviceRendererRegistration = this.rpcProviderService
46 .registerRpcImplementation(TransportpceDeviceRendererService.class, deviceRendererRPCImpl);
47 this.tpceServiceRegistry = this.rpcProviderService
48 .registerRpcImplementation(TransportpceRendererService.class, transportPCEServicePathRPCImpl);
52 * Method called when the blueprint container is destroyed.
56 LOG.info("RendererProvider Closed");
57 if (this.deviceRendererRegistration != null) {
58 this.deviceRendererRegistration.close();
60 if (this.tpceServiceRegistry != null) {
61 this.tpceServiceRegistry.close();