@Override public LoadedInstanceConfig loadConfig() throws Exception { int version = -1; Properties properties = new Properties(); ChildData childData = getConfigNode(); if ( childData != null ) { version = childData.getStat().getVersion(); properties.load(new ByteArrayInputStream(childData.getData())); } PropertyBasedInstanceConfig config = new PropertyBasedInstanceConfig(properties, defaults); return new LoadedInstanceConfig(config, version); }
/** * Remove Provider * * @param config ConsumerConfig * @param providerPath Provider path of zookeeper * @param data Event data * @param currentData provider data list * @throws UnsupportedEncodingException decode error */ public void removeProvider(ConsumerConfig config, String providerPath, ChildData data, List<ChildData> currentData) throws UnsupportedEncodingException { if (LOGGER.isInfoEnabled(config.getAppName())) { LOGGER.infoWithApp(config.getAppName(), "Receive remove provider: path=[" + data.getPath() + "]" + ", data=[" + StringSerializer.decode(data.getData()) + "]" + ", stat=[" + data.getStat() + "]" + ", list=[" + currentData.size() + "]"); } notifyListeners(config, providerPath, currentData, false); }
/** * Update Provider * * @param config ConsumerConfig * @param providerPath Provider path of zookeeper * @param data Event data * @param currentData provider data list * @throws UnsupportedEncodingException decode error */ public void updateProvider(ConsumerConfig config, String providerPath, ChildData data, List<ChildData> currentData) throws UnsupportedEncodingException { if (LOGGER.isInfoEnabled(config.getAppName())) { LOGGER.infoWithApp(config.getAppName(), "Receive update provider: path=[" + data.getPath() + "]" + ", data=[" + StringSerializer.decode(data.getData()) + "]" + ", stat=[" + data.getStat() + "]" + ", list=[" + currentData.size() + "]"); } notifyListeners(config, providerPath, currentData, false); }
/** * Add provider * * @param config ConsumerConfig * @param providerPath Provider path of zookeeper * @param data Event data * @param currentData provider data list * @throws UnsupportedEncodingException decode error */ public void addProvider(ConsumerConfig config, String providerPath, ChildData data, List<ChildData> currentData) throws UnsupportedEncodingException { if (LOGGER.isInfoEnabled(config.getAppName())) { LOGGER.infoWithApp(config.getAppName(), "Receive add provider: path=[" + data.getPath() + "]" + ", data=[" + StringSerializer.decode(data.getData()) + "]" + ", stat=[" + data.getStat() + "]" + ", list=[" + currentData.size() + "]"); } notifyListeners(config, providerPath, currentData, true); }
/** * Add provider * * @param config ConsumerConfig * @param providerPath Provider path of zookeeper * @param data Event data * @param currentData provider data list * @throws UnsupportedEncodingException decode error */ public void addProvider(ConsumerConfig config, String providerPath, ChildData data, List<ChildData> currentData) throws UnsupportedEncodingException { if (LOGGER.isInfoEnabled(config.getAppName())) { LOGGER.infoWithApp(config.getAppName(), "Receive add provider: path=[" + data.getPath() + "]" + ", data=[" + StringSerializer.decode(data.getData()) + "]" + ", stat=[" + data.getStat() + "]" + ", list=[" + currentData.size() + "]"); } notifyListeners(config, providerPath, currentData, true); }
/** * Remove Provider * * @param config ConsumerConfig * @param providerPath Provider path of zookeeper * @param data Event data * @param currentData provider data list * @throws UnsupportedEncodingException decode error */ public void removeProvider(ConsumerConfig config, String providerPath, ChildData data, List<ChildData> currentData) throws UnsupportedEncodingException { if (LOGGER.isInfoEnabled(config.getAppName())) { LOGGER.infoWithApp(config.getAppName(), "Receive remove provider: path=[" + data.getPath() + "]" + ", data=[" + StringSerializer.decode(data.getData()) + "]" + ", stat=[" + data.getStat() + "]" + ", list=[" + currentData.size() + "]"); } notifyListeners(config, providerPath, currentData, false); }
/** * Update Provider * * @param config ConsumerConfig * @param providerPath Provider path of zookeeper * @param data Event data * @param currentData provider data list * @throws UnsupportedEncodingException decode error */ public void updateProvider(ConsumerConfig config, String providerPath, ChildData data, List<ChildData> currentData) throws UnsupportedEncodingException { if (LOGGER.isInfoEnabled(config.getAppName())) { LOGGER.infoWithApp(config.getAppName(), "Receive update provider: path=[" + data.getPath() + "]" + ", data=[" + StringSerializer.decode(data.getData()) + "]" + ", stat=[" + data.getStat() + "]" + ", list=[" + currentData.size() + "]"); } notifyListeners(config, providerPath, currentData, false); }
/** * 接口配置修改子节点Data * * @param config 接口配置 * @param configPath 配置Path * @param data 子节点Data */ public void updateConfig(AbstractInterfaceConfig config, String configPath, ChildData data) { if (data == null) { if (LOGGER.isInfoEnabled(config.getAppName())) { LOGGER.infoWithApp(config.getAppName(), "Receive update data is null"); } } else { if (LOGGER.isInfoEnabled(config.getAppName())) { LOGGER.infoWithApp(config.getAppName(), "Receive update data: path=[" + data.getPath() + "]" + ", data=[" + StringSerializer.decode(data.getData()) + "]" + ", stat=[" + data.getStat() + "]"); } notifyListeners(config, configPath, data, false); } }
/** * 接口配置删除子节点Data * * @param config 接口配置 * @param configPath 配置Path * @param data 子节点Data */ public void removeConfig(AbstractInterfaceConfig config, String configPath, ChildData data) { if (data == null) { if (LOGGER.isInfoEnabled(config.getAppName())) { LOGGER.infoWithApp(config.getAppName(), "Receive remove data is null"); } } else { if (LOGGER.isInfoEnabled(config.getAppName())) { LOGGER.infoWithApp(config.getAppName(), "Receive remove data: path=[" + data.getPath() + "]" + ", data=[" + StringSerializer.decode(data.getData()) + "]" + ", stat=[" + data.getStat() + "]"); } notifyListeners(config, configPath, data, true); } }
/** * 接口配置修改子节点Data * * @param config 接口配置 * @param overridePath 覆盖Path * @param data 子节点Data * @throws Exception 转换配置异常 */ public void updateConfig(AbstractInterfaceConfig config, String overridePath, ChildData data) throws Exception { if (data == null) { if (LOGGER.isInfoEnabled(config.getAppName())) { LOGGER.infoWithApp(config.getAppName(), "Receive update data is null"); } } else { if (LOGGER.isInfoEnabled(config.getAppName())) { LOGGER.infoWithApp(config.getAppName(), "Receive update data: path=[" + data.getPath() + "]" + ", data=[" + StringSerializer.decode(data.getData()) + "]" + ", stat=[" + data.getStat() + "]"); } notifyListeners(config, overridePath, data, false, null); } }
/** * 接口配置新增子节点Data * * @param config 接口配置 * @param overridePath 覆盖Path * @param data 子节点Data * @throws Exception 转换配置异常 */ public void addConfig(AbstractInterfaceConfig config, String overridePath, ChildData data) throws Exception { if (data == null) { if (LOGGER.isInfoEnabled(config.getAppName())) { LOGGER.infoWithApp(config.getAppName(), "Receive data is null"); } } else { if (LOGGER.isInfoEnabled(config.getAppName())) { LOGGER.infoWithApp(config.getAppName(), "Receive add data: path=[" + data.getPath() + "]" + ", data=[" + StringSerializer.decode(data.getData()) + "]" + ", stat=[" + data.getStat() + "]"); } notifyListeners(config, overridePath, data, false, null); } }
/** * 接口配置修改子节点Data * * @param config 接口配置 * @param configPath 配置Path * @param data 子节点Data */ public void updateConfig(AbstractInterfaceConfig config, String configPath, ChildData data) { if (data == null) { if (LOGGER.isInfoEnabled(config.getAppName())) { LOGGER.infoWithApp(config.getAppName(), "Receive update data is null"); } } else { if (LOGGER.isInfoEnabled(config.getAppName())) { LOGGER.infoWithApp(config.getAppName(), "Receive update data: path=[" + data.getPath() + "]" + ", data=[" + StringSerializer.decode(data.getData()) + "]" + ", stat=[" + data.getStat() + "]"); } notifyListeners(config, configPath, data, false); } }
/** * 接口配置修改子节点Data * * @param config 接口配置 * @param overridePath 覆盖Path * @param data 子节点Data * @throws Exception 转换配置异常 */ public void updateConfig(AbstractInterfaceConfig config, String overridePath, ChildData data) throws Exception { if (data == null) { if (LOGGER.isInfoEnabled(config.getAppName())) { LOGGER.infoWithApp(config.getAppName(), "Receive update data is null"); } } else { if (LOGGER.isInfoEnabled(config.getAppName())) { LOGGER.infoWithApp(config.getAppName(), "Receive update data: path=[" + data.getPath() + "]" + ", data=[" + StringSerializer.decode(data.getData()) + "]" + ", stat=[" + data.getStat() + "]"); } notifyListeners(config, overridePath, data, false, null); } }
/** * 接口配置新增子节点Data * * @param config 接口配置 * @param overridePath 覆盖Path * @param data 子节点Data * @throws Exception 转换配置异常 */ public void addConfig(AbstractInterfaceConfig config, String overridePath, ChildData data) throws Exception { if (data == null) { if (LOGGER.isInfoEnabled(config.getAppName())) { LOGGER.infoWithApp(config.getAppName(), "Receive data is null"); } } else { if (LOGGER.isInfoEnabled(config.getAppName())) { LOGGER.infoWithApp(config.getAppName(), "Receive add data: path=[" + data.getPath() + "]" + ", data=[" + StringSerializer.decode(data.getData()) + "]" + ", stat=[" + data.getStat() + "]"); } notifyListeners(config, overridePath, data, false, null); } }
/** * 接口配置新增子节点Data * * @param config 接口配置 * @param configPath 配置Path * @param data 子节点Data */ public void addConfig(AbstractInterfaceConfig config, String configPath, ChildData data) { if (data == null) { if (LOGGER.isInfoEnabled(config.getAppName())) { LOGGER.infoWithApp(config.getAppName(), "Receive add data is null"); } } else { if (LOGGER.isInfoEnabled(config.getAppName())) { LOGGER.infoWithApp(config.getAppName(), "Receive add data: path=[" + data.getPath() + "]" + ", data=[" + StringSerializer.decode(data.getData()) + "]" + ", stat=[" + data.getStat() + "]"); } notifyListeners(config, configPath, data, false); } }
/** * 接口配置新增子节点Data * * @param config 接口配置 * @param configPath 配置Path * @param data 子节点Data */ public void addConfig(AbstractInterfaceConfig config, String configPath, ChildData data) { if (data == null) { if (LOGGER.isInfoEnabled(config.getAppName())) { LOGGER.infoWithApp(config.getAppName(), "Receive add data is null"); } } else { if (LOGGER.isInfoEnabled(config.getAppName())) { LOGGER.infoWithApp(config.getAppName(), "Receive add data: path=[" + data.getPath() + "]" + ", data=[" + StringSerializer.decode(data.getData()) + "]" + ", stat=[" + data.getStat() + "]"); } notifyListeners(config, configPath, data, false); } }
/** * 接口配置删除子节点Data * * @param config 接口配置 * @param configPath 配置Path * @param data 子节点Data */ public void removeConfig(AbstractInterfaceConfig config, String configPath, ChildData data) { if (data == null) { if (LOGGER.isInfoEnabled(config.getAppName())) { LOGGER.infoWithApp(config.getAppName(), "Receive remove data is null"); } } else { if (LOGGER.isInfoEnabled(config.getAppName())) { LOGGER.infoWithApp(config.getAppName(), "Receive remove data: path=[" + data.getPath() + "]" + ", data=[" + StringSerializer.decode(data.getData()) + "]" + ", stat=[" + data.getStat() + "]"); } notifyListeners(config, configPath, data, true); } }
LOGGER.infoWithApp(config.getAppName(), "Receive updateAll data: path=[" + data.getPath() + "], data=[" + StringSerializer.decode(data.getData()) + "]" + ", stat=[" + data.getStat() + "]");
/** * 接口配置删除子节点Data * * @param config 接口配置 * @param overridePath 覆盖Path * @param data 子节点Data * @param registerConfig 注册配置 * @throws Exception 转换配置异常 */ public void removeConfig(AbstractInterfaceConfig config, String overridePath, ChildData data, AbstractInterfaceConfig registerConfig) throws Exception { if (data == null) { if (LOGGER.isInfoEnabled(config.getAppName())) { LOGGER.infoWithApp(config.getAppName(), "Receive data is null"); } } else if (registerConfig == null) { if (LOGGER.isInfoEnabled(config.getAppName())) { LOGGER.infoWithApp(config.getAppName(), "Register config is null"); } } else { if (LOGGER.isInfoEnabled(config.getAppName())) { LOGGER.infoWithApp(config.getAppName(), "Receive data: path=[" + data.getPath() + "]" + ", data=[" + StringSerializer.decode(data.getData()) + "]" + ", stat=[" + data.getStat() + "]"); } notifyListeners(config, overridePath, data, true, registerConfig); } }
/** * 接口配置删除子节点Data * * @param config 接口配置 * @param overridePath 覆盖Path * @param data 子节点Data * @param registerConfig 注册配置 * @throws Exception 转换配置异常 */ public void removeConfig(AbstractInterfaceConfig config, String overridePath, ChildData data, AbstractInterfaceConfig registerConfig) throws Exception { if (data == null) { if (LOGGER.isInfoEnabled(config.getAppName())) { LOGGER.infoWithApp(config.getAppName(), "Receive data is null"); } } else if (registerConfig == null) { if (LOGGER.isInfoEnabled(config.getAppName())) { LOGGER.infoWithApp(config.getAppName(), "Register config is null"); } } else { if (LOGGER.isInfoEnabled(config.getAppName())) { LOGGER.infoWithApp(config.getAppName(), "Receive data: path=[" + data.getPath() + "]" + ", data=[" + StringSerializer.decode(data.getData()) + "]" + ", stat=[" + data.getStat() + "]"); } notifyListeners(config, overridePath, data, true, registerConfig); } }