Bump upstream dependencies to Ca
[transportpce.git] / renderer / src / main / java / org / opendaylight / transportpce / renderer / rpcs / RendererRPCImpl.java
1 /*
2  * Copyright © 2017 AT&T and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.transportpce.renderer.rpcs;
9
10 import com.google.common.collect.ImmutableClassToInstanceMap;
11 import org.opendaylight.mdsal.binding.api.RpcProviderService;
12 import org.opendaylight.transportpce.renderer.provisiondevice.RendererServiceOperations;
13 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.ServiceDelete;
14 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.ServiceImplementationRequest;
15 import org.opendaylight.yangtools.concepts.Registration;
16 import org.opendaylight.yangtools.yang.binding.Rpc;
17 import org.osgi.service.component.annotations.Activate;
18 import org.osgi.service.component.annotations.Component;
19 import org.osgi.service.component.annotations.Deactivate;
20 import org.osgi.service.component.annotations.Reference;
21 import org.slf4j.Logger;
22 import org.slf4j.LoggerFactory;
23
24 @Component(immediate = true)
25 public class RendererRPCImpl {
26
27     private static final Logger LOG = LoggerFactory.getLogger(RendererRPCImpl.class);
28     private Registration reg;
29
30     @Activate
31     public RendererRPCImpl(@Reference RendererServiceOperations rendererServiceOperations,
32             @Reference RpcProviderService rpcProviderService) {
33         this.reg = rpcProviderService.registerRpcImplementations(ImmutableClassToInstanceMap.<Rpc<?, ?>>builder()
34             .put(ServiceImplementationRequest.class, new ServiceImplementationRequestImpl(rendererServiceOperations))
35             .put(ServiceDelete.class, new ServiceDeleteImpl(rendererServiceOperations))
36             .build());
37         LOG.debug("TransportPCEServicePathRPCImpl instantiated");
38     }
39
40     @Deactivate
41     public void close() {
42         this.reg.close();
43         LOG.info("TransportPCEServicePathRPCImpl Closed");
44     }
45
46     public Registration getRegisteredRpc() {
47         return reg;
48     }
49
50 }