accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ctubb...@apache.org
Subject [51/54] [abbrv] accumulo git commit: Delete unused items from monitor
Date Thu, 06 Jul 2017 20:43:45 GMT
http://git-wip-us.apache.org/repos/asf/accumulo/blob/cc8d3353/server/monitor/src/main/java/org/apache/accumulo/monitor/util/Table.java
----------------------------------------------------------------------
diff --git a/server/monitor/src/main/java/org/apache/accumulo/monitor/util/Table.java b/server/monitor/src/main/java/org/apache/accumulo/monitor/util/Table.java
deleted file mode 100644
index 3af609c..0000000
--- a/server/monitor/src/main/java/org/apache/accumulo/monitor/util/Table.java
+++ /dev/null
@@ -1,276 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.accumulo.monitor.util;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.SortedMap;
-
-import javax.servlet.http.HttpServletRequest;
-
-import org.apache.accumulo.monitor.servlets.BasicServlet;
-import org.apache.accumulo.monitor.util.celltypes.CellType;
-import org.apache.accumulo.monitor.util.celltypes.StringType;
-
-public class Table {
-  private String tableName;
-  private String caption;
-  private String captionclass;
-  private String subcaption;
-  private ArrayList<TableColumn<?>> columns;
-  private ArrayList<TableRow> rows;
-  private boolean hasBegunAddingRows = false;
-
-  private SortedMap<String,String> namespaces;
-
-  public Table(String tableName, String caption) {
-    this(tableName, caption, null);
-  }
-
-  public Table(String tableName, String caption, String captionClass) {
-    this.tableName = tableName;
-    this.caption = caption;
-    this.captionclass = captionClass;
-    this.subcaption = null;
-    this.columns = new ArrayList<>();
-    this.rows = new ArrayList<>();
-  }
-
-  public synchronized void setSubCaption(String subcaption) {
-    this.subcaption = subcaption;
-  }
-
-  public synchronized <T> void addColumn(TableColumn<T> column) {
-    if (hasBegunAddingRows)
-      throw new IllegalStateException("Cannot add more columns newServer rows have been added");
-    columns.add(column);
-  }
-
-  private synchronized <T> void addColumn(String title, CellType<T> type, String
legend, boolean sortable) {
-    if (type == null)
-      type = new StringType<>();
-    type.setSortable(sortable);
-    addColumn(new TableColumn<>(title, type, legend));
-  }
-
-  public synchronized <T> void addUnsortableColumn(String title, CellType<T>
type, String legend) {
-    addColumn(title, type, legend, false);
-  }
-
-  public synchronized <T> void addSortableColumn(String title, CellType<T> type,
String legend) {
-    addColumn(title, type, legend, true);
-  }
-
-  public synchronized void addUnsortableColumn(String title) {
-    addUnsortableColumn(title, null, null);
-  }
-
-  public synchronized void addSortableColumn(String title) {
-    addSortableColumn(title, null, null);
-  }
-
-  public synchronized TableRow prepareRow() {
-    hasBegunAddingRows = true;
-    return new TableRow(columns.size());
-  }
-
-  public synchronized void addRow(TableRow row) {
-    hasBegunAddingRows = true;
-    if (columns.size() != row.size())
-      throw new IllegalStateException("Row must be the same size as the columns");
-    rows.add(row);
-  }
-
-  public synchronized void addRow(Object... cells) {
-    TableRow row = prepareRow();
-    if (cells.length != columns.size())
-      throw new IllegalArgumentException("Argument length not equal to the number of columns");
-    for (Object cell : cells)
-      row.add(cell);
-    addRow(row);
-  }
-
-  public synchronized void generate(HttpServletRequest req, StringBuilder sb) {
-    String page = req.getRequestURI();
-    if (columns.isEmpty())
-      throw new IllegalStateException("No columns in table");
-    for (TableRow row : rows)
-      if (row.size() != columns.size())
-        throw new RuntimeException("Each row must have the same number of columns");
-
-    boolean sortAscending = !"false".equals(BasicServlet.getCookieValue(req, "tableSort."
+ BasicServlet.encode(page) + "." + BasicServlet.encode(tableName)
-        + "." + "sortAsc"));
-
-    int sortCol = -1; // set to first sortable column by default
-    int numLegends = 0;
-    for (int i = 0; i < columns.size(); ++i) {
-      TableColumn<?> col = columns.get(i);
-      if (sortCol < 0 && col.getCellType().isSortable())
-        sortCol = i;
-      if (col.getLegend() != null && !col.getLegend().isEmpty())
-        ++numLegends;
-    }
-
-    // only get cookie if there is a possibility that it is sortable
-    if (sortCol >= 0) {
-      String sortColStr = BasicServlet.getCookieValue(req, "tableSort." + BasicServlet.encode(page)
+ "." + BasicServlet.encode(tableName) + "." + "sortCol");
-      if (sortColStr != null) {
-        try {
-          int col = Integer.parseInt(sortColStr);
-          // only bother if specified column is sortable
-          if (!(col < 0 || sortCol >= columns.size()) && columns.get(col).getCellType().isSortable())
-            sortCol = col;
-        } catch (NumberFormatException e) {
-          // ignore improperly formatted user cookie
-        }
-      }
-    }
-
-    boolean showLegend = false;
-    if (numLegends > 0) {
-      String showStr = BasicServlet.getCookieValue(req, "tableLegend." + BasicServlet.encode(page)
+ "." + BasicServlet.encode(tableName) + "." + "show");
-      showLegend = showStr != null && Boolean.parseBoolean(showStr);
-    }
-
-    String redir = BasicServlet.currentPage(req);
-
-    if (namespaces != null) {
-      sb.append("<div id=\"filters\">\n");
-      String namespace = BasicServlet.getCookieValue(req, "namespaceDropdown." + BasicServlet.encode(page)
+ "." + BasicServlet.encode(tableName) + "."
-          + "selected");
-      if (namespace == null) {
-        namespace = "*";
-      }
-      sb.append("<div class=\"table-caption\">Namespaces</div>\n");
-      sb.append("<hr />\n");
-      sb.append("<div class='left show'><dl>\n");
-      doDropdownMenu(redir, page, tableName, sb, namespaces, namespace);
-      sb.append("</dl></div>\n");
-      sb.append("</div>\n");
-      sb.append("<div id=\"tables\">\n");
-    } else {
-      sb.append("<div>\n");
-    }
-
-    sb.append("<a name='").append(tableName).append("'>&nbsp;</a>\n");
-    sb.append("<table id='").append(tableName).append("' class='sortable'>\n");
-    sb.append("<caption");
-    if (captionclass != null && !captionclass.isEmpty())
-      sb.append(" class='").append(captionclass).append("'");
-    sb.append(">\n");
-    if (caption != null && !caption.isEmpty())
-      sb.append("<span class='table-caption'>").append(caption).append("</span><br
/>\n");
-    if (subcaption != null && !subcaption.isEmpty())
-      sb.append("<span class='table-subcaption'>").append(subcaption).append("</span><br
/>\n");
-
-    if (numLegends > 0) {
-      String legendUrl = String.format("/op?action=toggleLegend&redir=%s&page=%s&table=%s&show=%s",
redir, page, tableName, !showLegend);
-      sb.append("<a href='").append(legendUrl).append("'>").append(showLegend ? "Hide"
: "Show").append("&nbsp;Legend</a>\n");
-      if (showLegend)
-        sb.append("<div class='left show'><dl>\n");
-    }
-    for (int i = 0; i < columns.size(); ++i) {
-      TableColumn<?> col = columns.get(i);
-      String title = col.getTitle();
-      if (rows.size() > 1 && col.getCellType().isSortable()) {
-        String url = String.format("/op?action=sortTable&redir=%s&page=%s&table=%s&%s=%s",
redir, page, tableName, sortCol == i ? "asc" : "col",
-            sortCol == i ? !sortAscending : i);
-        String img = "";
-        if (sortCol == i)
-          img = String.format("&nbsp;<img width='10px' height='10px' src='/resources/%s.gif'
alt='%s' />", sortAscending ? "up" : "down", !sortAscending ? "^"
-              : "v");
-        col.setTitle(String.format("<a href='%s'>%s%s</a>", url, title, img));
-      }
-      String legend = col.getLegend();
-      if (showLegend && legend != null && !legend.isEmpty())
-        sb.append("<dt class='smalltext'><b>").append(title.replace("<br />",
"&nbsp;")).append("</b><dd>").append(legend).append("</dd></dt>\n");
-    }
-    if (showLegend && numLegends > 0)
-      sb.append("</dl></div>\n");
-
-    sb.append("</caption>\n");
-    sb.append("<tr>");
-    boolean first = true;
-    for (TableColumn<?> col : columns) {
-      String cellValue = col.getTitle() == null ? "" : String.valueOf(col.getTitle()).trim();
-      sb.append("<th").append(first ? " class='firstcell'" : "").append(">").append(cellValue.isEmpty()
? "-" : cellValue).append("</th>");
-      first = false;
-    }
-    sb.append("</tr>\n");
-    // don't sort if no columns are sortable or if there aren't enough rows
-    if (rows.size() > 1 && sortCol > -1) {
-      Collections.sort(rows, TableRow.getComparator(sortCol, columns.get(sortCol).getCellType()));
-      if (!sortAscending)
-        Collections.reverse(rows);
-    }
-    boolean highlight = true;
-    for (TableRow row : rows) {
-      for (int i = 0; i < row.size(); ++i) {
-        try {
-          row.set(i, columns.get(i).getCellType().format(row.get(i)));
-        } catch (Exception ex) {
-          throw new RuntimeException("Unable to process column " + i, ex);
-        }
-      }
-      row(sb, highlight, columns, row);
-      highlight = !highlight;
-    }
-    if (rows.isEmpty())
-      sb.append("<tr><td class='center' colspan='").append(columns.size()).append("'><i>Empty</i></td></tr>\n");
-    sb.append("</table>\n</div>\n\n");
-  }
-
-  private static void row(StringBuilder sb, boolean highlight, ArrayList<TableColumn<?>>
columns, TableRow row) {
-    sb.append(highlight ? "<tr class='highlight'>" : "<tr>");
-    boolean first = true;
-    for (int i = 0; i < row.size(); ++i) {
-      String cellValue = String.valueOf(row.get(i)).trim();
-      if (cellValue.isEmpty() || cellValue.equals(String.valueOf((Object) null)))
-        cellValue = "-";
-      sb.append("<td class='").append(first ? "firstcell" : "");
-      if (columns.get(i).getCellType().alignment() != null)
-        sb.append(first ? " " : "").append(columns.get(i).getCellType().alignment());
-      sb.append("'>").append(cellValue).append("</td>");
-      first = false;
-    }
-    sb.append("</tr>\n");
-  }
-
-  private static void doDropdownMenu(String redir, String page, String tableName, StringBuilder
sb, SortedMap<String,String> namespaces, String namespace) {
-
-    String namespaceUrl = String.format("/op?action=namespace&redir=%s&page=%s&table=%s&selected=",
redir, page, tableName);
-
-    sb.append("<ul id=\"namespaces\">\n");
-    sb.append("<li><a ").append(namespace.equals("*") ? "class=\"active\" " : "").append("href=\"").append(namespaceUrl)
-        .append("*\">*&nbsp;(All&nbsp;Tables)</a></li>");
-    for (String key : namespaces.keySet()) {
-      if (key.equals("")) {
-        sb.append("<li><a ").append(namespace.equals("-") ? "class=\"active\" "
: "").append("href=\"").append(namespaceUrl)
-            .append("-\">-&nbsp;(DEFAULT)</a></li>");
-      } else {
-        sb.append("<li><a ").append(namespace.equals(key) ? "class=\"active\" "
: "").append("href=\"").append(namespaceUrl).append(key).append("\">")
-            .append(key).append("</a></li>");
-      }
-    }
-    sb.append("</ul>\n");
-
-  }
-
-  public void setNamespaces(SortedMap<String,String> namespaces) {
-    this.namespaces = namespaces;
-  }
-}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/cc8d3353/server/monitor/src/main/java/org/apache/accumulo/monitor/util/TableColumn.java
----------------------------------------------------------------------
diff --git a/server/monitor/src/main/java/org/apache/accumulo/monitor/util/TableColumn.java
b/server/monitor/src/main/java/org/apache/accumulo/monitor/util/TableColumn.java
deleted file mode 100644
index 86ba393..0000000
--- a/server/monitor/src/main/java/org/apache/accumulo/monitor/util/TableColumn.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.accumulo.monitor.util;
-
-import org.apache.accumulo.monitor.util.celltypes.CellType;
-import org.apache.accumulo.monitor.util.celltypes.StringType;
-
-public class TableColumn<T> {
-  private String title;
-  private CellType<T> type;
-  private String legend;
-
-  public TableColumn(String title, CellType<T> type, String legend) {
-    this.title = title;
-    this.type = type != null ? type : new StringType<>();
-    this.legend = legend;
-  }
-
-  public void setTitle(String title) {
-    this.title = title;
-  }
-
-  public String getTitle() {
-    return title;
-  }
-
-  public String getLegend() {
-    return legend;
-  }
-
-  public CellType<T> getCellType() {
-    return type;
-  }
-}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/cc8d3353/server/monitor/src/main/java/org/apache/accumulo/monitor/util/TableRow.java
----------------------------------------------------------------------
diff --git a/server/monitor/src/main/java/org/apache/accumulo/monitor/util/TableRow.java b/server/monitor/src/main/java/org/apache/accumulo/monitor/util/TableRow.java
deleted file mode 100644
index 42853f4..0000000
--- a/server/monitor/src/main/java/org/apache/accumulo/monitor/util/TableRow.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.accumulo.monitor.util;
-
-import java.util.ArrayList;
-import java.util.Comparator;
-
-public class TableRow {
-  private int size;
-  private ArrayList<Object> row;
-
-  TableRow(int size) {
-    this.size = size;
-    this.row = new ArrayList<>(size);
-  }
-
-  public boolean add(Object obj) {
-    if (row.size() == size)
-      throw new IllegalStateException("Row is full.");
-    return row.add(obj);
-  }
-
-  Object get(int index) {
-    return row.get(index);
-  }
-
-  int size() {
-    return row.size();
-  }
-
-  Object set(int i, Object value) {
-    return row.set(i, value);
-  }
-
-  public static <T> Comparator<TableRow> getComparator(int index, Comparator<T>
comp) {
-    return new TableRowComparator<>(index, comp);
-  }
-
-  private static class TableRowComparator<T> implements Comparator<TableRow>
{
-    private int index;
-    private Comparator<T> comp;
-
-    public TableRowComparator(int index, Comparator<T> comp) {
-      this.index = index;
-      this.comp = comp;
-    }
-
-    @SuppressWarnings("unchecked")
-    @Override
-    public int compare(TableRow o1, TableRow o2) {
-      return comp.compare((T) o1.get(index), (T) o2.get(index));
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/cc8d3353/server/monitor/src/main/java/org/apache/accumulo/monitor/util/celltypes/CellType.java
----------------------------------------------------------------------
diff --git a/server/monitor/src/main/java/org/apache/accumulo/monitor/util/celltypes/CellType.java
b/server/monitor/src/main/java/org/apache/accumulo/monitor/util/celltypes/CellType.java
deleted file mode 100644
index 5dcdf12..0000000
--- a/server/monitor/src/main/java/org/apache/accumulo/monitor/util/celltypes/CellType.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.accumulo.monitor.util.celltypes;
-
-import java.io.Serializable;
-import java.util.Comparator;
-
-public abstract class CellType<T> implements Comparator<T>, Serializable {
-
-  private static final long serialVersionUID = 1L;
-  private boolean sortable = true;
-
-  abstract public String alignment();
-
-  abstract public String format(Object obj);
-
-  public final void setSortable(boolean sortable) {
-    this.sortable = sortable;
-  }
-
-  public final boolean isSortable() {
-    return sortable;
-  }
-}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/cc8d3353/server/monitor/src/main/java/org/apache/accumulo/monitor/util/celltypes/DateTimeType.java
----------------------------------------------------------------------
diff --git a/server/monitor/src/main/java/org/apache/accumulo/monitor/util/celltypes/DateTimeType.java
b/server/monitor/src/main/java/org/apache/accumulo/monitor/util/celltypes/DateTimeType.java
deleted file mode 100644
index 78a863f..0000000
--- a/server/monitor/src/main/java/org/apache/accumulo/monitor/util/celltypes/DateTimeType.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.accumulo.monitor.util.celltypes;
-
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.Locale;
-
-public class DateTimeType extends CellType<Long> {
-  private static final long serialVersionUID = 1L;
-  private SimpleDateFormat simple;
-  private int dateFormat;
-  private int timeFormat;
-
-  public DateTimeType(int dateFormat, int timeFormat) {
-    this.dateFormat = dateFormat;
-    this.timeFormat = timeFormat;
-    this.simple = null;
-  }
-
-  public DateTimeType(SimpleDateFormat fmt) {
-    simple = fmt;
-  }
-
-  @Override
-  public String format(Object obj) {
-    if (obj == null)
-      return "-";
-    Long millis = (Long) obj;
-    if (millis == 0)
-      return "-";
-    if (simple != null)
-      return simple.format(new Date(millis)).replace(" ", "&nbsp;");
-    return DateFormat.getDateTimeInstance(dateFormat, timeFormat, Locale.getDefault()).format(new
Date(millis)).replace(" ", "&nbsp;");
-  }
-
-  @Override
-  public int compare(Long o1, Long o2) {
-    if (o1 == null && o2 == null)
-      return 0;
-    else if (o1 == null)
-      return -1;
-    else
-      return o1.compareTo(o2);
-  }
-
-  @Override
-  public String alignment() {
-    return "right";
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/cc8d3353/server/monitor/src/main/java/org/apache/accumulo/monitor/util/celltypes/DurationType.java
----------------------------------------------------------------------
diff --git a/server/monitor/src/main/java/org/apache/accumulo/monitor/util/celltypes/DurationType.java
b/server/monitor/src/main/java/org/apache/accumulo/monitor/util/celltypes/DurationType.java
deleted file mode 100644
index f1ba9ed..0000000
--- a/server/monitor/src/main/java/org/apache/accumulo/monitor/util/celltypes/DurationType.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.accumulo.monitor.util.celltypes;
-
-import org.apache.accumulo.core.util.Duration;
-
-public class DurationType extends NumberType<Long> {
-  private static final long serialVersionUID = 1L;
-  private Long errMin;
-  private Long errMax;
-
-  public DurationType() {
-    this(null, null);
-  }
-
-  public DurationType(Long errMin, Long errMax) {
-    this.errMin = errMin;
-    this.errMax = errMax;
-  }
-
-  @Override
-  public String format(Object obj) {
-    if (obj == null)
-      return "-";
-    Long millis = (Long) obj;
-    if (errMin != null && errMax != null)
-      return seconds(millis, errMin, errMax);
-    return Duration.format(millis);
-  }
-
-  private static String seconds(long secs, long errMin, long errMax) {
-    String numbers = Duration.format(secs);
-    if (secs < errMin || secs > errMax)
-      return "<span class='error'>" + numbers + "</span>";
-    return numbers;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/cc8d3353/server/monitor/src/main/java/org/apache/accumulo/monitor/util/celltypes/NumberType.java
----------------------------------------------------------------------
diff --git a/server/monitor/src/main/java/org/apache/accumulo/monitor/util/celltypes/NumberType.java
b/server/monitor/src/main/java/org/apache/accumulo/monitor/util/celltypes/NumberType.java
deleted file mode 100644
index dfa40eb..0000000
--- a/server/monitor/src/main/java/org/apache/accumulo/monitor/util/celltypes/NumberType.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.accumulo.monitor.util.celltypes;
-
-import static org.apache.accumulo.core.util.NumUtil.bigNumberForQuantity;
-
-public class NumberType<T extends Number> extends CellType<T> {
-
-  private static final long serialVersionUID = 1L;
-  protected final T warnMin, warnMax, errMin, errMax;
-
-  public NumberType(T warnMin, T warnMax, T errMin, T errMax) {
-    this.warnMin = warnMin;
-    this.warnMax = warnMax;
-    this.errMin = errMin;
-    this.errMax = errMax;
-  }
-
-  public NumberType(T errMin, T errMax) {
-    this(null, null, errMin, errMax);
-  }
-
-  public NumberType() {
-    this(null, null);
-  }
-
-  @SuppressWarnings("unchecked")
-  @Override
-  public String format(Object obj) {
-    T number = (T) obj;
-    String s = "-";
-    if (number instanceof Double || number instanceof Float) {
-      if (warnMin != null && warnMax != null && errMin != null &&
errMax != null)
-        s = commas(number.doubleValue(), warnMin.doubleValue(), warnMax.doubleValue(), errMin.doubleValue(),
errMax.doubleValue());
-      else if (errMin != null && errMax != null)
-        s = commas(number.doubleValue(), errMin.doubleValue(), errMax.doubleValue());
-      else
-        s = commas(number.doubleValue());
-    } else if (number instanceof Long || number instanceof Integer || number instanceof Short
|| number instanceof Byte) {
-      if (warnMin != null && warnMax != null && errMin != null &&
errMax != null)
-        s = commas(number.longValue(), warnMin.longValue(), warnMax.longValue(), errMin.longValue(),
errMax.longValue());
-      else if (errMin != null && errMax != null)
-        s = commas(number.longValue(), errMin.longValue(), errMax.longValue());
-      else
-        s = commas(number.longValue());
-    } else {
-      if (number != null)
-        s = String.valueOf(number);
-    }
-    return s;
-  }
-
-  @Override
-  public int compare(T o1, T o2) {
-    if (o1 == null && o2 == null)
-      return 0;
-    else if (o1 == null)
-      return -1;
-    else if (o2 == null)
-      return 1;
-    else
-      return Double.compare(o1.doubleValue(), o2.doubleValue());
-  }
-
-  public static String commas(long i) {
-    return bigNumberForQuantity(i);
-  }
-
-  public static String commas(long i, long errMin, long errMax) {
-    if (i < errMin || i > errMax)
-      return String.format("<span class='error'>%s</span>", bigNumberForQuantity(i));
-    return bigNumberForQuantity(i);
-  }
-
-  public static String commas(double i) {
-    return bigNumberForQuantity((long) i);
-  }
-
-  public static String commas(double d, double errMin, double errMax) {
-    if (d < errMin || d > errMax)
-      return String.format("<span class='error'>%s</span>", bigNumberForQuantity(d));
-    return bigNumberForQuantity(d);
-  }
-
-  public static String commas(long i, long warnMin, long warnMax, long errMin, long errMax)
{
-    if (i < errMin || i > errMax)
-      return String.format("<span class='error'>%s</span>", bigNumberForQuantity(i));
-    if (i < warnMin || i > warnMax)
-      return String.format("<span class='warning'>%s</span>", bigNumberForQuantity(i));
-    return bigNumberForQuantity(i);
-  }
-
-  public static String commas(double d, double warnMin, double warnMax, double errMin, double
errMax) {
-    if (d < errMin || d > errMax)
-      return String.format("<span class='error'>%s</span>", bigNumberForQuantity(d));
-    if (d < warnMin || d > warnMax)
-      return String.format("<span class='warning'>%s</span>", bigNumberForQuantity(d));
-    return bigNumberForQuantity(d);
-  }
-
-  @Override
-  public String alignment() {
-    return "right";
-  }
-}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/cc8d3353/server/monitor/src/main/java/org/apache/accumulo/monitor/util/celltypes/StringType.java
----------------------------------------------------------------------
diff --git a/server/monitor/src/main/java/org/apache/accumulo/monitor/util/celltypes/StringType.java
b/server/monitor/src/main/java/org/apache/accumulo/monitor/util/celltypes/StringType.java
deleted file mode 100644
index 5cdc1f4..0000000
--- a/server/monitor/src/main/java/org/apache/accumulo/monitor/util/celltypes/StringType.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.accumulo.monitor.util.celltypes;
-
-public class StringType<T> extends CellType<T> {
-  private static final long serialVersionUID = 1L;
-
-  @Override
-  public String format(Object obj) {
-    return obj == null ? "-" : obj.toString();
-  }
-
-  @Override
-  public int compare(T o1, T o2) {
-    if (o1 == null && o2 == null)
-      return 0;
-    else if (o1 == null)
-      return -1;
-    else if (o2 == null)
-      return 1;
-    return o1.toString().compareTo(o2.toString());
-  }
-
-  @Override
-  public String alignment() {
-    return "left";
-  }
-}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/cc8d3353/server/monitor/src/main/resources/resources/summary.js
----------------------------------------------------------------------
diff --git a/server/monitor/src/main/resources/resources/summary.js b/server/monitor/src/main/resources/resources/summary.js
index a451f2f..261de91 100644
--- a/server/monitor/src/main/resources/resources/summary.js
+++ b/server/monitor/src/main/resources/resources/summary.js
@@ -49,7 +49,7 @@ function refreshTraceSummaryTable(minutes) {
 
   if (data.length === 0 || data.recentTraces.length === 0) {
     var items = [];
-    items.push('<td class="center" colspan="6"><i>No traces in the last ' +
+    items.push('<td class="center" colspan="6"><i>No traces available for the
last ' +
         minutes + ' minute(s)</i></td>');
     $('<tr/>', {
       html: items.join('')

http://git-wip-us.apache.org/repos/asf/accumulo/blob/cc8d3353/test/src/main/java/org/apache/accumulo/test/ThriftServerBindsBeforeZooKeeperLockIT.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/ThriftServerBindsBeforeZooKeeperLockIT.java
b/test/src/main/java/org/apache/accumulo/test/ThriftServerBindsBeforeZooKeeperLockIT.java
index 2890fc7..aa6ca6b 100644
--- a/test/src/main/java/org/apache/accumulo/test/ThriftServerBindsBeforeZooKeeperLockIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/ThriftServerBindsBeforeZooKeeperLockIT.java
@@ -35,7 +35,6 @@ import org.apache.accumulo.minicluster.ServerType;
 import org.apache.accumulo.minicluster.impl.MiniAccumuloClusterImpl;
 import org.apache.accumulo.minicluster.impl.ProcessReference;
 import org.apache.accumulo.monitor.Monitor;
-import org.apache.accumulo.monitor.servlets.BasicServlet;
 import org.apache.accumulo.server.util.PortUtils;
 import org.apache.accumulo.test.categories.MiniClusterOnlyTests;
 import org.apache.accumulo.test.functional.FunctionalTestUtils;
@@ -53,6 +52,7 @@ import com.google.common.collect.ImmutableMap;
 public class ThriftServerBindsBeforeZooKeeperLockIT extends AccumuloClusterHarness {
   private static final Logger LOG = LoggerFactory.getLogger(ThriftServerBindsBeforeZooKeeperLockIT.class);
 
+  @Override
   public boolean canRunTest(ClusterType type) {
     return ClusterType.MINI == type;
   }
@@ -94,7 +94,7 @@ public class ThriftServerBindsBeforeZooKeeperLockIT extends AccumuloClusterHarne
             final int responseCode = cnxn.getResponseCode();
             final String errorText = FunctionalTestUtils.readAll(cnxn.getErrorStream());
             // This is our "assertion", but we want to re-check it if it's not what we expect
-            if (HttpURLConnection.HTTP_UNAVAILABLE == responseCode && null != errorText
&& errorText.contains(BasicServlet.STANDBY_MONITOR_MESSAGE)) {
+            if (HttpURLConnection.HTTP_UNAVAILABLE == responseCode && null != errorText
&& errorText.contains("This is not the active Monitor")) {
               return;
             }
             LOG.debug("Unexpected responseCode and/or error text, will retry: '{}' '{}'",
responseCode, errorText);


Mime
View raw message