accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ctubb...@apache.org
Subject [17/61] [abbrv] [partial] accumulo git commit: ACCUMULO-722 put trunk in my sandbox
Date Thu, 03 Mar 2016 21:59:42 GMT
http://git-wip-us.apache.org/repos/asf/accumulo/blob/7bdbfccb/1.5/core/src/main/java/org/apache/accumulo/core/iterators/user/TimestampFilter.java
----------------------------------------------------------------------
diff --git a/1.5/core/src/main/java/org/apache/accumulo/core/iterators/user/TimestampFilter.java b/1.5/core/src/main/java/org/apache/accumulo/core/iterators/user/TimestampFilter.java
new file mode 100644
index 0000000..2dbfe66
--- /dev/null
+++ b/1.5/core/src/main/java/org/apache/accumulo/core/iterators/user/TimestampFilter.java
@@ -0,0 +1,271 @@
+/*
+ * 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.core.iterators.user;
+
+import java.io.IOException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Map;
+import java.util.TimeZone;
+
+import org.apache.accumulo.core.client.IteratorSetting;
+import org.apache.accumulo.core.data.Key;
+import org.apache.accumulo.core.data.Value;
+import org.apache.accumulo.core.iterators.Filter;
+import org.apache.accumulo.core.iterators.IteratorEnvironment;
+import org.apache.accumulo.core.iterators.SortedKeyValueIterator;
+
+/**
+ * A Filter that matches entries whose timestamps fall within a range.
+ */
+public class TimestampFilter extends Filter {
+  private final SimpleDateFormat dateParser = initDateParser();
+  
+  private static SimpleDateFormat initDateParser() {
+    SimpleDateFormat dateParser = new SimpleDateFormat("yyyyMMddHHmmssz");
+    dateParser.setTimeZone(TimeZone.getTimeZone("GMT"));
+    return dateParser;
+  }
+  
+  public static final String START = "start";
+  public static final String START_INCL = "startInclusive";
+  public static final String END = "end";
+  public static final String END_INCL = "endInclusive";
+  private long start;
+  private long end;
+  private boolean startInclusive;
+  private boolean endInclusive;
+  private boolean hasStart;
+  private boolean hasEnd;
+  
+  public TimestampFilter() {}
+  
+  @Override
+  public boolean accept(Key k, Value v) {
+    long ts = k.getTimestamp();
+    if ((hasStart && (ts < start)) || (hasEnd && (ts > end)))
+      return false;
+    if (hasStart && !startInclusive && ts == start)
+      return false;
+    if (hasEnd && !endInclusive && ts == end)
+      return false;
+    return true;
+  }
+  
+  @Override
+  public void init(SortedKeyValueIterator<Key,Value> source, Map<String,String> options, IteratorEnvironment env) throws IOException {
+    super.init(source, options, env);
+    
+    if (options == null)
+      throw new IllegalArgumentException("start and/or end must be set for " + TimestampFilter.class.getName());
+    
+    hasStart = false;
+    hasEnd = false;
+    startInclusive = true;
+    endInclusive = true;
+    
+    if (options.containsKey(START))
+      hasStart = true;
+    if (options.containsKey(END))
+      hasEnd = true;
+    if (!hasStart && !hasEnd)
+      throw new IllegalArgumentException("must have either start or end for " + TimestampFilter.class.getName());
+    
+    try {
+      if (hasStart)
+        start = dateParser.parse(options.get(START)).getTime();
+      if (hasEnd)
+        end = dateParser.parse(options.get(END)).getTime();
+    } catch (Exception e) {
+      throw new IllegalArgumentException(e);
+    }
+    if (options.get(START_INCL) != null)
+      startInclusive = Boolean.parseBoolean(options.get(START_INCL));
+    if (options.get(END_INCL) != null)
+      endInclusive = Boolean.parseBoolean(options.get(END_INCL));
+  }
+  
+  @Override
+  public SortedKeyValueIterator<Key,Value> deepCopy(IteratorEnvironment env) {
+    TimestampFilter copy = (TimestampFilter) super.deepCopy(env);
+    copy.hasStart = hasStart;
+    copy.start = start;
+    copy.startInclusive = startInclusive;
+    copy.hasEnd = hasEnd;
+    copy.end = end;
+    copy.endInclusive = endInclusive;
+    return copy;
+  }
+  
+  @Override
+  public IteratorOptions describeOptions() {
+    IteratorOptions io = super.describeOptions();
+    io.setName("tsfilter");
+    io.setDescription("TimestampFilter displays entries with timestamps between specified values");
+    io.addNamedOption("start", "start timestamp (yyyyMMddHHmmssz)");
+    io.addNamedOption("end", "end timestamp (yyyyMMddHHmmssz)");
+    io.addNamedOption("startInclusive", "true or false");
+    io.addNamedOption("endInclusive", "true or false");
+    return io;
+  }
+  
+  @Override
+  public boolean validateOptions(Map<String,String> options) {
+    super.validateOptions(options);
+    try {
+      if (options.containsKey(START))
+        dateParser.parse(options.get(START));
+      if (options.containsKey(END))
+        dateParser.parse(options.get(END));
+      if (options.get(START_INCL) != null)
+        Boolean.parseBoolean(options.get(START_INCL));
+      if (options.get(END_INCL) != null)
+        Boolean.parseBoolean(options.get(END_INCL));
+    } catch (Exception e) {
+      return false;
+    }
+    return true;
+  }
+  
+  /**
+   * A convenience method for setting the range of timestamps accepted by the timestamp filter.
+   * 
+   * @param is
+   *          the iterator setting object to configure
+   * @param start
+   *          the start timestamp, inclusive (yyyyMMddHHmmssz)
+   * @param end
+   *          the end timestamp, inclusive (yyyyMMddHHmmssz)
+   */
+  public static void setRange(IteratorSetting is, String start, String end) {
+    setRange(is, start, true, end, true);
+  }
+  
+  /**
+   * A convenience method for setting the range of timestamps accepted by the timestamp filter.
+   * 
+   * @param is
+   *          the iterator setting object to configure
+   * @param start
+   *          the start timestamp (yyyyMMddHHmmssz)
+   * @param startInclusive
+   *          boolean indicating whether the start is inclusive
+   * @param end
+   *          the end timestamp (yyyyMMddHHmmssz)
+   * @param endInclusive
+   *          boolean indicating whether the end is inclusive
+   */
+  public static void setRange(IteratorSetting is, String start, boolean startInclusive, String end, boolean endInclusive) {
+    setStart(is, start, startInclusive);
+    setEnd(is, end, endInclusive);
+  }
+  
+  /**
+   * A convenience method for setting the start timestamp accepted by the timestamp filter.
+   * 
+   * @param is
+   *          the iterator setting object to configure
+   * @param start
+   *          the start timestamp (yyyyMMddHHmmssz)
+   * @param startInclusive
+   *          boolean indicating whether the start is inclusive
+   */
+  public static void setStart(IteratorSetting is, String start, boolean startInclusive) {
+    is.addOption(START, start);
+    is.addOption(START_INCL, Boolean.toString(startInclusive));
+  }
+  
+  /**
+   * A convenience method for setting the end timestamp accepted by the timestamp filter.
+   * 
+   * @param is
+   *          the iterator setting object to configure
+   * @param end
+   *          the end timestamp (yyyyMMddHHmmssz)
+   * @param endInclusive
+   *          boolean indicating whether the end is inclusive
+   */
+  public static void setEnd(IteratorSetting is, String end, boolean endInclusive) {
+    is.addOption(END, end);
+    is.addOption(END_INCL, Boolean.toString(endInclusive));
+  }
+  
+  /**
+   * A convenience method for setting the range of timestamps accepted by the timestamp filter.
+   * 
+   * @param is
+   *          the iterator setting object to configure
+   * @param start
+   *          the start timestamp, inclusive
+   * @param end
+   *          the end timestamp, inclusive
+   */
+  public static void setRange(IteratorSetting is, long start, long end) {
+    setRange(is, start, true, end, true);
+  }
+  
+  /**
+   * A convenience method for setting the range of timestamps accepted by the timestamp filter.
+   * 
+   * @param is
+   *          the iterator setting object to configure
+   * @param start
+   *          the start timestamp
+   * @param startInclusive
+   *          boolean indicating whether the start is inclusive
+   * @param end
+   *          the end timestamp
+   * @param endInclusive
+   *          boolean indicating whether the end is inclusive
+   */
+  public static void setRange(IteratorSetting is, long start, boolean startInclusive, long end, boolean endInclusive) {
+    setStart(is, start, startInclusive);
+    setEnd(is, end, endInclusive);
+  }
+  
+  /**
+   * A convenience method for setting the start timestamp accepted by the timestamp filter.
+   * 
+   * @param is
+   *          the iterator setting object to configure
+   * @param start
+   *          the start timestamp
+   * @param startInclusive
+   *          boolean indicating whether the start is inclusive
+   */
+  public static void setStart(IteratorSetting is, long start, boolean startInclusive) {
+    SimpleDateFormat dateParser = initDateParser();
+    is.addOption(START, dateParser.format(new Date(start)));
+    is.addOption(START_INCL, Boolean.toString(startInclusive));
+  }
+  
+  /**
+   * A convenience method for setting the end timestamp accepted by the timestamp filter.
+   * 
+   * @param is
+   *          the iterator setting object to configure
+   * @param end
+   *          the end timestamp
+   * @param endInclusive
+   *          boolean indicating whether the end is inclusive
+   */
+  public static void setEnd(IteratorSetting is, long end, boolean endInclusive) {
+    SimpleDateFormat dateParser = initDateParser();
+    is.addOption(END, dateParser.format(new Date(end)));
+    is.addOption(END_INCL, Boolean.toString(endInclusive));
+  }
+}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/7bdbfccb/1.5/core/src/main/java/org/apache/accumulo/core/iterators/user/VersioningIterator.java
----------------------------------------------------------------------
diff --git a/1.5/core/src/main/java/org/apache/accumulo/core/iterators/user/VersioningIterator.java b/1.5/core/src/main/java/org/apache/accumulo/core/iterators/user/VersioningIterator.java
new file mode 100644
index 0000000..02f0874
--- /dev/null
+++ b/1.5/core/src/main/java/org/apache/accumulo/core/iterators/user/VersioningIterator.java
@@ -0,0 +1,165 @@
+/*
+ * 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.core.iterators.user;
+
+import java.io.IOException;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Map;
+
+import org.apache.accumulo.core.client.IteratorSetting;
+import org.apache.accumulo.core.data.ByteSequence;
+import org.apache.accumulo.core.data.Key;
+import org.apache.accumulo.core.data.PartialKey;
+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.IteratorUtil;
+import org.apache.accumulo.core.iterators.OptionDescriber;
+import org.apache.accumulo.core.iterators.SortedKeyValueIterator;
+import org.apache.accumulo.core.iterators.WrappingIterator;
+
+public class VersioningIterator extends WrappingIterator implements OptionDescriber {
+  private final int maxCount = 10;
+  
+  private Key currentKey = new Key();
+  private int numVersions;
+  protected int maxVersions;
+  
+  private Range range;
+  private Collection<ByteSequence> columnFamilies;
+  private boolean inclusive;
+  
+  @Override
+  public VersioningIterator deepCopy(IteratorEnvironment env) {
+    VersioningIterator copy = new VersioningIterator();
+    copy.setSource(getSource().deepCopy(env));
+    copy.maxVersions = maxVersions;
+    return copy;
+  }
+  
+  @Override
+  public void next() throws IOException {
+    if (numVersions >= maxVersions) {
+      skipRowColumn();
+      resetVersionCount();
+      return;
+    }
+    
+    super.next();
+    if (getSource().hasTop()) {
+      if (getSource().getTopKey().equals(currentKey, PartialKey.ROW_COLFAM_COLQUAL_COLVIS)) {
+        numVersions++;
+      } else {
+        resetVersionCount();
+      }
+    }
+  }
+  
+  @Override
+  public void seek(Range range, Collection<ByteSequence> columnFamilies, boolean inclusive) throws IOException {
+    // do not want to seek to the middle of a row
+    Range seekRange = IteratorUtil.maximizeStartKeyTimeStamp(range);
+    this.range = seekRange;
+    this.columnFamilies = columnFamilies;
+    this.inclusive = inclusive;
+    
+    super.seek(seekRange, columnFamilies, inclusive);
+    resetVersionCount();
+    
+    if (range.getStartKey() != null)
+      while (hasTop() && range.beforeStartKey(getTopKey()))
+        next();
+  }
+  
+  private void resetVersionCount() {
+    if (super.hasTop())
+      currentKey.set(getSource().getTopKey());
+    numVersions = 1;
+  }
+  
+  private void skipRowColumn() throws IOException {
+    Key keyToSkip = currentKey;
+    super.next();
+    
+    int count = 0;
+    while (getSource().hasTop() && getSource().getTopKey().equals(keyToSkip, PartialKey.ROW_COLFAM_COLQUAL_COLVIS)) {
+      if (count < maxCount) {
+        // it is quicker to call next if we are close, but we never know if we are close
+        // so give next a try a few times
+        getSource().next();
+        count++;
+      } else {
+        reseek(keyToSkip.followingKey(PartialKey.ROW_COLFAM_COLQUAL_COLVIS));
+        count = 0;
+      }
+    }
+  }
+  
+  protected void reseek(Key key) throws IOException {
+    if (key == null)
+      return;
+    if (range.afterEndKey(key)) {
+      range = new Range(range.getEndKey(), true, range.getEndKey(), range.isEndKeyInclusive());
+      getSource().seek(range, columnFamilies, inclusive);
+    } else {
+      range = new Range(key, true, range.getEndKey(), range.isEndKeyInclusive());
+      getSource().seek(range, columnFamilies, inclusive);
+    }
+  }
+  
+  @Override
+  public void init(SortedKeyValueIterator<Key,Value> source, Map<String,String> options, IteratorEnvironment env) throws IOException {
+    super.init(source, options, env);
+    this.numVersions = 0;
+    
+    String maxVerString = options.get("maxVersions");
+    if (maxVerString != null)
+      this.maxVersions = Integer.parseInt(maxVerString);
+    else
+      this.maxVersions = 1;
+    
+    if (maxVersions < 1)
+      throw new IllegalArgumentException("maxVersions for versioning iterator must be >= 1");
+  }
+  
+  @Override
+  public IteratorOptions describeOptions() {
+    return new IteratorOptions("vers", "The VersioningIterator keeps a fixed number of versions for each key", Collections.singletonMap("maxVersions",
+        "number of versions to keep for a particular key (with differing timestamps)"), null);
+  }
+  
+  private static final String MAXVERSIONS_OPT = "maxVersions";
+  
+  @Override
+  public boolean validateOptions(Map<String,String> options) {
+    int i = Integer.parseInt(options.get(MAXVERSIONS_OPT));
+    if (i < 1)
+      throw new IllegalArgumentException(MAXVERSIONS_OPT + " for versioning iterator must be >= 1");
+    return true;
+  }
+  
+  /**
+   * Encode the maximum number of versions to return onto the ScanIterator
+   * 
+   * @param cfg
+   * @param maxVersions
+   */
+  public static void setMaxVersions(IteratorSetting cfg, int maxVersions) {
+    cfg.addOption(MAXVERSIONS_OPT, Integer.toString(maxVersions));
+  }
+}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/7bdbfccb/1.5/core/src/main/java/org/apache/accumulo/core/iterators/user/WholeRowIterator.java
----------------------------------------------------------------------
diff --git a/1.5/core/src/main/java/org/apache/accumulo/core/iterators/user/WholeRowIterator.java b/1.5/core/src/main/java/org/apache/accumulo/core/iterators/user/WholeRowIterator.java
new file mode 100644
index 0000000..e594b0c
--- /dev/null
+++ b/1.5/core/src/main/java/org/apache/accumulo/core/iterators/user/WholeRowIterator.java
@@ -0,0 +1,245 @@
+/*
+ * 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.core.iterators.user;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import java.util.SortedMap;
+import java.util.TreeMap;
+
+import org.apache.accumulo.core.data.ByteSequence;
+import org.apache.accumulo.core.data.Key;
+import org.apache.accumulo.core.data.PartialKey;
+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.hadoop.io.Text;
+
+/**
+ * 
+ * The WholeRowIterator is designed to provide row-isolation so that queries see mutations as atomic. It does so by encapsulating an entire row of key/value
+ * pairs into a single key/value pair, which is returned through the client as an atomic operation.
+ * 
+ * <p>
+ * One caveat is that when seeking in the WholeRowIterator using a range that starts at a non-inclusive first key in a row, (e.g. seek(new Range(new Key(new
+ * Text("row")),false,...),...)) this iterator will skip to the next row. This is done in order to prevent repeated scanning of the same row when system
+ * automatically creates ranges of that form, which happens in the case of the client calling continueScan, or in the case of the tablet server continuing a
+ * scan after swapping out sources.
+ * 
+ * <p>
+ * To regain the original key/value pairs of the row, call the decodeRow function on the key/value pair that this iterator returned.
+ * 
+ * @see RowFilter
+ */
+public class WholeRowIterator implements SortedKeyValueIterator<Key,Value> {
+  
+  private SortedKeyValueIterator<Key,Value> sourceIter;
+  private Key topKey = null;
+  private Value topValue = null;
+  
+  public WholeRowIterator() {
+    
+  }
+  
+  WholeRowIterator(SortedKeyValueIterator<Key,Value> source) {
+    this.sourceIter = source;
+  }
+  
+  // decode a bunch of key value pairs that have been encoded into a single value
+  public static final SortedMap<Key,Value> decodeRow(Key rowKey, Value rowValue) throws IOException {
+    SortedMap<Key,Value> map = new TreeMap<Key,Value>();
+    ByteArrayInputStream in = new ByteArrayInputStream(rowValue.get());
+    DataInputStream din = new DataInputStream(in);
+    int numKeys = din.readInt();
+    for (int i = 0; i < numKeys; i++) {
+      byte[] cf;
+      byte[] cq;
+      byte[] cv;
+      byte[] valBytes;
+      // read the col fam
+      {
+        int len = din.readInt();
+        cf = new byte[len];
+        din.read(cf);
+      }
+      // read the col qual
+      {
+        int len = din.readInt();
+        cq = new byte[len];
+        din.read(cq);
+      }
+      // read the col visibility
+      {
+        int len = din.readInt();
+        cv = new byte[len];
+        din.read(cv);
+      }
+      // read the timestamp
+      long timestamp = din.readLong();
+      // read the value
+      {
+        int len = din.readInt();
+        valBytes = new byte[len];
+        din.read(valBytes);
+      }
+      map.put(new Key(rowKey.getRowData().toArray(), cf, cq, cv, timestamp, false, false), new Value(valBytes, false));
+    }
+    return map;
+  }
+  
+  // take a stream of keys and values and output a value that encodes everything but their row
+  // keys and values must be paired one for one
+  public static final Value encodeRow(List<Key> keys, List<Value> values) throws IOException {
+    ByteArrayOutputStream out = new ByteArrayOutputStream();
+    DataOutputStream dout = new DataOutputStream(out);
+    dout.writeInt(keys.size());
+    for (int i = 0; i < keys.size(); i++) {
+      Key k = keys.get(i);
+      Value v = values.get(i);
+      // write the colfam
+      {
+        ByteSequence bs = k.getColumnFamilyData();
+        dout.writeInt(bs.length());
+        dout.write(bs.getBackingArray(), bs.offset(), bs.length());
+      }
+      // write the colqual
+      {
+        ByteSequence bs = k.getColumnQualifierData();
+        dout.writeInt(bs.length());
+        dout.write(bs.getBackingArray(), bs.offset(), bs.length());
+      }
+      // write the column visibility
+      {
+        ByteSequence bs = k.getColumnVisibilityData();
+        dout.writeInt(bs.length());
+        dout.write(bs.getBackingArray(), bs.offset(), bs.length());
+      }
+      // write the timestamp
+      dout.writeLong(k.getTimestamp());
+      // write the value
+      byte[] valBytes = v.get();
+      dout.writeInt(valBytes.length);
+      dout.write(valBytes);
+    }
+    
+    return new Value(out.toByteArray());
+  }
+  
+  List<Key> keys = new ArrayList<Key>();
+  List<Value> values = new ArrayList<Value>();
+  
+  private void prepKeys() throws IOException {
+    if (topKey != null)
+      return;
+    Text currentRow;
+    do {
+      if (sourceIter.hasTop() == false)
+        return;
+      currentRow = new Text(sourceIter.getTopKey().getRow());
+      keys.clear();
+      values.clear();
+      while (sourceIter.hasTop() && sourceIter.getTopKey().getRow().equals(currentRow)) {
+        keys.add(new Key(sourceIter.getTopKey()));
+        values.add(new Value(sourceIter.getTopValue()));
+        sourceIter.next();
+      }
+    } while (!filter(currentRow, keys, values));
+    
+    topKey = new Key(currentRow);
+    topValue = encodeRow(keys, values);
+    
+  }
+  
+  /**
+   * 
+   * @param currentRow
+   *          All keys have this in their row portion (do not modify!).
+   * @param keys
+   *          One key for each key in the row, ordered as they are given by the source iterator (do not modify!).
+   * @param values
+   *          One value for each key in keys, ordered to correspond to the ordering in keys (do not modify!).
+   * @return true if we want to keep the row, false if we want to skip it
+   */
+  protected boolean filter(Text currentRow, List<Key> keys, List<Value> values) {
+    return true;
+  }
+  
+  @Override
+  public SortedKeyValueIterator<Key,Value> deepCopy(IteratorEnvironment env) {
+    if (sourceIter != null)
+      return new WholeRowIterator(sourceIter.deepCopy(env));
+    return new WholeRowIterator();
+  }
+  
+  @Override
+  public Key getTopKey() {
+    return topKey;
+  }
+  
+  @Override
+  public Value getTopValue() {
+    return topValue;
+  }
+  
+  @Override
+  public boolean hasTop() {
+    return topKey != null;
+  }
+  
+  @Override
+  public void init(SortedKeyValueIterator<Key,Value> source, Map<String,String> options, IteratorEnvironment env) throws IOException {
+    sourceIter = source;
+  }
+  
+  @Override
+  public void next() throws IOException {
+    topKey = null;
+    topValue = null;
+    prepKeys();
+  }
+  
+  @Override
+  public void seek(Range range, Collection<ByteSequence> columnFamilies, boolean inclusive) throws IOException {
+    topKey = null;
+    topValue = null;
+    
+    Key sk = range.getStartKey();
+    
+    if (sk != null && sk.getColumnFamilyData().length() == 0 && sk.getColumnQualifierData().length() == 0 && sk.getColumnVisibilityData().length() == 0
+        && sk.getTimestamp() == Long.MAX_VALUE && !range.isStartKeyInclusive()) {
+      // assuming that we are seeking using a key previously returned by this iterator
+      // therefore go to the next row
+      Key followingRowKey = sk.followingKey(PartialKey.ROW);
+      if (range.getEndKey() != null && followingRowKey.compareTo(range.getEndKey()) > 0)
+        return;
+      
+      range = new Range(sk.followingKey(PartialKey.ROW), true, range.getEndKey(), range.isEndKeyInclusive());
+    }
+    
+    sourceIter.seek(range, columnFamilies, inclusive);
+    prepKeys();
+  }
+  
+}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/7bdbfccb/1.5/core/src/main/java/org/apache/accumulo/core/master/MasterNotRunningException.java
----------------------------------------------------------------------
diff --git a/1.5/core/src/main/java/org/apache/accumulo/core/master/MasterNotRunningException.java b/1.5/core/src/main/java/org/apache/accumulo/core/master/MasterNotRunningException.java
new file mode 100644
index 0000000..1b5361f
--- /dev/null
+++ b/1.5/core/src/main/java/org/apache/accumulo/core/master/MasterNotRunningException.java
@@ -0,0 +1,35 @@
+/*
+ * 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.core.master;
+
+public class MasterNotRunningException extends Exception {
+  
+  /**
+   * eclipse generated this ...
+   */
+  private static final long serialVersionUID = 1L;
+  private String message;
+  
+  public MasterNotRunningException(String msg) {
+    message = msg;
+  }
+  
+  public String getMessage() {
+    return message;
+  }
+  
+}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/7bdbfccb/1.5/core/src/main/java/org/apache/accumulo/core/master/state/tables/TableState.java
----------------------------------------------------------------------
diff --git a/1.5/core/src/main/java/org/apache/accumulo/core/master/state/tables/TableState.java b/1.5/core/src/main/java/org/apache/accumulo/core/master/state/tables/TableState.java
new file mode 100644
index 0000000..8cac10c
--- /dev/null
+++ b/1.5/core/src/main/java/org/apache/accumulo/core/master/state/tables/TableState.java
@@ -0,0 +1,35 @@
+/*
+ * 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.core.master.state.tables;
+
+public enum TableState {
+  // NEW while making directories and tablets;
+  NEW,
+  
+  // ONLINE tablets will be assigned
+  ONLINE,
+  
+  // OFFLINE tablets will be taken offline
+  OFFLINE,
+  
+  // DELETING waiting for tablets to go offline and table will be removed
+  DELETING,
+  
+  // UNKNOWN is NOT a valid state; it is reserved for unrecognized serialized
+  // representations of table state
+  UNKNOWN;
+}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/7bdbfccb/1.5/core/src/main/java/org/apache/accumulo/core/master/thrift/Compacting.java
----------------------------------------------------------------------
diff --git a/1.5/core/src/main/java/org/apache/accumulo/core/master/thrift/Compacting.java b/1.5/core/src/main/java/org/apache/accumulo/core/master/thrift/Compacting.java
new file mode 100644
index 0000000..d61d1b3
--- /dev/null
+++ b/1.5/core/src/main/java/org/apache/accumulo/core/master/thrift/Compacting.java
@@ -0,0 +1,475 @@
+/**
+ * Autogenerated by Thrift Compiler (0.8.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ *  @generated
+ */
+package org.apache.accumulo.core.master.thrift;
+
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@SuppressWarnings("all") public class Compacting implements org.apache.thrift.TBase<Compacting, Compacting._Fields>, java.io.Serializable, Cloneable {
+  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Compacting");
+
+  private static final org.apache.thrift.protocol.TField RUNNING_FIELD_DESC = new org.apache.thrift.protocol.TField("running", org.apache.thrift.protocol.TType.I32, (short)1);
+  private static final org.apache.thrift.protocol.TField QUEUED_FIELD_DESC = new org.apache.thrift.protocol.TField("queued", org.apache.thrift.protocol.TType.I32, (short)2);
+
+  private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+  static {
+    schemes.put(StandardScheme.class, new CompactingStandardSchemeFactory());
+    schemes.put(TupleScheme.class, new CompactingTupleSchemeFactory());
+  }
+
+  public int running; // required
+  public int queued; // required
+
+  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+    RUNNING((short)1, "running"),
+    QUEUED((short)2, "queued");
+
+    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+    static {
+      for (_Fields field : EnumSet.allOf(_Fields.class)) {
+        byName.put(field.getFieldName(), field);
+      }
+    }
+
+    /**
+     * Find the _Fields constant that matches fieldId, or null if its not found.
+     */
+    public static _Fields findByThriftId(int fieldId) {
+      switch(fieldId) {
+        case 1: // RUNNING
+          return RUNNING;
+        case 2: // QUEUED
+          return QUEUED;
+        default:
+          return null;
+      }
+    }
+
+    /**
+     * Find the _Fields constant that matches fieldId, throwing an exception
+     * if it is not found.
+     */
+    public static _Fields findByThriftIdOrThrow(int fieldId) {
+      _Fields fields = findByThriftId(fieldId);
+      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+      return fields;
+    }
+
+    /**
+     * Find the _Fields constant that matches name, or null if its not found.
+     */
+    public static _Fields findByName(String name) {
+      return byName.get(name);
+    }
+
+    private final short _thriftId;
+    private final String _fieldName;
+
+    _Fields(short thriftId, String fieldName) {
+      _thriftId = thriftId;
+      _fieldName = fieldName;
+    }
+
+    public short getThriftFieldId() {
+      return _thriftId;
+    }
+
+    public String getFieldName() {
+      return _fieldName;
+    }
+  }
+
+  // isset id assignments
+  private static final int __RUNNING_ISSET_ID = 0;
+  private static final int __QUEUED_ISSET_ID = 1;
+  private BitSet __isset_bit_vector = new BitSet(2);
+  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+  static {
+    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+    tmpMap.put(_Fields.RUNNING, new org.apache.thrift.meta_data.FieldMetaData("running", org.apache.thrift.TFieldRequirementType.DEFAULT, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
+    tmpMap.put(_Fields.QUEUED, new org.apache.thrift.meta_data.FieldMetaData("queued", org.apache.thrift.TFieldRequirementType.DEFAULT, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
+    metaDataMap = Collections.unmodifiableMap(tmpMap);
+    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Compacting.class, metaDataMap);
+  }
+
+  public Compacting() {
+  }
+
+  public Compacting(
+    int running,
+    int queued)
+  {
+    this();
+    this.running = running;
+    setRunningIsSet(true);
+    this.queued = queued;
+    setQueuedIsSet(true);
+  }
+
+  /**
+   * Performs a deep copy on <i>other</i>.
+   */
+  public Compacting(Compacting other) {
+    __isset_bit_vector.clear();
+    __isset_bit_vector.or(other.__isset_bit_vector);
+    this.running = other.running;
+    this.queued = other.queued;
+  }
+
+  public Compacting deepCopy() {
+    return new Compacting(this);
+  }
+
+  @Override
+  public void clear() {
+    setRunningIsSet(false);
+    this.running = 0;
+    setQueuedIsSet(false);
+    this.queued = 0;
+  }
+
+  public int getRunning() {
+    return this.running;
+  }
+
+  public Compacting setRunning(int running) {
+    this.running = running;
+    setRunningIsSet(true);
+    return this;
+  }
+
+  public void unsetRunning() {
+    __isset_bit_vector.clear(__RUNNING_ISSET_ID);
+  }
+
+  /** Returns true if field running is set (has been assigned a value) and false otherwise */
+  public boolean isSetRunning() {
+    return __isset_bit_vector.get(__RUNNING_ISSET_ID);
+  }
+
+  public void setRunningIsSet(boolean value) {
+    __isset_bit_vector.set(__RUNNING_ISSET_ID, value);
+  }
+
+  public int getQueued() {
+    return this.queued;
+  }
+
+  public Compacting setQueued(int queued) {
+    this.queued = queued;
+    setQueuedIsSet(true);
+    return this;
+  }
+
+  public void unsetQueued() {
+    __isset_bit_vector.clear(__QUEUED_ISSET_ID);
+  }
+
+  /** Returns true if field queued is set (has been assigned a value) and false otherwise */
+  public boolean isSetQueued() {
+    return __isset_bit_vector.get(__QUEUED_ISSET_ID);
+  }
+
+  public void setQueuedIsSet(boolean value) {
+    __isset_bit_vector.set(__QUEUED_ISSET_ID, value);
+  }
+
+  public void setFieldValue(_Fields field, Object value) {
+    switch (field) {
+    case RUNNING:
+      if (value == null) {
+        unsetRunning();
+      } else {
+        setRunning((Integer)value);
+      }
+      break;
+
+    case QUEUED:
+      if (value == null) {
+        unsetQueued();
+      } else {
+        setQueued((Integer)value);
+      }
+      break;
+
+    }
+  }
+
+  public Object getFieldValue(_Fields field) {
+    switch (field) {
+    case RUNNING:
+      return Integer.valueOf(getRunning());
+
+    case QUEUED:
+      return Integer.valueOf(getQueued());
+
+    }
+    throw new IllegalStateException();
+  }
+
+  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+  public boolean isSet(_Fields field) {
+    if (field == null) {
+      throw new IllegalArgumentException();
+    }
+
+    switch (field) {
+    case RUNNING:
+      return isSetRunning();
+    case QUEUED:
+      return isSetQueued();
+    }
+    throw new IllegalStateException();
+  }
+
+  @Override
+  public boolean equals(Object that) {
+    if (that == null)
+      return false;
+    if (that instanceof Compacting)
+      return this.equals((Compacting)that);
+    return false;
+  }
+
+  public boolean equals(Compacting that) {
+    if (that == null)
+      return false;
+
+    boolean this_present_running = true;
+    boolean that_present_running = true;
+    if (this_present_running || that_present_running) {
+      if (!(this_present_running && that_present_running))
+        return false;
+      if (this.running != that.running)
+        return false;
+    }
+
+    boolean this_present_queued = true;
+    boolean that_present_queued = true;
+    if (this_present_queued || that_present_queued) {
+      if (!(this_present_queued && that_present_queued))
+        return false;
+      if (this.queued != that.queued)
+        return false;
+    }
+
+    return true;
+  }
+
+  @Override
+  public int hashCode() {
+    return 0;
+  }
+
+  public int compareTo(Compacting other) {
+    if (!getClass().equals(other.getClass())) {
+      return getClass().getName().compareTo(other.getClass().getName());
+    }
+
+    int lastComparison = 0;
+    Compacting typedOther = (Compacting)other;
+
+    lastComparison = Boolean.valueOf(isSetRunning()).compareTo(typedOther.isSetRunning());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetRunning()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.running, typedOther.running);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetQueued()).compareTo(typedOther.isSetQueued());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetQueued()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.queued, typedOther.queued);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    return 0;
+  }
+
+  public _Fields fieldForId(int fieldId) {
+    return _Fields.findByThriftId(fieldId);
+  }
+
+  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+    schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+  }
+
+  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+    schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
+  }
+
+  @Override
+  public String toString() {
+    StringBuilder sb = new StringBuilder("Compacting(");
+    boolean first = true;
+
+    sb.append("running:");
+    sb.append(this.running);
+    first = false;
+    if (!first) sb.append(", ");
+    sb.append("queued:");
+    sb.append(this.queued);
+    first = false;
+    sb.append(")");
+    return sb.toString();
+  }
+
+  public void validate() throws org.apache.thrift.TException {
+    // check for required fields
+  }
+
+  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+    try {
+      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+    } catch (org.apache.thrift.TException te) {
+      throw new java.io.IOException(te);
+    }
+  }
+
+  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+    try {
+      // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
+      __isset_bit_vector = new BitSet(1);
+      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+    } catch (org.apache.thrift.TException te) {
+      throw new java.io.IOException(te);
+    }
+  }
+
+  private static class CompactingStandardSchemeFactory implements SchemeFactory {
+    public CompactingStandardScheme getScheme() {
+      return new CompactingStandardScheme();
+    }
+  }
+
+  private static class CompactingStandardScheme extends StandardScheme<Compacting> {
+
+    public void read(org.apache.thrift.protocol.TProtocol iprot, Compacting struct) throws org.apache.thrift.TException {
+      org.apache.thrift.protocol.TField schemeField;
+      iprot.readStructBegin();
+      while (true)
+      {
+        schemeField = iprot.readFieldBegin();
+        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
+          break;
+        }
+        switch (schemeField.id) {
+          case 1: // RUNNING
+            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
+              struct.running = iprot.readI32();
+              struct.setRunningIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 2: // QUEUED
+            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
+              struct.queued = iprot.readI32();
+              struct.setQueuedIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          default:
+            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+        }
+        iprot.readFieldEnd();
+      }
+      iprot.readStructEnd();
+
+      // check for required fields of primitive type, which can't be checked in the validate method
+      struct.validate();
+    }
+
+    public void write(org.apache.thrift.protocol.TProtocol oprot, Compacting struct) throws org.apache.thrift.TException {
+      struct.validate();
+
+      oprot.writeStructBegin(STRUCT_DESC);
+      oprot.writeFieldBegin(RUNNING_FIELD_DESC);
+      oprot.writeI32(struct.running);
+      oprot.writeFieldEnd();
+      oprot.writeFieldBegin(QUEUED_FIELD_DESC);
+      oprot.writeI32(struct.queued);
+      oprot.writeFieldEnd();
+      oprot.writeFieldStop();
+      oprot.writeStructEnd();
+    }
+
+  }
+
+  private static class CompactingTupleSchemeFactory implements SchemeFactory {
+    public CompactingTupleScheme getScheme() {
+      return new CompactingTupleScheme();
+    }
+  }
+
+  private static class CompactingTupleScheme extends TupleScheme<Compacting> {
+
+    @Override
+    public void write(org.apache.thrift.protocol.TProtocol prot, Compacting struct) throws org.apache.thrift.TException {
+      TTupleProtocol oprot = (TTupleProtocol) prot;
+      BitSet optionals = new BitSet();
+      if (struct.isSetRunning()) {
+        optionals.set(0);
+      }
+      if (struct.isSetQueued()) {
+        optionals.set(1);
+      }
+      oprot.writeBitSet(optionals, 2);
+      if (struct.isSetRunning()) {
+        oprot.writeI32(struct.running);
+      }
+      if (struct.isSetQueued()) {
+        oprot.writeI32(struct.queued);
+      }
+    }
+
+    @Override
+    public void read(org.apache.thrift.protocol.TProtocol prot, Compacting struct) throws org.apache.thrift.TException {
+      TTupleProtocol iprot = (TTupleProtocol) prot;
+      BitSet incoming = iprot.readBitSet(2);
+      if (incoming.get(0)) {
+        struct.running = iprot.readI32();
+        struct.setRunningIsSet(true);
+      }
+      if (incoming.get(1)) {
+        struct.queued = iprot.readI32();
+        struct.setQueuedIsSet(true);
+      }
+    }
+  }
+
+}
+

