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.NotificationPublishService;
13 import org.opendaylight.mdsal.binding.api.NotificationService;
14 import org.opendaylight.mdsal.binding.api.RpcProviderService;
15 import org.opendaylight.transportpce.pce.service.PathComputationService;
16 import org.opendaylight.transportpce.renderer.provisiondevice.RendererServiceOperations;
17 import org.opendaylight.transportpce.servicehandler.listeners.NetworkModelListenerImpl;
18 import org.opendaylight.transportpce.servicehandler.listeners.PceListenerImpl;
19 import org.opendaylight.transportpce.servicehandler.listeners.RendererListenerImpl;
20 import org.opendaylight.transportpce.servicehandler.service.ServiceDataStoreOperations;
21 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkmodel.rev201116.TransportpceNetworkmodelListener;
22 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev200128.TransportpcePceListener;
23 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev201125.TransportpceRendererListener;
24 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.OrgOpenroadmServiceService;
25 import org.opendaylight.yangtools.concepts.ListenerRegistration;
26 import org.opendaylight.yangtools.concepts.ObjectRegistration;
27 import org.slf4j.Logger;
28 import org.slf4j.LoggerFactory;
32 * Servicehandler Service and Notification.
33 * @author Martial Coulibaly ( martial.coulibaly@gfi.com ) on behalf of Orange
36 public class ServicehandlerProvider {
38 private static final Logger LOG = LoggerFactory.getLogger(ServicehandlerProvider.class);
40 private final DataBroker dataBroker;
41 private final RpcProviderService rpcService;
42 private final NotificationService notificationService;
43 private final NotificationPublishService notificationPublishService;
44 private ListenerRegistration<TransportpcePceListener> pcelistenerRegistration;
45 private ListenerRegistration<TransportpceRendererListener> rendererlistenerRegistration;
46 private ListenerRegistration<TransportpceNetworkmodelListener> networkmodellistenerRegistration;
47 private ObjectRegistration<OrgOpenroadmServiceService> rpcRegistration;
48 private PathComputationService pathComputationService;
49 private RendererServiceOperations rendererServiceOperations;
50 private ServiceDataStoreOperations serviceDataStoreOperations;
52 public ServicehandlerProvider(final DataBroker dataBroker, RpcProviderService rpcProviderService,
53 NotificationService notificationService, PathComputationService pathComputationService,
54 RendererServiceOperations rendererServiceOperations,
55 NotificationPublishService notificationPublishService,
56 ServiceDataStoreOperations serviceDataStoreOperations) {
57 this.dataBroker = dataBroker;
58 this.rpcService = rpcProviderService;
59 this.notificationService = notificationService;
60 this.pathComputationService = pathComputationService;
61 this.rendererServiceOperations = rendererServiceOperations;
62 this.notificationPublishService = notificationPublishService;
63 this.serviceDataStoreOperations = serviceDataStoreOperations;
64 this.serviceDataStoreOperations.initialize();
68 * Method called when the blueprint container is created.
71 LOG.info("ServicehandlerProvider Session Initiated");
72 final PceListenerImpl pceListenerImpl = new PceListenerImpl(rendererServiceOperations,
73 pathComputationService, notificationPublishService, serviceDataStoreOperations);
74 final RendererListenerImpl rendererListenerImpl =
75 new RendererListenerImpl(pathComputationService, notificationPublishService);
76 final NetworkModelListenerImpl networkModelListenerImpl =
77 new NetworkModelListenerImpl(notificationPublishService, serviceDataStoreOperations);
78 pcelistenerRegistration = notificationService.registerNotificationListener(pceListenerImpl);
79 rendererlistenerRegistration = notificationService.registerNotificationListener(rendererListenerImpl);
80 networkmodellistenerRegistration = notificationService.registerNotificationListener(networkModelListenerImpl);
81 final ServicehandlerImpl servicehandler = new ServicehandlerImpl(dataBroker, pathComputationService,
82 rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
83 networkModelListenerImpl, serviceDataStoreOperations);
85 rpcService.registerRpcImplementation(OrgOpenroadmServiceService.class, servicehandler);
89 * Method called when the blueprint container is destroyed.
92 LOG.info("ServicehandlerProvider Closed");
93 pcelistenerRegistration.close();
94 rendererlistenerRegistration.close();
95 networkmodellistenerRegistration.close();
96 rpcRegistration.close();