本文整理汇总了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;
}
示例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);
}
}
}
}
示例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);
}
}
示例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();
}
示例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();
}
示例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);
}
}
示例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();
}
示例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;
}
示例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;
}
示例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);
}
}
示例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);
}
}
示例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();
}
示例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);
}
}
}
示例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());
}
}
示例15: getConfFileMap
import com.baidu.disconf.client.common.model.DisconfCenterFile; //导入依赖的package包/类
public Map<String, DisconfCenterFile> getConfFileMap() {
return confFileMap;
}