Search in sources :

Example 6 with DisconfCenterItem

use of com.baidu.disconf.client.common.model.DisconfCenterItem in project disconf by knightliao.

the class DisconfItemCoreProcessorImpl method inject2Conf.

/**
 */
@Override
public void inject2Conf() {
    /**
     * 配置ITEM列表处理
     */
    for (String key : disconfStoreProcessor.getConfKeySet()) {
        LOGGER.debug("==============\tstart to inject value to disconf item instance: " + key + "\t=============================");
        DisconfCenterItem disconfCenterItem = (DisconfCenterItem) disconfStoreProcessor.getConfData(key);
        inject2OneConf(key, disconfCenterItem);
    }
}
Also used : DisconfCenterItem(com.baidu.disconf.client.common.model.DisconfCenterItem)

Example 7 with DisconfCenterItem

use of com.baidu.disconf.client.common.model.DisconfCenterItem in project disconf by knightliao.

the class DisconfItemCoreProcessorImpl method processOneItem.

@Override
public void processOneItem(String key) {
    LOGGER.debug("==============\tstart to process disconf item: " + key + "\t=============================");
    DisconfCenterItem disconfCenterItem = (DisconfCenterItem) disconfStoreProcessor.getConfData(key);
    if (disconfCenterItem != null) {
        try {
            updateOneConfItem(key, disconfCenterItem);
        } catch (Exception e) {
            LOGGER.error(e.toString(), e);
        }
    }
}
Also used : DisconfCenterItem(com.baidu.disconf.client.common.model.DisconfCenterItem)

Example 8 with DisconfCenterItem

use of com.baidu.disconf.client.common.model.DisconfCenterItem in project disconf by knightliao.

the class DisconfDataGetterDefaultImpl method getByItem.

@Override
public Object getByItem(String itemName) {
    DisconfStoreProcessor disconfStoreProcessor = DisconfStoreProcessorFactory.getDisconfStoreItemProcessor();
    DisconfCenterItem disconfCenterItem = (DisconfCenterItem) disconfStoreProcessor.getConfData(itemName);
    if (disconfCenterItem == null) {
        return null;
    }
    return disconfCenterItem.getValue();
}
Also used : DisconfCenterItem(com.baidu.disconf.client.common.model.DisconfCenterItem) DisconfStoreProcessor(com.baidu.disconf.client.store.DisconfStoreProcessor)

Example 9 with DisconfCenterItem

use of com.baidu.disconf.client.common.model.DisconfCenterItem in project disconf by knightliao.

the class DisconfCenterStore method storeOneItem.

/**
 * 存储 一个配置项
 */
public void storeOneItem(DisconfCenterBaseModel disconfCenterBaseModel) {
    DisconfCenterItem disconfCenterItem = (DisconfCenterItem) disconfCenterBaseModel;
    String key = disconfCenterItem.getKey();
    if (confItemMap.containsKey(key)) {
        LOGGER.error("There are two same item key!!!! " + "first: " + confItemMap.get(key).getClass().toString() + ", Second: " + disconfCenterItem.getClass().toString());
    } else {
        confItemMap.put(key, disconfCenterItem);
    }
}
Also used : DisconfCenterItem(com.baidu.disconf.client.common.model.DisconfCenterItem)

Example 10 with DisconfCenterItem

use of com.baidu.disconf.client.common.model.DisconfCenterItem in project disconf by knightliao.

the class StaticScannerItemMgrImpl method getDisconfItems.

/**
 * 转换配置项
 */
private static List<DisconfCenterBaseModel> getDisconfItems(ScanStaticModel scanModel) {
    List<DisconfCenterBaseModel> disconfCenterItems = new ArrayList<DisconfCenterBaseModel>();
    Set<Method> methods = scanModel.getDisconfItemMethodSet();
    for (Method method : methods) {
        DisconfCenterItem disconfCenterItem = transformScanItem(method);
        if (disconfCenterItem != null) {
            disconfCenterItems.add(disconfCenterItem);
        }
    }
    return disconfCenterItems;
}
Also used : DisconfCenterItem(com.baidu.disconf.client.common.model.DisconfCenterItem) ArrayList(java.util.ArrayList) DisconfCenterBaseModel(com.baidu.disconf.client.common.model.DisconfCenterBaseModel) Method(java.lang.reflect.Method)

Aggregations

DisconfCenterItem (com.baidu.disconf.client.common.model.DisconfCenterItem)10 Method (java.lang.reflect.Method)2 DisconfItem (com.baidu.disconf.client.common.annotations.DisconfItem)1 DisConfCommonModel (com.baidu.disconf.client.common.model.DisConfCommonModel)1 DisconfCenterBaseModel (com.baidu.disconf.client.common.model.DisconfCenterBaseModel)1 IDisconfUpdatePipeline (com.baidu.disconf.client.common.update.IDisconfUpdatePipeline)1 DisconfStoreProcessor (com.baidu.disconf.client.store.DisconfStoreProcessor)1 Field (java.lang.reflect.Field)1 ArrayList (java.util.ArrayList)1