本文整理了Java中org.dromara.soul.common.constant.ZkPathConstants.buildPluginPath()
方法的一些代码示例,展示了ZkPathConstants.buildPluginPath()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZkPathConstants.buildPluginPath()
方法的具体详情如下:
包路径:org.dromara.soul.common.constant.ZkPathConstants
类名称:ZkPathConstants
方法名:buildPluginPath
[英]buildPluginRealPath.
[中]buildPluginRealPath。
代码示例来源:origin: Dromara/soul
private void loadWatcherPlugin() {
Arrays.stream(PluginEnum.values()).forEach(pluginEnum -> {
String pluginPath = ZkPathConstants.buildPluginPath(pluginEnum.getName());
if (!zkClient.exists(pluginPath)) {
zkClient.createPersistent(pluginPath, true);
}
PluginZkDTO data = zkClient.readData(pluginPath);
Optional.ofNullable(data).ifPresent(d -> PLUGIN_MAP.put(pluginEnum.getName(), data));
zkClient.subscribeDataChanges(pluginPath, new IZkDataListener() {
@Override
public void handleDataChange(final String dataPath, final Object data) {
Optional.ofNullable(data)
.ifPresent(o -> {
PluginZkDTO dto = (PluginZkDTO) o;
PLUGIN_MAP.put(dto.getName(), dto);
});
}
@Override
public void handleDataDeleted(final String dataPath) {
PLUGIN_MAP.remove(pluginEnum.getName());
}
});
});
}
代码示例来源:origin: Dromara/soul
zkClient.delete(ZkPathConstants.buildPluginPath(pluginZK));
String selectorParentPath = ZkPathConstants.buildSelectorParentPath(pluginZK);
if (zkClient.exists(selectorParentPath)) {
代码示例来源:origin: Dromara/soul
/**
* create or update plugin.
*
* @param pluginDTO {@linkplain PluginDTO}
* @return rows
*/
@Override
@Transactional(rollbackFor = Exception.class)
public int createOrUpdate(final PluginDTO pluginDTO) {
int pluginCount;
PluginDO pluginDO = PluginDO.buildPluginDO(pluginDTO);
if (StringUtils.isEmpty(pluginDTO.getId())) {
pluginCount = pluginMapper.insertSelective(pluginDO);
} else {
pluginCount = pluginMapper.updateSelective(pluginDO);
}
String pluginPath = ZkPathConstants.buildPluginPath(pluginDO.getName());
if (!zkClient.exists(pluginPath)) {
zkClient.createPersistent(pluginPath, true);
}
zkClient.writeData(pluginPath, new PluginZkDTO(pluginDO.getId(),
pluginDO.getName(), pluginDO.getEnabled()));
return pluginCount;
}
代码示例来源:origin: Dromara/soul
/**
* delete plugins.
*
* @param ids primary key.
* @return rows
*/
@Override
@Transactional(rollbackFor = Exception.class)
public int delete(final List<String> ids) {
int pluginCount = 0;
for (String id : ids) {
PluginDO pluginDO = pluginMapper.selectById(id);
pluginCount += pluginMapper.delete(id);
String pluginPath = ZkPathConstants.buildPluginPath(pluginDO.getName());
if (zkClient.exists(pluginPath)) {
zkClient.delete(pluginPath);
}
String selectorParentPath = ZkPathConstants.buildSelectorParentPath(pluginDO.getName());
if (zkClient.exists(selectorParentPath)) {
zkClient.delete(selectorParentPath);
}
String ruleParentPath = ZkPathConstants.buildRuleParentPath(pluginDO.getName());
if (zkClient.exists(ruleParentPath)) {
zkClient.delete(ruleParentPath);
}
}
return pluginCount;
}
代码示例来源:origin: Dromara/soul
String pluginPath = ZkPathConstants.buildPluginPath(pluginDO.getName());
if (!zkClient.exists(pluginPath)) {
zkClient.createPersistent(pluginPath, true);
内容来源于网络,如有侵权,请联系作者删除!