Modify package structure and pom file
[vfc/nfvo/driver/ems.git] / ems / boco / src / main / java / org / onap / vfc / nfvo / emsdriver / taskscheduler / CollectOderJob.java
1 /**
2  * Copyright 2017 BOCO Corporation.  CMCC Technologies Co., Ltd
3  *
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
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16 package org.onap.vfc.nfvo.emsdriver.taskscheduler;
17
18 import org.apache.commons.logging.Log;
19 import org.apache.commons.logging.LogFactory;
20 import org.onap.vfc.nfvo.emsdriver.commons.constant.Constant;
21 import org.onap.vfc.nfvo.emsdriver.commons.model.CollectMsg;
22 import org.onap.vfc.nfvo.emsdriver.commons.model.CollectVo;
23 import org.onap.vfc.nfvo.emsdriver.commons.utils.DriverThread;
24 import org.onap.vfc.nfvo.emsdriver.messagemgr.MessageChannel;
25 import org.onap.vfc.nfvo.emsdriver.messagemgr.MessageChannelFactory;
26 import org.quartz.Job;
27 import org.quartz.JobExecutionContext;
28 import org.quartz.JobExecutionException;
29
30
31 public class CollectOderJob  implements Job {
32         
33         private Log log = LogFactory.getLog(DriverThread.class);
34         private MessageChannel collectChannel = MessageChannelFactory.getMessageChannel(Constant.COLLECT_CHANNEL_KEY);
35         
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());
44                         
45                         try {
46                                 collectChannel.put(collectMsg);
47                         } catch (InterruptedException e) {
48                                 log.error("collectChannel.put is error ",e);
49                         }
50                 }else{
51                         log.error("collectVo is null, collectMsg is not created! ");
52                 }
53                 
54                 
55         }
56
57 }