Modify spectrum assignment management in PCE
[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.rev210701.TransportpcePceService;
13 import org.opendaylight.yangtools.concepts.ObjectRegistration;
14 import org.slf4j.Logger;
15 import org.slf4j.LoggerFactory;
16
17 /*
18  * Class to register
19  * Pce Service & Notification.
20  */
21 public class PceProvider {
22
23     private static final Logger LOG = LoggerFactory.getLogger(PceProvider.class);
24
25     private final RpcProviderService rpcService;
26     private final PathComputationService pathComputationService;
27     private ObjectRegistration<PceServiceRPCImpl> rpcRegistration;
28
29     public PceProvider(RpcProviderService rpcProviderService, PathComputationService pathComputationService) {
30         this.rpcService = rpcProviderService;
31         this.pathComputationService = pathComputationService;
32     }
33
34     /*
35      * Method called when the blueprint container is created.
36      */
37     public void init() {
38         LOG.info("PceProvider Session Initiated");
39         final PceServiceRPCImpl consumer = new PceServiceRPCImpl(pathComputationService);
40         rpcRegistration = rpcService.registerRpcImplementation(TransportpcePceService.class, consumer);
41     }
42
43     /*
44      * Method called when the blueprint container is destroyed.
45      */
46     public void close() {
47         LOG.info("PceProvider Closed");
48         rpcRegistration.close();
49     }
50
51 }