2 * Copyright 2017 BOCO Corporation. CMCC Technologies Co., Ltd
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package org.onap.vfc.nfvo.emsdriver.collector.alarm;
17 import java.util.ArrayList;
18 import java.util.List;
20 import org.onap.vfc.nfvo.emsdriver.commons.constant.Constant;
21 import org.onap.vfc.nfvo.emsdriver.commons.model.CollectVo;
22 import org.onap.vfc.nfvo.emsdriver.commons.model.EMSInfo;
23 import org.onap.vfc.nfvo.emsdriver.commons.utils.DriverThread;
24 import org.onap.vfc.nfvo.emsdriver.configmgr.ConfigurationInterface;
26 public class AlarmManager extends DriverThread{
28 private ConfigurationInterface configurationInterface;
31 public void dispose() {
32 log.debug("AlarmManager is start");
34 List<EMSInfo> emsInfos = configurationInterface.getAllEMSInfo();
35 while(isRun() && emsInfos.size() == 0){
36 emsInfos = configurationInterface.getAllEMSInfo();
37 if(emsInfos.size() == 0){
40 log.debug("config is not load");
41 } catch (InterruptedException e) {
45 List<CollectVo> collectVos = new ArrayList<CollectVo>();
46 for(EMSInfo emsInfo : emsInfos){
48 CollectVo CollectVo = emsInfo.getCollectVoByType(Constant.COLLECT_TYPE_ALARM);
49 if(CollectVo != null){
50 CollectVo.setEmsName(emsInfo.getName());
51 collectVos.add(CollectVo);
55 for(CollectVo collectVo : collectVos){
56 AlarmTaskThread alarm = new AlarmTaskThread(collectVo);
57 alarm.setName(collectVo.getIP()+collectVo.getPort());
64 * @return the configurationInterface
66 public ConfigurationInterface getConfigurationInterface() {
67 return configurationInterface;
71 * @param configurationInterface the configurationInterface to set
73 public void setConfigurationInterface(
74 ConfigurationInterface configurationInterface) {
75 this.configurationInterface = configurationInterface;