2 * Copyright © 2017 Orange, Inc. 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
10 package org.opendaylight.transportpce.stubpce.impl;
12 import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
13 import org.opendaylight.controller.md.sal.binding.api.NotificationService;
14 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
15 import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
16 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.StubpceListener;
17 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.StubpceService;
18 import org.opendaylight.yangtools.concepts.ListenerRegistration;
19 import org.slf4j.Logger;
20 import org.slf4j.LoggerFactory;
24 * Stubpce Service & Notification.
25 * @author Martial Coulibaly ( martial.coulibaly@gfi.com ) on behalf of Orange
28 public class StubpceProvider {
29 private static final Logger LOG = LoggerFactory.getLogger(StubpceProvider.class);
30 private final RpcProviderRegistry rpcRegistry;
31 private final NotificationPublishService notificationPublishService;
34 private BindingAwareBroker.RpcRegistration<StubpceService> rpcRegistration;
35 private ListenerRegistration<StubpceListener> stubPcelistenerRegistration;
37 public StubpceProvider(RpcProviderRegistry rpcProviderRegistry,
38 NotificationService notificationService,
39 NotificationPublishService notificationPublishService) {
40 this.rpcRegistry = rpcProviderRegistry;
41 this.notificationPublishService = notificationPublishService;
45 * Method called when the blueprint container is created.
48 LOG.info("StubpceProvider Session Initiated");
49 final StubpceImpl consumer = new StubpceImpl(notificationPublishService);
50 rpcRegistration = rpcRegistry.addRpcImplementation(StubpceService.class, consumer);
54 * Method called when the blueprint container is destroyed.
57 LOG.info("StubpceProvider Closed");
58 rpcRegistration.close();
59 stubPcelistenerRegistration.close();