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.RendererServiceOperations;
12 import org.opendaylight.transportpce.renderer.rpcs.DeviceRendererRPCImpl;
13 import org.opendaylight.transportpce.renderer.rpcs.TransportPCEServicePathRPCImpl;
14 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev210618.TransportpceDeviceRendererService;
15 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.TransportpceRendererService;
16 import org.opendaylight.yangtools.concepts.ObjectRegistration;
17 import org.slf4j.Logger;
18 import org.slf4j.LoggerFactory;
20 public class RendererProvider {
22 private static final Logger LOG = LoggerFactory.getLogger(RendererProvider.class);
23 private final RpcProviderService rpcProviderService;
24 private DeviceRendererRPCImpl deviceRendererRPCImpl;
25 private ObjectRegistration<DeviceRendererRPCImpl> deviceRendererRegistration;
26 private ObjectRegistration<TransportpceRendererService> tpceServiceRegistry;
27 private RendererServiceOperations rendererServiceOperations;
29 public RendererProvider(RpcProviderService rpcProviderService, DeviceRendererRPCImpl deviceRendererRPCImpl,
30 RendererServiceOperations rendererServiceOperations) {
31 this.rpcProviderService = rpcProviderService;
32 this.deviceRendererRPCImpl = deviceRendererRPCImpl;
33 this.rendererServiceOperations = rendererServiceOperations;
37 * Method called when the blueprint container is created.
40 LOG.info("RendererProvider Session Initiated");
41 TransportPCEServicePathRPCImpl transportPCEServicePathRPCImpl =
42 new TransportPCEServicePathRPCImpl(this.rendererServiceOperations);
43 this.deviceRendererRegistration = this.rpcProviderService
44 .registerRpcImplementation(TransportpceDeviceRendererService.class, deviceRendererRPCImpl);
45 this.tpceServiceRegistry = this.rpcProviderService
46 .registerRpcImplementation(TransportpceRendererService.class, transportPCEServicePathRPCImpl);
50 * Method called when the blueprint container is destroyed.
53 LOG.info("RendererProvider Closed");
54 if (this.deviceRendererRegistration != null) {
55 this.deviceRendererRegistration.close();
57 if (this.tpceServiceRegistry != null) {
58 this.tpceServiceRegistry.close();