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.rev200128.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;
51 public ServicehandlerProvider(final DataBroker dataBroker, RpcProviderService rpcProviderService,
52 NotificationService notificationService, ServiceDataStoreOperations serviceDataStoreOperations,
53 PceListenerImpl pceListenerImpl, RendererListenerImpl rendererListenerImpl,
54 NetworkModelListenerImpl networkModelListenerImpl, ServicehandlerImpl servicehandler) {
55 this.dataBroker = dataBroker;
56 this.rpcService = rpcProviderService;
57 this.notificationService = notificationService;
58 this.serviceDataStoreOperations = serviceDataStoreOperations;
59 this.serviceDataStoreOperations.initialize();
60 this.pceListenerImpl = pceListenerImpl;
61 this.rendererListenerImpl = rendererListenerImpl;
62 this.networkModelListenerImpl = networkModelListenerImpl;
63 this.servicehandler = servicehandler;
67 * Method called when the blueprint container is created.
70 LOG.info("ServicehandlerProvider Session Initiated");
71 pcelistenerRegistration = notificationService.registerNotificationListener(pceListenerImpl);
72 rendererlistenerRegistration = notificationService.registerNotificationListener(rendererListenerImpl);
73 networkmodellistenerRegistration = notificationService.registerNotificationListener(networkModelListenerImpl);
74 rpcRegistration = rpcService.registerRpcImplementation(OrgOpenroadmServiceService.class, servicehandler);
78 * Method called when the blueprint container is destroyed.
81 LOG.info("ServicehandlerProvider Closed");
82 pcelistenerRegistration.close();
83 rendererlistenerRegistration.close();
84 networkmodellistenerRegistration.close();
85 rpcRegistration.close();