gpt4 book ai didi

com.sitewhere.microservice.zookeeper.ZkUtils类的使用及代码示例

转载 作者:知者 更新时间:2024-03-19 04:39:31 29 4
gpt4 key购买 nike

本文整理了Java中com.sitewhere.microservice.zookeeper.ZkUtils类的一些代码示例,展示了ZkUtils类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZkUtils类的具体详情如下:
包路径:com.sitewhere.microservice.zookeeper.ZkUtils
类名称:ZkUtils

ZkUtils介绍

[英]Utility methods for Zookeeper operations.
[中]动物园管理员操作的实用方法。

代码示例

代码示例来源:origin: sitewhere/sitewhere

/**
 * Copy a folder recursively into Zk.
 * 
 * @param curator
 * @param zkRoot
 * @param root
 * @param current
 * @throws SiteWhereException
 */
public static void copyFolderRecursivelytoZk(CuratorFramework curator, String zkRoot, File root, File current)
  throws SiteWhereException {
ZkUtils.copyFolderRecursivelytoZk(curator, zkRoot, root, current, Collections.emptyList());
}

代码示例来源:origin: sitewhere/sitewhere

List<String> children = curator.getChildren().forPath(current);
for (String child : children) {
ZkUtils.copyFolderRecursivelyFromZk(curator, zkRoot, root, current + "/" + child);

代码示例来源:origin: sitewhere/sitewhere

@Override
public void start(ILifecycleProgressMonitor monitor) throws SiteWhereException {
super.start(monitor);
// Copy all scipts from Zk to local.
try {
  if (getMicroservice().getZookeeperManager().getCurator().checkExists()
    .forPath(getZkScriptRootPath()) != null) {
  ZkUtils.copyFolderRecursivelyFromZk(getMicroservice().getZookeeperManager().getCurator(),
    getZkScriptRootPath(), getFileSystemRoot(), getZkScriptRootPath());
  }
} catch (Exception e) {
  throw new SiteWhereException("Unable to copy scripts from Zookeeper.", e);
}
}

代码示例来源:origin: sitewhere/sitewhere

@Override
public void copyTemplateContentsToZk(String templateId, CuratorFramework curator, String instancePath)
  throws SiteWhereException {
IInstanceTemplate template = getInstanceTemplates().get(templateId);
if (template == null) {
  throw new SiteWhereException("Instance template not found: " + templateId);
}
File root = getTemplatesRoot();
File templateFolder = new File(root, templateId);
if (!templateFolder.exists()) {
  throw new SiteWhereException("Template folder not found at '" + templateFolder.getAbsolutePath() + "'.");
}
ZkUtils.copyFolderRecursivelytoZk(curator, instancePath, templateFolder, templateFolder);
}

代码示例来源:origin: sitewhere/sitewhere

@Override
public void copyTemplateContentsToZk(String templateId, CuratorFramework curator, String tenantPath)
  throws SiteWhereException {
IDatasetTemplate template = getTemplatesById().get(templateId);
if (template == null) {
  throw new SiteWhereException("Dataset template not found: " + templateId);
}
File root = ((ITenantManagementMicroservice<?>) getMicroservice()).getDatasetTemplatesRoot();
// Copy template contents on top of default.
File templateFolder = new File(root, templateId);
if (!templateFolder.exists()) {
  throw new SiteWhereException(
    "Dataset template folder not found at '" + templateFolder.getAbsolutePath() + "'.");
}
ZkUtils.copyFolderRecursivelytoZk(curator, tenantPath, templateFolder, templateFolder);
}

代码示例来源:origin: sitewhere/sitewhere

"Unable to copy folder '" + file.getAbsolutePath() + "' into '" + subFile + "'.", e);
ZkUtils.copyFolderRecursivelytoZk(curator, zkRoot, root, file);
} else if (file.isFile()) {
FileInputStream input = null;

代码示例来源:origin: sitewhere/sitewhere

/**
 * Copy content from 'default' folder as baseline (also register any default
 * scripts).
 * 
 * @param curator
 * @param tenantPath
 * @param root
 * @throws SiteWhereException
 */
protected void addDefaultContent(CuratorFramework curator, ITenant tenant, File root) throws SiteWhereException {
String tenantPath = ((ITenantManagementMicroservice<?>) getMicroservice())
  .getInstanceTenantConfigurationPath(tenant.getId());
// Copy default content shared by all tenants.
File defaultFolder = new File(root, DEFAULT_TENANT_CONTENT_FOLDER);
if (!defaultFolder.exists()) {
  throw new SiteWhereException("Default folder not found at '" + defaultFolder.getAbsolutePath() + "'.");
}
ZkUtils.copyFolderRecursivelytoZk(curator, tenantPath, defaultFolder, defaultFolder,
  Collections.singletonList("scripts"));
// Add any default scripts.
addScriptsForFolder(tenant, defaultFolder);
}

代码示例来源:origin: sitewhere/sitewhere

/**
 * Copy template content on top of baseline structure added from 'default'
 * folder.
 * 
 * @param curator
 * @param template
 * @param tenantPath
 * @param root
 * @throws SiteWhereException
 */
protected void copyTemplateContent(CuratorFramework curator, ITenant tenant, ITenantTemplate template, File root)
  throws SiteWhereException {
String tenantPath = ((ITenantManagementMicroservice<?>) getMicroservice())
  .getInstanceTenantConfigurationPath(tenant.getId());
File templateFolder = getTenantTemplateFolder(template, root);
ZkUtils.copyFolderRecursivelytoZk(curator, tenantPath, templateFolder, templateFolder,
  Collections.singletonList("scripts"));
}

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com