incubator-accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bil...@apache.org
Subject svn commit: r1207529 [1/2] - in /incubator/accumulo/branches/1.4/src/core/src: main/java/org/apache/accumulo/core/client/mock/ main/java/org/apache/accumulo/core/iterators/ main/java/org/apache/accumulo/core/iterators/system/ main/java/org/apache/accum...
Date Mon, 28 Nov 2011 19:30:28 GMT
Author: billie
Date: Mon Nov 28 19:30:20 2011
New Revision: 1207529

URL: http://svn.apache.org/viewvc?rev=1207529&view=rev
Log:
ACCUMULO-167 added static methods, removed constructors or made them private, converted tests to configure through init instead

Added:
    incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/system/ColumnFamilySkippingIteratorTest.java
      - copied, changed from r1204997, incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/ColumnFamilySkippingIteratorTest.java
    incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/system/ColumnFilterTest.java
      - copied, changed from r1204997, incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/ColumnFilterTest.java
    incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/user/CombinerTest.java
      - copied, changed from r1204997, incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/CombinerTest.java
    incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/user/FilterTest.java
      - copied, changed from r1204997, incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/FilterTest.java
    incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/user/LargeRowFilterTest.java
      - copied, changed from r1204997, incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/LargeRowFilterTest.java
    incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/user/RegExFilterTest.java
      - copied, changed from r1204997, incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/RegExFilterTest.java
    incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/user/VersioningIteratorTest.java
      - copied, changed from r1205055, incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/VersioningIteratorTest.java
Removed:
    incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/ColumnFamilySkippingIteratorTest.java
    incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/ColumnFilterTest.java
    incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/CombinerTest.java
    incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/FilterTest.java
    incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/LargeRowFilterTest.java
    incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/RegExFilterTest.java
    incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/VersioningIteratorTest.java
Modified:
    incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/client/mock/MockBatchScanner.java
    incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/client/mock/MockScanner.java
    incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/Combiner.java
    incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/Filter.java
    incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/LongCombiner.java
    incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/system/ColumnQualifierFilter.java
    incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/system/VisibilityFilter.java
    incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/user/AgeOffFilter.java
    incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/user/ColumnAgeOffFilter.java
    incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/user/IntersectingIterator.java
    incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/user/LargeRowFilter.java
    incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/user/NoVisFilter.java
    incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/user/RegExFilter.java
    incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/user/SummingArrayCombiner.java
    incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/user/TimestampFilter.java
    incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/client/mock/MockConnectorTest.java
    incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/FamilyIntersectingIteratorTest.java
    incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/RowDeletingIteratorTest.java

