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.nfvo.emsdriver.taskscheduler;
18 import org.apache.commons.logging.Log;
19 import org.apache.commons.logging.LogFactory;
20 import org.onap.nfvo.emsdriver.commons.constant.Constant;
21 import org.onap.nfvo.emsdriver.commons.model.CollectMsg;
22 import org.onap.nfvo.emsdriver.commons.model.CollectVo;
23 import org.onap.nfvo.emsdriver.commons.utils.DriverThread;
24 import org.onap.nfvo.emsdriver.messagemgr.MessageChannel;
25 import org.onap.nfvo.emsdriver.messagemgr.MessageChannelFactory;
26 import org.quartz.Job;
27 import org.quartz.JobExecutionContext;
28 import org.quartz.JobExecutionException;
31 public class CollectOderJob implements Job {
33 private Log log = LogFactory.getLog(DriverThread.class);
34 private MessageChannel collectChannel = MessageChannelFactory.getMessageChannel(Constant.COLLECT_CHANNEL_KEY);
36 public void execute(JobExecutionContext context) throws JobExecutionException {
37 // TODO Auto-generated method stub
38 CollectVo collectVo = (CollectVo)context.getJobDetail().getJobDataMap().get("collectVo");
39 if(collectVo != null){
40 CollectMsg collectMsg = new CollectMsg();
41 collectMsg.setEmsName(collectVo.getEmsName());
42 collectMsg.setId(System.nanoTime());
43 collectMsg.setType(collectVo.getType());
46 collectChannel.put(collectMsg);
47 } catch (InterruptedException e) {
48 log.error("collectChannel.put is error ",e);
51 log.error("collectVo is null, collectMsg is not created! ");