com.sitewhere.microservice.zookeeper.ZkUtils.copyFolderRecursivelytoZk()方法的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(3.9k)|赞(0)|评价(0)|浏览(78)

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

ZkUtils.copyFolderRecursivelytoZk介绍

[英]Copy a folder recursively into Zk.
[中]将文件夹递归复制到Zk中。

代码示例

代码示例来源: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

@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"));
}

相关文章