Index: src/java/org/apache/hadoop/mapreduce/Counter.java
===================================================================
--- src/java/org/apache/hadoop/mapreduce/Counter.java	(revision 0)
+++ src/java/org/apache/hadoop/mapreduce/Counter.java	(revision 0)
@@ -0,0 +1,64 @@
+package org.apache.hadoop.mapreduce;
+
+import java.io.IOException;
+import java.io.DataInput;
+import java.io.DataOutput;
+
+import org.apache.hadoop.io.Text;
+import org.apache.hadoop.io.Writable;
+import org.apache.hadoop.io.WritableUtils;
+
+public class Counter implements Writable {
+
+  private String displayName;
+  private long value;
+    
+  Counter() { 
+    value = 0L;
+  }
+
+  Counter(String displayName, long value) {
+    this.displayName = displayName;
+    this.value = value;
+  }
+    
+  /**
+   * Read the binary representation of the counter
+   */
+  public synchronized void readFields(DataInput in) throws IOException {
+    displayName = Text.readString(in);
+    value = WritableUtils.readVLong(in);
+  }
+    
+  /**
+   * Write the binary representation of the counter
+   */
+  public synchronized void write(DataOutput out) throws IOException {
+    Text.writeString(out, displayName);
+    WritableUtils.writeVLong(out, value);
+  }
+    
+  /**
+   * Get the name of the counter.
+   * @return the user facing name of the counter
+   */
+  public String getDisplayName() {
+    return displayName;
+  }
+    
+  /**
+   * What is the current value of this counter?
+   * @return the current value
+   */
+  public synchronized long getValue() {
+    return value;
+  }
+    
+  /**
+   * Increment this counter by the given value
+   * @param incr the value to increase this counter by
+   */
+  public synchronized void increment(long incr) {
+    value += incr;
+  }
+}
Index: src/java/org/apache/hadoop/mapreduce/JobConf.java
===================================================================
--- src/java/org/apache/hadoop/mapreduce/JobConf.java	(revision 0)
+++ src/java/org/apache/hadoop/mapreduce/JobConf.java	(revision 0)
@@ -0,0 +1,4 @@
+package org.apache.hadoop.mapreduce;
+
+public class JobConf extends org.apache.hadoop.mapred.JobConf {
+}
\ No newline at end of file
Index: src/java/org/apache/hadoop/mapreduce/MapContext.java
===================================================================
--- src/java/org/apache/hadoop/mapreduce/MapContext.java	(revision 0)
+++ src/java/org/apache/hadoop/mapreduce/MapContext.java	(revision 0)
@@ -0,0 +1,11 @@
+package org.apache.hadoop.mapreduce;
+
+public interface MapContext<KeyIn,ValueIn,KeyOut,ValueOut> 
+  extends Context<KeyIn,ValueIn,KeyOut,ValueOut> {
+
+  /**
+   * Get the input split for this map.
+   */
+  InputSplit getInputSplit();
+}
+     
\ No newline at end of file
Index: src/java/org/apache/hadoop/mapreduce/Context.java
===================================================================
--- src/java/org/apache/hadoop/mapreduce/Context.java	(revision 0)
+++ src/java/org/apache/hadoop/mapreduce/Context.java	(revision 0)
@@ -0,0 +1,61 @@
+package org.apache.hadoop.mapreduce;
+
+import java.io.IOException;
+import org.apache.hadoop.util.Progressable;
+
+public interface Context<KeyIn, ValueIn, KeyOut, ValueOut> extends Progressable{
+
+  /**
+   * Return the current input key. The object will likely be re-used.
+   */
+  KeyIn getKey();
+
+  /**
+   * Return the current input value. The object will likely be re-used.
+   */
+  ValueIn getValue();
+
+  /**
+   * Generate an output key/value pair.
+   */
+  void collect(KeyOut key, ValueOut value) throws IOException;
+
+  /**
+   * Get the unique name for this task attempt.
+   */
+  String getTaskAttemptId();
+
+  /**
+   * Advance to the next key, returning false if at end. Only needed if
+   * the application needs to control the iteration (eg. MapRunables)
+   */
+  boolean nextKey() throws IOException;
+
+  /**
+   * Get the input key class, even if there are no inputs.
+   */
+  Class<? extends KeyIn> getInputKeyClass();
+
+  /**
+   * Get the input value class, even if there are no inputs.
+   */
+  Class<? extends ValueIn> getInputValueClass();
+
+  JobConf getJobConf();
+
+  /**
+   * Set the current status of the task to the given string.
+   */
+  void setStatus(String msg) throws IOException;
+
+  /**
+   * Lookup a counter by an enum.
+   */
+  Counter getCounter(Enum<?> counterName);
+
+  /**
+   * Lookup a counter by groupname and id. The enum-based interface is
+   * prefered.
+   */
+  Counter getCounter(String groupName, int id, String counterName);
+}
\ No newline at end of file
Index: src/java/org/apache/hadoop/mapreduce/Mapper.java
===================================================================
--- src/java/org/apache/hadoop/mapreduce/Mapper.java	(revision 0)
+++ src/java/org/apache/hadoop/mapreduce/Mapper.java	(revision 0)
@@ -0,0 +1,11 @@
+package org.apache.hadoop.mapreduce;
+
+import java.io.IOException;
+
+public interface Mapper<C extends MapContext> extends Closeable<C> {
+
+  /**
+   * Will be called once per an input key
+   */
+  void map(C context) throws IOException;
+}
\ No newline at end of file
Index: src/java/org/apache/hadoop/mapreduce/lib/MapperBase.java
===================================================================
--- src/java/org/apache/hadoop/mapreduce/lib/MapperBase.java	(revision 0)
+++ src/java/org/apache/hadoop/mapreduce/lib/MapperBase.java	(revision 0)
@@ -0,0 +1,13 @@
+package org.apache.hadoop.mapreduce.lib;
+
+import java.io.IOException;
+import org.apache.hadoop.mapreduce.Closeable;
+import org.apache.hadoop.mapreduce.MapContext;
+import org.apache.hadoop.mapreduce.Mapper;
+
+public abstract class MapperBase<C extends MapContext> implements Mapper<C>{
+
+  public abstract void map(C context) throws IOException;
+
+  public void close(C context) throws IOException { }
+}
\ No newline at end of file
Index: src/java/org/apache/hadoop/mapreduce/lib/IdentityReducer.java
===================================================================
--- src/java/org/apache/hadoop/mapreduce/lib/IdentityReducer.java	(revision 0)
+++ src/java/org/apache/hadoop/mapreduce/lib/IdentityReducer.java	(revision 0)
@@ -0,0 +1,14 @@
+package org.apache.hadoop.mapreduce.lib;
+
+import java.io.IOException;
+import org.apache.hadoop.mapreduce.ReduceContext;
+
+public class IdentityReducer<Key,Value, 
+                             C extends ReduceContext<Key,Value,Key,Value>>
+  extends ReducerBase<C> {
+
+  public void reduce(C context) throws IOException {
+    context.collect(context.getKey(), context.getValue());
+  }
+
+}
\ No newline at end of file
Index: src/java/org/apache/hadoop/mapreduce/lib/ReducerBase.java
===================================================================
--- src/java/org/apache/hadoop/mapreduce/lib/ReducerBase.java	(revision 0)
+++ src/java/org/apache/hadoop/mapreduce/lib/ReducerBase.java	(revision 0)
@@ -0,0 +1,14 @@
+package org.apache.hadoop.mapreduce.lib;
+
+import java.io.IOException;
+import org.apache.hadoop.mapreduce.Closeable;
+import org.apache.hadoop.mapreduce.ReduceContext;
+import org.apache.hadoop.mapreduce.Reducer;
+
+public abstract class ReducerBase<C extends ReduceContext> 
+  implements Reducer<C> {
+
+  public abstract void reduce(C context) throws IOException;
+
+  public void close(C context) throws IOException { }
+}
\ No newline at end of file
Index: src/java/org/apache/hadoop/mapreduce/lib/TokenCounterMapper.java
===================================================================
--- src/java/org/apache/hadoop/mapreduce/lib/TokenCounterMapper.java	(revision 0)
+++ src/java/org/apache/hadoop/mapreduce/lib/TokenCounterMapper.java	(revision 0)
@@ -0,0 +1,24 @@
+package org.apache.hadoop.mapreduce.lib;
+
+import java.io.IOException;
+import java.util.StringTokenizer;
+
+import org.apache.hadoop.io.IntWritable;
+import org.apache.hadoop.io.Text;
+import org.apache.hadoop.mapreduce.MapContext;
+
+public class TokenCounterMapper<C extends MapContext<?, Text, 
+                                                     Text, IntWritable>> 
+  extends MapperBase<C> {
+    
+  private final static IntWritable one = new IntWritable(1);
+  private Text word = new Text();
+    
+  public void map(C context) throws IOException {
+    StringTokenizer itr = new StringTokenizer(context.getValue().toString());
+    while (itr.hasMoreTokens()) {
+      word.set(itr.nextToken());
+      context.collect(word, one);
+    }
+  }
+}
Index: src/java/org/apache/hadoop/mapreduce/lib/IntSumReducer.java
===================================================================
--- src/java/org/apache/hadoop/mapreduce/lib/IntSumReducer.java	(revision 0)
+++ src/java/org/apache/hadoop/mapreduce/lib/IntSumReducer.java	(revision 0)
@@ -0,0 +1,22 @@
+package org.apache.hadoop.mapreduce.lib;
+
+import java.io.IOException;
+import org.apache.hadoop.io.IntWritable;
+import org.apache.hadoop.mapreduce.ReduceContext;
+
+public class IntSumReducer<Key,C extends ReduceContext<Key,IntWritable,
+                                                       Key,IntWritable>>
+  extends ReducerBase<C> {
+
+  private IntWritable result = new IntWritable();
+
+  public void reduce(C context) throws IOException {
+    int sum = 0;
+    while (context.nextValue()) {
+      sum += context.getValue().get();
+    }
+    result.set(sum);
+    context.collect(context.getKey(), result);
+  }
+
+}
\ No newline at end of file
Index: src/java/org/apache/hadoop/mapreduce/lib/IdentityMapper.java
===================================================================
--- src/java/org/apache/hadoop/mapreduce/lib/IdentityMapper.java	(revision 0)
+++ src/java/org/apache/hadoop/mapreduce/lib/IdentityMapper.java	(revision 0)
@@ -0,0 +1,14 @@
+package org.apache.hadoop.mapreduce.lib;
+
+import java.io.IOException;
+import org.apache.hadoop.mapreduce.MapContext;
+
+public class IdentityMapper<Key,Value, 
+                            C extends MapContext<Key,Value,Key,Value>>
+  extends MapperBase<C> {
+
+  public void map(C context) throws IOException {
+    context.collect(context.getKey(), context.getValue());
+  }
+
+}
\ No newline at end of file
Index: src/java/org/apache/hadoop/mapreduce/lib/LongSumReducer.java
===================================================================
--- src/java/org/apache/hadoop/mapreduce/lib/LongSumReducer.java	(revision 0)
+++ src/java/org/apache/hadoop/mapreduce/lib/LongSumReducer.java	(revision 0)
@@ -0,0 +1,22 @@
+package org.apache.hadoop.mapreduce.lib;
+
+import java.io.IOException;
+import org.apache.hadoop.io.LongWritable;
+import org.apache.hadoop.mapreduce.ReduceContext;
+
+public class LongSumReducer<Key,C extends ReduceContext<Key,LongWritable,
+                                                        Key,LongWritable>>
+  extends ReducerBase<C> {
+
+  private LongWritable result = new LongWritable();
+
+  public void reduce(C context) throws IOException {
+    long sum = 0;
+    while (context.nextValue()) {
+      sum += context.getValue().get();
+    }
+    result.set(sum);
+    context.collect(context.getKey(), result);
+  }
+
+}
\ No newline at end of file
Index: src/java/org/apache/hadoop/mapreduce/Closeable.java
===================================================================
--- src/java/org/apache/hadoop/mapreduce/Closeable.java	(revision 0)
+++ src/java/org/apache/hadoop/mapreduce/Closeable.java	(revision 0)
@@ -0,0 +1,7 @@
+package org.apache.hadoop.mapreduce;
+
+import java.io.IOException;
+
+public interface Closeable<C extends Context> {
+  void close(C context) throws IOException;
+}
\ No newline at end of file
Index: src/java/org/apache/hadoop/mapreduce/Reducer.java
===================================================================
--- src/java/org/apache/hadoop/mapreduce/Reducer.java	(revision 0)
+++ src/java/org/apache/hadoop/mapreduce/Reducer.java	(revision 0)
@@ -0,0 +1,11 @@
+package org.apache.hadoop.mapreduce;
+
+import java.io.IOException;
+
+public interface Reducer<C extends ReduceContext> extends Closeable<C> {
+
+  /**
+   * Will be called once per an input key.
+   */
+  void reduce(C context) throws IOException;
+}
\ No newline at end of file
Index: src/java/org/apache/hadoop/mapreduce/InputSplit.java
===================================================================
--- src/java/org/apache/hadoop/mapreduce/InputSplit.java	(revision 0)
+++ src/java/org/apache/hadoop/mapreduce/InputSplit.java	(revision 0)
@@ -0,0 +1,9 @@
+package org.apache.hadoop.mapreduce;
+
+import java.io.IOException;
+
+public interface InputSplit {
+  long getLength() throws IOException;
+  String[] getLocations() throws IOException;
+  Class<? extends Mapper> getMapperClass() throws IOException;
+}
\ No newline at end of file
Index: src/java/org/apache/hadoop/mapreduce/ReduceContext.java
===================================================================
--- src/java/org/apache/hadoop/mapreduce/ReduceContext.java	(revision 0)
+++ src/java/org/apache/hadoop/mapreduce/ReduceContext.java	(revision 0)
@@ -0,0 +1,12 @@
+package org.apache.hadoop.mapreduce;
+
+import java.io.IOException;
+
+public interface ReduceContext<KeyIn,ValueIn,KeyOut,ValueOut>
+  extends Context<KeyIn,ValueIn,KeyOut,ValueOut> {
+
+  /**
+   * Advance to the next value within the same key.
+   */
+  boolean nextValue() throws IOException;
+}
\ No newline at end of file
