Search in sources :

Example 6 with DisconfCenterFile

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

the class DisconfFileCoreProcessorImpl method inject2Conf.

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

Example 7 with DisconfCenterFile

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

the class DisconfFileCoreProcessorImpl method processOneItem.

@Override
public void processOneItem(String key) {
    LOGGER.debug("==============\tstart to process disconf file: " + key + "\t=============================");
    DisconfCenterFile disconfCenterFile = (DisconfCenterFile) disconfStoreProcessor.getConfData(key);
    try {
        updateOneConfFile(key, disconfCenterFile);
    } catch (Exception e) {
        LOGGER.error(e.toString(), e);
    }
}
Also used : DisconfCenterFile(com.baidu.disconf.client.common.model.DisconfCenterFile)

Example 8 with DisconfCenterFile

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

the class DisconfFileCoreProcessorImpl method updateOneConf.

/**
     * 更新消息:某个配置文件
     */
private void updateOneConf(String fileName) throws Exception {
    DisconfCenterFile disconfCenterFile = (DisconfCenterFile) disconfStoreProcessor.getConfData(fileName);
    if (disconfCenterFile != null) {
        // 更新仓库
        updateOneConfFile(fileName, disconfCenterFile);
        // 更新实例
        inject2OneConf(fileName, disconfCenterFile);
    }
}
Also used : DisconfCenterFile(com.baidu.disconf.client.common.model.DisconfCenterFile)

Example 9 with DisconfCenterFile

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

the class DisconfDataGetterDefaultImpl method getByFile.

@Override
public Map<String, Object> getByFile(String fileName) {
    DisconfStoreProcessor disconfStoreProcessor = DisconfStoreProcessorFactory.getDisconfStoreFileProcessor();
    DisconfCenterFile disconfCenterFile = (DisconfCenterFile) disconfStoreProcessor.getConfData(fileName);
    if (disconfCenterFile == null) {
        return new HashMap<String, Object>();
    }
    return disconfCenterFile.getKV();
}
Also used : HashMap(java.util.HashMap) DisconfCenterFile(com.baidu.disconf.client.common.model.DisconfCenterFile) DisconfStoreProcessor(com.baidu.disconf.client.store.DisconfStoreProcessor)

Example 10 with DisconfCenterFile

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

the class DisconfCenterStore method storeOneFile.

/**
     * 存储 一个配置文件
     */
public void storeOneFile(DisconfCenterBaseModel disconfCenterBaseModel) {
    DisconfCenterFile disconfCenterFile = (DisconfCenterFile) disconfCenterBaseModel;
    String fileName = disconfCenterFile.getFileName();
    if (confFileMap.containsKey(fileName)) {
        LOGGER.warn("There are two same fileName key!!!! " + fileName);
        DisconfCenterFile existCenterFile = confFileMap.get(fileName);
        // 如果是 同时使用了 注解式 和 非注解式 两种方式,则当修改时也要 进行 XML 式 reload
        if (disconfCenterFile.isTaggedWithNonAnnotationFile()) {
            existCenterFile.setIsTaggedWithNonAnnotationFile(true);
        }
    } else {
        confFileMap.put(fileName, disconfCenterFile);
    }
}
Also used : DisconfCenterFile(com.baidu.disconf.client.common.model.DisconfCenterFile)

Aggregations

DisconfCenterFile (com.baidu.disconf.client.common.model.DisconfCenterFile)11 FileItemValue (com.baidu.disconf.client.common.model.DisconfCenterFile.FileItemValue)3 DisConfCommonModel (com.baidu.disconf.client.common.model.DisConfCommonModel)2 Method (java.lang.reflect.Method)2 HashMap (java.util.HashMap)2 DisconfFile (com.baidu.disconf.client.common.annotations.DisconfFile)1 DisconfFileItem (com.baidu.disconf.client.common.annotations.DisconfFileItem)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