Remove pce-blueprint.xml file
[transportpce.git] / pce / src / main / java / org / opendaylight / transportpce / pce / impl / PceProvider.java
1 /*
2  * Copyright © 2017 AT&T, Inc. 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.pce.impl;
9
10 import org.opendaylight.mdsal.binding.api.RpcProviderService;
11 import org.opendaylight.transportpce.pce.service.PathComputationService;
12 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220808.TransportpcePceService;
13 import org.opendaylight.yangtools.concepts.ObjectRegistration;
14 import org.osgi.service.component.annotations.Activate;
15 import org.osgi.service.component.annotations.Component;
16 import org.osgi.service.component.annotations.Deactivate;
17 import org.osgi.service.component.annotations.Reference;
18 import org.slf4j.Logger;
19 import org.slf4j.LoggerFactory;
20
21 /*
22  * Class to register
23  * Pce Service & Notification.
24  */
25 @Component
26 public class PceProvider {
27
28     private static final Logger LOG = LoggerFactory.getLogger(PceProvider.class);
29
30     private final RpcProviderService rpcService;
31     private ObjectRegistration<PceServiceRPCImpl> rpcRegistration;
32
33     @Activate
34     public PceProvider(@Reference RpcProviderService rpcProviderService,
35             @Reference PathComputationService pathComputationService) {
36         this.rpcService = rpcProviderService;
37         LOG.info("PceProvider Session Initiated");
38         final PceServiceRPCImpl consumer = new PceServiceRPCImpl(pathComputationService);
39         rpcRegistration = rpcService.registerRpcImplementation(TransportpcePceService.class, consumer);
40     }
41
42     /*
43      * Method called when the blueprint container is destroyed.
44      */
45     @Deactivate
46     public void close() {
47         LOG.info("PceProvider Closed");
48         rpcRegistration.close();
49     }
50 }