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
9 package org.opendaylight.transportpce.olm;
11 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
12 import org.opendaylight.controller.md.sal.binding.api.MountPointService;
13 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RpcRegistration;
14 import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.olm.rev170418.OlmService;
16 import org.slf4j.Logger;
17 import org.slf4j.LoggerFactory;
20 * The Class OlmProvider.
22 public class OlmProvider {
24 /** The Constant LOG. */
25 private static final Logger LOG = LoggerFactory.getLogger(OlmProvider.class);
27 /** The data broker. */
28 private final DataBroker dataBroker;
30 /** The mount point service. */
31 private final MountPointService mountPointService;
33 /** The rpc provider registry. */
34 private final RpcProviderRegistry rpcProviderRegistry;
36 /** The get pm registration. */
37 private RpcRegistration<OlmService> olmRPCRegistration;
40 * Instantiates a new olm provider.
44 * @param mountPointService
45 * the mount point service
46 * @param rpcProviderRegistry
47 * the rpc provider registry
49 public OlmProvider(final DataBroker dataBroker, final MountPointService mountPointService,
50 final RpcProviderRegistry rpcProviderRegistry) {
51 this.dataBroker = dataBroker;
52 this.mountPointService = mountPointService;
53 this.rpcProviderRegistry = rpcProviderRegistry;
54 if (mountPointService == null) {
55 LOG.error("Mount service is null");
60 * Method called when the blueprint container is created.
63 LOG.info("OlmProvider Session Initiated");
64 // Initializing Notification module
65 olmRPCRegistration = rpcProviderRegistry.addRpcImplementation(OlmService.class, new OlmPowerSetupImpl(
66 dataBroker,mountPointService));
70 * Method called when the blueprint container is destroyed.
73 LOG.info("RendererProvider Closed");
74 // Clean up the RPC service registration
75 if (olmRPCRegistration != null) {
76 olmRPCRegistration.close();