http://git-wip-us.apache.org/repos/asf/accumulo/blob/7bdbfccb/1.5/core/src/main/java/org/apache/accumulo/core/master/thrift/DeadServer.java
----------------------------------------------------------------------
diff --git a/1.5/core/src/main/java/org/apache/accumulo/core/master/thrift/DeadServer.java b/1.5/core/src/main/java/org/apache/accumulo/core/master/thrift/DeadServer.java
new file mode 100644
index 0000000..f11b8ca
--- /dev/null
+++ b/1.5/core/src/main/java/org/apache/accumulo/core/master/thrift/DeadServer.java
@@ -0,0 +1,581 @@
+/**
+ * Autogenerated by Thrift Compiler (0.8.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ *  @generated
+ */
+package org.apache.accumulo.core.master.thrift;
+
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@SuppressWarnings("all") public class DeadServer implements org.apache.thrift.TBase<DeadServer, DeadServer._Fields>, java.io.Serializable, Cloneable {
+  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("DeadServer");
+
+  private static final org.apache.thrift.protocol.TField SERVER_FIELD_DESC = new org.apache.thrift.protocol.TField("server", org.apache.thrift.protocol.TType.STRING, (short)1);
+  private static final org.apache.thrift.protocol.TField LAST_STATUS_FIELD_DESC = new org.apache.thrift.protocol.TField("lastStatus", org.apache.thrift.protocol.TType.I64, (short)2);
+  private static final org.apache.thrift.protocol.TField STATUS_FIELD_DESC = new org.apache.thrift.protocol.TField("status", org.apache.thrift.protocol.TType.STRING, (short)3);
+
+  private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+  static {
+    schemes.put(StandardScheme.class, new DeadServerStandardSchemeFactory());
+    schemes.put(TupleScheme.class, new DeadServerTupleSchemeFactory());
+  }
+
+  public String server; // required
+  public long lastStatus; // required
+  public String status; // required
+
+  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+    SERVER((short)1, "server"),
+    LAST_STATUS((short)2, "lastStatus"),
+    STATUS((short)3, "status");
+
+    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+    static {
+      for (_Fields field : EnumSet.allOf(_Fields.class)) {
+        byName.put(field.getFieldName(), field);
+      }
+    }
+
+    /**
+     * Find the _Fields constant that matches fieldId, or null if its not found.
+     */
+    public static _Fields findByThriftId(int fieldId) {
+      switch(fieldId) {
+        case 1: // SERVER
+          return SERVER;
+        case 2: // LAST_STATUS
+          return LAST_STATUS;
+        case 3: // STATUS
+          return STATUS;
+        default:
+          return null;
+      }
+    }
+
+    /**
+     * Find the _Fields constant that matches fieldId, throwing an exception
+     * if it is not found.
+     */
+    public static _Fields findByThriftIdOrThrow(int fieldId) {
+      _Fields fields = findByThriftId(fieldId);
+      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+      return fields;
+    }
+
+    /**
+     * Find the _Fields constant that matches name, or null if its not found.
+     */
+    public static _Fields findByName(String name) {
+      return byName.get(name);
+    }
+
+    private final short _thriftId;
+    private final String _fieldName;
+
+    _Fields(short thriftId, String fieldName) {
+      _thriftId = thriftId;
+      _fieldName = fieldName;
+    }
+
+    public short getThriftFieldId() {
+      return _thriftId;
+    }
+
+    public String getFieldName() {
+      return _fieldName;
+    }
+  }
+
+  // isset id assignments
+  private static final int __LASTSTATUS_ISSET_ID = 0;
+  private BitSet __isset_bit_vector = new BitSet(1);
+  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+  static {
+    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+    tmpMap.put(_Fields.SERVER, new org.apache.thrift.meta_data.FieldMetaData("server", org.apache.thrift.TFieldRequirementType.DEFAULT, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+    tmpMap.put(_Fields.LAST_STATUS, new org.apache.thrift.meta_data.FieldMetaData("lastStatus", org.apache.thrift.TFieldRequirementType.DEFAULT, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
+    tmpMap.put(_Fields.STATUS, new org.apache.thrift.meta_data.FieldMetaData("status", org.apache.thrift.TFieldRequirementType.DEFAULT, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+    metaDataMap = Collections.unmodifiableMap(tmpMap);
+    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(DeadServer.class, metaDataMap);
+  }
+
+  public DeadServer() {
+  }
+
+  public DeadServer(
+    String server,
+    long lastStatus,
+    String status)
+  {
+    this();
+    this.server = server;
+    this.lastStatus = lastStatus;
+    setLastStatusIsSet(true);
+    this.status = status;
+  }
+
+  /**
+   * Performs a deep copy on <i>other</i>.
+   */
+  public DeadServer(DeadServer other) {
+    __isset_bit_vector.clear();
+    __isset_bit_vector.or(other.__isset_bit_vector);
+    if (other.isSetServer()) {
+      this.server = other.server;
+    }
+    this.lastStatus = other.lastStatus;
+    if (other.isSetStatus()) {
+      this.status = other.status;
+    }
+  }
+
+  public DeadServer deepCopy() {
+    return new DeadServer(this);
+  }
+
+  @Override
+  public void clear() {
+    this.server = null;
+    setLastStatusIsSet(false);
+    this.lastStatus = 0;
+    this.status = null;
+  }
+
+  public String getServer() {
+    return this.server;
+  }
+
+  public DeadServer setServer(String server) {
+    this.server = server;
+    return this;
+  }
+
+  public void unsetServer() {
+    this.server = null;
+  }
+
+  /** Returns true if field server is set (has been assigned a value) and false otherwise */
+  public boolean isSetServer() {
+    return this.server != null;
+  }
+
+  public void setServerIsSet(boolean value) {
+    if (!value) {
+      this.server = null;
+    }
+  }
+
+  public long getLastStatus() {
+    return this.lastStatus;
+  }
+
+  public DeadServer setLastStatus(long lastStatus) {
+    this.lastStatus = lastStatus;
+    setLastStatusIsSet(true);
+    return this;
+  }
+
+  public void unsetLastStatus() {
+    __isset_bit_vector.clear(__LASTSTATUS_ISSET_ID);
+  }
+
+  /** Returns true if field lastStatus is set (has been assigned a value) and false otherwise */
+  public boolean isSetLastStatus() {
+    return __isset_bit_vector.get(__LASTSTATUS_ISSET_ID);
+  }
+
+  public void setLastStatusIsSet(boolean value) {
+    __isset_bit_vector.set(__LASTSTATUS_ISSET_ID, value);
+  }
+
+  public String getStatus() {
+    return this.status;
+  }
+
+  public DeadServer setStatus(String status) {
+    this.status = status;
+    return this;
+  }
+
+  public void unsetStatus() {
+    this.status = null;
+  }
+
+  /** Returns true if field status is set (has been assigned a value) and false otherwise */
+  public boolean isSetStatus() {
+    return this.status != null;
+  }
+
+  public void setStatusIsSet(boolean value) {
+    if (!value) {
+      this.status = null;
+    }
+  }
+
+  public void setFieldValue(_Fields field, Object value) {
+    switch (field) {
+    case SERVER:
+      if (value == null) {
+        unsetServer();
+      } else {
+        setServer((String)value);
+      }
+      break;
+
+    case LAST_STATUS:
+      if (value == null) {
+        unsetLastStatus();
+      } else {
+        setLastStatus((Long)value);
+      }
+      break;
+
+    case STATUS:
+      if (value == null) {
+        unsetStatus();
+      } else {
+        setStatus((String)value);
+      }
+      break;
+
+    }
+  }
+
+  public Object getFieldValue(_Fields field) {
+    switch (field) {
+    case SERVER:
+      return getServer();
+
+    case LAST_STATUS:
+      return Long.valueOf(getLastStatus());
+
+    case STATUS:
+      return getStatus();
+
+    }
+    throw new IllegalStateException();
+  }
+
+  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+  public boolean isSet(_Fields field) {
+    if (field == null) {
+      throw new IllegalArgumentException();
+    }
+
+    switch (field) {
+    case SERVER:
+      return isSetServer();
+    case LAST_STATUS:
+      return isSetLastStatus();
+    case STATUS:
+      return isSetStatus();
+    }
+    throw new IllegalStateException();
+  }
+
+  @Override
+  public boolean equals(Object that) {
+    if (that == null)
+      return false;
+    if (that instanceof DeadServer)
+      return this.equals((DeadServer)that);
+    return false;
+  }
+
+  public boolean equals(DeadServer that) {
+    if (that == null)
+      return false;
+
+    boolean this_present_server = true && this.isSetServer();
+    boolean that_present_server = true && that.isSetServer();
+    if (this_present_server || that_present_server) {
+      if (!(this_present_server && that_present_server))
+        return false;
+      if (!this.server.equals(that.server))
+        return false;
+    }
+
+    boolean this_present_lastStatus = true;
+    boolean that_present_lastStatus = true;
+    if (this_present_lastStatus || that_present_lastStatus) {
+      if (!(this_present_lastStatus && that_present_lastStatus))
+        return false;
+      if (this.lastStatus != that.lastStatus)
+        return false;
+    }
+
+    boolean this_present_status = true && this.isSetStatus();
+    boolean that_present_status = true && that.isSetStatus();
+    if (this_present_status || that_present_status) {
+      if (!(this_present_status && that_present_status))
+        return false;
+      if (!this.status.equals(that.status))
+        return false;
+    }
+
+    return true;
+  }
+
+  @Override
+  public int hashCode() {
+    return 0;
+  }
+
+  public int compareTo(DeadServer other) {
+    if (!getClass().equals(other.getClass())) {
+      return getClass().getName().compareTo(other.getClass().getName());
+    }
+
+    int lastComparison = 0;
+    DeadServer typedOther = (DeadServer)other;
+
+    lastComparison = Boolean.valueOf(isSetServer()).compareTo(typedOther.isSetServer());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetServer()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.server, typedOther.server);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetLastStatus()).compareTo(typedOther.isSetLastStatus());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetLastStatus()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.lastStatus, typedOther.lastStatus);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetStatus()).compareTo(typedOther.isSetStatus());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetStatus()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.status, typedOther.status);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    return 0;
+  }
+
+  public _Fields fieldForId(int fieldId) {
+    return _Fields.findByThriftId(fieldId);
+  }
+
+  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+    schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+  }
+
+  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+    schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
+  }
+
+  @Override
+  public String toString() {
+    StringBuilder sb = new StringBuilder("DeadServer(");
+    boolean first = true;
+
+    sb.append("server:");
+    if (this.server == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.server);
+    }
+    first = false;
+    if (!first) sb.append(", ");
+    sb.append("lastStatus:");
+    sb.append(this.lastStatus);
+    first = false;
+    if (!first) sb.append(", ");
+    sb.append("status:");
+    if (this.status == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.status);
+    }
+    first = false;
+    sb.append(")");
+    return sb.toString();
+  }
+
+  public void validate() throws org.apache.thrift.TException {
+    // check for required fields
+  }
+
+  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+    try {
+      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+    } catch (org.apache.thrift.TException te) {
+      throw new java.io.IOException(te);
+    }
+  }
+
+  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+    try {
+      // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
+      __isset_bit_vector = new BitSet(1);
+      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+    } catch (org.apache.thrift.TException te) {
+      throw new java.io.IOException(te);
+    }
+  }
+
+  private static class DeadServerStandardSchemeFactory implements SchemeFactory {
+    public DeadServerStandardScheme getScheme() {
+      return new DeadServerStandardScheme();
+    }
+  }
+
+  private static class DeadServerStandardScheme extends StandardScheme<DeadServer> {
+
+    public void read(org.apache.thrift.protocol.TProtocol iprot, DeadServer struct) throws org.apache.thrift.TException {
+      org.apache.thrift.protocol.TField schemeField;
+      iprot.readStructBegin();
+      while (true)
+      {
+        schemeField = iprot.readFieldBegin();
+        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
+          break;
+        }
+        switch (schemeField.id) {
+          case 1: // SERVER
+            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+              struct.server = iprot.readString();
+              struct.setServerIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 2: // LAST_STATUS
+            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
+              struct.lastStatus = iprot.readI64();
+              struct.setLastStatusIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 3: // STATUS
+            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+              struct.status = iprot.readString();
+              struct.setStatusIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          default:
+            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+        }
+        iprot.readFieldEnd();
+      }
+      iprot.readStructEnd();
+
+      // check for required fields of primitive type, which can't be checked in the validate method
+      struct.validate();
+    }
+
+    public void write(org.apache.thrift.protocol.TProtocol oprot, DeadServer struct) throws org.apache.thrift.TException {
+      struct.validate();
+
+      oprot.writeStructBegin(STRUCT_DESC);
+      if (struct.server != null) {
+        oprot.writeFieldBegin(SERVER_FIELD_DESC);
+        oprot.writeString(struct.server);
+        oprot.writeFieldEnd();
+      }
+      oprot.writeFieldBegin(LAST_STATUS_FIELD_DESC);
+      oprot.writeI64(struct.lastStatus);
+      oprot.writeFieldEnd();
+      if (struct.status != null) {
+        oprot.writeFieldBegin(STATUS_FIELD_DESC);
+        oprot.writeString(struct.status);
+        oprot.writeFieldEnd();
+      }
+      oprot.writeFieldStop();
+      oprot.writeStructEnd();
+    }
+
+  }
+
+  private static class DeadServerTupleSchemeFactory implements SchemeFactory {
+    public DeadServerTupleScheme getScheme() {
+      return new DeadServerTupleScheme();
+    }
+  }
+
+  private static class DeadServerTupleScheme extends TupleScheme<DeadServer> {
+
+    @Override
+    public void write(org.apache.thrift.protocol.TProtocol prot, DeadServer struct) throws org.apache.thrift.TException {
+      TTupleProtocol oprot = (TTupleProtocol) prot;
+      BitSet optionals = new BitSet();
+      if (struct.isSetServer()) {
+        optionals.set(0);
+      }
+      if (struct.isSetLastStatus()) {
+        optionals.set(1);
+      }
+      if (struct.isSetStatus()) {
+        optionals.set(2);
+      }
+      oprot.writeBitSet(optionals, 3);
+      if (struct.isSetServer()) {
+        oprot.writeString(struct.server);
+      }
+      if (struct.isSetLastStatus()) {
+        oprot.writeI64(struct.lastStatus);
+      }
+      if (struct.isSetStatus()) {
+        oprot.writeString(struct.status);
+      }
+    }
+
+    @Override
+    public void read(org.apache.thrift.protocol.TProtocol prot, DeadServer struct) throws org.apache.thrift.TException {
+      TTupleProtocol iprot = (TTupleProtocol) prot;
+      BitSet incoming = iprot.readBitSet(3);
+      if (incoming.get(0)) {
+        struct.server = iprot.readString();
+        struct.setServerIsSet(true);
+      }
+      if (incoming.get(1)) {
+        struct.lastStatus = iprot.readI64();
+        struct.setLastStatusIsSet(true);
+      }
+      if (incoming.get(2)) {
+        struct.status = iprot.readString();
+        struct.setStatusIsSet(true);
+      }
+    }
+  }
+
+}
+


Mime
View raw message