Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id AC9A1200CCC for ; Thu, 6 Jul 2017 22:43:05 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id AB4D0167628; Thu, 6 Jul 2017 20:43:05 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 5216916763A for ; Thu, 6 Jul 2017 22:43:02 +0200 (CEST) Received: (qmail 67341 invoked by uid 500); 6 Jul 2017 20:43:01 -0000 Mailing-List: contact commits-help@accumulo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@accumulo.apache.org Delivered-To: mailing list commits@accumulo.apache.org Received: (qmail 64845 invoked by uid 99); 6 Jul 2017 20:42:59 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 Jul 2017 20:42:59 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 1CB8BF5536; Thu, 6 Jul 2017 20:42:57 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: ctubbsii@apache.org To: commits@accumulo.apache.org Date: Thu, 06 Jul 2017 20:43:45 -0000 Message-Id: <2088847583654b4dbaf2cf5b68554b33@git.apache.org> In-Reply-To: <3b8d0f56f4e142fcbb35fd820ce25ed9@git.apache.org> References: <3b8d0f56f4e142fcbb35fd820ce25ed9@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [51/54] [abbrv] accumulo git commit: Delete unused items from monitor archived-at: Thu, 06 Jul 2017 20:43:05 -0000 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> columns; - private ArrayList rows; - private boolean hasBegunAddingRows = false; - - private SortedMap 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 void addColumn(TableColumn column) { - if (hasBegunAddingRows) - throw new IllegalStateException("Cannot add more columns newServer rows have been added"); - columns.add(column); - } - - private synchronized void addColumn(String title, CellType type, String legend, boolean sortable) { - if (type == null) - type = new StringType<>(); - type.setSortable(sortable); - addColumn(new TableColumn<>(title, type, legend)); - } - - public synchronized void addUnsortableColumn(String title, CellType type, String legend) { - addColumn(title, type, legend, false); - } - - public synchronized void addSortableColumn(String title, CellType 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("
\n"); - String namespace = BasicServlet.getCookieValue(req, "namespaceDropdown." + BasicServlet.encode(page) + "." + BasicServlet.encode(tableName) + "." - + "selected"); - if (namespace == null) { - namespace = "*"; - } - sb.append("
Namespaces
\n"); - sb.append("
\n"); - sb.append("
\n"); - doDropdownMenu(redir, page, tableName, sb, namespaces, namespace); - sb.append("
\n"); - sb.append("
\n"); - sb.append("
\n"); - } else { - sb.append("
\n"); - } - - sb.append(" \n"); - sb.append("\n"); - sb.append("\n"); - if (caption != null && !caption.isEmpty()) - sb.append("").append(caption).append("
\n"); - if (subcaption != null && !subcaption.isEmpty()) - sb.append("").append(subcaption).append("
\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("").append(showLegend ? "Hide" : "Show").append(" Legend\n"); - if (showLegend) - sb.append("
\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(" %s", sortAscending ? "up" : "down", !sortAscending ? "^" - : "v"); - col.setTitle(String.format("%s%s", url, title, img)); - } - String legend = col.getLegend(); - if (showLegend && legend != null && !legend.isEmpty()) - sb.append("
").append(title.replace("
", " ")).append("
").append(legend).append("
\n"); - } - if (showLegend && numLegends > 0) - sb.append("
\n"); - - sb.append("\n"); - sb.append("
"); - boolean first = true; - for (TableColumn col : columns) { - String cellValue = col.getTitle() == null ? "" : String.valueOf(col.getTitle()).trim(); - sb.append("").append(cellValue.isEmpty() ? "-" : cellValue).append(""); - first = false; - } - sb.append("\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("\n"); - sb.append("
Empty
\n
\n\n"); - } - - private static void row(StringBuilder sb, boolean highlight, ArrayList> columns, TableRow row) { - sb.append(highlight ? "" : ""); - 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("").append(cellValue).append(""); - first = false; - } - sb.append("\n"); - } - - private static void doDropdownMenu(String redir, String page, String tableName, StringBuilder sb, SortedMap namespaces, String namespace) { - - String namespaceUrl = String.format("/op?action=namespace&redir=%s&page=%s&table=%s&selected=", redir, page, tableName); - - sb.append("\n"); - - } - - public void setNamespaces(SortedMap 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 { - private String title; - private CellType type; - private String legend; - - public TableColumn(String title, CellType 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 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 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 Comparator getComparator(int index, Comparator comp) { - return new TableRowComparator<>(index, comp); - } - - private static class TableRowComparator implements Comparator { - private int index; - private Comparator comp; - - public TableRowComparator(int index, Comparator 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 implements Comparator, 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 { - 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(" ", " "); - return DateFormat.getDateTimeInstance(dateFormat, timeFormat, Locale.getDefault()).format(new Date(millis)).replace(" ", " "); - } - - @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 { - 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 "" + numbers + ""; - 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 extends CellType { - - 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("%s", 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("%s", 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("%s", bigNumberForQuantity(i)); - if (i < warnMin || i > warnMax) - return String.format("%s", 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("%s", bigNumberForQuantity(d)); - if (d < warnMin || d > warnMax) - return String.format("%s", 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 extends CellType { - 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('No traces in the last ' + + items.push('No traces available for the last ' + minutes + ' minute(s)'); $('', { 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);