252506453dde6deb6bf4f6137c32e0acf775d147
[vfc/nfvo/resmanagement.git] /
1 /*
2  * Copyright 2016 Huawei 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
17 package org.onap.vfc.nfvo.resmanagement.service.activator;
18
19 import org.onap.vfc.nfvo.resmanagement.service.adapter.inf.IResmgrAdapterMgrService;
20 import org.slf4j.Logger;
21 import org.slf4j.LoggerFactory;
22 import org.springframework.beans.BeansException;
23 import org.springframework.beans.factory.config.DestructionAwareBeanPostProcessor;
24
25 /**
26  * <br>
27  * <p>
28  * </p>
29  * 
30  * @author
31  * @version NFVO 0.5 Sep 22, 2016
32  */
33 public class ROAResmgrServicePostProcessor implements DestructionAwareBeanPostProcessor {
34
35     private static final Logger LOG = LoggerFactory.getLogger(ROAResmgrServicePostProcessor.class);
36
37     @Override
38     public Object postProcessAfterInitialization(Object bean, String name) throws BeansException {
39         if(bean instanceof IResmgrAdapterMgrService) {
40             LOG.warn("Register to Microservice BUS!");
41             IResmgrAdapterMgrService resmgrAdapterSvc = (IResmgrAdapterMgrService)bean;
42             resmgrAdapterSvc.register();
43         }
44
45         return bean;
46     }
47
48     @Override
49     public Object postProcessBeforeInitialization(Object bean, String name) throws BeansException {
50         // TODO Auto-generated method stub
51         return bean;
52     }
53
54     @Override
55     public void postProcessBeforeDestruction(Object bean, String name) throws BeansException {
56         // TODO Auto-generated method stub
57
58     }
59
60 }