Modified: incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/client/mock/MockBatchScanner.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/client/mock/MockBatchScanner.java?rev=1207529&r1=1207528&r2=1207529&view=diff
==============================================================================
--- incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/client/mock/MockBatchScanner.java (original)
+++ incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/client/mock/MockBatchScanner.java Mon Nov 28 19:30:20 2011
@@ -49,8 +49,8 @@ public class MockBatchScanner extends Mo
   static class RangesFilter extends Filter {
     List<Range> ranges;
     
-    public RangesFilter(SortedKeyValueIterator<Key,Value> iterator, List<Range> ranges) {
-      super(iterator);
+    RangesFilter(SortedKeyValueIterator<Key,Value> iterator, List<Range> ranges) {
+      setSource(iterator);
       this.ranges = ranges;
     }
     

Modified: incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/client/mock/MockScanner.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/client/mock/MockScanner.java?rev=1207529&r1=1207528&r2=1207529&view=diff
==============================================================================
--- incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/client/mock/MockScanner.java (original)
+++ incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/client/mock/MockScanner.java Mon Nov 28 19:30:20 2011
@@ -78,8 +78,8 @@ public class MockScanner extends MockSca
   static class RangeFilter extends Filter {
     Range range;
     
-    public RangeFilter(SortedKeyValueIterator<Key,Value> i, Range range) {
-      super(i);
+    RangeFilter(SortedKeyValueIterator<Key,Value> i, Range range) {
+      setSource(i);
       this.range = range;
     }
     

Modified: incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/Combiner.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/Combiner.java?rev=1207529&r1=1207528&r2=1207529&view=diff
==============================================================================
--- incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/Combiner.java (original)
+++ incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/Combiner.java Mon Nov 28 19:30:20 2011
@@ -26,14 +26,13 @@ import java.util.Map;
 import java.util.NoSuchElementException;
 
 import org.apache.accumulo.core.client.IteratorSetting;
+import org.apache.accumulo.core.client.IteratorSetting.Column;
 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.conf.ColumnSet;
-import org.apache.accumulo.core.util.Pair;
-import org.apache.hadoop.io.Text;
 import org.apache.log4j.Logger;
 
 /**
@@ -46,7 +45,7 @@ import org.apache.log4j.Logger;
  */
 public abstract class Combiner extends WrappingIterator implements OptionDescriber {
   static final Logger log = Logger.getLogger(Combiner.class);
-  public static final String COLUMNS_OPTION = "columns";
+  protected static final String COLUMNS_OPTION = "columns";
   
   /**
    * A Java Iterator that iterates over the Values for a given Key from a source SortedKeyValueIterator.
@@ -115,8 +114,6 @@ public abstract class Combiner extends W
   Key topKey;
   Value topValue;
   
-  public Combiner() {}
-  
   @Override
   public Key getTopKey() {
     if (topKey == null)
@@ -231,7 +228,7 @@ public abstract class Combiner extends W
         Collections
             .singletonMap(
                 COLUMNS_OPTION,
-        "<col fam>[:<col qual>]{,<col fam>[:<col qual>]} escape non aplhanum chars using %<hex>."),
+        "<col fam>[:<col qual>]{,<col fam>[:<col qual>]} escape non-alphanum chars using %<hex>."),
         null);
   }
   
@@ -253,38 +250,15 @@ public abstract class Combiner extends W
   }
   
   /**
-   * A convenience class for passing column family and column qualifiers
-   */
-  public static class Column extends Pair<Text,Text> {
-    
-    public Column(Text columnFamily, Text columnQualifier) {
-      super(columnFamily, columnQualifier);
-    }
-    
-    public Column(Text columnFamily) {
-      super(columnFamily, null);
-    }
-    
-    public Column(String columnFamily, String columnQualifier) {
-      super(new Text(columnFamily), new Text(columnQualifier));
-    }
-    
-    public Column(String columnFamily) {
-      super(new Text(columnFamily), null);
-    }
-    
-  }
-
-  /**
    * A convenience method to set which columns a combiner should be applied to.
    * 
    * @param is
    *          iterator settings object to configure
    * @param columns
-   *          a list columns to encode as the value for the combiner column configuration
+   *          a list of columns to encode as the value for the combiner column configuration
    */
   
-  public static void setColumns(IteratorSetting is, List<Column> columns) {
+  public static void setColumns(IteratorSetting is, List<IteratorSetting.Column> columns) {
     String sep = "";
     StringBuilder sb = new StringBuilder();
     

Modified: incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/Filter.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/Filter.java?rev=1207529&r1=1207528&r2=1207529&view=diff
==============================================================================
--- incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/Filter.java (original)
+++ incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/Filter.java Mon Nov 28 19:30:20 2011
@@ -21,6 +21,7 @@ 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.Range;
@@ -50,14 +51,7 @@ public abstract class Filter extends Wra
   }
   
   private static final String NEGATE = "negate";
-  boolean negate;
-  
-  public Filter() {}
-  
-  public Filter(SortedKeyValueIterator<Key,Value> iterator) {
-    setSource(iterator);
-    negate = false;
-  }
+  boolean negate = false;
   
   @Override
   public void next() throws IOException {
@@ -111,4 +105,16 @@ public abstract class Filter extends Wra
     }
     return true;
   }
+  
+  /**
+   * A convenience method for setting the negation option on a filter.
+   * 
+   * @param is
+   *          IteratorSetting object to configure.
+   * @param negate
+   *          if false, filter accepts k/v for which the accept method returns true; if true, filter accepts k/v for which the accept method returns false.
+   */
+  public static void setNegate(IteratorSetting is, boolean negate) {
+    is.addOption(NEGATE, Boolean.toString(negate));
+  }
 }

Modified: incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/LongCombiner.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/LongCombiner.java?rev=1207529&r1=1207528&r2=1207529&view=diff
==============================================================================
--- incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/LongCombiner.java (original)
+++ incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/LongCombiner.java Mon Nov 28 19:30:20 2011
@@ -23,8 +23,10 @@ import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.Map;
 
+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.start.classloader.AccumuloClassLoader;
 import org.apache.hadoop.io.WritableUtils;
 
 /**
@@ -38,7 +40,8 @@ import org.apache.hadoop.io.WritableUtil
  * VARNUM, LONG, and STRING which indicate the VarNumEncoder, LongEncoder, and StringEncoder respectively.
  */
 public abstract class LongCombiner extends TypedValueCombiner<Long> {
-  public static final String TYPE = "type";
+  protected static final String TYPE = "type";
+  protected static final String CLASS_PREFIX = "class:";
   
   public static enum Type {
     VARNUM, LONG, STRING
@@ -47,20 +50,44 @@ public abstract class LongCombiner exten
   @Override
   public void init(SortedKeyValueIterator<Key,Value> source, Map<String,String> options, IteratorEnvironment env) throws IOException {
     super.init(source, options, env);
-    if (options.get(TYPE) == null)
+    setEncoder(options);
+  }
+  
+  private void setEncoder(Map<String,String> options) {
+    String type = options.get(TYPE);
+    if (type == null)
       throw new IllegalArgumentException("no type specified");
-    switch (Type.valueOf(options.get(TYPE))) {
-      case VARNUM:
-        encoder = new VarNumEncoder();
-        return;
-      case LONG:
-        encoder = new LongEncoder();
-        return;
-      case STRING:
-        encoder = new StringEncoder();
-        return;
-      default:
-        throw new IllegalArgumentException();
+    if (type.startsWith(CLASS_PREFIX)) {
+      try {
+        @SuppressWarnings("unchecked")
+        Class<? extends Encoder<Long>> clazz = (Class<? extends Encoder<Long>>) AccumuloClassLoader.loadClass(type.substring(CLASS_PREFIX.length()),
+            Encoder.class);
+        encoder = clazz.newInstance();
+        if (encoder.decode(encoder.encode(42l)) != 42l) {
+          throw new IllegalArgumentException("something wrong with " + type + " -- doesn't encode and decode a Long properly");
+        }
+      } catch (ClassNotFoundException e) {
+        throw new IllegalArgumentException(e);
+      } catch (InstantiationException e) {
+        throw new IllegalArgumentException(e);
+      } catch (IllegalAccessException e) {
+        throw new IllegalArgumentException(e);
+      }
+    }
+    else {
+      switch (Type.valueOf(type)) {
+        case VARNUM:
+          encoder = new VarNumEncoder();
+          return;
+        case LONG:
+          encoder = new LongEncoder();
+          return;
+        case STRING:
+          encoder = new StringEncoder();
+          return;
+        default:
+          throw new IllegalArgumentException();
+      }
     }
   }
   
@@ -76,13 +103,7 @@ public abstract class LongCombiner exten
   @Override
   public boolean validateOptions(Map<String,String> options) {
     super.validateOptions(options);
-    if (options.get(TYPE) == null)
-      return false;
-    try {
-      Type.valueOf(options.get(TYPE));
-    } catch (Exception e) {
-      return false;
-    }
+    setEncoder(options);
     return true;
   }
   
@@ -175,4 +196,40 @@ public abstract class LongCombiner exten
     }
     return a + b;
   }
+  
+  /**
+   * A convenience method for setting the long encoding type.
+   * 
+   * @param is
+   *          IteratorSetting object to configure.
+   * @param type
+   *          LongCombiner.Type specifying the encoding type.
+   */
+  public static void setEncodingType(IteratorSetting is, LongCombiner.Type type) {
+    is.addOption(TYPE, type.toString());
+  }
+  
+  /**
+   * A convenience method for setting the long encoding type.
+   * 
+   * @param is
+   *          IteratorSetting object to configure.
+   * @param encoderClass
+   *          Class<? extends Encoder<Long>> specifying the encoding type.
+   */
+  public static void setEncodingType(IteratorSetting is, Class<? extends Encoder<Long>> encoderClass) {
+    is.addOption(TYPE, CLASS_PREFIX + encoderClass.getName());
+  }
+  
+  /**
+   * A convenience method for setting the long encoding type.
+   * 
+   * @param is
+   *          IteratorSetting object to configure.
+   * @param encoderClassName
+   *          name of a class specifying the encoding type.
+   */
+  public static void setEncodingType(IteratorSetting is, String encoderClassName) {
+    is.addOption(TYPE, CLASS_PREFIX + encoderClassName);
+  }
 }

Modified: incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/system/ColumnQualifierFilter.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/system/ColumnQualifierFilter.java?rev=1207529&r1=1207528&r2=1207529&view=diff
==============================================================================
--- incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/system/ColumnQualifierFilter.java (original)
+++ incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/system/ColumnQualifierFilter.java Mon Nov 28 19:30:20 2011
@@ -37,13 +37,13 @@ public class ColumnQualifierFilter exten
   public ColumnQualifierFilter() {}
   
   public ColumnQualifierFilter(SortedKeyValueIterator<Key,Value> iterator, HashSet<Column> columns) {
-    super(iterator);
+    setSource(iterator);
     init(columns);
   }
   
   public ColumnQualifierFilter(SortedKeyValueIterator<Key,Value> iterator, HashSet<ByteSequence> columnFamilies,
       HashMap<ByteSequence,HashSet<ByteSequence>> columnsQualifiers, boolean scanColumns) {
-    super(iterator);
+    setSource(iterator);
     this.columnFamilies = columnFamilies;
     this.columnsQualifiers = columnsQualifiers;
     this.scanColumns = scanColumns;

Modified: incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/system/VisibilityFilter.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/system/VisibilityFilter.java?rev=1207529&r1=1207528&r2=1207529&view=diff
==============================================================================
--- incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/system/VisibilityFilter.java (original)
+++ incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/system/VisibilityFilter.java Mon Nov 28 19:30:20 2011
@@ -41,7 +41,7 @@ public class VisibilityFilter extends Fi
   public VisibilityFilter() {}
   
   public VisibilityFilter(SortedKeyValueIterator<Key,Value> iterator, Authorizations authorizations, byte[] defaultVisibility) {
-    super(iterator);
+    setSource(iterator);
     this.ve = new VisibilityEvaluator(authorizations);
     this.defaultVisibility = new Text(defaultVisibility);
     this.cache = new LRUMap(1000);

Modified: incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/user/AgeOffFilter.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/user/AgeOffFilter.java?rev=1207529&r1=1207528&r2=1207529&view=diff
==============================================================================
--- incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/user/AgeOffFilter.java (original)
+++ incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/user/AgeOffFilter.java Mon Nov 28 19:30:20 2011
@@ -19,6 +19,7 @@ package org.apache.accumulo.core.iterato
 import java.io.IOException;
 import java.util.Map;
 
+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;
@@ -32,6 +33,7 @@ import org.apache.accumulo.core.iterator
  */
 public class AgeOffFilter extends Filter {
   private static final String TTL = "ttl";
+  private static final String CURRENT_TIME = "currentTime";
   private long threshold;
   private long currentTime;
   
@@ -49,8 +51,8 @@ public class AgeOffFilter extends Filter
    * @param threshold
    *          Current time in milliseconds.
    */
-  public AgeOffFilter(SortedKeyValueIterator<Key,Value> iterator, long threshold, long currentTime) {
-    super(iterator);
+  private AgeOffFilter(SortedKeyValueIterator<Key,Value> iterator, long threshold, long currentTime) {
+    setSource(iterator);
     this.threshold = threshold;
     this.currentTime = currentTime;
   }
@@ -80,7 +82,7 @@ public class AgeOffFilter extends Filter
     
     threshold = Long.parseLong(ttl);
     
-    String time = options.get("currentTime");
+    String time = options.get(CURRENT_TIME);
     if (time != null)
       currentTime = Long.parseLong(time);
     else
@@ -98,7 +100,7 @@ public class AgeOffFilter extends Filter
   public IteratorOptions describeOptions() {
     IteratorOptions io = super.describeOptions();
     io.addNamedOption(TTL, "time to live (milliseconds)");
-    io.addNamedOption("currentTime", "if set, use the given value as the absolute time in milliseconds as the current time of day");
+    io.addNamedOption(CURRENT_TIME, "if set, use the given value as the absolute time in milliseconds as the current time of day");
     io.setName("ageoff");
     io.setDescription("AgeOffFilter removes entries with timestamps more than <ttl> milliseconds old");
     return io;
@@ -114,4 +116,28 @@ public class AgeOffFilter extends Filter
     }
     return true;
   }
+  
+  /**
+   * A convenience method for setting the age off threshold.
+   * 
+   * @param is
+   *          IteratorSetting object to configure.
+   * @param ttl
+   *          age off threshold in milliseconds.
+   */
+  public static void setTTL(IteratorSetting is, Long ttl) {
+    is.addOption(TTL, Long.toString(ttl));
+  }
+  
+  /**
+   * A convenience method for setting the current time (from which to measure the age off threshold).
+   * 
+   * @param is
+   *          IteratorSetting object to configure.
+   * @param currentTime
+   *          time in milliseconds.
+   */
+  public static void setCurrentTime(IteratorSetting is, Long currentTime) {
+    is.addOption(CURRENT_TIME, Long.toString(currentTime));
+  }
 }

Modified: incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/user/ColumnAgeOffFilter.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/user/ColumnAgeOffFilter.java?rev=1207529&r1=1207528&r2=1207529&view=diff
==============================================================================
--- incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/user/ColumnAgeOffFilter.java (original)
+++ incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/user/ColumnAgeOffFilter.java Mon Nov 28 19:30:20 2011
@@ -20,13 +20,16 @@ import java.io.IOException;
 import java.util.Map;
 import java.util.Map.Entry;
 
+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;
+import org.apache.accumulo.core.iterators.conf.ColumnSet;
 import org.apache.accumulo.core.iterators.conf.ColumnToClassMapping;
-import org.apache.accumulo.core.iterators.conf.PerColumnIteratorConfig;
+import org.apache.accumulo.core.util.Pair;
+import org.apache.hadoop.io.Text;
 
 /**
  * A filter that ages off key/value pairs based on the Key's column and timestamp. It removes an entry if its timestamp is less than currentTime - threshold.
@@ -36,8 +39,8 @@ public class ColumnAgeOffFilter extends 
   
   public ColumnAgeOffFilter() {}
   
-  public ColumnAgeOffFilter(SortedKeyValueIterator<Key,Value> iterator, TTLSet ttls, long currentTime) {
-    super(iterator);
+  private ColumnAgeOffFilter(SortedKeyValueIterator<Key,Value> iterator, TTLSet ttls, long currentTime) {
+    setSource(iterator);
     this.ttls = ttls;
     this.currentTime = currentTime;
   }
@@ -51,12 +54,12 @@ public class ColumnAgeOffFilter extends 
         String ttl = entry.getValue();
         Long l = Long.parseLong(ttl);
         
-        PerColumnIteratorConfig ac = PerColumnIteratorConfig.decodeColumns(column, ttl);
+        Pair<Text,Text> colPair = ColumnSet.decodeColumns(column);
         
-        if (ac.getColumnQualifier() == null) {
-          addObject(ac.getColumnFamily(), l);
+        if (colPair.getSecond() == null) {
+          addObject(colPair.getFirst(), l);
         } else {
-          addObject(ac.getColumnFamily(), ac.getColumnQualifier(), l);
+          addObject(colPair.getFirst(), colPair.getSecond(), l);
         }
       }
     }
@@ -96,7 +99,7 @@ public class ColumnAgeOffFilter extends 
     IteratorOptions io = super.describeOptions();
     io.setName("colageoff");
     io.setDescription("ColumnAgeOffFilter ages off columns at different rates given a time to live in milliseconds for each column");
-    io.addUnnamedOption("<columnName> <Long>");
+    io.addUnnamedOption("<col fam>[:<col qual>] <Long> (escape non-alphanum chars using %<hex>)");
     return io;
   }
   
@@ -106,4 +109,30 @@ public class ColumnAgeOffFilter extends 
     this.ttls = new TTLSet(options);
     return true;
   }
+  
+  /**
+   * A convenience method for adding or changing an age off threshold for a column.
+   * 
+   * @param is
+   *          IteratorSetting object to configure.
+   * @param column
+   *          column to encode as a parameter name.
+   * @param ttl
+   *          age off threshold in milliseconds.
+   */
+  public static void addTTL(IteratorSetting is, IteratorSetting.Column column, Long ttl) {
+    is.addOption(ColumnSet.encodeColumns(column.getFirst(), column.getSecond()), Long.toString(ttl));
+  }
+
+  /**
+   * A convenience method for removing an age off threshold for a column.
+   * 
+   * @param is
+   *          IteratorSetting object to configure.
+   * @param column
+   *          column to encode as a parameter name.
+   */
+  public static void removeTTL(IteratorSetting is, IteratorSetting.Column column) {
+    is.removeOption(ColumnSet.encodeColumns(column.getFirst(), column.getSecond()));
+  }
 }

Modified: incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/user/IntersectingIterator.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/user/IntersectingIterator.java?rev=1207529&r1=1207528&r2=1207529&view=diff
==============================================================================
--- incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/user/IntersectingIterator.java (original)
+++ incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/user/IntersectingIterator.java Mon Nov 28 19:30:20 2011
@@ -115,7 +115,7 @@ public class IntersectingIterator implem
     return new IntersectingIterator(this, env);
   }
   
-  public IntersectingIterator(IntersectingIterator other, IteratorEnvironment env) {
+  private IntersectingIterator(IntersectingIterator other, IteratorEnvironment env) {
     if (other.sources != null) {
       sourcesCount = other.sourcesCount;
       sources = new TermSource[sourcesCount];

Modified: incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/user/LargeRowFilter.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/user/LargeRowFilter.java?rev=1207529&r1=1207528&r2=1207529&view=diff
==============================================================================
--- incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/user/LargeRowFilter.java (original)
+++ incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/user/LargeRowFilter.java Mon Nov 28 19:30:20 2011
@@ -23,6 +23,7 @@ import java.util.Collections;
 import java.util.HashSet;
 import java.util.Map;
 
+import org.apache.accumulo.core.client.IteratorSetting;
 import org.apache.accumulo.core.data.ArrayByteSequence;
 import org.apache.accumulo.core.data.ByteSequence;
 import org.apache.accumulo.core.data.Key;
@@ -48,7 +49,7 @@ public class LargeRowFilter implements S
   private static final ByteSequence EMPTY = new ArrayByteSequence(new byte[] {});
   
   /* key into hash map, value refers to the row supression limit (maxColumns) */
-  public static final String MAX_COLUMNS = "max_columns";
+  private static final String MAX_COLUMNS = "max_columns";
   
   private SortedKeyValueIterator<Key,Value> source;
   
@@ -275,4 +276,15 @@ public class LargeRowFilter implements S
     return true;
   }
   
+  /**
+   * A convenience method for setting the maximum number of columns to keep.
+   * 
+   * @param is
+   *          IteratorSetting object to configure.
+   * @param maxColumns
+   *          number of columns to keep.
+   */
+  public static void setMaxColumns(IteratorSetting is, int maxColumns) {
+    is.addOption(MAX_COLUMNS, Integer.toString(maxColumns));
+  }
 }

Modified: incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/user/NoVisFilter.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/user/NoVisFilter.java?rev=1207529&r1=1207528&r2=1207529&view=diff
==============================================================================
--- incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/user/NoVisFilter.java (original)
+++ incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/user/NoVisFilter.java Mon Nov 28 19:30:20 2011
@@ -19,7 +19,6 @@ package org.apache.accumulo.core.iterato
 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.SortedKeyValueIterator;
 import org.apache.accumulo.core.security.ColumnVisibility;
 
 /**
@@ -27,12 +26,6 @@ import org.apache.accumulo.core.security
  */
 public class NoVisFilter extends Filter {
   
-  public NoVisFilter() {}
-  
-  public NoVisFilter(SortedKeyValueIterator<Key,Value> iterator) {
-    super(iterator);
-  }
-  
   @Override
   public boolean accept(Key k, Value v) {
     ColumnVisibility vis = new ColumnVisibility(k.getColumnVisibility());

Modified: incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/user/RegExFilter.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/user/RegExFilter.java?rev=1207529&r1=1207528&r2=1207529&view=diff
==============================================================================
--- incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/user/RegExFilter.java (original)
+++ incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/user/RegExFilter.java Mon Nov 28 19:30:20 2011
@@ -37,7 +37,8 @@ public class RegExFilter extends Filter 
   
   @Override
   public SortedKeyValueIterator<Key,Value> deepCopy(IteratorEnvironment env) {
-    RegExFilter result = new RegExFilter(getSource().deepCopy(env));
+    RegExFilter result = new RegExFilter();
+    result.setSource(getSource().deepCopy(env));
     result.rowMatcher = rowMatcher.pattern().matcher("");
     result.colfMatcher = colfMatcher.pattern().matcher("");
     result.colqMatcher = colqMatcher.pattern().matcher("");
@@ -46,12 +47,6 @@ public class RegExFilter extends Filter 
     return result;
   }
   
-  public RegExFilter() {}
-  
-  public RegExFilter(SortedKeyValueIterator<Key,Value> iterator) {
-    super(iterator);
-  }
-  
   public static final String ROW_REGEX = "rowRegex";
   public static final String COLF_REGEX = "colfRegex";
   public static final String COLQ_REGEX = "colqRegex";

Modified: incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/user/SummingArrayCombiner.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/user/SummingArrayCombiner.java?rev=1207529&r1=1207528&r2=1207529&view=diff
==============================================================================
--- incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/user/SummingArrayCombiner.java (original)
+++ incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/user/SummingArrayCombiner.java Mon Nov 28 19:30:20 2011
@@ -22,23 +22,32 @@ import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
+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.IteratorEnvironment;
 import org.apache.accumulo.core.iterators.LongCombiner;
-import org.apache.accumulo.core.iterators.LongCombiner.Type;
 import org.apache.accumulo.core.iterators.SortedKeyValueIterator;
 import org.apache.accumulo.core.iterators.TypedValueCombiner;
+import org.apache.accumulo.start.classloader.AccumuloClassLoader;
 import org.apache.hadoop.io.WritableUtils;
 
 /**
  * A Combiner that interprets Values as arrays of Longs and returns an array of element-wise sums.
  */
 public class SummingArrayCombiner extends TypedValueCombiner<List<Long>> {
+  private static final String TYPE = "type";
+  private static final String CLASS_PREFIX = "class:";
+
+  public static enum Type {
+    VARNUM, LONG, STRING
+  }
+
   @Override
   public List<Long> typedReduce(Key key, Iterator<List<Long>> iter) {
     List<Long> sum = new ArrayList<Long>();
@@ -65,20 +74,44 @@ public class SummingArrayCombiner extend
   @Override
   public void init(SortedKeyValueIterator<Key,Value> source, Map<String,String> options, IteratorEnvironment env) throws IOException {
     super.init(source, options, env);
-    if (options.get(LongCombiner.TYPE) == null)
+    setEncoder(options);
+  }
+  
+  private void setEncoder(Map<String,String> options) {
+    String type = options.get(TYPE);
+    if (type == null)
       throw new IllegalArgumentException("no type specified");
-    switch (Type.valueOf(options.get(LongCombiner.TYPE))) {
-      case VARNUM:
-        encoder = new VarNumArrayEncoder();
-        return;
-      case LONG:
-        encoder = new LongArrayEncoder();
-        return;
-      case STRING:
-        encoder = new StringArrayEncoder();
-        return;
-      default:
-        throw new IllegalArgumentException();
+    if (type.startsWith(CLASS_PREFIX)) {
+      try {
+        @SuppressWarnings("unchecked")
+        Class<? extends Encoder<List<Long>>> clazz = (Class<? extends Encoder<List<Long>>>) AccumuloClassLoader.loadClass(
+            type.substring(CLASS_PREFIX.length()), Encoder.class);
+        encoder = clazz.newInstance();
+        List<Long> testList = encoder.decode(encoder.encode(Arrays.asList(0l, 1l)));
+        if (testList.size() != 3 || testList.get(0) != 0l || testList.get(1) != 1l) {
+          throw new IllegalArgumentException("something wrong with " + type + " -- doesn't encode and decode a List<Long> properly");
+        }
+      } catch (ClassNotFoundException e) {
+        throw new IllegalArgumentException(e);
+      } catch (InstantiationException e) {
+        throw new IllegalArgumentException(e);
+      } catch (IllegalAccessException e) {
+        throw new IllegalArgumentException(e);
+      }
+    } else {
+      switch (Type.valueOf(options.get(TYPE))) {
+        case VARNUM:
+          encoder = new VarNumArrayEncoder();
+          return;
+        case LONG:
+          encoder = new LongArrayEncoder();
+          return;
+        case STRING:
+          encoder = new StringArrayEncoder();
+          return;
+        default:
+          throw new IllegalArgumentException();
+      }
     }
   }
   
@@ -87,20 +120,14 @@ public class SummingArrayCombiner extend
     IteratorOptions io = super.describeOptions();
     io.setName("typedcombiner");
     io.setDescription("TypedValueCombiner can interpret Values as a variety of number encodings (VLong, Long, or String) before combining");
-    io.addNamedOption(LongCombiner.TYPE, "<VARNUM|LONG|STRING>");
+    io.addNamedOption(TYPE, "<VARNUM|LONG|STRING>");
     return io;
   }
   
   @Override
   public boolean validateOptions(Map<String,String> options) {
     super.validateOptions(options);
-    if (options.get(LongCombiner.TYPE) == null)
-      return false;
-    try {
-      Type.valueOf(options.get(LongCombiner.TYPE));
-    } catch (Exception e) {
-      return false;
-    }
+    setEncoder(options);
     return true;
   }
   
@@ -190,4 +217,40 @@ public class SummingArrayCombiner extend
       return la;
     }
   }
+  
+  /**
+   * A convenience method for setting the encoding type.
+   * 
+   * @param is
+   *          IteratorSetting object to configure.
+   * @param type
+   *          SummingArrayCombiner.Type specifying the encoding type.
+   */
+  public static void setEncodingType(IteratorSetting is, Type type) {
+    is.addOption(TYPE, type.toString());
+  }
+  
+  /**
+   * A convenience method for setting the encoding type.
+   * 
+   * @param is
+   *          IteratorSetting object to configure.
+   * @param encoderClass
+   *          Class<? extends Encoder<Long>> specifying the encoding type.
+   */
+  public static void setEncodingType(IteratorSetting is, Class<? extends Encoder<List<Long>>> encoderClass) {
+    is.addOption(TYPE, CLASS_PREFIX + encoderClass.getName());
+  }
+  
+  /**
+   * A convenience method for setting the encoding type.
+   * 
+   * @param is
+   *          IteratorSetting object to configure.
+   * @param encoderClassName
+   *          name of a class specifying the encoding type.
+   */
+  public static void setEncodingType(IteratorSetting is, String encoderClassName) {
+    is.addOption(TYPE, CLASS_PREFIX + encoderClassName);
+  }
 }

Modified: incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/user/TimestampFilter.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/user/TimestampFilter.java?rev=1207529&r1=1207528&r2=1207529&view=diff
==============================================================================
--- incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/user/TimestampFilter.java (original)
+++ incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/user/TimestampFilter.java Mon Nov 28 19:30:20 2011
@@ -20,6 +20,7 @@ import java.io.IOException;
 import java.text.SimpleDateFormat;
 import java.util.Map;
 
+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;
@@ -40,25 +41,30 @@ public class TimestampFilter extends Fil
   private long end;
   private boolean startInclusive;
   private boolean endInclusive;
+  private boolean hasStart;
+  private boolean hasEnd;
   
   public TimestampFilter() {}
   
-  public TimestampFilter(SortedKeyValueIterator<Key,Value> iterator, long start, boolean startInclusive, long end, boolean endInclusive) {
-    super(iterator);
+  private TimestampFilter(SortedKeyValueIterator<Key,Value> iterator, boolean hasStart, long start, boolean startInclusive, boolean hasEnd, long end,
+      boolean endInclusive) {
+    setSource(iterator);
     this.start = start;
     this.startInclusive = startInclusive;
+    this.hasStart = true;
     this.end = end;
     this.endInclusive = endInclusive;
+    this.hasEnd = true;
   }
   
   @Override
   public boolean accept(Key k, Value v) {
     long ts = k.getTimestamp();
-    if (ts < start || ts > end)
+    if ((hasStart && (ts < start)) || (hasEnd && (ts > end)))
       return false;
-    if (!startInclusive && ts == start)
+    if (hasStart && !startInclusive && ts == start)
       return false;
-    if (!endInclusive && ts == end)
+    if (hasEnd && !endInclusive && ts == end)
       return false;
     return true;
   }
@@ -68,13 +74,25 @@ public class TimestampFilter extends Fil
     super.init(source, options, env);
     
     if (options == null)
-      throw new IllegalArgumentException("ttl must be set for AgeOffFilter");
+      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 {
-      start = dateParser.parse(options.get(START)).getTime();
-      end = dateParser.parse(options.get(END)).getTime();
+      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);
     }
@@ -86,7 +104,7 @@ public class TimestampFilter extends Fil
   
   @Override
   public SortedKeyValueIterator<Key,Value> deepCopy(IteratorEnvironment env) {
-    return new TimestampFilter(getSource(), start, startInclusive, end, endInclusive);
+    return new TimestampFilter(getSource(), hasStart, start, startInclusive, hasEnd, end, endInclusive);
   }
   
   @Override
@@ -105,8 +123,10 @@ public class TimestampFilter extends Fil
   public boolean validateOptions(Map<String,String> options) {
     super.validateOptions(options);
     try {
-      dateParser.parse(options.get(START));
-      dateParser.parse(options.get(END));
+      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)
@@ -116,4 +136,67 @@ public class TimestampFilter extends Fil
     }
     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));
+  }
 }

Modified: incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/client/mock/MockConnectorTest.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/client/mock/MockConnectorTest.java?rev=1207529&r1=1207528&r2=1207529&view=diff
==============================================================================
--- incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/client/mock/MockConnectorTest.java (original)
+++ incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/client/mock/MockConnectorTest.java Mon Nov 28 19:30:20 2011
@@ -38,7 +38,6 @@ import org.apache.accumulo.core.data.Mut
 import org.apache.accumulo.core.data.Range;
 import org.apache.accumulo.core.data.Value;
 import org.apache.accumulo.core.iterators.Combiner;
-import org.apache.accumulo.core.iterators.SortedKeyValueIterator;
 import org.apache.accumulo.core.iterators.user.SummingCombiner;
 import org.apache.accumulo.core.security.Authorizations;
 import org.apache.hadoop.io.Text;
@@ -93,10 +92,9 @@ public class MockConnectorTest {
     Connector c = mockInstance.getConnector("root", new byte[] {});
     String table = "perDayCounts";
     c.tableOperations().create(table);
-    Class<? extends SortedKeyValueIterator<Key,Value>> clazz = SummingCombiner.class;
-    IteratorSetting is = new IteratorSetting(10, "String Summation", clazz);
-    Combiner.setColumns(is, Collections.singletonList(new Combiner.Column("day")));
-    is.addOption(SummingCombiner.TYPE, SummingCombiner.Type.STRING.name());
+    IteratorSetting is = new IteratorSetting(10, "String Summation", SummingCombiner.class);
+    Combiner.setColumns(is, Collections.singletonList(new IteratorSetting.Column("day")));
+    SummingCombiner.setEncodingType(is, SummingCombiner.Type.STRING);
     c.tableOperations().attachIterator(table, is);
     String keys[][] = { {"foo", "day", "20080101"}, {"foo", "day", "20080101"}, {"foo", "day", "20080103"}, {"bar", "day", "20080101"},
         {"bar", "day", "20080101"},};

Modified: incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/FamilyIntersectingIteratorTest.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/FamilyIntersectingIteratorTest.java?rev=1207529&r1=1207528&r2=1207529&view=diff
==============================================================================
--- incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/FamilyIntersectingIteratorTest.java (original)
+++ incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/FamilyIntersectingIteratorTest.java Mon Nov 28 19:30:20 2011
@@ -22,9 +22,9 @@ import java.util.Collection;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Map;
+import java.util.Map.Entry;
 import java.util.Random;
 import java.util.TreeMap;
-import java.util.Map.Entry;
 
 import junit.framework.TestCase;
 
@@ -34,9 +34,6 @@ import org.apache.accumulo.core.data.Ran
 import org.apache.accumulo.core.data.Value;
 import org.apache.accumulo.core.file.rfile.RFileTest;
 import org.apache.accumulo.core.file.rfile.RFileTest.TestRFile;
-import org.apache.accumulo.core.iterators.FamilyIntersectingIterator;
-import org.apache.accumulo.core.iterators.IteratorEnvironment;
-import org.apache.accumulo.core.iterators.SortedKeyValueIterator;
 import org.apache.accumulo.core.iterators.system.MultiIterator;
 import org.apache.accumulo.core.iterators.user.IntersectingIterator;
 import org.apache.hadoop.io.Text;
@@ -158,8 +155,8 @@ public class FamilyIntersectingIteratorT
     Logger.getRootLogger().setLevel(Level.ERROR);
   }
   
-  private static final int NUM_ROWS = 10;
-  private static final int NUM_DOCIDS = 1000;
+  private static final int NUM_ROWS = 5;
+  private static final int NUM_DOCIDS = 200;
   
   public void test1() throws IOException {
     columnFamilies = new Text[2];

Modified: incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/RowDeletingIteratorTest.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/RowDeletingIteratorTest.java?rev=1207529&r1=1207528&r2=1207529&view=diff
==============================================================================
--- incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/RowDeletingIteratorTest.java (original)
+++ incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/RowDeletingIteratorTest.java Mon Nov 28 19:30:20 2011
@@ -21,30 +21,26 @@ import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.TreeMap;
 
+import junit.framework.TestCase;
+
 import org.apache.accumulo.core.conf.AccumuloConfiguration;
 import org.apache.accumulo.core.data.ArrayByteSequence;
 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.RowDeletingIterator;
-import org.apache.accumulo.core.iterators.SortedKeyValueIterator;
-import org.apache.accumulo.core.iterators.SortedMapIterator;
 import org.apache.accumulo.core.iterators.IteratorUtil.IteratorScope;
 import org.apache.accumulo.core.iterators.system.ColumnFamilySkippingIterator;
 import org.apache.hadoop.io.Text;
 
-import junit.framework.TestCase;
-
 public class RowDeletingIteratorTest extends TestCase {
   
-  static class TestIE implements IteratorEnvironment {
+  public static class TestIE implements IteratorEnvironment {
     
     private IteratorScope scope;
     private boolean fmc;
     
-    TestIE(IteratorScope scope, boolean fmc) {
+    public TestIE(IteratorScope scope, boolean fmc) {
       this.scope = scope;
       this.fmc = fmc;
     }

Copied: incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/system/ColumnFamilySkippingIteratorTest.java (from r1204997, incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/ColumnFamilySkippingIteratorTest.java)
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/system/ColumnFamilySkippingIteratorTest.java?p2=incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/system/ColumnFamilySkippingIteratorTest.java&p1=incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/ColumnFamilySkippingIteratorTest.java&r1=1204997&r2=1207529&rev=1207529&view=diff
==============================================================================
--- incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/ColumnFamilySkippingIteratorTest.java (original)
+++ incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/system/ColumnFamilySkippingIteratorTest.java Mon Nov 28 19:30:20 2011
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.accumulo.core.iterators;
+package org.apache.accumulo.core.iterators.system;
 
 import java.util.Collection;
 import java.util.HashSet;

Copied: incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/system/ColumnFilterTest.java (from r1204997, incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/ColumnFilterTest.java)
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/system/ColumnFilterTest.java?p2=incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/system/ColumnFilterTest.java&p1=incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/ColumnFilterTest.java&r1=1204997&r2=1207529&rev=1207529&view=diff
==============================================================================
--- incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/ColumnFilterTest.java (original)
+++ incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/system/ColumnFilterTest.java Mon Nov 28 19:30:20 2011
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.accumulo.core.iterators;
+package org.apache.accumulo.core.iterators.system;
 
 import java.util.HashSet;
 

Copied: incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/user/CombinerTest.java (from r1204997, incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/CombinerTest.java)
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/user/CombinerTest.java?p2=incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/user/CombinerTest.java&p1=incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/CombinerTest.java&r1=1204997&r2=1207529&rev=1207529&view=diff
==============================================================================
--- incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/CombinerTest.java (original)
+++ incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/user/CombinerTest.java Mon Nov 28 19:30:20 2011
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.accumulo.core.iterators;
+package org.apache.accumulo.core.iterators.user;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
@@ -23,22 +23,26 @@ import static org.junit.Assert.assertTru
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.HashMap;
+import java.util.Collections;
 import java.util.List;
-import java.util.Map;
 import java.util.TreeMap;
 
+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.Range;
 import org.apache.accumulo.core.data.Value;
+import org.apache.accumulo.core.iterators.Combiner;
 import org.apache.accumulo.core.iterators.Combiner.ValueIterator;
+import org.apache.accumulo.core.iterators.DefaultIteratorEnvironment;
+import org.apache.accumulo.core.iterators.LongCombiner;
+import org.apache.accumulo.core.iterators.LongCombiner.LongEncoder;
+import org.apache.accumulo.core.iterators.LongCombiner.StringEncoder;
+import org.apache.accumulo.core.iterators.LongCombiner.VarNumEncoder;
+import org.apache.accumulo.core.iterators.SortedKeyValueIterator;
+import org.apache.accumulo.core.iterators.SortedMapIterator;
 import org.apache.accumulo.core.iterators.TypedValueCombiner.Encoder;
 import org.apache.accumulo.core.iterators.system.MultiIterator;
-import org.apache.accumulo.core.iterators.user.MaxCombiner;
-import org.apache.accumulo.core.iterators.user.MinCombiner;
-import org.apache.accumulo.core.iterators.user.SummingArrayCombiner;
-import org.apache.accumulo.core.iterators.user.SummingCombiner;
 import org.apache.hadoop.io.Text;
 import org.junit.Test;
 
@@ -91,12 +95,11 @@ public class CombinerTest {
     
     Combiner ai = new SummingCombiner();
     
-    Map<String,String> opts = new HashMap<String,String>();
+    IteratorSetting is = new IteratorSetting(1, SummingCombiner.class);
+    LongCombiner.setEncodingType(is, SummingCombiner.Type.VARNUM);
+    Combiner.setColumns(is, Collections.singletonList(new IteratorSetting.Column("2")));
     
-    opts.put(SummingCombiner.TYPE, SummingCombiner.Type.VARNUM.name());
-    opts.put(Combiner.COLUMNS_OPTION, "2");
-    
-    ai.init(new SortedMapIterator(tm1), opts, null);
+    ai.init(new SortedMapIterator(tm1), is.getProperties(), null);
     ai.seek(new Range(), EMPTY_COL_FAMS, false);
     
     assertTrue(ai.hasTop());
@@ -157,12 +160,11 @@ public class CombinerTest {
     
     Combiner ai = new SummingCombiner();
     
-    Map<String,String> opts = new HashMap<String,String>();
-    
-    opts.put(Combiner.COLUMNS_OPTION, "cf001");
-    opts.put(SummingCombiner.TYPE, SummingCombiner.Type.VARNUM.name());
+    IteratorSetting is = new IteratorSetting(1, SummingCombiner.class);
+    LongCombiner.setEncodingType(is, VarNumEncoder.class);
+    Combiner.setColumns(is, Collections.singletonList(new IteratorSetting.Column("cf001")));
     
-    ai.init(new SortedMapIterator(tm1), opts, null);
+    ai.init(new SortedMapIterator(tm1), is.getProperties(), null);
     ai.seek(new Range(), EMPTY_COL_FAMS, false);
     
     assertTrue(ai.hasTop());
@@ -224,12 +226,11 @@ public class CombinerTest {
     
     Combiner ai = new SummingCombiner();
     
-    Map<String,String> opts = new HashMap<String,String>();
-    
-    opts.put(Combiner.COLUMNS_OPTION, "cf001");
-    opts.put(SummingCombiner.TYPE, SummingCombiner.Type.LONG.name());
+    IteratorSetting is = new IteratorSetting(1, SummingCombiner.class);
+    LongCombiner.setEncodingType(is, LongEncoder.class.getName());
+    Combiner.setColumns(is, Collections.singletonList(new IteratorSetting.Column("cf001")));
     
-    ai.init(new SortedMapIterator(tm1), opts, null);
+    ai.init(new SortedMapIterator(tm1), is.getProperties(), null);
     ai.seek(new Range(), EMPTY_COL_FAMS, false);
     
     assertTrue(ai.hasTop());
@@ -294,12 +295,11 @@ public class CombinerTest {
     
     Combiner ai = new SummingCombiner();
     
-    Map<String,String> opts = new HashMap<String,String>();
+    IteratorSetting is = new IteratorSetting(1, SummingCombiner.class);
+    LongCombiner.setEncodingType(is, SummingCombiner.Type.STRING);
+    Combiner.setColumns(is, Collections.singletonList(new IteratorSetting.Column("cf001")));
     
-    opts.put(Combiner.COLUMNS_OPTION, "cf001");
-    opts.put(SummingCombiner.TYPE, SummingCombiner.Type.STRING.name());
-    
-    ai.init(new SortedMapIterator(tm1), opts, null);
+    ai.init(new SortedMapIterator(tm1), is.getProperties(), null);
     ai.seek(new Range(), EMPTY_COL_FAMS, false);
     
     assertTrue(ai.hasTop());
@@ -366,17 +366,18 @@ public class CombinerTest {
     nkv(tm3, 1, 1, 1, 1, false, 4l, encoder);
     
     Combiner ai = new SummingCombiner();
-    Map<String,String> opts = new HashMap<String,String>();
-    opts.put(Combiner.COLUMNS_OPTION, "cf001");
-    opts.put(SummingCombiner.TYPE, SummingCombiner.Type.STRING.name());
     
+    IteratorSetting is = new IteratorSetting(1, SummingCombiner.class);
+    LongCombiner.setEncodingType(is, StringEncoder.class);
+    Combiner.setColumns(is, Collections.singletonList(new IteratorSetting.Column("cf001")));
+
     List<SortedKeyValueIterator<Key,Value>> sources = new ArrayList<SortedKeyValueIterator<Key,Value>>(3);
     sources.add(new SortedMapIterator(tm1));
     sources.add(new SortedMapIterator(tm2));
     sources.add(new SortedMapIterator(tm3));
     
     MultiIterator mi = new MultiIterator(sources, true);
-    ai.init(mi, opts, null);
+    ai.init(mi, is.getProperties(), null);
     ai.seek(new Range(), EMPTY_COL_FAMS, false);
     
     assertTrue(ai.hasTop());
@@ -396,12 +397,11 @@ public class CombinerTest {
     
     Combiner ai = new SummingCombiner();
     
-    Map<String,String> opts = new HashMap<String,String>();
+    IteratorSetting is = new IteratorSetting(1, SummingCombiner.class);
+    LongCombiner.setEncodingType(is, VarNumEncoder.class.getName());
+    Combiner.setColumns(is, Collections.singletonList(new IteratorSetting.Column("cf001")));
     
-    opts.put(Combiner.COLUMNS_OPTION, "cf001");
-    opts.put(SummingCombiner.TYPE, SummingCombiner.Type.VARNUM.name());
-    
-    ai.init(new SortedMapIterator(tm1), opts, new DefaultIteratorEnvironment());
+    ai.init(new SortedMapIterator(tm1), is.getProperties(), new DefaultIteratorEnvironment());
     
     // try seeking to the beginning of a key that aggregates
     
@@ -425,12 +425,11 @@ public class CombinerTest {
     
     Combiner ai = new SummingCombiner();
     
-    Map<String,String> opts = new HashMap<String,String>();
-    
-    opts.put(Combiner.COLUMNS_OPTION, "cf001");
-    opts.put(SummingCombiner.TYPE, SummingCombiner.Type.LONG.name());
+    IteratorSetting is = new IteratorSetting(1, SummingCombiner.class);
+    LongCombiner.setEncodingType(is, SummingCombiner.Type.LONG);
+    Combiner.setColumns(is, Collections.singletonList(new IteratorSetting.Column("cf001")));
     
-    ai.init(new SortedMapIterator(tm1), opts, new DefaultIteratorEnvironment());
+    ai.init(new SortedMapIterator(tm1), is.getProperties(), new DefaultIteratorEnvironment());
     
     ai.seek(nr(1, 1, 1, 4, true), EMPTY_COL_FAMS, false);
     
@@ -449,7 +448,7 @@ public class CombinerTest {
     tm1 = new TreeMap<Key,Value>();
     nkv(tm1, 1, 1, 1, 2, true, 0l, encoder);
     ai = new SummingCombiner();
-    ai.init(new SortedMapIterator(tm1), opts, new DefaultIteratorEnvironment());
+    ai.init(new SortedMapIterator(tm1), is.getProperties(), new DefaultIteratorEnvironment());
     
     ai.seek(nr(1, 1, 1, 4, true), EMPTY_COL_FAMS, false);
     
@@ -487,12 +486,11 @@ public class CombinerTest {
     
     Combiner ai = new MaxCombiner();
     
-    Map<String,String> opts = new HashMap<String,String>();
+    IteratorSetting is = new IteratorSetting(1, SummingCombiner.class);
+    LongCombiner.setEncodingType(is, SummingCombiner.Type.VARNUM);
+    Combiner.setColumns(is, Collections.singletonList(new IteratorSetting.Column("cf001")));
     
-    opts.put(Combiner.COLUMNS_OPTION, "cf001");
-    opts.put(SummingCombiner.TYPE, SummingCombiner.Type.VARNUM.name());
-    
-    ai.init(new SortedMapIterator(tm1), opts, null);
+    ai.init(new SortedMapIterator(tm1), is.getProperties(), null);
     ai.seek(new Range(), EMPTY_COL_FAMS, false);
     
     assertTrue(ai.hasTop());
@@ -505,7 +503,7 @@ public class CombinerTest {
     
     ai = new MinCombiner();
     
-    ai.init(new SortedMapIterator(tm1), opts, null);
+    ai.init(new SortedMapIterator(tm1), is.getProperties(), null);
     ai.seek(new Range(), EMPTY_COL_FAMS, false);
     
     assertTrue(ai.hasTop());
@@ -541,12 +539,11 @@ public class CombinerTest {
     
     Combiner ai = new SummingArrayCombiner();
     
-    Map<String,String> opts = new HashMap<String,String>();
-    
-    opts.put(Combiner.COLUMNS_OPTION, "cf001");
-    opts.put(SummingCombiner.TYPE, type);
+    IteratorSetting is = new IteratorSetting(1, SummingCombiner.class);
+    LongCombiner.setEncodingType(is, SummingCombiner.Type.valueOf(type));
+    Combiner.setColumns(is, Collections.singletonList(new IteratorSetting.Column("cf001")));
     
-    ai.init(new SortedMapIterator(tm1), opts, null);
+    ai.init(new SortedMapIterator(tm1), is.getProperties(), null);
     ai.seek(new Range(), EMPTY_COL_FAMS, false);
     
     assertTrue(ai.hasTop());

Copied: incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/user/FilterTest.java (from r1204997, incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/FilterTest.java)
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/user/FilterTest.java?p2=incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/user/FilterTest.java&p1=incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/FilterTest.java&r1=1204997&r2=1207529&rev=1207529&view=diff
==============================================================================
--- incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/FilterTest.java (original)
+++ incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/user/FilterTest.java Mon Nov 28 19:30:20 2011
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.accumulo.core.iterators;
+package org.apache.accumulo.core.iterators.user;
 
 import java.io.IOException;
 import java.text.ParseException;
@@ -23,24 +23,23 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.HashSet;
+import java.util.Map;
 import java.util.TreeMap;
 
 import junit.framework.TestCase;
 
+import org.apache.accumulo.core.client.IteratorSetting;
 import org.apache.accumulo.core.data.ByteSequence;
 import org.apache.accumulo.core.data.Column;
 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.DefaultIteratorEnvironment;
 import org.apache.accumulo.core.iterators.Filter;
 import org.apache.accumulo.core.iterators.SortedKeyValueIterator;
 import org.apache.accumulo.core.iterators.SortedMapIterator;
 import org.apache.accumulo.core.iterators.system.ColumnQualifierFilter;
 import org.apache.accumulo.core.iterators.system.VisibilityFilter;
-import org.apache.accumulo.core.iterators.user.AgeOffFilter;
-import org.apache.accumulo.core.iterators.user.ColumnAgeOffFilter;
-import org.apache.accumulo.core.iterators.user.NoVisFilter;
-import org.apache.accumulo.core.iterators.user.TimestampFilter;
 import org.apache.accumulo.core.security.Authorizations;
 import org.apache.accumulo.core.security.ColumnVisibility;
 import org.apache.hadoop.io.Text;
@@ -48,12 +47,9 @@ import org.apache.hadoop.io.Text;
 public class FilterTest extends TestCase {
   
   private static final Collection<ByteSequence> EMPTY_COL_FAMS = new ArrayList<ByteSequence>();
+  private static final Map<String,String> EMPTY_OPTS = new HashMap<String,String>();
   
   public class SimpleFilter extends Filter {
-    public SimpleFilter(SortedKeyValueIterator<Key,Value> iterator) {
-      super(iterator);
-    }
-    
     public boolean accept(Key k, Value v) {
       // System.out.println(k.getRow());
       if (k.getRow().toString().endsWith("0"))
@@ -63,10 +59,6 @@ public class FilterTest extends TestCase
   }
   
   public class SimpleFilter2 extends Filter {
-    public SimpleFilter2(SortedKeyValueIterator<Key,Value> iterator) {
-      super(iterator);
-    }
-    
     public boolean accept(Key k, Value v) {
       if (k.getColumnFamily().toString().equals("a"))
         return false;
@@ -96,31 +88,66 @@ public class FilterTest extends TestCase
     }
     assertTrue(tm.size() == 1000);
     
-    Filter filter1 = new SimpleFilter(new SortedMapIterator(tm));
+    Filter filter1 = new SimpleFilter();
+    filter1.init(new SortedMapIterator(tm), EMPTY_OPTS, null);
     filter1.seek(new Range(), EMPTY_COL_FAMS, false);
     int size = size(filter1);
     assertTrue("size = " + size, size == 100);
     
-    try {
-      Filter fi = new SimpleFilter(new SortedMapIterator(tm));
-      Key k = new Key(new Text("500"));
-      fi.seek(new Range(k, null), EMPTY_COL_FAMS, false);
-      TreeMap<Key,Value> tmOut = new TreeMap<Key,Value>();
-      while (fi.hasTop()) {
-        tmOut.put(fi.getTopKey(), fi.getTopValue());
-        fi.next();
-      }
-      assertTrue(tmOut.size() == 50);
-    } catch (IOException e) {
-      assertFalse(true);
+    Filter fi = new SimpleFilter();
+    fi.init(new SortedMapIterator(tm), EMPTY_OPTS, null);
+    Key k = new Key(new Text("500"));
+    fi.seek(new Range(k, null), EMPTY_COL_FAMS, false);
+    size = size(fi);
+    assertTrue("size = " + size, size == 50);
+    
+    filter1 = new SimpleFilter();
+    filter1.init(new SortedMapIterator(tm), EMPTY_OPTS, null);
+    Filter filter2 = new SimpleFilter2();
+    filter2.init(filter1, EMPTY_OPTS, null);
+    filter2.seek(new Range(), EMPTY_COL_FAMS, false);
+    size = size(filter2);
+    assertTrue("size = " + size, size == 0);
+  }
+  
+  public void test1neg() throws IOException {
+    Text colf = new Text("a");
+    Text colq = new Text("b");
+    Value dv = new Value();
+    TreeMap<Key,Value> tm = new TreeMap<Key,Value>();
+    
+    for (int i = 0; i < 1000; i++) {
+      Key k = new Key(new Text(String.format("%03d", i)), colf, colq);
+      tm.put(k, dv);
     }
+    assertTrue(tm.size() == 1000);
     
-    Filter filter2 = new SimpleFilter2(new SimpleFilter(new SortedMapIterator(tm)));
+    Filter filter1 = new SimpleFilter();
+    
+    IteratorSetting is = new IteratorSetting(1, SimpleFilter.class);
+    Filter.setNegate(is, true);
+    
+    filter1.init(new SortedMapIterator(tm), is.getProperties(), null);
+    filter1.seek(new Range(), EMPTY_COL_FAMS, false);
+    int size = size(filter1);
+    assertTrue("size = " + size, size == 900);
+    
+    Filter fi = new SimpleFilter();
+    fi.init(new SortedMapIterator(tm), is.getProperties(), null);
+    Key k = new Key(new Text("500"));
+    fi.seek(new Range(k, null), EMPTY_COL_FAMS, false);
+    size = size(fi);
+    assertTrue("size = " + size, size == 450);
+    
+    filter1 = new SimpleFilter();
+    filter1.init(new SortedMapIterator(tm), EMPTY_OPTS, null);
+    Filter filter2 = new SimpleFilter2();
+    filter2.init(filter1, is.getProperties(), null);
     filter2.seek(new Range(), EMPTY_COL_FAMS, false);
     size = size(filter2);
-    assertTrue("tmOut wasn't empty " + size, size == 0);
+    assertTrue("size = " + size, size == 100);
   }
-  
+
   public void test2() throws IOException {
     Text colf = new Text("a");
     Text colq = new Text("b");
@@ -134,7 +161,11 @@ public class FilterTest extends TestCase
     }
     assertTrue(tm.size() == 1000);
     
-    AgeOffFilter a = new AgeOffFilter(new SortedMapIterator(tm), 101, 1001);
+    AgeOffFilter a = new AgeOffFilter();
+    IteratorSetting is = new IteratorSetting(1, AgeOffFilter.class);
+    AgeOffFilter.setTTL(is, 101l);
+    AgeOffFilter.setCurrentTime(is, 1001l);
+    a.init(new SortedMapIterator(tm), is.getProperties(), null);
     a.seek(new Range(), EMPTY_COL_FAMS, false);
     assertEquals(size(a), 100);
   }
@@ -144,8 +175,8 @@ public class FilterTest extends TestCase
     Text colq = new Text("b");
     Value dv = new Value();
     TreeMap<Key,Value> tm = new TreeMap<Key,Value>();
-    HashMap<String,String> options = new HashMap<String,String>();
-    options.put("a", "901");
+    IteratorSetting is = new IteratorSetting(1, ColumnAgeOffFilter.class);
+    ColumnAgeOffFilter.addTTL(is, new IteratorSetting.Column("a"), 901l);
     long ts = System.currentTimeMillis();
     
     for (long i = 0; i < 1000; i++) {
@@ -154,17 +185,23 @@ public class FilterTest extends TestCase
     }
     assertTrue(tm.size() == 1000);
     
-    ColumnAgeOffFilter a = new ColumnAgeOffFilter(new SortedMapIterator(tm), null, 0l);
-    a.init(new SortedMapIterator(tm), options, new DefaultIteratorEnvironment());
+    ColumnAgeOffFilter a = new ColumnAgeOffFilter();
+    a.init(new SortedMapIterator(tm), is.getProperties(), new DefaultIteratorEnvironment());
     a.overrideCurrentTime(ts);
     a.seek(new Range(), EMPTY_COL_FAMS, false);
     assertEquals(size(a), 902);
     
-    options.put("a:b", "101");
-    a.init(new SortedMapIterator(tm), options, new DefaultIteratorEnvironment());
+    ColumnAgeOffFilter.addTTL(is, new IteratorSetting.Column("a", "b"), 101l);
+    a.init(new SortedMapIterator(tm), is.getProperties(), new DefaultIteratorEnvironment());
     a.overrideCurrentTime(ts);
     a.seek(new Range(), EMPTY_COL_FAMS, false);
     assertEquals(size(a), 102);
+    
+    ColumnAgeOffFilter.removeTTL(is, new IteratorSetting.Column("a", "b"));
+    a.init(new SortedMapIterator(tm), is.getProperties(), new DefaultIteratorEnvironment());
+    a.overrideCurrentTime(ts);
+    a.seek(new Range(), EMPTY_COL_FAMS, false);
+    assertEquals(size(a), 902);
   }
   
   public void test3() throws IOException {
@@ -275,7 +312,6 @@ public class FilterTest extends TestCase
     
     size = size(ncqf(tm, new Column("a".getBytes(), "x".getBytes(), null), new Column("b".getBytes(), null, null)));
     assertTrue(size == 3);
-    
   }
   
   public void testNoVisFilter() throws IOException {
@@ -287,7 +323,8 @@ public class FilterTest extends TestCase
     }
     assertTrue(tm.size() == 1000);
     
-    Filter filter = new NoVisFilter(new SortedMapIterator(tm));
+    Filter filter = new NoVisFilter();
+    filter.init(new SortedMapIterator(tm), EMPTY_OPTS, null);
     filter.seek(new Range(), EMPTY_COL_FAMS, false);
     int size = size(filter);
     assertTrue("size = " + size, size == 100);
@@ -306,19 +343,6 @@ public class FilterTest extends TestCase
     }
     assertTrue(tm.size() == 100);
     
-    TimestampFilter a = new TimestampFilter(new SortedMapIterator(tm), 11, true, 31, false);
-    a.seek(new Range(), EMPTY_COL_FAMS, false);
-    assertEquals(size(a), 20);
-    a = new TimestampFilter(new SortedMapIterator(tm), 11, true, 31, true);
-    a.seek(new Range(), EMPTY_COL_FAMS, false);
-    assertEquals(size(a), 21);
-    a = new TimestampFilter(new SortedMapIterator(tm), 11, false, 31, false);
-    a.seek(new Range(), EMPTY_COL_FAMS, false);
-    assertEquals(size(a), 19);
-    a = new TimestampFilter(new SortedMapIterator(tm), 11, false, 31, true);
-    a.seek(new Range(), EMPTY_COL_FAMS, false);
-    assertEquals(size(a), 20);
-    
     SimpleDateFormat dateParser = new SimpleDateFormat("yyyyMMddHHmmssz");
     long baseTime = dateParser.parse("19990101000000GMT").getTime();
     tm.clear();
@@ -328,27 +352,48 @@ public class FilterTest extends TestCase
       tm.put(k, dv);
     }
     assertTrue(tm.size() == 100);
-    a = new TimestampFilter();
-    TreeMap<String,String> opts = new TreeMap<String,String>();
-    opts.put(TimestampFilter.START, "19990101000011GMT");
-    opts.put(TimestampFilter.END, "19990101000031GMT");
-    a.init(new SortedMapIterator(tm), opts, null);
+    TimestampFilter a = new TimestampFilter();
+    IteratorSetting is = new IteratorSetting(1, TimestampFilter.class);
+    TimestampFilter.setRange(is, "19990101000011GMT", "19990101000031GMT");
+    a.init(new SortedMapIterator(tm), is.getProperties(), null);
     a.seek(new Range(), EMPTY_COL_FAMS, false);
     assertEquals(size(a), 21);
     
-    opts.put(TimestampFilter.END_INCL, "false");
-    a.init(new SortedMapIterator(tm), opts, null);
+    TimestampFilter.setEnd(is, "19990101000031GMT", false);
+    a.init(new SortedMapIterator(tm), is.getProperties(), null);
     a.seek(new Range(), EMPTY_COL_FAMS, false);
     assertEquals(size(a), 20);
     
-    opts.put(TimestampFilter.START_INCL, "false");
-    a.init(new SortedMapIterator(tm), opts, null);
+    TimestampFilter.setStart(is, "19990101000011GMT", false);
+    a.init(new SortedMapIterator(tm), is.getProperties(), null);
     a.seek(new Range(), EMPTY_COL_FAMS, false);
     assertEquals(size(a), 19);
     
-    opts.put(TimestampFilter.END_INCL, "true");
-    a.init(new SortedMapIterator(tm), opts, null);
+    TimestampFilter.setEnd(is, "19990101000031GMT", true);
+    a.init(new SortedMapIterator(tm), is.getProperties(), null);
     a.seek(new Range(), EMPTY_COL_FAMS, false);
     assertEquals(size(a), 20);
+    
+    is.clearOptions();
+    TimestampFilter.setStart(is, "19990101000011GMT", true);
+    a.init(new SortedMapIterator(tm), is.getProperties(), null);
+    a.seek(new Range(), EMPTY_COL_FAMS, false);
+    assertEquals(size(a), 89);
+    
+    TimestampFilter.setStart(is, "19990101000011GMT", false);
+    a.init(new SortedMapIterator(tm), is.getProperties(), null);
+    a.seek(new Range(), EMPTY_COL_FAMS, false);
+    assertEquals(size(a), 88);
+    
+    is.clearOptions();
+    TimestampFilter.setEnd(is, "19990101000031GMT", true);
+    a.init(new SortedMapIterator(tm), is.getProperties(), null);
+    a.seek(new Range(), EMPTY_COL_FAMS, false);
+    assertEquals(size(a), 32);
+    
+    TimestampFilter.setEnd(is, "19990101000031GMT", false);
+    a.init(new SortedMapIterator(tm), is.getProperties(), null);
+    a.seek(new Range(), EMPTY_COL_FAMS, false);
+    assertEquals(size(a), 31);
   }
 }

Copied: incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/user/LargeRowFilterTest.java (from r1204997, incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/LargeRowFilterTest.java)
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/user/LargeRowFilterTest.java?p2=incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/user/LargeRowFilterTest.java&p1=incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/LargeRowFilterTest.java&r1=1204997&r2=1207529&rev=1207529&view=diff
==============================================================================
--- incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/LargeRowFilterTest.java (original)
+++ incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/user/LargeRowFilterTest.java Mon Nov 28 19:30:20 2011
@@ -14,27 +14,27 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.accumulo.core.iterators;
+package org.apache.accumulo.core.iterators.user;
 
 import java.io.IOException;
-import java.util.HashMap;
 import java.util.HashSet;
 import java.util.TreeMap;
 
+import junit.framework.TestCase;
+
+import org.apache.accumulo.core.client.IteratorSetting;
 import org.apache.accumulo.core.data.ArrayByteSequence;
 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.SortedMapIterator;
 import org.apache.accumulo.core.iterators.IteratorUtil.IteratorScope;
+import org.apache.accumulo.core.iterators.RowDeletingIteratorTest;
+import org.apache.accumulo.core.iterators.SortedMapIterator;
 import org.apache.accumulo.core.iterators.system.ColumnFamilySkippingIterator;
-import org.apache.accumulo.core.iterators.user.LargeRowFilter;
 import org.apache.accumulo.core.util.LocalityGroupUtil;
 
-import junit.framework.TestCase;
-
 public class LargeRowFilterTest extends TestCase {
   
   private String genRow(int r) {
@@ -60,9 +60,9 @@ public class LargeRowFilterTest extends 
   private LargeRowFilter setupIterator(TreeMap<Key,Value> testData, int maxColumns, IteratorScope scope) throws IOException {
     SortedMapIterator smi = new SortedMapIterator(testData);
     LargeRowFilter lrfi = new LargeRowFilter();
-    HashMap<String,String> options = new HashMap<String,String>();
-    options.put(LargeRowFilter.MAX_COLUMNS, "" + maxColumns);
-    lrfi.init(new ColumnFamilySkippingIterator(smi), options, new RowDeletingIteratorTest.TestIE(scope, false));
+    IteratorSetting is = new IteratorSetting(1, LargeRowFilter.class);
+    LargeRowFilter.setMaxColumns(is, maxColumns);
+    lrfi.init(new ColumnFamilySkippingIterator(smi), is.getProperties(), new RowDeletingIteratorTest.TestIE(scope, false));
     return lrfi;
   }
   



Mime
View raw message