當前位置: 首頁>>代碼示例>>Java>>正文


Java DisconfCenterFile類代碼示例

本文整理匯總了Java中com.baidu.disconf.client.common.model.DisconfCenterFile的典型用法代碼示例。如果您正苦於以下問題:Java DisconfCenterFile類的具體用法?Java DisconfCenterFile怎麽用?Java DisconfCenterFile使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


DisconfCenterFile類屬於com.baidu.disconf.client.common.model包,在下文中一共展示了DisconfCenterFile類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getDisconfFiles

import com.baidu.disconf.client.common.model.DisconfCenterFile; //導入依賴的package包/類
/**
 * 獲取配置文件數據
 */
private static List<DisconfCenterBaseModel> getDisconfFiles(ScanStaticModel scanModel) {

    List<DisconfCenterBaseModel> disconfCenterFiles = new ArrayList<DisconfCenterBaseModel>();

    Set<Class<?>> classSet = scanModel.getDisconfFileClassSet();
    for (Class<?> disconfFile : classSet) {

        Set<Method> methods = scanModel.getDisconfFileItemMap().get(disconfFile);
        if (methods == null) {
            continue;
        }

        DisconfCenterFile disconfCenterFile = transformScanFile(disconfFile, methods);

        disconfCenterFiles.add(disconfCenterFile);
    }

    return disconfCenterFiles;
}
 
開發者ID:knightliao,項目名稱:disconf,代碼行數:23,代碼來源:StaticScannerFileMgrImpl.java

示例2: callUpdatePipeline

import com.baidu.disconf.client.common.model.DisconfCenterFile; //導入依賴的package包/類
/**
 * @param key
 */
private void callUpdatePipeline(String key) {

    Object object = disconfStoreProcessor.getConfData(key);
    if (object != null) {
        DisconfCenterFile disconfCenterFile = (DisconfCenterFile) object;

        IDisconfUpdatePipeline iDisconfUpdatePipeline =
                DisconfCenterStore.getInstance().getiDisconfUpdatePipeline();
        if (iDisconfUpdatePipeline != null) {
            try {
                iDisconfUpdatePipeline.reloadDisconfFile(key, disconfCenterFile.getFilePath());
            } catch (Exception e) {
                LOGGER.error(e.toString(), e);
            }
        }
    }
}
 
開發者ID:knightliao,項目名稱:disconf,代碼行數:21,代碼來源:DisconfFileCoreProcessorImpl.java

示例3: inject2Conf

import com.baidu.disconf.client.common.model.DisconfCenterFile; //導入依賴的package包/類
@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);
    }
}
 
開發者ID:knightliao,項目名稱:disconf,代碼行數:17,代碼來源:DisconfFileCoreProcessorImpl.java

示例4: getConfig

import com.baidu.disconf.client.common.model.DisconfCenterFile; //導入依賴的package包/類
/**
 *
 */
@Override
public Object getConfig(String fileName, String keyName) {

    DisconfCenterFile disconfCenterFile = getInstance().getConfFileMap().get(fileName);

    // 校驗是否存在
    if (disconfCenterFile == null) {
        LOGGER.debug("cannot find " + fileName + " in store....");
        return null;
    }

    if (disconfCenterFile.getKeyMaps().get(keyName) == null) {
        LOGGER.debug("cannot find " + fileName + ", " + keyName + " in store....");
        return null;
    }

    return disconfCenterFile.getKeyMaps().get(keyName).getValue();
}
 
開發者ID:knightliao,項目名稱:disconf,代碼行數:22,代碼來源:DisconfStoreFileProcessorImpl.java

示例5: confToString

import com.baidu.disconf.client.common.model.DisconfCenterFile; //導入依賴的package包/類
/**
 *
 */
@Override
public String confToString() {

    StringBuffer sBuffer = new StringBuffer();
    sBuffer.append("\n");
    Map<String, DisconfCenterFile> disMap = getInstance().getConfFileMap();
    for (String file : disMap.keySet()) {
        sBuffer.append("disconf-file:\t" + file + "\t");

        if (LOGGER.isDebugEnabled()) {
            sBuffer.append(disMap.get(file).toString());
        } else {
            sBuffer.append(disMap.get(file).infoString());
        }
        sBuffer.append("\n");
    }

    return sBuffer.toString();
}
 
開發者ID:knightliao,項目名稱:disconf,代碼行數:23,代碼來源:DisconfStoreFileProcessorImpl.java

示例6: storeOneFile

import com.baidu.disconf.client.common.model.DisconfCenterFile; //導入依賴的package包/類
/**
 * 存儲 一個配置文件
 */
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);
    }
}
 
開發者ID:knightliao,項目名稱:disconf,代碼行數:24,代碼來源:DisconfCenterStore.java

