Fix Log message in OLM provider
[transportpce.git] / olm / src / main / java / org / opendaylight / transportpce / olm / OlmProvider.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
9 package org.opendaylight.transportpce.olm;
10
11 import org.opendaylight.mdsal.binding.api.RpcProviderService;
12 import org.opendaylight.transportpce.olm.service.OlmPowerService;
13 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev210618.TransportpceOlmService;
14 import org.opendaylight.yangtools.concepts.ObjectRegistration;
15 import org.slf4j.Logger;
16 import org.slf4j.LoggerFactory;
17
18 /**
19  * The Class OlmProvider.
20  */
21 public class OlmProvider {
22     private static final Logger LOG = LoggerFactory.getLogger(OlmProvider.class);
23     private final RpcProviderService rpcProviderService;
24     private final OlmPowerService olmPowerService;
25     private ObjectRegistration<TransportpceOlmService> olmRPCRegistration;
26
27     /**
28      * Instantiates a new olm provider.
29      * @param olmPowerService
30      *            implementation of OlmService
31      * @param rpcProviderService
32      *            the rpc provider service
33      */
34     public OlmProvider(final RpcProviderService rpcProviderService, final OlmPowerService olmPowerService) {
35         this.rpcProviderService = rpcProviderService;
36         this.olmPowerService = olmPowerService;
37     }
38
39     /**
40      * Method called when the blueprint container is created.
41      */
42     public void init() {
43         LOG.info("OlmProvider Session Initiated");
44         // Initializing Notification module
45         olmRPCRegistration = rpcProviderService.registerRpcImplementation(TransportpceOlmService.class,
46                 new OlmPowerServiceRpcImpl(this.olmPowerService));
47     }
48
49     /**
50      * Method called when the blueprint container is destroyed.
51      */
52     public void close() {
53         LOG.info("OlmProvider Closed");
54         // Clean up the RPC service registration
55         if (olmRPCRegistration != null) {
56             olmRPCRegistration.close();
57         }
58     }
59 }