412d46657612431eff53d450af8ceb5086f6516b
[ccsdk/sli.git] /
1 /*
2  * ============LICENSE_START==========================================
3  * Copyright (c) 2019 PANTHEON.tech s.r.o.
4  * ===================================================================
5  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
6  * the License. You may obtain a copy of the License at
7  *
8  *        http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
11  * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
12  * OF ANY KIND, either express or implied. See the License for the specific language governing permissions and
13  * limitations under the License.
14  * ============LICENSE_END============================================
15  *
16  */
17 package org.onap.ccsdk.sli.northbound.dataChange.lighty;
18
19 import io.lighty.core.controller.api.AbstractLightyModule;
20 import io.lighty.core.controller.api.LightyModule;
21 import org.onap.ccsdk.sli.core.sli.provider.SvcLogicService;
22 import org.onap.ccsdk.sli.northbound.DataChangeClient;
23 import org.onap.ccsdk.sli.northbound.DataChangeProvider;
24 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
25 import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
26 import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
27
28 /**
29  * The implementation of the {@link io.lighty.core.controller.api.LightyModule} that manages and provides services from
30  * the dataChange-provider artifact.
31  */
32 public class DataChangeModule extends AbstractLightyModule implements LightyModule {
33
34     private final SvcLogicService svcLogicService;
35     private final DataBroker dataBroker;
36     private final NotificationPublishService publishService;
37     private final RpcProviderRegistry rpcRegistry;
38
39     private DataChangeClient dataChangeClient;
40     private DataChangeProvider dataChangeProvider;
41
42     public DataChangeModule(SvcLogicService svcLogicService, DataBroker dataBroker,
43             NotificationPublishService publishService, RpcProviderRegistry rpcRegistry) {
44         this.svcLogicService = svcLogicService;
45         this.dataBroker = dataBroker;
46         this.publishService = publishService;
47         this.rpcRegistry = rpcRegistry;
48     }
49
50     @Override
51     protected boolean initProcedure() {
52         this.dataChangeClient = new DataChangeClient(svcLogicService);
53         this.dataChangeProvider = new DataChangeProvider(dataBroker, publishService, rpcRegistry, dataChangeClient);
54         return true;
55     }
56
57     @Override
58     protected boolean stopProcedure() {
59         return true;
60     }
61
62 }