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.stubrenderer.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.transportpce.b.c._interface.servicepath.rev170426.TransportpceServicepathListener;
17 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.TransportpceServicepathService;
18 import org.opendaylight.yangtools.concepts.ListenerRegistration;
19 import org.slf4j.Logger;
20 import org.slf4j.LoggerFactory;
23 * Class to register Stubrenderer Service and Notification.
24 * @author <a href="mailto:martial.coulibaly@gfi.com">Martial Coulibaly</a> on behalf of Orange
27 public class StubrendererProvider {
28 private static final Logger LOG = LoggerFactory.getLogger(StubrendererProvider.class);
29 private final RpcProviderRegistry rpcRegistry;
30 private final NotificationPublishService notificationPublishService;
33 private BindingAwareBroker.RpcRegistration<TransportpceServicepathService> rpcRegistration;
34 private ListenerRegistration<TransportpceServicepathListener> stubRendererlistenerRegistration;
36 public StubrendererProvider(RpcProviderRegistry rpcProviderRegistry,
37 NotificationService notificationService,
38 NotificationPublishService notificationPublishService) {
39 this.rpcRegistry = rpcProviderRegistry;
40 this.notificationPublishService = notificationPublishService;
44 * Method called when the blueprint container is created.
47 LOG.info("StubrendererProvider Session Initiated");
48 final StubrendererImpl consumer = new StubrendererImpl(notificationPublishService);
49 rpcRegistration = rpcRegistry.addRpcImplementation(TransportpceServicepathService.class, consumer);
53 * Method called when the blueprint container is destroyed.
56 LOG.info("StubrendererProvider Closed");
57 rpcRegistration.close();
58 stubRendererlistenerRegistration.close();