1 /*******************************************************************************
2 * ============LICENSE_START========================================================================
3 * ONAP : ccsdk feature sdnr wt
4 * =================================================================================================
5 * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
6 * =================================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
8 * in compliance with the License. You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software distributed under the License
13 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
14 * or implied. See the License for the specific language governing permissions and limitations under
16 * ============LICENSE_END==========================================================================
17 ******************************************************************************/
18 package org.onap.ccsdk.features.sdnr.wt.dataprovider.impl;
20 import org.onap.ccsdk.features.sdnr.wt.common.database.HtDatabaseClient;
21 import org.onap.ccsdk.features.sdnr.wt.dataprovider.http.ReadyHttpServlet;
22 import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider;
23 import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.IEntityDataProvider;
24 import org.opendaylight.mdsal.binding.api.RpcProviderService;
25 import org.slf4j.Logger;
26 import org.slf4j.LoggerFactory;
28 public class DataProviderImpl implements IEntityDataProvider, AutoCloseable {
30 private static final Logger LOG = LoggerFactory.getLogger(DataProviderImpl.class);
32 private static final String APPLICATION_NAME = null;
33 private RpcProviderService rpcProviderService = null;
34 private DataProviderServiceImpl rpcApiService;
35 private ReadyHttpServlet readyServlet;
36 private HtDatabaseClient dbClient;
40 public DataProviderImpl() {
41 LOG.info("Creating provider for {}", APPLICATION_NAME);
44 public void setRpcProviderService(RpcProviderService rpcProviderService) {
45 this.rpcProviderService = rpcProviderService;
47 public void setReadyServlet(ReadyHttpServlet readyServlet) {
48 this.readyServlet = readyServlet;
50 public void init() throws Exception {
52 LOG.info("Session Initiated start {}", APPLICATION_NAME);
55 this.rpcApiService = new DataProviderServiceImpl(rpcProviderService);
58 LOG.info("Session Initiated end. Initialization done");
62 public void close() throws Exception {
63 LOG.info("DeviceManagerImpl closing ...");
67 LOG.info("DeviceManagerImpl closing done");
71 * Used to close all Services, that should support AutoCloseable Pattern
76 private void close(AutoCloseable... toCloseList) throws Exception {
77 for (AutoCloseable element : toCloseList) {
78 if (element != null) {
85 public DataProvider getDataProvider() {
86 return rpcApiService.getDataProvider();
90 public void setReadyStatus(boolean status) {
91 if(this.readyServlet!=null) {
92 this.readyServlet.setStatus(status);