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
9 package org.opendaylight.transportpce.servicehandler.impl;
11 import org.opendaylight.mdsal.binding.api.DataBroker;
12 import org.opendaylight.mdsal.binding.api.NotificationService;
13 import org.opendaylight.mdsal.binding.api.RpcProviderService;
14 import org.opendaylight.transportpce.servicehandler.listeners.NetworkModelListenerImpl;
15 import org.opendaylight.transportpce.servicehandler.listeners.PceListenerImpl;
16 import org.opendaylight.transportpce.servicehandler.listeners.RendererListenerImpl;
17 import org.opendaylight.transportpce.servicehandler.service.ServiceDataStoreOperations;
18 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkmodel.rev201116.TransportpceNetworkmodelListener;
19 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev210701.TransportpcePceListener;
20 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev201125.TransportpceRendererListener;
21 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.OrgOpenroadmServiceService;
22 import org.opendaylight.yangtools.concepts.ListenerRegistration;
23 import org.opendaylight.yangtools.concepts.ObjectRegistration;
24 import org.slf4j.Logger;
25 import org.slf4j.LoggerFactory;
29 * Servicehandler Service and Notification.
30 * @author Martial Coulibaly ( martial.coulibaly@gfi.com ) on behalf of Orange
33 public class ServicehandlerProvider {
35 private static final Logger LOG = LoggerFactory.getLogger(ServicehandlerProvider.class);
37 private final DataBroker dataBroker;
38 private final RpcProviderService rpcService;
39 private final NotificationService notificationService;
40 private ListenerRegistration<TransportpcePceListener> pcelistenerRegistration;
41 private ListenerRegistration<TransportpceRendererListener> rendererlistenerRegistration;
42 private ListenerRegistration<TransportpceNetworkmodelListener> networkmodellistenerRegistration;
43 private ObjectRegistration<OrgOpenroadmServiceService> rpcRegistration;
44 private ServiceDataStoreOperations serviceDataStoreOperations;
45 private PceListenerImpl pceListenerImpl;
46 private RendererListenerImpl rendererListenerImpl;
47 private NetworkModelListenerImpl networkModelListenerImpl;
48 private ServicehandlerImpl servicehandler;
50 public ServicehandlerProvider(final DataBroker dataBroker, RpcProviderService rpcProviderService,
51 NotificationService notificationService, ServiceDataStoreOperations serviceDataStoreOperations,
52 PceListenerImpl pceListenerImpl, RendererListenerImpl rendererListenerImpl,
53 NetworkModelListenerImpl networkModelListenerImpl, ServicehandlerImpl servicehandler) {
54 this.dataBroker = dataBroker;
55 this.rpcService = rpcProviderService;
56 this.notificationService = notificationService;
57 this.serviceDataStoreOperations = serviceDataStoreOperations;
58 this.serviceDataStoreOperations.initialize();
59 this.pceListenerImpl = pceListenerImpl;
60 this.rendererListenerImpl = rendererListenerImpl;
61 this.networkModelListenerImpl = networkModelListenerImpl;
62 this.servicehandler = servicehandler;
66 * Method called when the blueprint container is created.
69 LOG.info("ServicehandlerProvider Session Initiated");
70 pcelistenerRegistration = notificationService.registerNotificationListener(pceListenerImpl);
71 rendererlistenerRegistration = notificationService.registerNotificationListener(rendererListenerImpl);
72 networkmodellistenerRegistration = notificationService.registerNotificationListener(networkModelListenerImpl);
73 rpcRegistration = rpcService.registerRpcImplementation(OrgOpenroadmServiceService.class, servicehandler);
77 * Method called when the blueprint container is destroyed.
80 LOG.info("ServicehandlerProvider Closed");
81 pcelistenerRegistration.close();
82 rendererlistenerRegistration.close();
83 networkmodellistenerRegistration.close();
84 rpcRegistration.close();