示例7: getByFile

import com.baidu.disconf.client.common.model.DisconfCenterFile; //導入依賴的package包/類
@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();
}
 
開發者ID:ningyu1,項目名稱:disconf-client-ext,代碼行數:14,代碼來源:DisconfDataGetterDefaultImpl.java

示例8: getDisconfCenterFile

import com.baidu.disconf.client.common.model.DisconfCenterFile; //導入依賴的package包/類
/**
 *
 */
public static DisconfCenterBaseModel getDisconfCenterFile(String fileName) {

    DisconfCenterFile disconfCenterFile = new DisconfCenterFile();

    fileName = fileName.trim();

    //
    // file name
    disconfCenterFile.setFileName(fileName);

    // file type
    disconfCenterFile.setSupportFileTypeEnum(SupportFileTypeEnum.getByFileName(fileName));

    //
    // disConfCommonModel
    DisConfCommonModel disConfCommonModel = makeDisConfCommonModel(DisClientConfigExt.GLOBAL_APP, "", DisClientConfigExt.GLOBAL_VERSION);
    disconfCenterFile.setDisConfCommonModel(disConfCommonModel);

    // Remote URL
    String url = DisconfWebPathMgr.getRemoteUrlParameter(DisClientSysConfig.getInstance().CONF_SERVER_STORE_ACTION,
            disConfCommonModel.getApp(),
            disConfCommonModel.getVersion(),
            disConfCommonModel.getEnv(),
            disconfCenterFile.getFileName(),
            DisConfigTypeEnum.FILE);
    disconfCenterFile.setRemoteServerUrl(url);

    return disconfCenterFile;
}
 
開發者ID:ningyu1,項目名稱:disconf-client-ext,代碼行數:33,代碼來源:StaticScannerNonAnnotationFileMgrImplExt.java

示例9: getDisconfCenterFile

import com.baidu.disconf.client.common.model.DisconfCenterFile; //導入依賴的package包/類
/**
 *
 */
public static DisconfCenterBaseModel getDisconfCenterFile(String fileName) {

    DisconfCenterFile disconfCenterFile = new DisconfCenterFile();

    fileName = fileName.trim();

    //
    // file name
    disconfCenterFile.setFileName(fileName);

    // 非注解式
    disconfCenterFile.setIsTaggedWithNonAnnotationFile(true);

    // file type
    disconfCenterFile.setSupportFileTypeEnum(SupportFileTypeEnum.getByFileName(fileName));

    //
    // disConfCommonModel
    DisConfCommonModel disConfCommonModel = makeDisConfCommonModel("", "", "");
    disconfCenterFile.setDisConfCommonModel(disConfCommonModel);

    // Remote URL
    String url = DisconfWebPathMgr.getRemoteUrlParameter(DisClientSysConfig.getInstance().CONF_SERVER_STORE_ACTION,
            disConfCommonModel.getApp(),
            disConfCommonModel.getVersion(),
            disConfCommonModel.getEnv(),
            disconfCenterFile.getFileName(),
            DisConfigTypeEnum.FILE);
    disconfCenterFile.setRemoteServerUrl(url);

    return disconfCenterFile;
}
 
開發者ID:knightliao,項目名稱:disconf,代碼行數:36,代碼來源:StaticScannerNonAnnotationFileMgrImpl.java

示例10: processOneItem

import com.baidu.disconf.client.common.model.DisconfCenterFile; //導入依賴的package包/類
@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);
    }
}
 
開發者ID:knightliao,項目名稱:disconf,代碼行數:15,代碼來源:DisconfFileCoreProcessorImpl.java

示例11: updateOneConf

import com.baidu.disconf.client.common.model.DisconfCenterFile; //導入依賴的package包/類
/**
 * 更新消息:某個配置文件
 */
private void updateOneConf(String fileName) throws Exception {

    DisconfCenterFile disconfCenterFile = (DisconfCenterFile) disconfStoreProcessor.getConfData(fileName);

    if (disconfCenterFile != null) {

        // 更新倉庫
        updateOneConfFile(fileName, disconfCenterFile);

        // 更新實例
        inject2OneConf(fileName, disconfCenterFile);
    }
}
 
開發者ID:knightliao,項目名稱:disconf,代碼行數:17,代碼來源:DisconfFileCoreProcessorImpl.java

示例12: getCommonModel

import com.baidu.disconf.client.common.model.DisconfCenterFile; //導入依賴的package包/類
/**
 *
 */
@Override
public DisConfCommonModel getCommonModel(String keyName) {

    DisconfCenterFile disconfCenterFile = getInstance().getConfFileMap().get(keyName);

    // 校驗是否存在
    if (disconfCenterFile == null) {
        LOGGER.error("cannot find " + keyName + " in store....");
        return null;
    }

    return disconfCenterFile.getDisConfCommonModel();
}
 
