SDN-R update common
[ccsdk/features.git] / sdnr / wt / devicemanager / provider / src / main / java / org / onap / ccsdk / features / sdnr / wt / devicemanager / toggleAlarmFilter / NotificationDelayService.java
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/toggleAlarmFilter/NotificationDelayService.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/toggleAlarmFilter/NotificationDelayService.java
deleted file mode 100644 (file)
index a9a0459..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- ******************************************************************************/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.toggleAlarmFilter;
-
-import java.util.HashMap;
-
-import org.onap.ccsdk.features.sdnr.wt.common.configuration.ConfigurationFileRepresentation;
-import org.onap.ccsdk.features.sdnr.wt.common.configuration.filechange.IConfigChangedListener;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.DeviceManagerService;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.toggleAlarmFilter.conf.ToggleAlarmConfig;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class NotificationDelayService<T> implements DeviceManagerService, AutoCloseable, IConfigChangedListener {
-    private static final Logger LOG = LoggerFactory.getLogger(NotificationDelayService.class);
-
-    private final HashMap<String, NotificationDelayFilter<T>> filters;
-    private final ToggleAlarmConfig config;
-
-    public NotificationDelayService(ConfigurationFileRepresentation htconfig) {
-        this.filters = new HashMap<>();
-        htconfig.registerConfigChangedListener(this);
-        config = new ToggleAlarmConfig(htconfig);
-        onConfigChanged();
-    }
-
-    public NotificationDelayFilter<T> getInstance(String nodeName, NotificationDelayedListener<T> eventListener) {
-        NotificationDelayFilter<T> filter = filters.getOrDefault(nodeName, null);
-
-        LOG.trace("nodeName={}, filter!=null? {}", nodeName, filter != null);
-        if (filter == null) {
-            filter = new NotificationDelayFilter<>(nodeName, eventListener);
-            this.filters.put(nodeName, filter);
-        }
-        return filter;
-    }
-
-    @Override
-    public void onConfigChanged() {
-        NotificationDelayFilter.setDelay(config.getDelay());
-        NotificationDelayFilter.setEnabled(config.isEnabled());
-    }
-
-    @Override
-    public void close() throws Exception {
-        // close all filters
-        for (NotificationDelayFilter<T> filter : this.filters.values()) {
-            filter.close();
-        }
-    }
-
-}