io.fabric8.zookeeper.utils.ZooKeeperUtils.getStringData()方法的使用及代码示例

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

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

ZooKeeperUtils.getStringData介绍

暂无

代码示例

代码示例来源:origin: jboss-fuse/fabric8

/**
 * Returns the string data of the given path if it exists or null
 */
public String getStringData(String path) throws Exception {
  return ZooKeeperUtils.getStringData(curator, path);
}

代码示例来源:origin: io.fabric8/fabric-zookeeper

/**
 * Returns the string data of the given path if it exists or null
 */
public String getStringData(String path) throws Exception {
  return ZooKeeperUtils.getStringData(curator, path);
}

代码示例来源:origin: io.fabric8/fabric-zookeeper

public String getStringData(String zkPath) throws Exception {
  String answer = cache.get(zkPath);
  if (answer == null) {
    ZooKeeperUtils.getStringData(curator, zkPath);
  }
  return answer;
}

代码示例来源:origin: io.fabric8/fabric-zookeeper

public static Properties getProperties(CuratorFramework curator, String path, Watcher watcher) throws Exception {
  String value = getStringData(curator, path, watcher);
  Properties properties = new Properties();
  if (value != null) {
    try {
      properties.load(new StringReader(value));
    } catch (IOException ignore) {
    }
  }
  return properties;
}

代码示例来源:origin: jboss-fuse/fabric8

public static Properties getProperties(TreeCacheExtended cace, String path) throws Exception {
  String value = getStringData(cace, path);
  Properties properties = new Properties();
  if (value != null) {
    try {
      properties.load(new StringReader(value));
    } catch (IOException ignore) {
    }
  }
  return properties;
}

代码示例来源:origin: io.fabric8/fabric-zookeeper

public static Properties getProperties(TreeCache cace, String path) throws Exception {
  String value = getStringData(cace, path);
  Properties properties = new Properties();
  if (value != null) {
    try {
      properties.load(new StringReader(value));
    } catch (IOException ignore) {
    }
  }
  return properties;
}

代码示例来源:origin: jboss-fuse/fabric8

public static Properties getProperties(CuratorFramework curator, String path, Watcher watcher) throws Exception {
  String value = getStringData(curator, path, watcher);
  Properties properties = new Properties();
  if (value != null) {
    try {
      properties.load(new StringReader(value));
    } catch (IOException ignore) {
    }
  }
  return properties;
}

代码示例来源:origin: jboss-fuse/fabric8

public static Properties getContainerTokens(CuratorFramework curator) throws Exception {
  Properties props = new Properties();
  if (exists(curator, CONTAINERS_NODE) != null) {
    for (String key : getChildren(curator, CONTAINERS_NODE)) {
      props.setProperty("container#" + key, getStringData(curator, CONTAINERS_NODE + "/" + key));
    }
  }
  return props;
}

代码示例来源:origin: io.fabric8/fabric-zookeeper

public static Properties getContainerTokens(CuratorFramework curator) throws Exception {
  Properties props = new Properties();
  if (exists(curator, CONTAINERS_NODE) != null) {
    for (String key : getChildren(curator, CONTAINERS_NODE)) {
      props.setProperty("container#" + key, getStringData(curator, CONTAINERS_NODE + "/" + key));
    }
  }
  return props;
}

代码示例来源:origin: io.fabric8/fabric-core-agent-jclouds

@Override
public Credentials getValue() {
  Credentials credentials = null;
  try {
    String identity = getStringData(curator, ZkPath.CLOUD_NODE_IDENTITY.getPath(normalizeKey(key)));
    String credential = getStringData(curator, ZkPath.CLOUD_NODE_CREDENTIAL.getPath(normalizeKey(key)));
    credentials = LoginCredentials.fromCredentials(new Credentials(identity, credential));
  } catch (Exception e) {
    LOGGER.debug("Failed to read jclouds credentials from zookeeper due to {}.", e.getMessage());
  }
  return credentials;
}

代码示例来源:origin: jboss-fuse/fabric8

public String getContents(String path, boolean escape) throws Exception {
    CuratorFramework curator = getCurator();
    String answer = getStringData(curator, path);
    if (answer != null) {
      return ZooKeeperUtils.getSubstitutedData(curator, answer);
    }
    return answer;
  }
}

代码示例来源:origin: jboss-fuse/fabric8