開發者ID:knightliao,項目名稱:disconf,代碼行數:17,代碼來源:DisconfStoreFileProcessorImpl.java

示例13: inject2Instance

import com.baidu.disconf.client.common.model.DisconfCenterFile; //導入依賴的package包/類
/**
 *
 */
@Override
public void inject2Instance(Object object, String fileName) {

    DisconfCenterFile disconfCenterFile = getInstance().getConfFileMap().get(fileName);

    // 校驗是否存在
    if (disconfCenterFile == null) {
        LOGGER.error("cannot find " + fileName + " in store....");
        return;
    }

    //
    // 靜態類
    //
    if (object != null) {
        // 設置object
        disconfCenterFile.setObject(object);
    }

    // 根據類型設置值
    //
    // 注入實體
    //
    Map<String, FileItemValue> keMap = disconfCenterFile.getKeyMaps();
    for (String fileItem : keMap.keySet()) {

        // 根據類型設置值
        try {

            //
            // 靜態類
            //
            if (object == null) {

                if (keMap.get(fileItem).isStatic()) {
                    LOGGER.debug(fileItem + " is a static field. ");
                    keMap.get(fileItem).setValue4StaticFileItem(keMap.get(fileItem).getValue());
                }

                //
                // 非靜態類
                //
            } else {

                LOGGER.debug(fileItem + " is a non-static field. ");

                if (keMap.get(fileItem).getValue() == null) {

                    // 如果倉庫值為空,則實例 直接使用默認值
                    Object defaultValue = keMap.get(fileItem).getFieldDefaultValue(object);
                    keMap.get(fileItem).setValue(defaultValue);

                } else {

                    // 如果倉庫裏的值為非空,則實例使用倉庫裏的值
                    keMap.get(fileItem).setValue4FileItem(object, keMap.get(fileItem).getValue());
                }
            }

        } catch (Exception e) {
            LOGGER.error("inject2Instance fileName " + fileName + " " + e.toString(), e);
        }
    }
}
 
開發者ID:knightliao,項目名稱:disconf,代碼行數:68,代碼來源:DisconfStoreFileProcessorImpl.java

示例14: inject2Store

import com.baidu.disconf.client.common.model.DisconfCenterFile; //導入依賴的package包/類
/**
 *
 */
@Override
public void inject2Store(String fileName, DisconfValue disconfValue) {

    DisconfCenterFile disconfCenterFile = getInstance().getConfFileMap().get(fileName);

    // 校驗是否存在
    if (disconfCenterFile == null) {
        LOGGER.error("cannot find " + fileName + " in store....");
        return;
    }

    if (disconfValue == null || disconfValue.getFileData() == null) {
        LOGGER.error("value is null for {}", fileName);
        return;
    }

    // 存儲
    Map<String, FileItemValue> keMap = disconfCenterFile.getKeyMaps();
    if (keMap.size() > 0) {
        for (String fileItem : keMap.keySet()) {

            Object object = disconfValue.getFileData().get(fileItem);
            if (object == null) {
                LOGGER.error("cannot find {} to be injected. file content is: {}", fileItem,
                        disconfValue.getFileData().toString());
                continue;
            }

            // 根據類型設置值
            try {

                Object value = keMap.get(fileItem).getFieldValueByType(object);
                keMap.get(fileItem).setValue(value);

            } catch (Exception e) {
                LOGGER.error("inject2Store filename: " + fileName + " " + e.toString(), e);
            }
        }
    }

    // 使用過 XML式配置
    if (disconfCenterFile.isTaggedWithNonAnnotationFile()) {

        if (disconfCenterFile.getSupportFileTypeEnum().equals(SupportFileTypeEnum.PROPERTIES)) {
            // 如果是采用XML進行配置的,則需要利用spring的reload將數據reload到bean裏
            ReloadConfigurationMonitor.reload();
        }
        disconfCenterFile.setAdditionalKeyMaps(disconfValue.getFileData());
    }
}
 
開發者ID:knightliao,項目名稱:disconf,代碼行數:54,代碼來源:DisconfStoreFileProcessorImpl.java

示例15: getConfFileMap

import com.baidu.disconf.client.common.model.DisconfCenterFile; //導入依賴的package包/類
public Map<String, DisconfCenterFile> getConfFileMap() {
    return confFileMap;
}
 
開發者ID:knightliao,項目名稱:disconf,代碼行數:4,代碼來源:DisconfCenterStore.java


注:本文中的com.baidu.disconf.client.common.model.DisconfCenterFile類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。