accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ctubb...@apache.org
Subject [09/54] [partial] ACCUMULO-658, ACCUMULO-656 Split server into separate modules
Date Fri, 01 Nov 2013 00:55:48 GMT
http://git-wip-us.apache.org/repos/asf/accumulo/blob/598821cd/server/src/main/java/org/apache/accumulo/server/monitor/util/Table.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/monitor/util/Table.java b/server/src/main/java/org/apache/accumulo/server/monitor/util/Table.java
deleted file mode 100644
index 8862c06..0000000
--- a/server/src/main/java/org/apache/accumulo/server/monitor/util/Table.java
+++ /dev/null
@@ -1,233 +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.server.monitor.util;
-
-import java.util.ArrayList;
-import java.util.Collections;
-
-import javax.servlet.http.Cookie;
-import javax.servlet.http.HttpServletRequest;
-
-import org.apache.accumulo.server.monitor.servlets.BasicServlet;
-import org.apache.accumulo.server.monitor.util.celltypes.CellType;
-import org.apache.accumulo.server.monitor.util.celltypes.StringType;
-
-public class Table {
-  private String table;
-  private String caption;
-  private String captionclass;
-  private String subcaption;
-  private ArrayList<TableColumn<?>> columns;
-  private ArrayList<TableRow> rows;
-  private boolean hasBegunAddingRows = false;
-  
-  public Table(String tableName, String caption) {
-    this(tableName, caption, null);
-  }
-  
-  public Table(String tableName, String caption, String captionClass) {
-    this.table = tableName;
-    this.caption = caption;
-    this.captionclass = captionClass;
-    this.subcaption = null;
-    this.columns = new ArrayList<TableColumn<?>>();
-    this.rows = new ArrayList<TableRow>();
-  }
-  
-  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<T>();
-    type.setSortable(sortable);
-    addColumn(new TableColumn<T>(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 = true;
-    Cookie c = BasicServlet.getCookie(req, "tableSort." + page + "." + table + "." + "sortAsc");
-    if (c != null && "false".equals(c.getValue()))
-      sortAscending = false;
-    
-    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) {
-      c = BasicServlet.getCookie(req, "tableSort." + page + "." + table + "." + "sortCol");
-      if (c != null && c.getValue() != null) {
-        try {
-          int col = Integer.parseInt(c.getValue());
-          // 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) {
-      c = BasicServlet.getCookie(req, "tableLegend." + page + "." + table + "." + "show");
-      showLegend = c != null && Boolean.parseBoolean(c.getValue());
-    }
-    
-    sb.append("<div>\n");
-    sb.append("<a name='").append(table).append("'>&nbsp;</a>\n");
-    sb.append("<table id='").append(table).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");
-    
-    String redir = BasicServlet.currentPage(req);
-    if (numLegends > 0) {
-      String legendUrl = String.format("/op?action=toggleLegend&redir=%s&page=%s&table=%s&show=%s", redir, page, table, !showLegend);
-      sb.append("<a href='").append(legendUrl).append("'>").append(showLegend ? "Hide" : "Show").append("&nbsp;Legend</a>\n");
-      if (showLegend)
-        sb.append("<div class='left ").append(showLegend ? "show" : "hide").append("'><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, table, sortCol == i ? "asc" : "col",
-            sortCol == i ? !sortAscending : i);
-        String img = "";
-        if (sortCol == i)
-          img = String.format("&nbsp;<img width='10px' height='10px' src='/web/%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");
-  }
-  
-}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/598821cd/server/src/main/java/org/apache/accumulo/server/monitor/util/TableColumn.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/monitor/util/TableColumn.java b/server/src/main/java/org/apache/accumulo/server/monitor/util/TableColumn.java
deleted file mode 100644
index 830c28a..0000000
--- a/server/src/main/java/org/apache/accumulo/server/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.server.monitor.util;
-
-import org.apache.accumulo.server.monitor.util.celltypes.CellType;
-import org.apache.accumulo.server.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<T>();
-    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/598821cd/server/src/main/java/org/apache/accumulo/server/monitor/util/TableRow.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/monitor/util/TableRow.java b/server/src/main/java/org/apache/accumulo/server/monitor/util/TableRow.java
deleted file mode 100644
index 6d0f12d..0000000
--- a/server/src/main/java/org/apache/accumulo/server/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.server.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<Object>(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<T>(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/598821cd/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/CellType.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/CellType.java b/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/CellType.java
deleted file mode 100644
index 4217d37..0000000
--- a/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/CellType.java
+++ /dev/null
@@ -1,35 +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.server.monitor.util.celltypes;
-
-import java.util.Comparator;
-
-public abstract class CellType<T> implements Comparator<T> {
-  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/598821cd/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/CompactionsType.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/CompactionsType.java b/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/CompactionsType.java
deleted file mode 100644
index 49eb6a5..0000000
--- a/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/CompactionsType.java
+++ /dev/null
@@ -1,72 +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.server.monitor.util.celltypes;
-
-import org.apache.accumulo.core.master.thrift.Compacting;
-import org.apache.accumulo.core.master.thrift.TableInfo;
-
-public class CompactionsType extends CellType<TableInfo> {
-  
-  private String fieldName;
-  
-  public CompactionsType(String which) {
-    this.fieldName = which;
-  }
-  
-  @Override
-  public String format(Object obj) {
-    if (obj == null)
-      return "-";
-    TableInfo summary = (TableInfo) obj;
-    Compacting c = summary.majors;
-    if (fieldName.equals("minor"))
-      c = summary.minors;
-    else if (fieldName.equals("scans"))
-      c = summary.scans;
-    if (c == null)
-      c = new Compacting();
-    return String.format("%s&nbsp;(%,d)", NumberType.commas(c.running, c.queued == 0 ? 0 : 1, summary.onlineTablets), c.queued);
-  }
-  
-  @Override
-  public int compare(TableInfo o1, TableInfo o2) {
-    if (o1 == null)
-      return -1;
-    if (o2 == null)
-      return 1;
-    Compacting c1 = o1.majors;
-    Compacting c2 = o2.majors;
-    if (fieldName.equals("minor")) {
-      c1 = o1.minors;
-      c2 = o2.minors;
-    } else if (fieldName.equals("scans")) {
-      c1 = o1.scans;
-      c2 = o2.scans;
-    }
-    if (c1 == null)
-      return -1;
-    if (c2 == null)
-      return 1;
-    return c1.running + c1.queued - c2.running - c2.queued;
-  }
-  
-  @Override
-  public String alignment() {
-    return "right";
-  }
-  
-}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/598821cd/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/DateTimeType.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/DateTimeType.java b/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/DateTimeType.java
deleted file mode 100644
index 29d517c..0000000
--- a/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/DateTimeType.java
+++ /dev/null
@@ -1,66 +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.server.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 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/598821cd/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/DurationType.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/DurationType.java b/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/DurationType.java
deleted file mode 100644
index ec29413..0000000
--- a/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/DurationType.java
+++ /dev/null
@@ -1,51 +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.server.monitor.util.celltypes;
-
-import org.apache.accumulo.core.util.Duration;
-
-public class DurationType extends NumberType<Long> {
-  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/598821cd/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/NumberType.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/NumberType.java b/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/NumberType.java
deleted file mode 100644
index 72e3ef4..0000000
--- a/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/NumberType.java
+++ /dev/null
@@ -1,118 +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.server.monitor.util.celltypes;
-
-import static org.apache.accumulo.core.util.NumUtil.bigNumberForQuantity;
-
-public class NumberType<T extends Number> extends CellType<T> {
-  
-  private 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.valueOf(o1.doubleValue()).compareTo(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/598821cd/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/PercentageType.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/PercentageType.java b/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/PercentageType.java
deleted file mode 100644
index fb4f60c..0000000
--- a/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/PercentageType.java
+++ /dev/null
@@ -1,40 +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.server.monitor.util.celltypes;
-
-public class PercentageType extends CellType<Double> {
-  
-  @Override
-  public int compare(Double o1, Double o2) {
-    return o1.compareTo(o2);
-  }
-  
-  @Override
-  public String alignment() {
-    return "right";
-  }
-  
-  @Override
-  public String format(Object obj) {
-    if (obj == null)
-      return "-";
-    
-    return String.format("%.0f%s", 100 * (Double) obj, "%");
-    
-  }
-  
-}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/598821cd/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/ProgressChartType.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/ProgressChartType.java b/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/ProgressChartType.java
deleted file mode 100644
index 424bf2d..0000000
--- a/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/ProgressChartType.java
+++ /dev/null
@@ -1,59 +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.server.monitor.util.celltypes;
-
-public class ProgressChartType extends NumberType<Double> {
-  
-  private double max;
-  
-  public ProgressChartType() {
-    this(1.0);
-  }
-  
-  public ProgressChartType(Double total) {
-    max = total == null ? 1.0 : total;
-  }
-  
-  @Override
-  public String format(Object obj) {
-    if (obj == null)
-      return "-";
-    Double num = (Double) obj;
-    return getChart(num, max);
-  }
-  
-  public static String getChart(double num, double total) {
-    StringBuilder result = new StringBuilder();
-    double percent = 0;
-    if (total != 0)
-      percent = (num / total) * 100;
-    
-    int width = 0;
-    if (percent < 1)
-      width = 0;
-    else if (percent > 100)
-      width = 100;
-    else
-      width = (int) percent;
-    
-    result.append("<div class='progress-chart'>");
-    result.append("<div style='width: ").append(width).append("%;'></div>");
-    result.append("</div>&nbsp;");
-    result.append((percent < 1 && percent > 0) ? "&lt;1" : (int) percent).append("%");
-    return result.toString();
-  }
-}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/598821cd/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/StringType.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/StringType.java b/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/StringType.java
deleted file mode 100644
index d48f3ea..0000000
--- a/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/StringType.java
+++ /dev/null
@@ -1,40 +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.server.monitor.util.celltypes;
-
-public class StringType<T> extends CellType<T> {
-  @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/598821cd/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/TServerLinkType.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/TServerLinkType.java b/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/TServerLinkType.java
deleted file mode 100644
index 8081f30..0000000
--- a/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/TServerLinkType.java
+++ /dev/null
@@ -1,51 +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.server.monitor.util.celltypes;
-
-import org.apache.accumulo.core.master.thrift.TabletServerStatus;
-
-public class TServerLinkType extends CellType<TabletServerStatus> {
-  
-  @Override
-  public String format(Object obj) {
-    if (obj == null)
-      return "-";
-    TabletServerStatus status = (TabletServerStatus) obj;
-    return String.format("<a href='/tservers?s=%s'>%s</a>", status.name, displayName(status));
-  }
-  
-  public static String displayName(TabletServerStatus status) {
-    return displayName(status == null ? null : status.name);
-  }
-  
-  public static String displayName(String address) {
-    if (address == null)
-      return "--Unknown--";
-    return address;
-  }
-  
-  @Override
-  public int compare(TabletServerStatus o1, TabletServerStatus o2) {
-    return displayName(o1).compareTo(displayName(o2));
-  }
-  
-  @Override
-  public String alignment() {
-    return "left";
-  }
-  
-}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/598821cd/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/TableLinkType.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/TableLinkType.java b/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/TableLinkType.java
deleted file mode 100644
index 4ca6dac..0000000
--- a/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/TableLinkType.java
+++ /dev/null
@@ -1,56 +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.server.monitor.util.celltypes;
-
-import java.util.Map;
-
-import org.apache.accumulo.core.client.impl.Tables;
-import org.apache.accumulo.server.client.HdfsZooInstance;
-
-public class TableLinkType extends CellType<String> {
-  
-  private Map<String,String> tidToNameMap;
-  
-  public TableLinkType() {
-    tidToNameMap = Tables.getIdToNameMap(HdfsZooInstance.getInstance());
-  }
-  
-  @Override
-  public String format(Object obj) {
-    if (obj == null)
-      return "-";
-    String tableId = (String) obj;
-    return String.format("<a href='/tables?t=%s'>%s</a>", tableId, displayName(tableId));
-  }
-  
-  private String displayName(String tableId) {
-    if (tableId == null)
-      return "-";
-    return Tables.getPrintableTableNameFromId(tidToNameMap, tableId);
-  }
-  
-  @Override
-  public int compare(String o1, String o2) {
-    return displayName(o1).compareTo(displayName(o2));
-  }
-  
-  @Override
-  public String alignment() {
-    return "left";
-  }
-  
-}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/598821cd/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/TableStateType.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/TableStateType.java b/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/TableStateType.java
deleted file mode 100644
index 74e156f..0000000
--- a/server/src/main/java/org/apache/accumulo/server/monitor/util/celltypes/TableStateType.java
+++ /dev/null
@@ -1,57 +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.server.monitor.util.celltypes;
-
-import org.apache.accumulo.core.master.state.tables.TableState;
-
-public class TableStateType extends CellType<TableState> {
-  
-  @Override
-  public String alignment() {
-    return "center";
-  }
-  
-  @Override
-  public String format(Object obj) {
-    TableState state = obj == null ? TableState.UNKNOWN : (TableState) obj;
-    String style = null;
-    switch (state) {
-      case ONLINE:
-      case OFFLINE:
-        break;
-      case NEW:
-      case DELETING:
-        style = "warning";
-        break;
-      case UNKNOWN:
-      default:
-        style = "error";
-    }
-    style = style != null ? " class='" + style + "'" : "";
-    return String.format("<span%s>%s</span>", style, state);
-  }
-  
-  @Override
-  public int compare(TableState o1, TableState o2) {
-    if (o1 == null && o2 == null)
-      return 0;
-    else if (o1 == null)
-      return -1;
-    return o1.compareTo(o2);
-  }
-  
-}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/598821cd/server/src/main/java/org/apache/accumulo/server/problems/ProblemReport.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/problems/ProblemReport.java b/server/src/main/java/org/apache/accumulo/server/problems/ProblemReport.java
deleted file mode 100644
index fec4e55..0000000
--- a/server/src/main/java/org/apache/accumulo/server/problems/ProblemReport.java
+++ /dev/null
@@ -1,221 +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.server.problems;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.util.Map.Entry;
-
-import org.apache.accumulo.core.Constants;
-import org.apache.accumulo.core.data.Key;
-import org.apache.accumulo.core.data.Mutation;
-import org.apache.accumulo.core.data.Value;
-import org.apache.accumulo.core.util.Encoding;
-import org.apache.accumulo.core.zookeeper.ZooUtil;
-import org.apache.accumulo.fate.zookeeper.ZooUtil.NodeExistsPolicy;
-import org.apache.accumulo.fate.zookeeper.ZooUtil.NodeMissingPolicy;
-import org.apache.accumulo.server.client.HdfsZooInstance;
-import org.apache.accumulo.server.security.SystemCredentials;
-import org.apache.accumulo.server.util.MetadataTableUtil;
-import org.apache.accumulo.server.zookeeper.ZooReaderWriter;
-import org.apache.hadoop.io.Text;
-
-public class ProblemReport {
-  private String tableName;
-  private ProblemType problemType;
-  private String resource;
-  private String exception;
-  private String server;
-  private long creationTime;
-  
-  public ProblemReport(String table, ProblemType problemType, String resource, String server, Throwable e) {
-    this.tableName = table;
-    
-    this.problemType = problemType;
-    this.resource = resource;
-    
-    if (e != null) {
-      this.exception = e.getMessage();
-    }
-    
-    if (server == null) {
-      try {
-        server = InetAddress.getLocalHost().getHostAddress();
-      } catch (UnknownHostException e1) {
-        
-      }
-    }
-    
-    this.server = server;
-    this.creationTime = System.currentTimeMillis();
-  }
-  
-  public ProblemReport(String table, ProblemType problemType, String resource, Throwable e) {
-    this(table, problemType, resource, null, e);
-  }
-  
-  private ProblemReport(String table, ProblemType problemType, String resource, byte enc[]) throws IOException {
-    this.tableName = table;
-    this.problemType = problemType;
-    this.resource = resource;
-    
-    decode(enc);
-  }
-  
-  private byte[] encode() throws IOException {
-    ByteArrayOutputStream baos = new ByteArrayOutputStream();
-    DataOutputStream dos = new DataOutputStream(baos);
-    
-    dos.writeLong(creationTime);
-    
-    dos.writeBoolean(server != null);
-    if (server != null) {
-      dos.writeUTF(server);
-    }
-    
-    dos.writeBoolean(exception != null);
-    if (exception != null) {
-      dos.writeUTF(exception);
-    }
-    
-    dos.close();
-    baos.close();
-    
-    return baos.toByteArray();
-  }
-  
-  private void decode(byte enc[]) throws IOException {
-    ByteArrayInputStream bais = new ByteArrayInputStream(enc);
-    DataInputStream dis = new DataInputStream(bais);
-    
-    creationTime = dis.readLong();
-    
-    if (dis.readBoolean()) {
-      server = dis.readUTF();
-    } else {
-      server = null;
-    }
-    
-    if (dis.readBoolean()) {
-      exception = dis.readUTF();
-    } else {
-      exception = null;
-    }
-  }
-  
-  void removeFromMetadataTable() throws Exception {
-    Mutation m = new Mutation(new Text("~err_" + tableName));
-    m.putDelete(new Text(problemType.name()), new Text(resource));
-    MetadataTableUtil.getMetadataTable(SystemCredentials.get()).update(m);
-  }
-  
-  void saveToMetadataTable() throws Exception {
-    Mutation m = new Mutation(new Text("~err_" + tableName));
-    m.put(new Text(problemType.name()), new Text(resource), new Value(encode()));
-    MetadataTableUtil.getMetadataTable(SystemCredentials.get()).update(m);
-  }
-  
-  void removeFromZooKeeper() throws Exception {
-    String zpath = getZPath();
-    ZooReaderWriter.getInstance().recursiveDelete(zpath, NodeMissingPolicy.SKIP);
-  }
-  
-  void saveToZooKeeper() throws Exception {
-    ZooReaderWriter.getInstance().putPersistentData(getZPath(), encode(), NodeExistsPolicy.OVERWRITE);
-  }
-  
-  private String getZPath() throws IOException {
-    ByteArrayOutputStream baos = new ByteArrayOutputStream();
-    DataOutputStream dos = new DataOutputStream(baos);
-    dos.writeUTF(getTableName());
-    dos.writeUTF(getProblemType().name());
-    dos.writeUTF(getResource());
-    dos.close();
-    baos.close();
-    
-    String zpath = ZooUtil.getRoot(HdfsZooInstance.getInstance()) + Constants.ZPROBLEMS + "/" + Encoding.encodeAsBase64FileName(new Text(baos.toByteArray()));
-    return zpath;
-  }
-  
-  static ProblemReport decodeZooKeeperEntry(String node) throws Exception {
-    byte bytes[] = Encoding.decodeBase64FileName(node);
-    
-    ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
-    DataInputStream dis = new DataInputStream(bais);
-    
-    String tableName = dis.readUTF();
-    String problemType = dis.readUTF();
-    String resource = dis.readUTF();
-    
-    String zpath = ZooUtil.getRoot(HdfsZooInstance.getInstance()) + Constants.ZPROBLEMS + "/" + node;
-    byte[] enc = ZooReaderWriter.getInstance().getData(zpath, null);
-    
-    return new ProblemReport(tableName, ProblemType.valueOf(problemType), resource, enc);
-    
-  }
-  
-  public static ProblemReport decodeMetadataEntry(Entry<Key,Value> entry) throws IOException {
-    String tableName = entry.getKey().getRow().toString().substring("~err_".length());
-    String problemType = entry.getKey().getColumnFamily().toString();
-    String resource = entry.getKey().getColumnQualifier().toString();
-    
-    return new ProblemReport(tableName, ProblemType.valueOf(problemType), resource, entry.getValue().get());
-  }
-  
-  public String getTableName() {
-    return tableName;
-  }
-  
-  public ProblemType getProblemType() {
-    return problemType;
-  }
-  
-  public String getResource() {
-    return resource;
-  }
-  
-  public String getException() {
-    return exception;
-  }
-  
-  public String getServer() {
-    return server;
-  }
-  
-  public long getTime() {
-    return creationTime;
-  }
-  
-  @Override
-  public int hashCode() {
-    return tableName.hashCode() + problemType.hashCode() + resource.hashCode();
-  }
-  
-  @Override
-  public boolean equals(Object o) {
-    if (o instanceof ProblemReport) {
-      ProblemReport opr = (ProblemReport) o;
-      return tableName.equals(opr.tableName) && problemType.equals(opr.problemType) && resource.equals(opr.resource);
-    }
-    return false;
-  }
-}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/598821cd/server/src/main/java/org/apache/accumulo/server/problems/ProblemReportingIterator.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/problems/ProblemReportingIterator.java b/server/src/main/java/org/apache/accumulo/server/problems/ProblemReportingIterator.java
deleted file mode 100644
index 69d73e1..0000000
--- a/server/src/main/java/org/apache/accumulo/server/problems/ProblemReportingIterator.java
+++ /dev/null
@@ -1,116 +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.server.problems;
-
-import java.io.IOException;
-import java.util.Collection;
-import java.util.Map;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import org.apache.accumulo.core.data.ByteSequence;
-import org.apache.accumulo.core.data.Key;
-import org.apache.accumulo.core.data.Range;
-import org.apache.accumulo.core.data.Value;
-import org.apache.accumulo.core.iterators.IteratorEnvironment;
-import org.apache.accumulo.core.iterators.SortedKeyValueIterator;
-import org.apache.accumulo.core.iterators.system.InterruptibleIterator;
-
-public class ProblemReportingIterator implements InterruptibleIterator {
-  private SortedKeyValueIterator<Key,Value> source;
-  private boolean sawError = false;
-  private boolean continueOnError;
-  private String resource;
-  private String table;
-  
-  public ProblemReportingIterator(String table, String resource, boolean continueOnError, SortedKeyValueIterator<Key,Value> source) {
-    this.table = table;
-    this.resource = resource;
-    this.continueOnError = continueOnError;
-    this.source = source;
-  }
-  
-  @Override
-  public SortedKeyValueIterator<Key,Value> deepCopy(IteratorEnvironment env) {
-    return new ProblemReportingIterator(table, resource, continueOnError, source.deepCopy(env));
-  }
-  
-  @Override
-  public Key getTopKey() {
-    return source.getTopKey();
-  }
-  
-  @Override
-  public Value getTopValue() {
-    return source.getTopValue();
-  }
-  
-  @Override
-  public boolean hasTop() {
-    if (sawError) {
-      return false;
-    }
-    return source.hasTop();
-  }
-  
-  @Override
-  public void init(SortedKeyValueIterator<Key,Value> source, Map<String,String> options, IteratorEnvironment env) throws IOException {
-    throw new UnsupportedOperationException();
-  }
-  
-  @Override
-  public void next() throws IOException {
-    try {
-      source.next();
-    } catch (IOException ioe) {
-      sawError = true;
-      ProblemReports.getInstance().report(new ProblemReport(table, ProblemType.FILE_READ, resource, ioe));
-      if (!continueOnError) {
-        throw ioe;
-      }
-    }
-  }
-  
-  @Override
-  public void seek(Range range, Collection<ByteSequence> columnFamilies, boolean inclusive) throws IOException {
-    if (continueOnError && sawError) {
-      return;
-    }
-    
-    try {
-      source.seek(range, columnFamilies, inclusive);
-    } catch (IOException ioe) {
-      sawError = true;
-      ProblemReports.getInstance().report(new ProblemReport(table, ProblemType.FILE_READ, resource, ioe));
-      if (!continueOnError) {
-        throw ioe;
-      }
-    }
-  }
-  
-  public boolean sawError() {
-    return sawError;
-  }
-  
-  public String getResource() {
-    return resource;
-  }
-  
-  @Override
-  public void setInterruptFlag(AtomicBoolean flag) {
-    ((InterruptibleIterator) source).setInterruptFlag(flag);
-  }
-}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/598821cd/server/src/main/java/org/apache/accumulo/server/problems/ProblemReports.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/problems/ProblemReports.java b/server/src/main/java/org/apache/accumulo/server/problems/ProblemReports.java
deleted file mode 100644
index a68a3cd..0000000
--- a/server/src/main/java/org/apache/accumulo/server/problems/ProblemReports.java
+++ /dev/null
@@ -1,320 +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.server.problems;
-
-import java.util.Collections;
-import java.util.EnumMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.NoSuchElementException;
-import java.util.TreeMap;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.LinkedBlockingQueue;
-import java.util.concurrent.RejectedExecutionException;
-import java.util.concurrent.ThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
-
-import org.apache.accumulo.core.Constants;
-import org.apache.accumulo.core.client.Connector;
-import org.apache.accumulo.core.client.IteratorSetting;
-import org.apache.accumulo.core.client.Scanner;
-import org.apache.accumulo.core.data.Key;
-import org.apache.accumulo.core.data.Mutation;
-import org.apache.accumulo.core.data.Range;
-import org.apache.accumulo.core.data.Value;
-import org.apache.accumulo.core.iterators.SortedKeyIterator;
-import org.apache.accumulo.core.metadata.MetadataTable;
-import org.apache.accumulo.core.metadata.RootTable;
-import org.apache.accumulo.core.security.Authorizations;
-import org.apache.accumulo.core.util.LoggingRunnable;
-import org.apache.accumulo.core.util.NamingThreadFactory;
-import org.apache.accumulo.core.zookeeper.ZooUtil;
-import org.apache.accumulo.fate.zookeeper.IZooReaderWriter;
-import org.apache.accumulo.server.client.HdfsZooInstance;
-import org.apache.accumulo.server.security.SystemCredentials;
-import org.apache.accumulo.server.util.MetadataTableUtil;
-import org.apache.accumulo.server.zookeeper.ZooReaderWriter;
-import org.apache.commons.collections.map.LRUMap;
-import org.apache.hadoop.io.Text;
-import org.apache.log4j.Logger;
-
-public class ProblemReports implements Iterable<ProblemReport> {
-  
-  private static final Logger log = Logger.getLogger(ProblemReports.class);
-  
-  private final LRUMap problemReports = new LRUMap(1000);
-  
-  /*
-   * use a thread pool so that reporting a problem never blocks
-   * 
-   * make the thread pool use a bounded queue to avoid the case where problem reports are not being processed because the whole system is in a really bad state
-   * (like HDFS is down) and everything is reporting lots of problems, but problem reports can not be processed
-   */
-  private ExecutorService reportExecutor = new ThreadPoolExecutor(0, 1, 60, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(500), new NamingThreadFactory(
-      "acu-problem-reporter"));
-  
-  public void report(final ProblemReport pr) {
-    
-    synchronized (problemReports) {
-      if (problemReports.containsKey(pr)) {
-        return;
-      }
-      
-      problemReports.put(pr, System.currentTimeMillis());
-    }
-    
-    Runnable r = new Runnable() {
-      
-      @Override
-      public void run() {
-        
-        log.debug("Filing problem report " + pr.getTableName() + " " + pr.getProblemType() + " " + pr.getResource());
-        
-        try {
-          if (pr.getTableName().equals(MetadataTable.ID) || pr.getTableName().equals(RootTable.ID)) {
-            // file report in zookeeper
-            pr.saveToZooKeeper();
-          } else {
-            // file report in metadata table
-            pr.saveToMetadataTable();
-          }
-        } catch (Exception e) {
-          log.error("Failed to file problem report " + pr.getTableName() + " " + pr.getProblemType() + " " + pr.getResource(), e);
-        }
-      }
-      
-    };
-    
-    try {
-      reportExecutor.execute(new LoggingRunnable(log, r));
-    } catch (RejectedExecutionException ree) {
-      log.error("Failed to report problem " + pr.getTableName() + " " + pr.getProblemType() + " " + pr.getResource() + "  " + ree.getMessage());
-    }
-    
-  }
-  
-  public void printProblems() throws Exception {
-    for (ProblemReport pr : this) {
-      System.out.println(pr.getTableName() + " " + pr.getProblemType() + " " + pr.getResource() + " " + pr.getException());
-    }
-  }
-  
-  public void deleteProblemReport(String table, ProblemType pType, String resource) {
-    final ProblemReport pr = new ProblemReport(table, pType, resource, null);
-    
-    Runnable r = new Runnable() {
-      
-      @Override
-      public void run() {
-        try {
-          if (pr.getTableName().equals(MetadataTable.ID)) {
-            // file report in zookeeper
-            pr.removeFromZooKeeper();
-          } else {
-            // file report in metadata table
-            pr.removeFromMetadataTable();
-          }
-        } catch (Exception e) {
-          log.error("Failed to delete problem report " + pr.getTableName() + " " + pr.getProblemType() + " " + pr.getResource(), e);
-        }
-      }
-    };
-    
-    try {
-      reportExecutor.execute(new LoggingRunnable(log, r));
-    } catch (RejectedExecutionException ree) {
-      log.error("Failed to delete problem report " + pr.getTableName() + " " + pr.getProblemType() + " " + pr.getResource() + "  " + ree.getMessage());
-    }
-  }
-  
-  private static ProblemReports instance;
-  
-  public void deleteProblemReports(String table) throws Exception {
-    
-    if (MetadataTable.ID.equals(table)) {
-      Iterator<ProblemReport> pri = iterator(table);
-      while (pri.hasNext()) {
-        pri.next().removeFromZooKeeper();
-      }
-      return;
-    }
-    
-    Connector connector = HdfsZooInstance.getInstance().getConnector(SystemCredentials.get().getPrincipal(), SystemCredentials.get().getToken());
-    Scanner scanner = connector.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
-    scanner.addScanIterator(new IteratorSetting(1, "keys-only", SortedKeyIterator.class));
-    
-    if (table == null) {
-      scanner.setRange(new Range(new Text("~err_"), false, new Text("~err`"), false));
-    } else {
-      scanner.setRange(new Range(new Text("~err_" + table)));
-    }
-    
-    Mutation delMut = new Mutation(new Text("~err_" + table));
-    
-    boolean hasProblems = false;
-    for (Entry<Key,Value> entry : scanner) {
-      hasProblems = true;
-      delMut.putDelete(entry.getKey().getColumnFamily(), entry.getKey().getColumnQualifier());
-    }
-    
-    if (hasProblems)
-      MetadataTableUtil.getMetadataTable(SystemCredentials.get()).update(delMut);
-  }
-  
-  public Iterator<ProblemReport> iterator(final String table) {
-    try {
-      
-      return new Iterator<ProblemReport>() {
-        
-        IZooReaderWriter zoo = ZooReaderWriter.getInstance();
-        private int iter1Count = 0;
-        private Iterator<String> iter1;
-        
-        private Iterator<String> getIter1() {
-          if (iter1 == null) {
-            try {
-              List<String> children;
-              if (table == null || table.equals(MetadataTable.ID)) {
-                children = zoo.getChildren(ZooUtil.getRoot(HdfsZooInstance.getInstance()) + Constants.ZPROBLEMS);
-              } else {
-                children = Collections.emptyList();
-              }
-              iter1 = children.iterator();
-            } catch (Exception e) {
-              throw new RuntimeException(e);
-            }
-          }
-          
-          return iter1;
-        }
-        
-        private Iterator<Entry<Key,Value>> iter2;
-        
-        private Iterator<Entry<Key,Value>> getIter2() {
-          if (iter2 == null) {
-            try {
-              if ((table == null || !table.equals(MetadataTable.ID)) && iter1Count == 0) {
-                Connector connector = HdfsZooInstance.getInstance().getConnector(SystemCredentials.get().getPrincipal(), SystemCredentials.get().getToken());
-                Scanner scanner = connector.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
-                
-                scanner.setTimeout(3, TimeUnit.SECONDS);
-                
-                if (table == null) {
-                  scanner.setRange(new Range(new Text("~err_"), false, new Text("~err`"), false));
-                } else {
-                  scanner.setRange(new Range(new Text("~err_" + table)));
-                }
-                
-                iter2 = scanner.iterator();
-                
-              } else {
-                Map<Key,Value> m = Collections.emptyMap();
-                iter2 = m.entrySet().iterator();
-              }
-            } catch (Exception e) {
-              throw new RuntimeException(e);
-            }
-          }
-          
-          return iter2;
-        }
-        
-        @Override
-        public boolean hasNext() {
-          if (getIter1().hasNext()) {
-            return true;
-          }
-          
-          if (getIter2().hasNext()) {
-            return true;
-          }
-          
-          return false;
-        }
-        
-        @Override
-        public ProblemReport next() {
-          try {
-            if (getIter1().hasNext()) {
-              iter1Count++;
-              return ProblemReport.decodeZooKeeperEntry(getIter1().next());
-            }
-            
-            if (getIter2().hasNext()) {
-              return ProblemReport.decodeMetadataEntry(getIter2().next());
-            }
-          } catch (Exception e) {
-            throw new RuntimeException(e);
-          }
-          
-          throw new NoSuchElementException();
-        }
-        
-        @Override
-        public void remove() {
-          throw new UnsupportedOperationException();
-        }
-        
-      };
-      
-    } catch (Exception e) {
-      throw new RuntimeException(e);
-    }
-  }
-  
-  @Override
-  public Iterator<ProblemReport> iterator() {
-    return iterator(null);
-  }
-  
-  public static synchronized ProblemReports getInstance() {
-    if (instance == null) {
-      instance = new ProblemReports();
-    }
-    
-    return instance;
-  }
-  
-  public static void main(String args[]) throws Exception {
-    getInstance().printProblems();
-  }
-  
-  public Map<String,Map<ProblemType,Integer>> summarize() {
-    
-    TreeMap<String,Map<ProblemType,Integer>> summary = new TreeMap<String,Map<ProblemType,Integer>>();
-    
-    for (ProblemReport pr : this) {
-      Map<ProblemType,Integer> tableProblems = summary.get(pr.getTableName());
-      if (tableProblems == null) {
-        tableProblems = new EnumMap<ProblemType,Integer>(ProblemType.class);
-        summary.put(pr.getTableName(), tableProblems);
-      }
-      
-      Integer count = tableProblems.get(pr.getProblemType());
-      if (count == null) {
-        count = 0;
-      }
-      
-      tableProblems.put(pr.getProblemType(), count + 1);
-    }
-    
-    return summary;
-  }
-  
-}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/598821cd/server/src/main/java/org/apache/accumulo/server/problems/ProblemType.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/problems/ProblemType.java b/server/src/main/java/org/apache/accumulo/server/problems/ProblemType.java
deleted file mode 100644
index 27af759..0000000
--- a/server/src/main/java/org/apache/accumulo/server/problems/ProblemType.java
+++ /dev/null
@@ -1,21 +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.server.problems;
-
-public enum ProblemType {
-  FILE_READ, FILE_WRITE, TABLET_LOAD
-}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/598821cd/server/src/main/java/org/apache/accumulo/server/security/AuditedSecurityOperation.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/security/AuditedSecurityOperation.java b/server/src/main/java/org/apache/accumulo/server/security/AuditedSecurityOperation.java
deleted file mode 100644
index ee337a5..0000000
--- a/server/src/main/java/org/apache/accumulo/server/security/AuditedSecurityOperation.java
+++ /dev/null
@@ -1,436 +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.server.security;
-
-import java.nio.ByteBuffer;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import org.apache.accumulo.core.client.TableNotFoundException;
-import org.apache.accumulo.core.client.impl.Tables;
-import org.apache.accumulo.core.client.impl.Translator;
-import org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException;
-import org.apache.accumulo.core.data.Column;
-import org.apache.accumulo.core.data.KeyExtent;
-import org.apache.accumulo.core.data.Range;
-import org.apache.accumulo.core.data.thrift.IterInfo;
-import org.apache.accumulo.core.data.thrift.TColumn;
-import org.apache.accumulo.core.data.thrift.TKeyExtent;
-import org.apache.accumulo.core.data.thrift.TRange;
-import org.apache.accumulo.core.master.thrift.TableOperation;
-import org.apache.accumulo.core.metadata.MetadataTable;
-import org.apache.accumulo.core.security.Authorizations;
-import org.apache.accumulo.core.security.Credentials;
-import org.apache.accumulo.core.security.SystemPermission;
-import org.apache.accumulo.core.security.TablePermission;
-import org.apache.accumulo.core.security.thrift.TCredentials;
-import org.apache.accumulo.core.util.ByteBufferUtil;
-import org.apache.accumulo.server.client.HdfsZooInstance;
-import org.apache.accumulo.server.security.handler.Authenticator;
-import org.apache.accumulo.server.security.handler.Authorizor;
-import org.apache.accumulo.server.security.handler.PermissionHandler;
-import org.apache.hadoop.io.Text;
-import org.apache.log4j.Logger;
-
-/**
- *
- */
-public class AuditedSecurityOperation extends SecurityOperation {
-  
-  public static final String AUDITLOG = "Audit";
-  public static final Logger audit = Logger.getLogger(AUDITLOG);
-  
-  public AuditedSecurityOperation(Authorizor author, Authenticator authent, PermissionHandler pm, String instanceId) {
-    super(author, authent, pm, instanceId);
-  }
-  
-  public static synchronized SecurityOperation getInstance() {
-    String instanceId = HdfsZooInstance.getInstance().getInstanceID();
-    return getInstance(instanceId, false);
-  }
-  
-  public static synchronized SecurityOperation getInstance(String instanceId, boolean initialize) {
-    if (instance == null) {
-      instance = new AuditedSecurityOperation(getAuthorizor(instanceId, initialize), getAuthenticator(instanceId, initialize), getPermHandler(instanceId,
-          initialize), instanceId);
-    }
-    return instance;
-  }
-  
-  private static String getTableName(String tableId) {
-    try {
-      return Tables.getTableName(HdfsZooInstance.getInstance(), tableId);
-    } catch (TableNotFoundException e) {
-      return "Unknown Table with ID " + tableId;
-    }
-  }
-  
-  public static StringBuilder getAuthString(List<ByteBuffer> authorizations) {
-    StringBuilder auths = new StringBuilder();
-    for (ByteBuffer bb : authorizations) {
-      auths.append(ByteBufferUtil.toString(bb)).append(",");
-    }
-    return auths;
-  }
-  
-  private static boolean shouldAudit(TCredentials credentials, String tableId) {
-    return !tableId.equals(MetadataTable.ID) && shouldAudit(credentials);
-  }
-  
-  // Is INFO the right level to check? Do we even need that check?
-  private static boolean shouldAudit(TCredentials credentials) {
-    return !SystemCredentials.get().getToken().getClass().getName().equals(credentials.getTokenClassName());
-  }
-  
-  /*
-   * Three auditing methods try to capture the 4 states we might have here. audit is in response to a thrown exception, the operation failed (perhaps due to
-   * insufficient privs, or some other reason) audit(credentials, template, args) is a successful operation audit(credentials, permitted, template, args) is a
-   * privileges check that is either permitted or denied. We don't know if the operation went on to be successful or not at this point, we would have to go
-   * digging through loads of other code to find it.
-   */
-  private void audit(TCredentials credentials, ThriftSecurityException ex, String template, Object... args) {
-    audit.warn("operation: failed; user: " + credentials.getPrincipal() + "; " + String.format(template, args) + "; exception: " + ex.toString());
-  }
-  
-  private void audit(TCredentials credentials, String template, Object... args) {
-    if (shouldAudit(credentials)) {
-      audit.info("operation: success; user: " + credentials.getPrincipal() + ": " + String.format(template, args));
-    }
-  }
-  
-  private void audit(TCredentials credentials, boolean permitted, String template, Object... args) {
-    if (shouldAudit(credentials)) {
-      String prefix = permitted ? "permitted" : "denied";
-      audit.info("operation: " + prefix + "; user: " + credentials.getPrincipal() + "; " + String.format(template, args));
-    }
-  }
-  
-  public static final String CAN_SCAN_AUDIT_TEMPLATE = "action: scan; targetTable: %s; authorizations: %s; range: %s; columns: %s; iterators: %s; iteratorOptions: %s;";
-  private static final int MAX_ELEMENTS_TO_LOG = 10;
-  
-  private static List<String> truncate(Collection<? extends Object> list) {
-    List<String> result = new ArrayList<String>();
-    int i = 0;
-    for (Object obj : list) {
-      if (i > MAX_ELEMENTS_TO_LOG) {
-        result.add(" and " + (list.size() - MAX_ELEMENTS_TO_LOG) + " more ");
-        break;
-      }
-      result.add(obj.toString());
-    }
-    return result;
-  }
-  
-  @Override
-  public boolean canScan(TCredentials credentials, String tableId, TRange range, List<TColumn> columns, List<IterInfo> ssiList,
-      Map<String,Map<String,String>> ssio, List<ByteBuffer> authorizations) throws ThriftSecurityException {
-    if (shouldAudit(credentials, tableId)) {
-      Range convertedRange = new Range(range);
-      List<String> convertedColumns = truncate(Translator.translate(columns, new Translator.TColumnTranslator()));
-      String tableName = getTableName(tableId);
-      
-      try {
-        boolean canScan = super.canScan(credentials, tableId);
-        audit(credentials, canScan, CAN_SCAN_AUDIT_TEMPLATE, tableName, getAuthString(authorizations), convertedRange, convertedColumns, ssiList, ssio);
-        
-        return canScan;
-      } catch (ThriftSecurityException ex) {
-        audit(credentials, ex, CAN_SCAN_AUDIT_TEMPLATE, getAuthString(authorizations), tableId, convertedRange, convertedColumns, ssiList, ssio);
-        throw ex;
-      }
-    } else {
-      return super.canScan(credentials, tableId);
-    }
-  }
-  
-  public static final String CAN_SCAN_BATCH_AUDIT_TEMPLATE = "action: scan; targetTable: %s; authorizations: %s; range: %s; columns: %s; iterators: %s; iteratorOptions: %s;";
-  
-  @Override
-  public boolean canScan(TCredentials credentials, String tableId, Map<TKeyExtent,List<TRange>> tbatch, List<TColumn> tcolumns, List<IterInfo> ssiList,
-      Map<String,Map<String,String>> ssio, List<ByteBuffer> authorizations) throws ThriftSecurityException {
-    if (shouldAudit(credentials, tableId)) {
-      @SuppressWarnings({"unchecked", "rawtypes"})
-      Map<KeyExtent,List<Range>> convertedBatch = Translator.translate(tbatch, new Translator.TKeyExtentTranslator(), new Translator.ListTranslator(
-          new Translator.TRangeTranslator()));
-      Map<KeyExtent, List<String>> truncated = new HashMap<KeyExtent, List<String>>();
-      for (Entry<KeyExtent,List<Range>> entry : convertedBatch.entrySet()) {
-          truncated.put(entry.getKey(), truncate(entry.getValue()));
-      }
-      List<Column> convertedColumns = Translator.translate(tcolumns, new Translator.TColumnTranslator());
-      String tableName = getTableName(tableId);
-      
-      try {
-        boolean canScan = super.canScan(credentials, tableId);
-        audit(credentials, canScan, CAN_SCAN_BATCH_AUDIT_TEMPLATE, tableName, getAuthString(authorizations), convertedBatch, convertedColumns, ssiList, ssio);
-        
-        return canScan;
-      } catch (ThriftSecurityException ex) {
-        audit(credentials, ex, CAN_SCAN_BATCH_AUDIT_TEMPLATE, getAuthString(authorizations), tableId, convertedBatch, convertedColumns, ssiList, ssio);
-        throw ex;
-      }
-    } else {
-      return super.canScan(credentials, tableId);
-    }
-  }
-  
-  public static final String CHANGE_AUTHORIZATIONS_AUDIT_TEMPLATE = "action: changeAuthorizations; targetUser: %s; authorizations: %s";
-  
-  @Override
-  public void changeAuthorizations(TCredentials credentials, String user, Authorizations authorizations) throws ThriftSecurityException {
-    try {
-      super.changeAuthorizations(credentials, user, authorizations);
-      audit(credentials, CHANGE_AUTHORIZATIONS_AUDIT_TEMPLATE, user, authorizations);
-    } catch (ThriftSecurityException ex) {
-      audit(credentials, ex, CHANGE_AUTHORIZATIONS_AUDIT_TEMPLATE, user, authorizations);
-      throw ex;
-    }
-  }
-  
-  public static final String CHANGE_PASSWORD_AUDIT_TEMPLATE = "action: changePassword; targetUser: %s;";
-  
-  @Override
-  public void changePassword(TCredentials credentials, Credentials newInfo) throws ThriftSecurityException {
-    try {
-      super.changePassword(credentials, newInfo);
-      audit(credentials, CHANGE_PASSWORD_AUDIT_TEMPLATE, newInfo.getPrincipal());
-    } catch (ThriftSecurityException ex) {
-      audit(credentials, ex, CHANGE_PASSWORD_AUDIT_TEMPLATE, newInfo.getPrincipal());
-      throw ex;
-    }
-  }
-  
-  public static final String CREATE_USER_AUDIT_TEMPLATE = "action: createUser; targetUser: %s; Authorizations: %s;";
-  
-  @Override
-  public void createUser(TCredentials credentials, Credentials newUser, Authorizations authorizations) throws ThriftSecurityException {
-    try {
-      super.createUser(credentials, newUser, authorizations);
-      audit(credentials, CREATE_USER_AUDIT_TEMPLATE, newUser.getPrincipal(), authorizations);
-    } catch (ThriftSecurityException ex) {
-      audit(credentials, ex, CREATE_USER_AUDIT_TEMPLATE, newUser.getPrincipal(), authorizations);
-      throw ex;
-    }
-  }
-  
-  public static final String CAN_CREATE_TABLE_AUDIT_TEMPLATE = "action: createTable; targetTable: %s;";
-  
-  @Override
-  public boolean canCreateTable(TCredentials c, String tableName) throws ThriftSecurityException {
-    try {
-      boolean result = super.canCreateTable(c);
-      audit(c, result, CAN_CREATE_TABLE_AUDIT_TEMPLATE, tableName);
-      return result;
-    } catch (ThriftSecurityException ex) {
-      audit(c, ex, CAN_CREATE_TABLE_AUDIT_TEMPLATE, tableName);
-      throw ex;
-    }
-  }
-  
-  public static final String CAN_DELETE_TABLE_AUDIT_TEMPLATE = "action: deleteTable; targetTable: %s;";
-  
-  @Override
-  public boolean canDeleteTable(TCredentials c, String tableId) throws ThriftSecurityException {
-    String tableName = getTableName(tableId);
-    try {
-      boolean result = super.canDeleteTable(c, tableId);
-      audit(c, result, CAN_DELETE_TABLE_AUDIT_TEMPLATE, tableName, tableId);
-      return result;
-    } catch (ThriftSecurityException ex) {
-      audit(c, ex, CAN_DELETE_TABLE_AUDIT_TEMPLATE, tableName, tableId);
-      throw ex;
-    }
-  }
-  
-  public static final String CAN_RENAME_TABLE_AUDIT_TEMPLATE = "action: renameTable; targetTable: %s; newTableName: %s;";
-  
-  @Override
-  public boolean canRenameTable(TCredentials c, String tableId, String oldTableName, String newTableName) throws ThriftSecurityException {
-    try {
-      boolean result = super.canRenameTable(c, tableId, oldTableName, newTableName);
-      audit(c, result, CAN_RENAME_TABLE_AUDIT_TEMPLATE, oldTableName, newTableName);
-      return result;
-    } catch (ThriftSecurityException ex) {
-      audit(c, ex, CAN_RENAME_TABLE_AUDIT_TEMPLATE, oldTableName, newTableName);
-      throw ex;
-    }
-  }
-  
-  public static final String CAN_CLONE_TABLE_AUDIT_TEMPLATE = "action: cloneTable; targetTable: %s; newTableName: %s";
-  
-  @Override
-  public boolean canCloneTable(TCredentials c, String tableId, String tableName) throws ThriftSecurityException {
-    String oldTableName = getTableName(tableId);
-    try {
-      boolean result = super.canCloneTable(c, tableId, tableName);
-      audit(c, result, CAN_CLONE_TABLE_AUDIT_TEMPLATE, oldTableName, tableName);
-      return result;
-    } catch (ThriftSecurityException ex) {
-      audit(c, ex, CAN_CLONE_TABLE_AUDIT_TEMPLATE, oldTableName, tableName);
-      throw ex;
-    }
-  }
-  
-  public static final String CAN_DELETE_RANGE_AUDIT_TEMPLATE = "action: deleteData; targetTable: %s; startRange: %s; endRange: %s;";
-  
-  @Override
-  public boolean canDeleteRange(TCredentials c, String tableId, String tableName, Text startRow, Text endRow) throws ThriftSecurityException {
-    try {
-      boolean result = super.canDeleteRange(c, tableId, tableName, startRow, endRow);
-      audit(c, result, CAN_DELETE_RANGE_AUDIT_TEMPLATE, tableName, startRow.toString(), endRow.toString());
-      return result;
-    } catch (ThriftSecurityException ex) {
-      audit(c, ex, CAN_DELETE_RANGE_AUDIT_TEMPLATE, tableName, startRow.toString(), endRow.toString());
-      throw ex;
-    }
-  }
-  
-  public static final String CAN_BULK_IMPORT_AUDIT_TEMPLATE = "action: bulkImport; targetTable: %s; dataDir: %s; failDir: %s;";
-  
-  @Override
-  public boolean canBulkImport(TCredentials c, String tableId, String tableName, String dir, String failDir) throws ThriftSecurityException {
-    try {
-      boolean result = super.canBulkImport(c, tableId);
-      audit(c, result, CAN_BULK_IMPORT_AUDIT_TEMPLATE, tableName, dir, failDir);
-      return result;
-    } catch (ThriftSecurityException ex) {
-      audit(c, ex, CAN_BULK_IMPORT_AUDIT_TEMPLATE, tableName, dir, failDir);
-      throw ex;
-    }
-  }
-  
-  public static final String CAN_IMPORT_AUDIT_TEMPLATE = "action: import; targetTable: %s; dataDir: %s;";
-  
-  @Override
-  public boolean canImport(TCredentials credentials, String tableName, String importDir) throws ThriftSecurityException {
-    
-    try {
-      boolean result = super.canImport(credentials, tableName, importDir);
-      audit(credentials, result, CAN_IMPORT_AUDIT_TEMPLATE, tableName, importDir);
-      return result;
-    } catch (ThriftSecurityException ex) {
-      audit(credentials, ex, CAN_IMPORT_AUDIT_TEMPLATE, tableName, importDir);
-      throw ex;
-    }
-  }
-  
-  public static final String CAN_EXPORT_AUDIT_TEMPLATE = "action: export; targetTable: %s; dataDir: %s;";
-  
-  @Override
-  public boolean canExport(TCredentials credentials, String tableId, String tableName, String exportDir) throws ThriftSecurityException {
-    
-    try {
-      boolean result = super.canExport(credentials, tableId, tableName, exportDir);
-      audit(credentials, result, CAN_EXPORT_AUDIT_TEMPLATE, tableName, exportDir);
-      return result;
-    } catch (ThriftSecurityException ex) {
-      audit(credentials, ex, CAN_EXPORT_AUDIT_TEMPLATE, tableName, exportDir);
-      throw ex;
-    }
-  }
-  
-  public static final String DROP_USER_AUDIT_TEMPLATE = "action: dropUser; targetUser: %s;";
-  
-  @Override
-  public void dropUser(TCredentials credentials, String user) throws ThriftSecurityException {
-    try {
-      super.dropUser(credentials, user);
-      audit(credentials, DROP_USER_AUDIT_TEMPLATE, user);
-    } catch (ThriftSecurityException ex) {
-      audit(credentials, ex, DROP_USER_AUDIT_TEMPLATE, user);
-      throw ex;
-    }
-  }
-  
-  public static final String GRANT_SYSTEM_PERMISSION_AUDIT_TEMPLATE = "action: grantSystemPermission; permission: %s; targetUser: %s;";
-  
-  @Override
-  public void grantSystemPermission(TCredentials credentials, String user, SystemPermission permission) throws ThriftSecurityException {
-    try {
-      super.grantSystemPermission(credentials, user, permission);
-      audit(credentials, GRANT_SYSTEM_PERMISSION_AUDIT_TEMPLATE, permission, user);
-    } catch (ThriftSecurityException ex) {
-      audit(credentials, ex, GRANT_SYSTEM_PERMISSION_AUDIT_TEMPLATE, permission, user);
-      throw ex;
-    }
-  }
-  
-  public static final String GRANT_TABLE_PERMISSION_AUDIT_TEMPLATE = "action: grantTablePermission; permission: %s; targetTable: %s; targetUser: %s;";
-  
-  @Override
-  public void grantTablePermission(TCredentials credentials, String user, String tableId, TablePermission permission) throws ThriftSecurityException {
-    String tableName = getTableName(tableId);
-    try {
-      super.grantTablePermission(credentials, user, tableId, permission);
-      audit(credentials, GRANT_TABLE_PERMISSION_AUDIT_TEMPLATE, permission, tableName, user);
-    } catch (ThriftSecurityException ex) {
-      audit(credentials, ex, GRANT_TABLE_PERMISSION_AUDIT_TEMPLATE, permission, tableName, user);
-      throw ex;
-    }
-  }
-  
-  public static final String REVOKE_SYSTEM_PERMISSION_AUDIT_TEMPLATE = "action: revokeSystemPermission; permission: %s; targetUser: %s;";
-  
-  @Override
-  public void revokeSystemPermission(TCredentials credentials, String user, SystemPermission permission) throws ThriftSecurityException {
-    
-    try {
-      super.revokeSystemPermission(credentials, user, permission);
-      audit(credentials, REVOKE_SYSTEM_PERMISSION_AUDIT_TEMPLATE, permission, user);
-    } catch (ThriftSecurityException ex) {
-      audit(credentials, ex, REVOKE_SYSTEM_PERMISSION_AUDIT_TEMPLATE, permission, user);
-      throw ex;
-    }
-  }
-  
-  public static final String REVOKE_TABLE_PERMISSION_AUDIT_TEMPLATE = "action: revokeTablePermission; permission: %s; targetTable: %s; targetUser: %s;";
-  
-  @Override
-  public void revokeTablePermission(TCredentials credentials, String user, String tableId, TablePermission permission) throws ThriftSecurityException {
-    String tableName = getTableName(tableId);
-    try {
-      super.revokeTablePermission(credentials, user, tableId, permission);
-      audit(credentials, REVOKE_TABLE_PERMISSION_AUDIT_TEMPLATE, permission, tableName, user);
-    } catch (ThriftSecurityException ex) {
-      audit(credentials, ex, REVOKE_TABLE_PERMISSION_AUDIT_TEMPLATE, permission, tableName, user);
-      throw ex;
-    }
-  }
-  
-  public static final String CAN_ONLINE_OFFLINE_TABLE_AUDIT_TEMPLATE = "action: %s; targetTable: %s;";
-  
-  @Override
-  public boolean canOnlineOfflineTable(TCredentials credentials, String tableId, TableOperation op) throws ThriftSecurityException {
-    String tableName = getTableName(tableId);
-    String operation = null;
-    if (op == TableOperation.ONLINE)
-      operation = "onlineTable";
-    if (op == TableOperation.OFFLINE)
-      operation = "offlineTable";
-    try {
-      boolean result = super.canOnlineOfflineTable(credentials, tableId, op);
-      audit(credentials, result, CAN_ONLINE_OFFLINE_TABLE_AUDIT_TEMPLATE, operation, tableName, tableId);
-      return result;
-    } catch (ThriftSecurityException ex) {
-      audit(credentials, ex, CAN_ONLINE_OFFLINE_TABLE_AUDIT_TEMPLATE, operation, tableName, tableId);
-      throw ex;
-    }
-  }
-}


Mime
View raw message