@Override
public String getContainerVersion(String containerId) {
  assertValid();
  try {
    return getStringData(configCache, ZkPath.CONFIG_CONTAINER.getPath(containerId));
  } catch (Exception e) {
    throw FabricException.launderThrowable(e);
  }
}

代码示例来源:origin: jboss-fuse/fabric8

private String getAlgorithm(FabricService fabricService) {
  try {
    return getStringData(fabricService.adapt(CuratorFramework.class), AUTHENTICATION_CRYPT_ALGORITHM.getPath());
  } catch (Exception e) {
    throw FabricException.launderThrowable(e);
  }
}

代码示例来源:origin: io.fabric8/fabric-commands

@Override
  protected Object doExecute() throws Exception {
    if (exists(getCurator(), ZkPath.AUTHENTICATION_CRYPT_ALGORITHM.getPath()) != null) {
      System.out.println(getStringData(getCurator(), ZkPath.AUTHENTICATION_CRYPT_ALGORITHM.getPath()));
    }
    return null;
  }
}

代码示例来源:origin: jboss-fuse/fabric8

@Override
public String getClusterId() {
  assertValid();
  try {
    return getStringData(curator.get(), ZkPath.CONFIG_ENSEMBLES.getPath());
  } catch (Exception e) {
    throw FabricException.launderThrowable(e);
  }
}

代码示例来源:origin: jboss-fuse/fabric8

private String getPassword(FabricService fabricService) {
  try {
    String pw = getStringData(fabricService.adapt(CuratorFramework.class), AUTHENTICATION_CRYPT_PASSWORD.getPath());
    // the password may be encoded, so we need to decode if needed
    return PasswordEncoder.decode(pw);
  } catch (Exception e) {
    throw FabricException.launderThrowable(e);
  }
}

代码示例来源:origin: io.fabric8/fabric-commands

@Override
  protected Object doExecute() throws Exception {
    if (exists(getCurator(), ZkPath.AUTHENTICATION_CRYPT_PASSWORD.getPath()) != null) {
      System.out.println(PasswordEncoder.decode(getStringData(getCurator(), ZkPath.AUTHENTICATION_CRYPT_PASSWORD.getPath())));
    }
    return null;
  }
}

代码示例来源:origin: io.fabric8.runtime/fabric-runtime-container-tomcat-registration

/**
 * Returns the container specific resolution policy.
 */
private String getContainerResolutionPolicy(CuratorFramework zooKeeper, String container) throws Exception {
  String policy = null;
  List<String> validResolverList = Arrays.asList(ZkDefs.VALID_RESOLVERS);
  if (exists(zooKeeper, ZkPath.CONTAINER_RESOLVER.getPath(container)) != null) {
    policy = getStringData(zooKeeper, ZkPath.CONTAINER_RESOLVER.getPath(container));
  } else if (bootstrapConfiguration.get().getLocalResolver() != null && validResolverList.contains(bootstrapConfiguration.get().getLocalResolver())) {
    policy = bootstrapConfiguration.get().getLocalResolver();
  }
  return policy;
}

代码示例来源:origin: jboss-fuse/fabric8

private String getContainerResolutionPolicy(CuratorFramework zooKeeper, String container) throws Exception {
  String policy = null;
  List<String> validResolverList = Arrays.asList(ZkDefs.VALID_RESOLVERS);
  if (exists(zooKeeper, ZkPath.CONTAINER_RESOLVER.getPath(container)) != null) {
    policy = getStringData(zooKeeper, ZkPath.CONTAINER_RESOLVER.getPath(container));
  } else if (bootstrapConfiguration.get().getLocalResolver() != null && validResolverList.contains(bootstrapConfiguration.get().getLocalResolver())) {
    policy = bootstrapConfiguration.get().getLocalResolver();
  }
  return policy;
}

代码示例来源:origin: jboss-fuse/fabric8

@Override
public Map<String, String> getEnsembleConfiguration() throws Exception {
  String clusterId = getStringData(obtainValid(curator), ZkPath.CONFIG_ENSEMBLES.getPath());
  String versionId = dataStore.get().getDefaultVersion();
  String profileId = "fabric-ensemble-" + clusterId;
  String ensembleConfigName = "io.fabric8.zookeeper.server-" + clusterId + ".properties";
  Profile ensembleProfile = profileRegistry.get().getRequiredProfile(versionId, profileId);
  Map<String, byte[]> fileconfigs = ensembleProfile.getFileConfigurations();
  return DataStoreUtils.toMap(fileconfigs.get(ensembleConfigName));
 }

相关文章