Exemplo n.º 1
0
 public String get_string_property(String propertyName) {
   if (propertyName.equals("cluster name")) {
     return DatabaseDescriptor.getClusterName();
   } else if (propertyName.equals("config file")) {
     String filename = DatabaseDescriptor.getConfigFileName();
     try {
       StringBuilder fileData = new StringBuilder(8192);
       BufferedInputStream stream = new BufferedInputStream(new FileInputStream(filename));
       byte[] buf = new byte[1024];
       int numRead;
       while ((numRead = stream.read(buf)) != -1) {
         String str = new String(buf, 0, numRead);
         fileData.append(str);
       }
       stream.close();
       return fileData.toString();
     } catch (IOException e) {
       return "file not found!";
     }
   } else if (propertyName.equals("version")) {
     return "0.3.0";
   } else {
     return "?";
   }
 }
Exemplo n.º 2
0
 @Override
 public String toString() {
   StringBuilder sb = new StringBuilder();
   sb.append(name)
       .append(", rep strategy:")
       .append(strategyClass.getSimpleName())
       .append("{")
       .append(StringUtils.join(cfMetaData.values(), ", "))
       .append("}")
       .append(", durable_writes: ")
       .append(durableWrites);
   return sb.toString();
 }
Exemplo n.º 3
0
  private String getSlicesInfo(ColumnFamily container) {
    StringBuilder sb = new StringBuilder();
    CellNameType type = container.metadata().comparator;
    for (ColumnSlice sl : slices) {
      assert sl != null;

      sb.append('[');
      sb.append(type.getString(sl.start));
      sb.append('-');
      sb.append(type.getString(sl.finish));
      sb.append(']');
    }
    return sb.toString();
  }