Ejemplo n.º 1
0
  /**
   * Find the pre-compild catalog report in the jarfile, and modify it for use in the the built-in
   * web portal.
   */
  public static String liveReport() {
    byte[] reportbytes = VoltDB.instance().getCatalogContext().getFileInJar("catalog-report.html");
    String report = new String(reportbytes, Charsets.UTF_8);

    // remove commented out code
    report = report.replace("<!--##RESOURCES", "");
    report = report.replace("##RESOURCES-->", "");

    // inject the cluster overview
    String clusterStr = "<h4>System Overview</h4>\n<p>" + getLiveSystemOverview() + "</p><br/>\n";
    report = report.replace("<!--##CLUSTER##-->", clusterStr);

    // inject the running system platform properties
    PlatformProperties pp = PlatformProperties.getPlatformProperties();
    String ppStr = "<h4>Cluster Platform</h4>\n<p>" + pp.toHTML() + "</p><br/>\n";
    report = report.replace("<!--##PLATFORM2##-->", ppStr);

    // change the live/static var to live
    if (VoltDB.instance().getConfig().m_isEnterprise) {
      report = report.replace("&b=r&", "&b=e&");
    } else {
      report = report.replace("&b=r&", "&b=c&");
    }

    return report;
  }
Ejemplo n.º 2
0
  /** Generate the HTML catalog report from a newly compiled VoltDB catalog */
  public static String report(Catalog catalog, ArrayList<Feedback> warnings) throws IOException {
    // asynchronously get platform properties
    new Thread() {
      @Override
      public void run() {
        PlatformProperties.getPlatformProperties();
      }
    }.start();

    URL url = Resources.getResource(ReportMaker.class, "template.html");
    String contents = Resources.toString(url, Charsets.UTF_8);

    Cluster cluster = catalog.getClusters().get("cluster");
    assert (cluster != null);
    Database db = cluster.getDatabases().get("database");
    assert (db != null);

    String statsData = getStatsHTML(db, warnings);
    contents = contents.replace("##STATS##", statsData);

    String schemaData = generateSchemaTable(db.getTables(), db.getConnectors());
    contents = contents.replace("##SCHEMA##", schemaData);

    String procData = generateProceduresTable(db.getProcedures());
    contents = contents.replace("##PROCS##", procData);

    DatabaseSizes sizes = CatalogSizing.getCatalogSizes(db);

    String sizeData = generateSizeTable(sizes);
    contents = contents.replace("##SIZES##", sizeData);

    String sizeSummary = generateSizeSummary(sizes);
    contents = contents.replace("##SIZESUMMARY##", sizeSummary);

    String platformData = PlatformProperties.getPlatformProperties().toHTML();
    contents = contents.replace("##PLATFORM##", platformData);

    contents = contents.replace("##VERSION##", VoltDB.instance().getVersionString());

    DateFormat df = new SimpleDateFormat("d MMM yyyy HH:mm:ss z");
    contents = contents.replace("##TIMESTAMP##", df.format(m_timestamp));

    String msg =
        Encoder.hexEncode(VoltDB.instance().getVersionString() + "," + System.currentTimeMillis());
    contents = contents.replace("get.py?a=KEY&", String.format("get.py?a=%s&", msg));

    return contents;
  }
Ejemplo n.º 3
0
 @Override
 public void run() {
   PlatformProperties.getPlatformProperties();
 }